PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
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 / switch / AmSwitch.vue
ameliabooking / v3 / src / views / _components / switch Last commit date
AmSwitch.vue 5 days ago
AmSwitch.vue
239 lines
1 <template>
2 <div class="am-switch-wrapper" :class="parentClass" :style="cssVars">
3 <el-switch
4 :id="id"
5 ref="amSwitch"
6 v-model="model"
7 class="am-switch"
8 :class="props.class"
9 :name="name"
10 :width="width"
11 :size="size"
12 :validate-event="validateEvent"
13 :loading="loading"
14 :disabled="disabled"
15 :active-color="activeColor"
16 :inactive-color="inactiveColor"
17 :active-text="activeText"
18 :inactive-text="inactiveText"
19 :active-value="activeValue"
20 :inactive-value="inactiveValue"
21 :active-icon-class="activeIconClass"
22 :inactive-icon-class="inactiveIconClass"
23 :active-icon="activeIcon"
24 :inactive-icon="inactiveIcon"
25 :before-change="beforeChange"
26 :border-color="borderColor"
27 :inline-prompt="inlinePrompt"
28 :aria-label="ariaLabel"
29 @change="(e) => emits('change', e)"
30 >
31 </el-switch>
32 </div>
33 </template>
34
35 <script setup>
36 // * Import from Vue
37 import { ref, toRefs, computed, inject } from 'vue'
38
39 /**
40 * Component Props
41 */
42 const props = defineProps({
43 modelValue: {
44 type: [Boolean, String, Number],
45 default: false,
46 },
47 id: {
48 type: String,
49 },
50 name: {
51 type: String,
52 },
53 width: {
54 type: [Number, String],
55 },
56 size: {
57 type: String,
58 default: 'default',
59 validator(value) {
60 return ['large', 'default', 'small'].includes(value)
61 },
62 },
63 validateEvent: {
64 type: Boolean,
65 default: true,
66 },
67 loading: {
68 type: Boolean,
69 default: false,
70 },
71 disabled: {
72 type: Boolean,
73 default: false,
74 },
75 activeColor: {
76 type: String,
77 },
78 inactiveColor: {
79 type: String,
80 },
81 activeText: {
82 type: String,
83 },
84 inactiveText: {
85 type: String,
86 },
87 activeValue: {
88 type: [Boolean, String, Number],
89 default: true,
90 },
91 inactiveValue: {
92 type: [Boolean, String, Number],
93 default: false,
94 },
95 activeIconClass: {
96 type: String,
97 },
98 inactiveIconClass: {
99 type: String,
100 },
101 activeIcon: {
102 type: String,
103 },
104 inactiveIcon: {
105 type: String,
106 },
107 beforeChange: {
108 type: [Function, Boolean],
109 default: () => {},
110 },
111 borderColor: {
112 type: String,
113 },
114 inlinePrompt: {
115 type: Boolean,
116 default: false,
117 },
118 parentClass: {
119 type: String,
120 },
121 class: {
122 type: String,
123 },
124 ariaLabel: {
125 type: String,
126 },
127 })
128
129 /**
130 * Component Emits
131 */
132 const emits = defineEmits(['update:modelValue', 'change'])
133
134 /**
135 * Component model
136 */
137 const { modelValue } = toRefs(props)
138 const model = computed({
139 get: () => modelValue.value,
140 set: (value) => emits('update:modelValue', value),
141 })
142
143 /**
144 * Component reference
145 */
146 const amSwitch = ref(null)
147
148 // * Color vars
149 const amColors = inject(
150 'amColors',
151 ref({
152 colorPrimary: '#1246D6',
153 colorSuccess: '#019719',
154 colorError: '#B4190F',
155 colorWarning: '#CCA20C',
156 colorMainBgr: '#FFFFFF',
157 colorMainHeadingText: '#33434C',
158 colorMainText: '#1A2C37',
159 colorSbBgr: '#17295A',
160 colorSbText: '#FFFFFF',
161 colorInpBgr: '#FFFFFF',
162 colorInpBorder: '#D1D5D7',
163 colorInpText: '#1A2C37',
164 colorInpPlaceHolder: '#1A2C37',
165 colorDropBgr: '#FFFFFF',
166 colorDropBorder: '#D1D5D7',
167 colorDropText: '#0E1920',
168 colorBtnPrim: '#265CF2',
169 colorBtnPrimText: '#FFFFFF',
170 colorBtnSec: '#1A2C37',
171 colorBtnSecText: '#FFFFFF',
172 colorBtnWaiting: '#CCA20C',
173 colorBtnWaitingText: '#FFFFFF',
174 colorBtnDanger: '#B4190F',
175 colorBtnDangerText: '#FFFFFF',
176 }),
177 )
178
179 // * CSS Variables
180 const cssVars = computed(() => {
181 return {
182 '--am-c-switch-bgr-active': amColors.value.colorPrimary,
183 '--am-c-switch-bgr-inactive': amColors.value.colorInpBorder,
184 '--am-c-switch-action': amColors.value.colorMainBgr,
185 '--am-c-switch-text': amColors.value.colorMainText,
186 }
187 })
188 </script>
189
190 <style lang="scss">
191 @mixin am-switch-block {
192 .am-switch {
193 --am-c-switch-bgr: var(--am-c-switch-bgr-inactive);
194 position: relative;
195 display: flex;
196 align-items: center;
197 gap: 8px;
198
199 &-wrapper {
200 display: inline-flex;
201 }
202 //
203 &.is-checked {
204 --am-c-switch-bgr: var(--am-c-switch-bgr-active);
205
206 .el-switch {
207 &__core {
208 background-color: var(--am-c-switch-bgr-active);
209 }
210 }
211 }
212 .el-switch {
213 &__core {
214 border: 1px solid var(--am-c-switch-bgr);
215 background-color: var(--am-c-switch-bgr);
216 }
217
218 &__action {
219 background-color: var(--am-c-switch-action);
220 }
221
222 &__label {
223 color: var(--am-c-switch-text);
224 }
225 }
226 }
227 }
228
229 // public
230 .amelia-v2-booking #amelia-container {
231 @include am-switch-block;
232 }
233
234 // admin
235 #amelia-app-backend-new {
236 @include am-switch-block;
237 }
238 </style>
239