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 / time-select / AmTimeSelect.vue
ameliabooking / v3 / src / views / _components / time-select Last commit date
AmTimeSelect.vue 1 year ago
AmTimeSelect.vue
477 lines
1 <template>
2 <div class="am-time-select__wrapper" :class="parentClass" :style="cssVars">
3 <el-time-select
4 :id="props.id"
5 ref="amTimeSelect"
6 v-model="model"
7 class="am-time-select"
8 :class="[
9 `am-time-select--${size}`,
10 {'am-time-select--disabled': disabled },
11 {'am-time-select--prefix': props.prefixIcon },
12 {'am-time-select--suffix': props.suffixIcon || (props.clearIcon && pross.clearable)},
13 props.class,
14 ]"
15 :disabled="props.disabled"
16 :placeholder="props.placeholder"
17 :clear-icon="props.clearIcon"
18 :clearable="props.clearable"
19 :editable="props.editable"
20 :name="props.name"
21 :popper-class="`am-time-select__popper${
22 props.popperClass ? ' ' + props.popperClass : props.popperClass
23 }`"
24 :prefix-icon="props.prefixIcon"
25 :suffix-icon="props.suffixIcon"
26 :end="props.end"
27 :max-time="props.maxTime"
28 :min-time="props.minTime"
29 :start="props.start"
30 :step="props.step"
31 :format="props.format"
32 :include-end-time="props.includeEndTime"
33 :effect="props.effect"
34 />
35 </div>
36 </template>
37
38 <script setup>
39 // * Import from Vue
40 import { ref, toRefs, computed, markRaw, inject, onMounted } from 'vue'
41
42 // * Dedicated components
43 import IconComponent from '../icons/IconComponent.vue'
44
45 // * Composables
46 import { useColorTransparency } from '../../../assets/js/common/colorManipulation'
47
48 /**
49 * Component Props
50 * */
51 const props = defineProps({
52 modelValue: {
53 type: String,
54 },
55 id: {
56 type: String,
57 default: '',
58 },
59 disabled: {
60 type: Boolean,
61 default: false,
62 },
63 editable: {
64 type: Boolean,
65 default: true,
66 },
67 clearable: {
68 type: Boolean,
69 default: true,
70 },
71 includeEndTime: {
72 type: Boolean,
73 default: false,
74 },
75 size: {
76 // default / medium / small / mini / micro
77 type: String,
78 default: 'default',
79 validator(value) {
80 return ['default', 'medium', 'small', 'mini', 'micro'].includes(value)
81 },
82 },
83 placeholder: {
84 type: String,
85 default: '',
86 },
87 name: {
88 type: String,
89 },
90 effect: {
91 type: String,
92 default: 'light',
93 validator(value) {
94 return ['dark', 'light'].includes(value)
95 },
96 },
97 prefixIcon: {
98 type: [String, Object, Function],
99 default: markRaw({
100 components: { IconComponent },
101 template: `<IconComponent icon="clock"/>`,
102 }),
103 },
104 suffixIcon: {
105 type: [String, Object, Function],
106 default: markRaw({
107 components: { IconComponent },
108 template: `<IconComponent icon="arrow-up"/>`,
109 }),
110 },
111 clearIcon: {
112 type: [String, Object, Function],
113 default: markRaw({
114 components: { IconComponent },
115 template: `<IconComponent icon="close"/>`,
116 }),
117 },
118 start: {
119 type: String,
120 default: '',
121 },
122 end: {
123 type: String,
124 default: '',
125 },
126 step: {
127 type: String,
128 default: '',
129 },
130 minTime: {
131 type: String,
132 default: '',
133 },
134 maxTime: {
135 type: String,
136 default: '',
137 },
138 format: {
139 type: String,
140 default: 'HH:mm',
141 },
142 popperClass: {
143 type: String,
144 default: '',
145 },
146 class: {
147 type: String,
148 default: '',
149 },
150 parentClass: {
151 type: String,
152 default: '',
153 },
154 })
155
156 /**
157 * Component Emits
158 * */
159 const emits = defineEmits(['update:modelValue'])
160
161 /**
162 * Component Model
163 * */
164 const { modelValue } = toRefs(props)
165
166 const model = computed({
167 get: () => modelValue.value,
168 set: (value) => {
169 emits('update:modelValue', value)
170 },
171 })
172
173 /**
174 * Component Refs
175 * */
176 const amTimeSelect = ref(null)
177
178 // * Font Vars
179 let amFonts = inject(
180 'amFonts',
181 ref({
182 fontFamily: 'Amelia Roboto, sans-serif',
183 fontUrl: '',
184 customFontFamily: '',
185 fontFormat: '',
186 customFontSelected: false,
187 })
188 )
189
190 // * Color Vars
191 let amColors = inject(
192 'amColors',
193 ref({
194 colorPrimary: '#1246D6',
195 colorSuccess: '#019719',
196 colorError: '#B4190F',
197 colorWarning: '#CCA20C',
198 colorMainBgr: '#FFFFFF',
199 colorMainHeadingText: '#33434C',
200 colorMainText: '#1A2C37',
201 colorSbBgr: '#17295A',
202 colorSbText: '#FFFFFF',
203 colorInpBgr: '#FFFFFF',
204 colorInpBorder: '#D1D5D7',
205 colorInpText: '#1A2C37',
206 colorInpPlaceHolder: '#808A90',
207 colorDropBgr: '#FFFFFF',
208 colorDropBorder: '#D1D5D7',
209 colorDropText: '#0E1920',
210 colorBtnPrim: '#265CF2',
211 colorBtnPrimText: '#FFFFFF',
212 colorBtnSec: '#1A2C37',
213 colorBtnSecText: '#FFFFFF',
214 })
215 )
216
217 // * Css Variables
218 let cssVars = computed(() => {
219 return {
220 '--am-c-timeselect-shadow': useColorTransparency(amColors.value.colorInpText, 0.05),
221 '--am-c-timeselect-text-op60': useColorTransparency(amColors.value.colorInpText, 0.6),
222 '--am-c-timeselect-text-op40': useColorTransparency(amColors.value.colorInpText, 0.4),
223 '--am-c-timeselect-text-op10': useColorTransparency(amColors.value.colorInpText, 0.03),
224 '--am-font-family': amFonts.value.fontFamily,
225 }
226 })
227
228 onMounted(() => {
229 const popperWrapper = document.querySelector("[id^='el-popper-container']");
230 popperWrapper.style.setProperty('--am-c-option-bgr', amColors.value.colorDropBgr)
231 popperWrapper.style.setProperty('--am-c-option-border', amColors.value.colorDropBorder)
232 popperWrapper.style.setProperty('--am-c-option-text', amColors.value.colorDropText)
233 popperWrapper.style.setProperty('--am-c-option-text-op65', useColorTransparency(amColors.value.colorDropText, 0.65))
234 popperWrapper.style.setProperty('--am-c-option-text-op50', useColorTransparency(amColors.value.colorDropText, 0.50))
235 popperWrapper.style.setProperty('--am-c-option-hover', useColorTransparency(amColors.value.colorDropText, 0.1))
236 popperWrapper.style.setProperty('--am-c-option-selected', amColors.value.colorPrimary)
237 popperWrapper.style.setProperty('--am-c-option-selected-op10', useColorTransparency(amColors.value.colorPrimary, 0.1))
238 popperWrapper.style.setProperty('--am-c-option-img-bgr', amColors.value.colorSuccess)
239 popperWrapper.style.setProperty('--am-c-option-img-text', amColors.value.colorMainBgr)
240 popperWrapper.style.setProperty('--am-font-family', amFonts.value.fontFamily)
241 })
242 </script>
243
244 <style lang="scss">
245 @mixin am-time-select-block {
246 .am-time-select {
247 // -c- color
248 // -rad- border radius
249 // -h- height
250 // -fs- font size
251 // -padd- padding
252 // -bgr background
253 --am-c-timeselect-bgr: var(--am-c-inp-bgr);
254 --am-c-timeselect-border: var(--am-c-inp-border);
255 --am-c-timeselect-text: var(--am-c-inp-text);
256 --am-c-timeselect-placeholder: var(--am-c-inp-placeholder);
257 --am-rad-timeselect: var(--am-rad-inp);
258 --am-fs-timeselect: var(--am-fs-inp);
259 --am-h-timeselect: var(--am-h-inp);
260 --am-padd-timeselect: 8px 12px;
261 width: 100%;
262
263 // Select Wrapper
264 &__wrapper {
265 width: 100%;
266 }
267
268 // Size - default / medium / small / mini / micro
269 &--default {
270 --am-h-timeselect: 40px;
271 }
272 &--medium {
273 --am-h-timeselect: 36px;
274 }
275 &--small {
276 --am-h-timeselect: 32px;
277 }
278 &--mini {
279 --am-h-timeselect: 28px;
280 }
281 &--micro {
282 --am-h-timeselect: 24px;
283 }
284
285 // Disabled
286 &--disabled {
287 --am-c-timeselect-bgr: var(--am-c-timeselect-text-op10);
288 --am-c-timeselect-text: var(--am-c-timeselect-text-op60);
289 cursor: not-allowed;
290 }
291
292 // Prefix / Suffix
293 &--prefix {
294 --am-padd-timeselect: 0 12px 0 8px;
295
296 &.am-time-select--suffix {
297 --am-padd-timeselect: 0 8px;
298 }
299 }
300
301 &--suffix {
302 --am-padd-timeselect: 0 8px 0 12px;
303 }
304
305 // Input
306 .el-select {
307 // Visual presentation of input
308 &__wrapper {
309 display: flex;
310 align-items: center;
311 gap: 0 6px;
312 height: var(--am-h-timeselect);
313 min-height: 24px;
314 background-color: var(--am-c-timeselect-bgr);
315 border-radius: var(--am-rad-timeselect);
316 border: none;
317 box-shadow: 0 0 0 1px var(--am-c-timeselect-border);
318 padding: var(--am-padd-timeselect);
319 }
320
321 // Input
322 &__input {
323 width: 100%;
324 height: 100%;
325 min-height: 24px;
326 font-size: var(--am-fs-timeselect);
327 font-weight: 400;
328 line-height: 24px;
329 text-overflow: ellipsis;
330 white-space: nowrap;
331 overflow: hidden;
332 color: var(--am-c-timeselect-text);
333 border: none;
334 border-radius: 0;
335 background: none;
336 padding: 0;
337 box-shadow: none;
338
339 // Placeholder
340 &::placeholder {
341 color: var(--am-c-timeselect-placeholder);
342 opacity: 1; /* Ensures it’s not transparent */
343 }
344 &::-webkit-input-placeholder { /* Chrome, Safari */
345 color: var(--am-c-timeselect-placeholder);
346 }
347 &:-moz-placeholder { /* Firefox 4-18 */
348 color: var(--am-c-timeselect-placeholder);
349 opacity: 1;
350 }
351 &::-moz-placeholder { /* Firefox 19+ */
352 color: var(--am-c-timeselect-placeholder);
353 opacity: 1;
354 }
355 &:-ms-input-placeholder { /* IE 10-11 */
356 color: var(--am-c-timeselect-placeholder);
357 }
358 }
359
360 // Visual presentation of input value
361 &__selected-item {
362 &.is-transparent {
363 --am-c-timeselect-text: var(--am-c-timeselect-text-placeholder);
364 }
365
366 span {
367 font-size: var(--am-fs-timeselect);
368 line-height: 24px;
369 font-weight: 400;
370 color: var(--am-c-timeselect-text);
371 }
372 }
373
374 // Prefix and Suffix icon
375 &__prefix, &__suffix {
376 .el-icon {
377 width: auto;
378 height: auto;
379 }
380
381 [class^='am-icon']^='am-icon'] {
382 font-size: 24px;
383 line-height: 1;
384 color: var(--am-c-timeselect-text)
385 }
386
387 .am-icon-arrow-up, .am-icon-close {
388 font-size: 18px;
389 }
390 }
391 }
392 }
393 }
394
395 // Time Select Popper
396 .am-time-select__popper {
397 --am-hmin-timeselect-option: 32px;
398 --am-h-timeselect-option: auto;
399 --am-flh-timeselect-option: 1.4;
400 --am-c-timeselect-option-text: var(--am-c-option-text);
401 --am-c-timeselect-option-bgr: transparent;
402 --am-pad-timeselect-option: 8px;
403 --am-mar-timeselect-option: 0px;
404 --am-fs-timeselect-option: 14px;
405 --am-fw-timeselect-option: 400;
406 --am-ff-timeselect-option: var(--am-font-family);
407 background-color: var(--am-c-option-bgr) !important;
408
409 &.el-select__popper.el-popper[role='tooltip']='tooltip'] {
410 background-color: transparent;
411 border-color: var(--am-c-option-border);
412 overflow: hidden;
413 }
414
415 &.el-select-dropdown {
416 margin: 0;
417 position: static;
418 border: none;
419 }
420
421 * {
422 font-family: var(--am-font-family), sans-serif;
423 border-radius: unset;
424 }
425
426 .el-select-dropdown {
427 &__list {
428 padding: 0;
429 }
430
431 &__item {
432 min-height: var(--am-hmin-timeselect-option) !important;
433 height: var(--am-h-timeselect-option) !important;
434 font-family: var(--am-ff-timeselect-option), sans-serif !important;
435 font-size: var(--am-fs-timeselect-option) !important;
436 font-weight: var(--am-fw-timeselect-option) !important;
437 line-height: var(--am-flh-timeselect-option) !important;
438 color: var(--am-c-timeselect-option-text) !important;
439 background-color: var(--am-c-timeselect-option-bgr) !important;
440 padding: var(--am-pad-timeselect-option) !important;
441 margin: var(--am-mar-timeselect-option) !important;
442 white-space: normal;
443
444 &:hover,
445 &.hover {
446 --am-c-timeselect-option-bgr: var(--am-c-option-hover);
447 }
448
449 &.selected {
450 --am-c-timeselect-option-text: var(--am-c-option-selected);
451 }
452
453 &.is-disabled {
454 --am-c-timeselect-option-text: var(--am-c-option-text-op50) !important;
455 }
456
457 &:last-child {
458 border-bottom: none;
459 }
460 }
461
462 &__empty {
463 color: var(--am-c-option-text-op65);
464 }
465 }
466 }
467
468 // public
469 .amelia-v2-booking #amelia-container {
470 @include am-time-select-block;
471 }
472
473 // admin
474 #amelia-app-backend-new {
475 @include am-time-select-block;
476 }
477 </style>