@bagelink/vue 1.1.23 → 1.1.29

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.
Files changed (34) hide show
  1. package/dist/components/AddressSearch.vue.d.ts +3 -0
  2. package/dist/components/AddressSearch.vue.d.ts.map +1 -1
  3. package/dist/components/Carousel.vue.d.ts.map +1 -1
  4. package/dist/components/Dropdown.vue.d.ts +1 -0
  5. package/dist/components/Dropdown.vue.d.ts.map +1 -1
  6. package/dist/components/ListItem.vue.d.ts +6 -0
  7. package/dist/components/ListItem.vue.d.ts.map +1 -1
  8. package/dist/components/Loading.vue.d.ts.map +1 -1
  9. package/dist/components/form/inputs/NumberInput.vue.d.ts.map +1 -1
  10. package/dist/components/form/inputs/SelectInput.vue.d.ts +6 -0
  11. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  12. package/dist/composables/index.d.ts +1 -1
  13. package/dist/composables/index.d.ts.map +1 -1
  14. package/dist/composables/useDevice.d.ts +5 -0
  15. package/dist/composables/useDevice.d.ts.map +1 -0
  16. package/dist/index.cjs +219 -127
  17. package/dist/index.mjs +219 -127
  18. package/dist/style.css +180 -131
  19. package/dist/utils/BagelFormUtils.d.ts +16 -0
  20. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  21. package/dist/utils/index.d.ts +1 -0
  22. package/dist/utils/index.d.ts.map +1 -1
  23. package/package.json +2 -2
  24. package/src/components/Carousel.vue +34 -12
  25. package/src/components/Dropdown.vue +38 -1
  26. package/src/components/ListItem.vue +48 -5
  27. package/src/components/Loading.vue +1 -0
  28. package/src/components/form/inputs/NumberInput.vue +3 -0
  29. package/src/composables/index.ts +1 -2
  30. package/src/composables/useDevice.ts +24 -0
  31. package/src/utils/BagelFormUtils.ts +34 -0
  32. package/src/utils/index.ts +1 -0
  33. package/dist/types/timeago.d.ts +0 -23
  34. package/dist/types/timeago.d.ts.map +0 -1
