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