@bagelink/vue 0.0.511 → 0.0.518
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Btn.vue.d.ts +2 -0
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/Carousel.vue.d.ts +27 -4
- package/dist/components/Carousel.vue.d.ts.map +1 -1
- package/dist/components/MapEmbed.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +8 -0
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts +3 -1
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/index.cjs +141 -128
- package/dist/index.mjs +141 -128
- package/dist/style.css +188 -184
- package/package.json +1 -1
- package/src/components/Btn.vue +8 -1
- package/src/components/Carousel.vue +134 -117
- package/src/components/ListItem.vue +2 -2
- package/src/components/MapEmbed.vue +6 -4
- package/src/components/Modal.vue +1 -2
- package/src/components/TableSchema.vue +1 -1
- package/src/components/form/inputs/CheckInput.vue +46 -70
- package/src/components/form/inputs/DateInput.vue +9 -0
- package/src/components/layout/TabsNav.vue +2 -2
- package/src/styles/bagel.css +1 -1
- package/src/styles/layout.css +14 -0
- package/src/styles/mobilLayout.css +14 -0
- package/src/styles/scrollbar.css +2 -4
package/package.json
CHANGED
package/src/components/Btn.vue
CHANGED
|
@@ -19,6 +19,7 @@ const props = withDefaults(
|
|
|
19
19
|
'role'?: string
|
|
20
20
|
'value'?: string
|
|
21
21
|
'to'?: string
|
|
22
|
+
'href'?: string
|
|
22
23
|
'round'?: boolean
|
|
23
24
|
'is'?: string
|
|
24
25
|
'onClick'?: (e: MouseEvent) => void
|
|
@@ -35,6 +36,12 @@ const props = withDefaults(
|
|
|
35
36
|
},
|
|
36
37
|
)
|
|
37
38
|
|
|
39
|
+
const isComponent = $computed(() => {
|
|
40
|
+
if (props.to) return 'router-link'
|
|
41
|
+
if (props.href) return 'a'
|
|
42
|
+
return props.is
|
|
43
|
+
})
|
|
44
|
+
|
|
38
45
|
const slots = useSlots()
|
|
39
46
|
|
|
40
47
|
const computedTheme = $computed(
|
|
@@ -84,7 +91,7 @@ const computedBackgroundColor = $computed(
|
|
|
84
91
|
|
|
85
92
|
<template>
|
|
86
93
|
<component
|
|
87
|
-
:is="
|
|
94
|
+
:is="isComponent" :href="href" :to="to" :type="type" :role="role" :disabled="disabled" :class="{
|
|
88
95
|
'bgl_btn-icon': icon && !slots.default && !value,
|
|
89
96
|
'bgl_btn': !icon || slots.default || value,
|
|
90
97
|
thin,
|
|
@@ -2,78 +2,70 @@
|
|
|
2
2
|
import { onMounted, onUnmounted, watch } from 'vue'
|
|
3
3
|
|
|
4
4
|
const props = defineProps({
|
|
5
|
-
autoHeight: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
freeDrag: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
default: true,
|
|
16
|
-
},
|
|
17
|
-
items: {
|
|
18
|
-
type: Number,
|
|
19
|
-
default: 4,
|
|
20
|
-
},
|
|
21
|
-
index: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: 0,
|
|
24
|
-
},
|
|
5
|
+
autoHeight: { type: Boolean, default: false },
|
|
6
|
+
allowScroll: { type: Boolean, default: true },
|
|
7
|
+
freeDrag: { type: Boolean, default: true },
|
|
8
|
+
items: { type: Number, default: 4 },
|
|
9
|
+
index: { type: Number, default: 0 },
|
|
10
|
+
autoplay: { type: Boolean, default: false },
|
|
11
|
+
autoplaySpeed: { type: Number, default: 3000 },
|
|
12
|
+
loop: { type: Boolean, default: false },
|
|
25
13
|
})
|
|
14
|
+
|
|
26
15
|
const emit = defineEmits(['update:index'])
|
|
27
|
-
|
|
16
|
+
|
|
17
|
+
const bglSlider = $ref<HTMLElement | null>(null)
|
|
28
18
|
let activeSlideIndex = $ref(0)
|
|
29
19
|
let isDragging = $ref(false)
|
|
30
20
|
let startX = $ref(0)
|
|
31
21
|
let scrollLeft = $ref(0)
|
|
32
22
|
let isPressed = $ref(false)
|
|
23
|
+
let yHeight = $ref('auto')
|
|
24
|
+
let autoplayInterval = $ref<ReturnType<typeof setInterval> | null>(null)
|
|
25
|
+
let originalSlideCount = $ref(0)
|
|
33
26
|
|
|
34
27
|
function disableDrag() {
|
|
35
|
-
bglSlider
|
|
36
|
-
?.querySelectorAll('img')
|
|
37
|
-
.forEach((e) => { e.setAttribute('draggable', 'false') })
|
|
38
|
-
|
|
28
|
+
bglSlider?.querySelectorAll('img').forEach((e) => { e.setAttribute('draggable', 'false') })
|
|
39
29
|
for (const e of (bglSlider?.children as any[] | undefined) || []) {
|
|
40
30
|
e.setAttribute('draggable', 'false')
|
|
41
|
-
e.addEventListener('click', (
|
|
31
|
+
e.addEventListener('click', (el: any) => el.preventDefault())
|
|
42
32
|
}
|
|
43
33
|
}
|
|
44
34
|
|
|
45
|
-
let yHeight = $ref('auto')
|
|
46
35
|
function evalHeight() {
|
|
47
36
|
if (!props.autoHeight || !bglSlider) return
|
|
48
|
-
const
|
|
49
|
-
const height = Array.from(slidChildren)
|
|
37
|
+
const height = Array.from(bglSlider.children[activeSlideIndex].children)
|
|
50
38
|
.map(el => el.clientHeight)
|
|
51
39
|
.reduce((a, b) => a + b, 0)
|
|
52
|
-
|
|
53
40
|
yHeight = `${height}px`
|
|
54
41
|
}
|
|
55
42
|
|
|
56
|
-
function goToSlide(index: number) {
|
|
57
|
-
if (!bglSlider
|
|
58
|
-
|
|
43
|
+
function goToSlide(index: number, behavior: ScrollBehavior = 'smooth') {
|
|
44
|
+
if (!bglSlider) return
|
|
45
|
+
if (props.loop) {
|
|
46
|
+
if (index >= originalSlideCount) {
|
|
47
|
+
index = index % originalSlideCount
|
|
48
|
+
behavior = 'auto'
|
|
49
|
+
} else if (index < 0) {
|
|
50
|
+
index = originalSlideCount - (-index % originalSlideCount)
|
|
51
|
+
behavior = 'auto'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
59
55
|
const isRTL = getComputedStyle(bglSlider).direction === 'rtl'
|
|
60
|
-
const scrollX =
|
|
61
|
-
|
|
56
|
+
const scrollX = bglSlider.offsetWidth * index * (isRTL ? -1 : 1)
|
|
57
|
+
bglSlider.scrollTo({ left: scrollX, behavior })
|
|
62
58
|
activeSlideIndex = index
|
|
63
59
|
evalHeight()
|
|
64
60
|
}
|
|
65
61
|
|
|
66
|
-
watch(() => props.index, goToSlide)
|
|
62
|
+
watch(() => props.index, (index) => { goToSlide(index) })
|
|
67
63
|
|
|
68
|
-
watch(
|
|
69
|
-
() => activeSlideIndex,
|
|
70
|
-
(index) => { emit('update:index', index) }
|
|
71
|
-
)
|
|
64
|
+
watch(() => activeSlideIndex, (index) => { emit('update:index', index) })
|
|
72
65
|
|
|
73
66
|
function scrollEnd() {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const nextSlide = Math.round(slider.scrollLeft / slider.offsetWidth)
|
|
67
|
+
if (props.items !== 1 || !bglSlider) return
|
|
68
|
+
const nextSlide = Math.round(bglSlider.scrollLeft / bglSlider.offsetWidth)
|
|
77
69
|
goToSlide(nextSlide)
|
|
78
70
|
}
|
|
79
71
|
|
|
@@ -82,11 +74,10 @@ function stopDragging(e: MouseEvent) {
|
|
|
82
74
|
const slider = bglSlider
|
|
83
75
|
if (!slider) return
|
|
84
76
|
const isDragForward = startX > e.pageX + slider.offsetLeft
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
activeSlideIndex = isDragForward
|
|
78
|
+
? Math.ceil(slider.scrollLeft / slider.offsetWidth)
|
|
79
|
+
: Math.floor(slider.scrollLeft / slider.offsetWidth)
|
|
88
80
|
if (props.items === 1) goToSlide(activeSlideIndex)
|
|
89
|
-
startX = 0
|
|
90
81
|
document.removeEventListener('mousemove', move)
|
|
91
82
|
document.removeEventListener('mouseup', stopDragging)
|
|
92
83
|
document.removeEventListener('dragend', stopDragging)
|
|
@@ -96,11 +87,9 @@ function stopDragging(e: MouseEvent) {
|
|
|
96
87
|
function move(e: MouseEvent) {
|
|
97
88
|
if (!bglSlider) return
|
|
98
89
|
const x = e.pageX - bglSlider.offsetLeft
|
|
99
|
-
|
|
100
|
-
if (walk > 20 || walk < -20) isDragging = true
|
|
90
|
+
if (Math.abs(x - startX) > 20) isDragging = true
|
|
101
91
|
if (!isDragging) return
|
|
102
|
-
|
|
103
|
-
bglSlider.scrollLeft = scrollLeft - scroll
|
|
92
|
+
bglSlider.scrollLeft = scrollLeft - (x - startX)
|
|
104
93
|
}
|
|
105
94
|
|
|
106
95
|
function startDragging(e: MouseEvent) {
|
|
@@ -114,57 +103,85 @@ function startDragging(e: MouseEvent) {
|
|
|
114
103
|
}
|
|
115
104
|
|
|
116
105
|
function next() {
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (isLastSlide) goToSlide(0)
|
|
121
|
-
else goToSlide(activeSlideIndex + 1)
|
|
106
|
+
if (bglSlider) {
|
|
107
|
+
goToSlide(activeSlideIndex + 1)
|
|
108
|
+
}
|
|
122
109
|
}
|
|
123
110
|
|
|
124
111
|
function prev() {
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else goToSlide(activeSlideIndex - 1)
|
|
112
|
+
if (bglSlider) {
|
|
113
|
+
goToSlide(activeSlideIndex - 1)
|
|
114
|
+
}
|
|
129
115
|
}
|
|
130
116
|
|
|
131
117
|
function evalWidth() {
|
|
132
|
-
if (
|
|
133
|
-
|
|
118
|
+
if (bglSlider) goToSlide(activeSlideIndex)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function startAutoplay() {
|
|
122
|
+
if (props.autoplay) {
|
|
123
|
+
autoplayInterval = setInterval(next, props.autoplaySpeed)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function stopAutoplay() {
|
|
128
|
+
if (autoplayInterval) {
|
|
129
|
+
clearInterval(autoplayInterval)
|
|
130
|
+
autoplayInterval = null
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function cloneSlides() {
|
|
135
|
+
if (!bglSlider || !props.loop) return
|
|
136
|
+
const slides = Array.from(bglSlider.children)
|
|
137
|
+
originalSlideCount = slides.length
|
|
138
|
+
slides.forEach((slide) => {
|
|
139
|
+
const clone = slide.cloneNode(true) as HTMLElement
|
|
140
|
+
bglSlider.appendChild(clone)
|
|
141
|
+
})
|
|
142
|
+
slides.forEach((slide) => {
|
|
143
|
+
const clone = slide.cloneNode(true) as HTMLElement
|
|
144
|
+
bglSlider.insertBefore(clone, bglSlider.firstChild)
|
|
145
|
+
})
|
|
134
146
|
}
|
|
135
147
|
|
|
136
148
|
onMounted(() => {
|
|
149
|
+
cloneSlides()
|
|
137
150
|
window.addEventListener('resize', evalWidth)
|
|
138
151
|
evalHeight()
|
|
139
152
|
disableDrag()
|
|
153
|
+
startAutoplay()
|
|
140
154
|
})
|
|
141
155
|
|
|
142
|
-
onUnmounted(() => {
|
|
156
|
+
onUnmounted(() => {
|
|
157
|
+
window.removeEventListener('resize', evalWidth)
|
|
158
|
+
stopAutoplay()
|
|
159
|
+
})
|
|
143
160
|
</script>
|
|
144
161
|
|
|
145
162
|
<template>
|
|
146
|
-
<div class="BglCarousel" :style="{ height: yHeight }" :class="{ autoHeight }">
|
|
163
|
+
<div class="BglCarousel" :style="{ height: yHeight }" :class="{ autoHeight: props.autoHeight }">
|
|
147
164
|
<div
|
|
148
165
|
ref="bglSlider"
|
|
149
|
-
:class="
|
|
150
|
-
dragging: isDragging,
|
|
151
|
-
|
|
152
|
-
[`slides-${items}`]: true,
|
|
153
|
-
allowScroll,
|
|
154
|
-
}"
|
|
155
|
-
class="bgl-slider"
|
|
166
|
+
class="bgl-slider" :class="[
|
|
167
|
+
{ dragging: isDragging, clicking: isPressed, [`slides-${props.items}`]: true, allowScroll: props.allowScroll },
|
|
168
|
+
]"
|
|
156
169
|
@scrollend="scrollEnd"
|
|
157
170
|
@mousedown="startDragging"
|
|
171
|
+
@mouseenter="stopAutoplay"
|
|
172
|
+
@mouseleave="startAutoplay"
|
|
173
|
+
@focusin="stopAutoplay"
|
|
174
|
+
@focusout="startAutoplay"
|
|
158
175
|
>
|
|
159
176
|
<div v-if="isDragging" class="blocker" />
|
|
160
177
|
<slot />
|
|
161
178
|
</div>
|
|
162
179
|
<div class="Handlers">
|
|
163
180
|
<span @click="prev">
|
|
164
|
-
<slot
|
|
181
|
+
<slot name="prev" :index="activeSlideIndex" />
|
|
165
182
|
</span>
|
|
166
183
|
<span @click="next">
|
|
167
|
-
<slot
|
|
184
|
+
<slot name="next" :index="activeSlideIndex" />
|
|
168
185
|
</span>
|
|
169
186
|
</div>
|
|
170
187
|
</div>
|
|
@@ -172,99 +189,99 @@ onUnmounted(() => { window.removeEventListener('resize', evalWidth) })
|
|
|
172
189
|
|
|
173
190
|
<style scoped>
|
|
174
191
|
.blocker {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
192
|
+
position: fixed;
|
|
193
|
+
top: 0;
|
|
194
|
+
left: 0;
|
|
195
|
+
width: 100%;
|
|
196
|
+
height: 100%;
|
|
197
|
+
z-index: 100;
|
|
181
198
|
}
|
|
182
199
|
|
|
183
200
|
.bgl-slider {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
201
|
+
display: grid;
|
|
202
|
+
position: relative;
|
|
203
|
+
scroll-behavior: smooth;
|
|
204
|
+
grid-auto-flow: column;
|
|
205
|
+
grid-auto-columns: 100%;
|
|
206
|
+
scroll-snap-type: x mandatory;
|
|
207
|
+
overflow-x: hidden;
|
|
191
208
|
}
|
|
192
209
|
|
|
193
210
|
.autoHeight {
|
|
194
|
-
|
|
211
|
+
transition: height ease 0.7s;
|
|
195
212
|
}
|
|
196
213
|
|
|
197
214
|
.bgl-slider.allowScroll {
|
|
198
|
-
|
|
215
|
+
overflow-x: scroll;
|
|
199
216
|
}
|
|
200
217
|
|
|
201
218
|
.bgl-slider.slides-6 {
|
|
202
|
-
|
|
203
|
-
|
|
219
|
+
grid-auto-columns: 15.9%;
|
|
220
|
+
gap: 1%;
|
|
204
221
|
}
|
|
205
222
|
|
|
206
223
|
.bgl-slider.slides-5 {
|
|
207
|
-
|
|
208
|
-
|
|
224
|
+
grid-auto-columns: 19.3%;
|
|
225
|
+
gap: 1%;
|
|
209
226
|
}
|
|
210
227
|
|
|
211
228
|
.bgl-slider.slides-4 {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
229
|
+
grid-auto-columns: 25%;
|
|
230
|
+
gap: 1%;
|
|
231
|
+
}
|
|
215
232
|
|
|
216
233
|
.bgl-slider.slides-3 {
|
|
217
|
-
|
|
218
|
-
|
|
234
|
+
grid-auto-columns: 33%;
|
|
235
|
+
gap: 1%;
|
|
219
236
|
}
|
|
220
237
|
|
|
221
238
|
.bgl-slider.slides-2 {
|
|
222
|
-
|
|
223
|
-
|
|
239
|
+
grid-auto-columns: 50%;
|
|
240
|
+
gap: 1%;
|
|
224
241
|
}
|
|
225
242
|
|
|
226
243
|
.bgl-slider.slides-1 {
|
|
227
|
-
|
|
244
|
+
grid-auto-columns: 100%;
|
|
228
245
|
}
|
|
229
246
|
|
|
230
247
|
.bgl-slider::-webkit-scrollbar {
|
|
231
|
-
|
|
248
|
+
display: none;
|
|
232
249
|
}
|
|
233
250
|
|
|
234
251
|
.bgl-slider * {
|
|
235
|
-
|
|
252
|
+
scroll-snap-align: center;
|
|
236
253
|
}
|
|
237
254
|
|
|
238
255
|
.dragging.bgl-slider {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
256
|
+
cursor: grabbing;
|
|
257
|
+
cursor: -webkit-grabbing;
|
|
258
|
+
scroll-snap-type: unset;
|
|
242
259
|
}
|
|
243
260
|
|
|
244
261
|
.clicking.bgl-slider {
|
|
245
|
-
|
|
262
|
+
scroll-behavior: unset;
|
|
246
263
|
}
|
|
247
264
|
|
|
248
265
|
.dragging.bgl-slider * {
|
|
249
|
-
|
|
250
|
-
|
|
266
|
+
scroll-snap-align: unset;
|
|
267
|
+
user-select: none;
|
|
251
268
|
}
|
|
252
269
|
|
|
253
270
|
@media screen and (max-width: 1280px) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
271
|
+
.bgl-slider.slides-4 {
|
|
272
|
+
grid-auto-columns: 33%;
|
|
273
|
+
}
|
|
257
274
|
}
|
|
258
275
|
|
|
259
276
|
@media screen and (max-width: 991px) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
277
|
+
.bgl-slider.slides-4 {
|
|
278
|
+
grid-auto-columns: 50%;
|
|
279
|
+
}
|
|
263
280
|
}
|
|
264
281
|
|
|
265
282
|
@media screen and (max-width: 600px) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
283
|
+
.bgl-slider.slides-4 {
|
|
284
|
+
grid-auto-columns: 100%;
|
|
285
|
+
}
|
|
269
286
|
}
|
|
270
287
|
</style>
|
|
@@ -14,11 +14,11 @@ defineProps<{
|
|
|
14
14
|
<component :is="to ? 'RouterLink' : 'div'" :to="to" class="flex list-item gap-1">
|
|
15
15
|
<Avatar v-if="src || showAvatar" style="flex-basis: 1;" :name="title" :src="src" :size="40" />
|
|
16
16
|
<div>
|
|
17
|
-
<p class="
|
|
17
|
+
<p class="no-margin ellipsis line-height-14">
|
|
18
18
|
{{ title }}
|
|
19
19
|
<slot />
|
|
20
20
|
</p>
|
|
21
|
-
<p class="
|
|
21
|
+
<p class="txt12 no-margin txt-gray ellipsis">
|
|
22
22
|
{{ subtitle }}
|
|
23
23
|
<slot name="subtitle" />
|
|
24
24
|
</p>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import L from 'leaflet'
|
|
3
|
-
import type { LatLngExpression,
|
|
3
|
+
import type { LatLngExpression, Marker } from 'leaflet'
|
|
4
4
|
import 'leaflet/dist/leaflet.css'
|
|
5
5
|
import { onMounted, watch } from 'vue'
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ interface MapProps {
|
|
|
13
13
|
|
|
14
14
|
const props = defineProps<MapProps>()
|
|
15
15
|
|
|
16
|
-
let map = $ref<Map>()
|
|
16
|
+
let map = $ref<L.Map>()
|
|
17
17
|
const markers = $ref<Marker[]>([])
|
|
18
18
|
|
|
19
19
|
function initializeMap() {
|
|
@@ -32,14 +32,16 @@ function addMarker(latlng: LatLngExpression) {
|
|
|
32
32
|
iconUrl: `data:image/svg+xml;utf8,${encodeURIComponent(markerSVG)}`,
|
|
33
33
|
iconSize: [32, 32],
|
|
34
34
|
})
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
if (!map) initializeMap()
|
|
37
|
+
const marker = L.marker(latlng, { icon: customIcon }).addTo(map as L.Map)
|
|
36
38
|
markers.push(marker)
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
async function geocodeAddress(address: string) {
|
|
40
42
|
const geocodeUrl = `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(address)}`
|
|
41
43
|
const res = await fetch(geocodeUrl)
|
|
42
|
-
const data = await res.json() || []
|
|
44
|
+
const data: any[] = await res.json() || []
|
|
43
45
|
data.forEach((element) => { addMarker([element.lat, element.lon]) })
|
|
44
46
|
}
|
|
45
47
|
|
package/src/components/Modal.vue
CHANGED
|
@@ -87,8 +87,7 @@ onUnmounted(() => {
|
|
|
87
87
|
|
|
88
88
|
<div v-else class="sticky bg-white z-index-999 -mt-1 -ms-1 px-025 h-30px pt-025 modal-no-title">
|
|
89
89
|
<Btn
|
|
90
|
-
class="color-black"
|
|
91
|
-
:style="{ float: side ? 'left' : 'right' }"
|
|
90
|
+
class="color-black position-start"
|
|
92
91
|
icon="close"
|
|
93
92
|
thin
|
|
94
93
|
color="white"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
defineProps<{
|
|
2
|
+
const props = defineProps<{
|
|
3
3
|
label?: string
|
|
4
4
|
id?: string
|
|
5
5
|
title?: string
|
|
@@ -7,18 +7,25 @@ defineProps<{
|
|
|
7
7
|
required?: boolean
|
|
8
8
|
}>()
|
|
9
9
|
|
|
10
|
+
const inputId = $ref(props.id || Math.random().toString(36).substring(7))
|
|
11
|
+
|
|
10
12
|
const checked = defineModel<boolean>('modelValue', { default: false })
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
<template>
|
|
14
|
-
<div
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<div
|
|
17
|
+
class="bagel-input bgl-checkbox align-items-center ps-025"
|
|
18
|
+
:title="title"
|
|
19
|
+
:class="{ small }"
|
|
20
|
+
>
|
|
21
|
+
<input
|
|
22
|
+
:id="inputId"
|
|
23
|
+
v-model="checked"
|
|
24
|
+
:required="required"
|
|
25
|
+
type="checkbox"
|
|
26
|
+
class="me-05"
|
|
27
|
+
>
|
|
28
|
+
<label :for="inputId">
|
|
22
29
|
<slot name="label">
|
|
23
30
|
{{ label }}
|
|
24
31
|
</slot>
|
|
@@ -26,75 +33,44 @@ const checked = defineModel<boolean>('modelValue', { default: false })
|
|
|
26
33
|
</div>
|
|
27
34
|
</template>
|
|
28
35
|
|
|
29
|
-
<style>
|
|
30
|
-
:root {
|
|
31
|
-
--bgl-white: #fff;
|
|
32
|
-
--input-height: 40px;
|
|
33
|
-
--input-border-radius: 7px;
|
|
34
|
-
--bgl-transition: all 200ms ease;
|
|
35
|
-
--bgl-primary: #19b8ea;
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
39
|
-
|
|
40
36
|
<style scoped>
|
|
41
37
|
.bgl-checkbox {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
flex-direction: row;
|
|
45
|
-
align-items: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.bgl-checkbox input[type=checkbox] {
|
|
49
|
-
position: absolute;
|
|
50
|
-
opacity: 0;
|
|
51
|
-
z-index: -1;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
cursor: pointer;
|
|
52
40
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
user-select: none;
|
|
59
|
-
font-size: var(--input-font-size);
|
|
41
|
+
.bgl-checkbox input[type='checkbox'] {
|
|
42
|
+
accent-color: var(--bgl-primary);
|
|
43
|
+
height: calc(var(--input-height) / 2.75);
|
|
44
|
+
width: calc(var(--input-height) / 2.75);
|
|
45
|
+
min-width: 0;
|
|
60
46
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
.bgl-checkbox input[type='checkbox']::before {
|
|
48
|
+
content: '';
|
|
49
|
+
height: calc(var(--input-height) / 2.75);
|
|
50
|
+
width: calc(var(--input-height) / 2.75);
|
|
51
|
+
background: var(--bgl-primary);
|
|
52
|
+
border-radius: 100%;
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transition: all 200ms ease;
|
|
55
|
+
position: absolute;
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
.bgl-checkbox input[type='checkbox']:hover::before {
|
|
58
|
+
opacity: 0.2;
|
|
59
|
+
transform: scale(2);
|
|
68
60
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
border-radius: calc(var(--input-border-radius) / 2);
|
|
75
|
-
border: var(--bgl-primary) 1px solid;
|
|
76
|
-
position: relative;
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: center;
|
|
61
|
+
.bgl-checkbox label {
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
user-select: none;
|
|
64
|
+
font-size: var(--input-font-size);
|
|
65
|
+
transition: var(--bgl-transition-400);
|
|
80
66
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
background: var(--bgl-primary);
|
|
67
|
+
.bgl-checkbox:hover label {
|
|
68
|
+
color: var(--bgl-primary) !important;
|
|
84
69
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
width: calc(var(--input-height) / 2.5);
|
|
88
|
-
height: calc(var(--input-height) / 2.5);
|
|
89
|
-
position: absolute;
|
|
90
|
-
z-index: 2;
|
|
91
|
-
fill: var(--bgl-white);
|
|
92
|
-
pointer-events: none;
|
|
93
|
-
transform: scale(0);
|
|
94
|
-
transition: var(--bgl-transition);
|
|
70
|
+
.bgl-checkbox input:checked + label{
|
|
71
|
+
color: var(--bgl-primary) !important;
|
|
95
72
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
transform: scale(1);
|
|
73
|
+
.bagel-input:focus-within.bgl-checkbox:not(:checked) label {
|
|
74
|
+
color: var(--label-color) !important;
|
|
99
75
|
}
|
|
100
76
|
</style>
|
|
@@ -12,6 +12,10 @@ const props = withDefaults(
|
|
|
12
12
|
modelValue?: string | Date
|
|
13
13
|
defaultValue?: string | Date
|
|
14
14
|
extraProps?: VueDatePickerProps
|
|
15
|
+
allowedDates?: string[] | Date[]
|
|
16
|
+
timePickerInline?: boolean
|
|
17
|
+
minutesIncrement?: string | number
|
|
18
|
+
minutesGridIncrement?: string | number
|
|
15
19
|
}>(),
|
|
16
20
|
{
|
|
17
21
|
enableTime: false,
|
|
@@ -59,7 +63,12 @@ onMounted(() => {
|
|
|
59
63
|
v-model="date"
|
|
60
64
|
:auto-apply="true"
|
|
61
65
|
:enable-time-picker="enableTime"
|
|
66
|
+
:allowed-dates="allowedDates"
|
|
62
67
|
v-bind="extraProps"
|
|
68
|
+
:time-picker-inline="timePickerInline"
|
|
69
|
+
:minutes-increment="minutesIncrement"
|
|
70
|
+
:minutes-grid-increment="minutesGridIncrement"
|
|
71
|
+
:start-time="{ hours: 8, minutes: 0 }"
|
|
63
72
|
/>
|
|
64
73
|
</div>
|
|
65
74
|
</template>
|