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 / checkbox / AmCheckbox.vue
ameliabooking / v3 / src / views / _components / checkbox Last commit date
AmCheckbox.vue 5 days ago AmCheckboxGroup.vue 5 days ago
AmCheckbox.vue
276 lines
1 <template>
2 <div class="am-checkbox-wrapper" :style="cssVars">
3 <el-checkbox
4 :id="props.id"
5 ref="amCheckbox"
6 v-model="model"
7 :value="props.value"
8 :label="props.label"
9 :true-value="props.trueValue"
10 :false-value="props.falseValue"
11 :disabled="props.disabled"
12 :border="props.border"
13 :name="props.name"
14 :checked="props.checked"
15 :indeterminate="props.indeterminate"
16 :validate-event="props.validateEvent"
17 :tabindex="props.tabindex"
18 :aria-controls="props.ariaControls"
19 :class="[`am-checkbox__${size}`]"
20 class="am-checkbox"
21 :aria-label="props.label"
22 @change="(e) => $emit('change', e)"
23 >
24 <template v-if="label && !$slots.default">{{ label }}</template>
25 <slot></slot>
26 </el-checkbox>
27 </div>
28 </template>
29
30 <script setup>
31 import { computed, inject, ref, toRefs } from 'vue'
32 import { useColorTransparency } from '../../../assets/js/common/colorManipulation'
33
34 /**
35 * Component Props
36 */
37 const props = defineProps({
38 modelValue: {
39 type: [String, Number, Boolean],
40 },
41 value: {
42 // ** value of the Checkbox when used inside a checkbox-group
43 type: [String, Number, Boolean, Object],
44 },
45 label: {
46 // ** label of the Checkbox when used inside a checkbox-group. If there's no value, label will act as value
47 type: [String, Number, Boolean, Object],
48 },
49 trueValue: {
50 // ** value of the Checkbox if it's checked
51 type: [String, Number],
52 },
53 falseValue: {
54 // ** value of the Checkbox if it's unchecked
55 type: [String, Number],
56 },
57 disabled: {
58 type: Boolean,
59 default: false,
60 },
61 border: {
62 // ** whether to add a border around Checkbox
63 type: Boolean,
64 default: false,
65 },
66 size: {
67 type: String,
68 default: 'default',
69 validator(value) {
70 return ['default', 'medium', 'small'].includes(value)
71 },
72 },
73 name: {
74 type: String,
75 default: '',
76 },
77 checked: {
78 type: Boolean,
79 default: false,
80 },
81 indeterminate: {
82 // ** Set indeterminate state, only responsible for style control
83 type: Boolean,
84 default: false,
85 },
86 validateEvent: {
87 // ** whether to trigger form validation
88 type: Boolean,
89 default: true,
90 },
91 tabindex: {
92 // ** input tabindex
93 type: [String, Number],
94 },
95 id: {
96 // ** input id
97 type: String,
98 },
99 ariaControls: {
100 // ** same as aria-controls, takes effect when indeterminate is true
101 type: String,
102 },
103 })
104
105 /**
106 * Component Emits
107 * */
108 const emits = defineEmits(['change', 'update:modelValue'])
109
110 /**
111 * Component model
112 */
113 let { modelValue } = toRefs(props)
114 let model = computed({
115 get: () => modelValue.value,
116 set: (val) => {
117 emits('update:modelValue', val)
118 },
119 })
120
121 /**
122 * Component reference
123 */
124 const amCheckbox = ref()
125
126 // * Color Vars
127 let amColors = inject('amColors', {})
128
129 // * Css Variables
130 let cssVars = computed(() => {
131 return {
132 '--am-c-checkbox-text-op60': useColorTransparency(amColors.value.colorInpText, 0.6),
133 '--am-c-checkbox-btn-op80': useColorTransparency(amColors.value.colorPrimary, 0.8),
134 '--am-c-checkbox-btn-op60': useColorTransparency(amColors.value.colorPrimary, 0.6),
135 '--am-c-checkbox-btn-dsb-op60': useColorTransparency(amColors.value.colorInpBgr, 0.6),
136 }
137 })
138 </script>
139
140 <style lang="scss">
141 @mixin am-checkbox-block {
142 .am-checkbox {
143 // -c- color
144 // -rad- border radius
145 // -bgr background
146 --am-c-checkbox-bgr: var(--am-c-inp-bgr);
147 --am-c-checkbox-bgr-checked: var(--am-c-primary);
148 --am-c-checkbox-border: var(--am-c-inp-border);
149 --am-c-checkbox-text: var(--am-c-main-text);
150 --am-c-checkbox-inp-text: var(--am-c-main-bgr);
151 --am-rad-checkbox: 4px;
152 --am-w-checkbox-inp: 16px;
153 --am-h-checkbox-inp: 16px;
154
155 display: flex;
156 align-items: center;
157 white-space: pre-line;
158 min-height: 32px;
159 height: auto;
160 gap: 8px;
161
162 &__default {
163 --am-w-checkbox-inp: 16px;
164 --am-h-checkbox-inp: 16px;
165 }
166
167 &__medium {
168 --am-w-checkbox-inp: 14px;
169 --am-h-checkbox-inp: 14px;
170 }
171
172 &__small {
173 --am-w-checkbox-inp: 12px;
174 --am-h-checkbox-inp: 12px;
175 }
176
177 &-wrapper {
178 width: 100%;
179
180 .el-checkbox {
181 &__input {
182 width: var(--am-w-checkbox-inp);
183 height: var(--am-h-checkbox-inp);
184 border-radius: var(--am-rad-checkbox);
185 align-self: flex-start;
186 padding: 2px 0;
187
188 &.is-indeterminate.is-checked {
189 .el-checkbox__inner {
190 --am-c-checkbox-border: var(--am-c-primary);
191 --am-c-checkbox-bgr: var(--am-c-inp-bgr);
192
193 &:before {
194 background-color: var(--am-c-primary);
195 transform: scale(1) translate(-50%, -50%);
196 top: 50%;
197 left: 50%;
198 width: 70%;
199 height: 2px;
200 }
201 }
202 }
203 }
204
205 &__label {
206 //margin-left: 8px;
207 font-weight: 500;
208 color: var(--am-c-checkbox-text);
209 align-self: flex-start;
210 word-break: break-word;
211 white-space: pre-line;
212 }
213
214 &__inner {
215 flex: 0 0 auto;
216 width: 16px;
217 height: 16px;
218 border: 1px solid var(--am-c-checkbox-border);
219 background: var(--am-c-checkbox-bgr);
220 border-radius: var(--am-rad-checkbox);
221
222 &:after {
223 left: 5px;
224 border-color: var(--am-c-checkbox-inp-text);
225 border-width: 2px;
226 }
227
228 &:hover {
229 --am-c-checkbox-bgr: var(--am-c-checkbox-btn-op80);
230 }
231
232 &:focus {
233 --am-c-checkbox-border: var(--am-c-checkbox-btn-op80);
234 }
235 }
236
237 &.is-checked {
238 --am-c-checkbox-bgr: var(--am-c-checkbox-bgr-checked);
239 --am-c-checkbox-text-op60: var(--am-c-inp-text);
240
241 &.is-disabled {
242 --am-c-checkbox-bgr: var(--am-c-checkbox-btn-op60);
243
244 .el-checkbox__inner {
245 &:hover {
246 --am-c-checkbox-bgr: var(--am-c-checkbox-btn-op60);
247 }
248 }
249 }
250 }
251
252 &.is-disabled {
253 --am-c-checkbox-bgr: var(--am-c-checkbox-btn-dsb-op60);
254
255 .el-checkbox__inner {
256 &:hover {
257 --am-c-checkbox-bgr: var(--am-c-checkbox-btn-dsb-op60);
258 }
259 }
260 }
261 }
262 }
263 }
264 }
265
266 // public
267 .amelia-v2-booking #amelia-container {
268 @include am-checkbox-block;
269 }
270
271 // admin
272 #amelia-app-backend-new {
273 @include am-checkbox-block;
274 }
275 </style>
276