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