@@ -148,13 +148,21 @@ function goToSlide(index: number, isTouchNav = false) {
148
148
  function next() {
149
149
  if (!isSliderAvailable) return
150
150
  countSlides()
151
- goToSlide((activeSlideIndex + 1) % slideCount)
151
+ // In RTL, next and prev are reversed
152
+ const nextIndex = props.rtl
153
+ ? (activeSlideIndex - 1 + slideCount) % slideCount
154
+ : (activeSlideIndex + 1) % slideCount
155
+ goToSlide(nextIndex)
152
156
  }
153
157
 
154
158
  function prev() {
155
159
  if (!isSliderAvailable) return
156
160
  countSlides()
157
- goToSlide((activeSlideIndex - 1 + slideCount) % slideCount)
161
+ // In RTL, next and prev are reversed
162
+ const prevIndex = props.rtl
163
+ ? (activeSlideIndex + 1) % slideCount
164
+ : (activeSlideIndex - 1 + slideCount) % slideCount
165
+ goToSlide(prevIndex)
158
166
  }
159
167
 
160
168
  // Height management
@@ -264,7 +272,7 @@ function onDrag(e: MouseEvent) {
264
272
 
265
273
  if (Math.abs(distance) > THRESHOLDS.DRAG) isDragging = true
266
274
  if (isDragging) {
267
- const newTranslate = translateX + distance
275
+ const newTranslate = translateX + (props.rtl ? -distance : distance)
268
276
  const maxTranslate = 0
269
277
 
270
278
  const containerWidth = bglSlider.offsetWidth
@@ -294,8 +302,8 @@ function endDrag() {
294
302
 
295
303
  let targetPanel = currentPanel
296
304
  if (dragPercentage > THRESHOLDS.SWIPE_PERCENT) {
297
- const direction = totalDragDistance > 0 ? -1 : 1
298
- targetPanel = Math.floor(currentPanel) + (direction < 0 ? 0 : 1)
305
+ const distnace = totalDragDistance > 0 ? -1 : 1
306
+ targetPanel = Math.floor(currentPanel) + (distnace < 0 ? 0 : 1)
299
307
  } else {
300
308
  targetPanel = Math.round(currentPanel)
301
309
  }
@@ -457,6 +465,7 @@ function onTouchEnd() {
457
465
  ? (totalSwipeDistance > 0 ? -1 : 1)
458
466
  : velocityDirection
459
467
 
468
+ // Apply RTL correction to direction
460
469
  const rtlDirection = props.rtl ? -direction : direction
461
470
 
462
471
  if (isMobile) {
@@ -509,7 +518,8 @@ function onWheel(e: WheelEvent) {
509
518
  clearAutoplay()
510
519
  if (wheelTimeout) clearTimeout(wheelTimeout)
511
520
 
512
- accumulatedDeltaX += e.deltaX
521
+ // Reverse the delta direction for RTL mode
522
+ accumulatedDeltaX += props.rtl ? -e.deltaX : e.deltaX
513
523
 
514
524
  wheelTimeout = setTimeout(() => {
515
525
  accumulatedDeltaX = 0
@@ -567,12 +577,12 @@ watch(() => activeSlideIndex, handleSlideChange)
567
577
  </script>
568
578
 
569
579
  <template>
570
- <div class="BglCarousel" :style="{ height: yHeight }" :class="{ autoHeight }" :dir="rtl ? 'rtl' : 'ltr'">
580
+ <div class="BglCarousel" :dir="rtl ? 'rtl' : 'ltr'">
571
581
  <div
572
582
  ref="bglSlider"
573
583
  class="bgl-slider"
574
- :class="{ dragging: isDragging, clicking: isPressed, [`slides-${itemCount}`]: true, grab: freeDrag && slideCount > 1 }"
575
- :style="{ '--item-count': itemCount }"
584
+ :class="{ dragging: isDragging, clicking: isPressed, [`slides-${itemCount}`]: true, grab: freeDrag && slideCount > 1, autoHeight }"
585
+ :style="{ '--item-count': itemCount, 'height': yHeight }"
576
586
  @mousedown="startDrag"
577
587
  @mouseover="clearAutoplay"
578
588
  @focusin="clearAutoplay"
@@ -592,9 +602,9 @@ watch(() => activeSlideIndex, handleSlideChange)
592
602
  @click="goToSlide(i - 1)"
593
603
  />
594
604
  </div>
595
- <div class="Handlers">
596
- <span @click="prev"><slot name="prev" :index="activeSlideIndex" :prev="prev" /></span>
597
- <span @click="next"><slot name="next" :index="activeSlideIndex" :next="next" /></span>
605
+ <div class="navigation-buttons" :class="{ rtl }">
606
+ <span class="prev" @click="prev"><slot name="prev" :index="activeSlideIndex" :prev="prev" /></span>
607
+ <span class="next" @click="next"><slot name="next" :index="activeSlideIndex" :next="next" /></span>
598
608
  </div>
599
609
  </div>
600
610
  </template>
@@ -669,4 +679,16 @@ watch(() => activeSlideIndex, handleSlideChange)
669
679
  .dot.current {
670
680
  opacity: 0.8;
671
681
  }
682
+
683
+ .navigation-buttons {
684
+ display: flex;
685
+ justify-content: center;
686
+ align-items: center;
687
+ gap: 1rem;
688
+ margin-top: 1rem;
689
+ }
690
+
691
+ .navigation-buttons.rtl {
692
+ flex-direction: row-reverse;
693
+ }
672
694
  </style>
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import type { IconType, ThemeType } from '@bagelink/vue'
3
3
  import type { TriggerEvent } from 'floating-vue'
4
- import { Btn } from '@bagelink/vue'
4
+ import { Btn, useDevice } from '@bagelink/vue'
5
5
  import { Dropdown as DDown } from 'floating-vue'
6
6
 
7
7
  export type Side = 'top' | 'right' | 'bottom' | 'left' | 'auto'
@@ -19,6 +19,7 @@ const {
19
19
  outline,
20
20
  round,
21
21
  placement = 'bottom-start',
22
+ disablePlacement = false,
22
23
  noAutoFocus,
23
24
  autoHide = true,
24
25
  triggers = ['click'],
@@ -36,6 +37,7 @@ const {
36
37
  outline?: boolean
37
38
  round?: boolean
38
39
  placement?: AlignedPlacement
40
+ disablePlacement?: boolean
39
41
  noAutoFocus?: boolean
40
42
  autoHide?: boolean
41
43
  triggers?: TriggerEvent[]
@@ -86,6 +88,12 @@ function hide() {
86
88
  ddownRef?.hide()
87
89
  }
88
90
 
91
+ const { isMobile } = useDevice()
92
+
93
+ const shouldDisablePositioning = $computed(() => {
94
+ return disablePlacement && isMobile
95
+ })
96
+
89
97
  defineExpose({ show, hide, shown })
90
98
  </script>
91
99
 
@@ -95,6 +103,7 @@ defineExpose({ show, hide, shown })
95
103
  v-model:shown="shown"
96
104
  :disabled="disabled"
97
105
  :noAutoFocus="noAutoFocus"
106
+ :positioning-disabled="shouldDisablePositioning"
98
107
  :placement="placement"
99
108
  :autoHide="autoHide"
100
109
  :triggers="triggers"
@@ -120,3 +129,31 @@ defineExpose({ show, hide, shown })
120
129
  </template>
121
130
  </DDown>
122
131
  </template>
132
+
133
+ <style>
134
+ .v-popper__popper--no-positioning {
135
+ position: fixed;
136
+ z-index: 9999;
137
+ top: 0;
138
+ left: 0;
139
+ width: 100%;
140
+ height: 100%;
141
+ display: flex;
142
+ align-items: flex-end;
143
+ }
144
+
145
+ .v-popper__popper--no-positioning .v-popper__backdrop {
146
+ display: block;
147
+ background: rgba(0 0 0 / 90%);
148
+ }
149
+
150
+ .v-popper__popper--no-positioning .v-popper__wrapper {
151
+ width: 100%;
152
+ pointer-events: auto;
153
+ transition: transform .15s ease-out;
154
+ }
155
+
156
+ .v-popper__popper--no-positioning.v-popper__popper--hidden .v-popper__wrapper {
157
+ transform: translateY(100%);
158
+ }
159
+ </style>
@@ -2,43 +2,86 @@
2
2
  import type { IconType } from '@bagelink/vue'
3
3
  import { Avatar, Icon } from '@bagelink/vue'
4
4
 
5
- defineProps<{
5
+ const props = defineProps<{
6
6
  src?: string
7
7
  showAvatar?: boolean
8
8
  to?: string
9
+ href?: string
9
10
  icon?: IconType
10
11
  title?: string
11
12
  subtitle?: string
12
13
  flat?: boolean
14
+ disabled?: boolean
15
+ lead?: string
16
+ iconEnd?: IconType
17
+ target?: '_blank' | '_self'
13
18
  onClick?: () => void
14
19
  }>()
20
+
21
+ const isComponent = $computed(() => {
22
+ if (props.to) return 'router-link'
23
+ if (props.href) return 'a'
24
+ if (props.onClick) return 'button'
25
+ return 'div'
26
+ })
27
+
28
+ const bind = $computed(() => {
29
+ const obj: Record<string, any> = {}
30
+ if (props.to) obj.to = props.to
31
+ else if (props.href) obj.href = props.href
32
+ if (props.target && (props.to || props.href)) obj.target = props.target
33
+
34
+ obj.class = {
35
+ 'notClickable': !(props.to || props.onClick),
36
+ 'no-border-list': props.flat,
37
+ }
38
+ if (props.disabled) obj.disabled = true
39
+ return obj
40
+ })
15
41
  </script>
16
42
 
17
43
  <template>
18
44
  <component
19
- :is="to ? 'RouterLink' : 'div'"
20
- :to="to"
45
+ :is="isComponent"
46
+ v-bind="bind"
21
47
  class="flex gap-05 list-item"
22
- :class="{ 'notClickable': !(to || onClick), 'no-border-list': flat }"
23
48
  @click="onClick"
24
49
  >
25
50
  <Avatar v-if="src || showAvatar" style="flex-basis: 1;" :name="title" :src="src" :size="40" />
26
51
  <Icon v-if="icon" size="1.2" class="color-primary" :icon="icon" />
27
52
 
28
53
  <div>
54
+ <p v-if="lead" class="txt10 no-margin txt-gray ellipsis">
55
+ {{ lead }}
56
+ <slot name="lead" />
57
+ </p>
29
58
  <p class="no-margin ellipsis line-height-14 pb-025">
30
59
  {{ title }}
31
60
  <slot />
32
61
  </p>
33
- <p class="txt12 no-margin txt-gray ellipsis">
62
+ <p v-if="subtitle" class="txt12 no-margin txt-gray ellipsis">
34
63
  {{ subtitle }}
35
64
  <slot name="subtitle" />
36
65
  </p>
37
66
  </div>
67
+ <Icon v-if="iconEnd" :icon="iconEnd" class="transition-400" />
38
68
  </component>
39
69
  </template>
40
70
 
41
71
  <style>
72
+ button.list-item {
73
+ cursor: pointer;
74
+ display: flex;
75
+ gap: 0.5rem;
76
+ border: none;
77
+ background-color: unset;
78
+ width: 100%;
79
+
80
+ }
81
+ .list-item:disabled {
82
+ opacity: 0.5;
83
+ pointer-events: none;
84
+ }
42
85
  .list-item {
43
86
  padding: 0.6rem 1rem;
44
87
  min-height: -webkit-fit-content;
@@ -82,6 +82,7 @@ const computedBorder = $computed(() => {
82
82
  width: var(--size);
83
83
  height: var(--size);
84
84
  transform: translate(calc(var(--thickness) * -1), calc(var(--thickness) * -1));
85
+ direction: ltr;
85
86
  }
86
87
  .lds-ring div {
87
88
  box-sizing: border-box;
@@ -202,6 +202,9 @@ watch(() => modelValue, (newVal) => {
202
202
  </template>
203
203
 
204
204
  <style scoped>
205
+ .txtInputIconStart input{
206
+ padding-inline-start: calc(var(--input-height) / 1.5);
207
+ }
205
208
  .txtInputIconStart .iconStart {
206
209
  color: var(--input-color);
207
210
  position: absolute;
@@ -4,8 +4,7 @@ import type { Ref, UnwrapRef } from 'vue'
4
4
  import { getFallbackSchema } from '@bagelink/vue'
5
5
  import { ref, watch } from 'vue'
6
6
 
7
-
8
-
7
+ export { useDevice } from './useDevice'
9
8
 
10
9
  interface UseBglSchemaParamsT<T> {
11
10
  schema?: BglFormSchemaFnT<T>
@@ -0,0 +1,24 @@
1
+ import { ref, onMounted, onUnmounted } from 'vue'
2
+
3
+ export function useDevice() {
4
+ const innerWidth = ref(window.innerWidth)
5
+ const isMobile = ref(window.innerWidth < 768)
6
+
7
+ function updateDeviceInfo() {
8
+ innerWidth.value = window.innerWidth
9
+ isMobile.value = window.innerWidth < 768
10
+ }
11
+
12
+ onMounted(() => {
13
+ window.addEventListener('resize', updateDeviceInfo)
14
+ })
15
+
16
+ onUnmounted(() => {
17
+ window.removeEventListener('resize', updateDeviceInfo)
18
+ })
19
+
20
+ return {
21
+ innerWidth,
22
+ isMobile
23
+ }
24
+ }
@@ -351,3 +351,37 @@ export function arrField<T extends { [key: string]: any }>(
351
351
  // return f
352
352
  // })
353
353
  // }
354
+
355
+ export function useForm(): {
356
+ txtField: typeof txtField
357
+ selectField: typeof selectField
358
+ checkField: typeof checkField
359
+ dateField: typeof dateField
360
+ numField: typeof numField
361
+ frmRow: typeof frmRow
362
+ uploadField: typeof uploadField
363
+ rangeField: typeof rangeField
364
+ bglForm: typeof bglForm
365
+ telField: typeof telField
366
+ colorField: typeof colorField
367
+ arrField: typeof arrField
368
+ richText: typeof richText
369
+ findBglFieldById: typeof findBglFieldById
370
+ } {
371
+ return {
372
+ txtField,
373
+ selectField,
374
+ checkField,
375
+ dateField,
376
+ numField,
377
+ frmRow,
378
+ uploadField,
379
+ rangeField,
380
+ bglForm,
381
+ telField,
382
+ colorField,
383
+ arrField,
384
+ richText,
385
+ findBglFieldById,
386
+ }
387
+ }
@@ -163,6 +163,7 @@ export function normalizeDimension(value: string | number | undefined, defaultMe
163
163
  }
164
164
 
165
165
  export * as bagelFormUtils from './BagelFormUtils'
166
+ export { useForm } from './BagelFormUtils'
166
167
 
167
168
  export { useLang } from './lang'
168
169
 
@@ -1,23 +0,0 @@
1
- export interface TimeUnit {
2
- singular: string;
3
- plural: string;
4
- }
5
- export type TranslationValue = string | TimeUnit;
6
- export interface LanguageTranslations {
7
- [key: string]: TranslationValue;
8
- }
9
- export type AvailableTimeLanguages = 'en' | 'es' | 'fr' | 'he';
10
- export type DayFormatTypes = 'DD' | 'DDD' | 'DDDD';
11
- export type MonthFormatTypes = 'MM' | 'MMM' | 'MMMM';
12
- export type YearFormatTypes = 'YY' | 'YYYY';
13
- export type HourFormatTypes = 'HH';
14
- export type MinuteFormatTypes = 'mm';
15
- export type SecondFormatTypes = 'ss';
16
- export type MillisecondFormatTypes = 'sss';
17
- export type AmPmFormatTypes = 'AmPm';
18
- export type DateFormatSeparatorTypes = '/' | '-' | ' ' | ':' | '.';
19
- export type CommonDateFormats = `${DayFormatTypes}${DateFormatSeparatorTypes}${MonthFormatTypes}${DateFormatSeparatorTypes}${YearFormatTypes}` | 'DD.MM.YY' | 'DD.MM.YYYY' | 'DD/MM/YY' | 'DD/MM/YYYY' | 'MM.DD.YY' | 'MM.DD.YYYY' | 'MM/DD/YY' | 'MM/DD/YYYY' | 'YYYY-MM-DD' | 'YY-MM-DD' | 'DD MMM YYYY' | 'DD MMMM YYYY' | 'DDD, DD MMM' | 'DDDD, DD MMMM' | 'MMM DD' | 'MMMM DD';
20
- export type CommonTimeFormats = 'HH:mm' | 'HH:mm:ss' | 'HH:mm:ss:sss' | 'HH:MM' | 'HH:mm AmPm';
21
- export type CommonDateTimeFormats = `${CommonDateFormats} ${CommonTimeFormats}` | `${CommonTimeFormats}, ${CommonDateFormats}` | 'YYYY-MM-DD HH:MM';
22
- export type DateTimeAcceptedFormats = CommonDateFormats | CommonTimeFormats | CommonDateTimeFormats;
23
- //# sourceMappingURL=timeago.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timeago.d.ts","sourceRoot":"","sources":["../../src/types/timeago.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,gBAAgB,G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