@bagelink/vue 1.6.47 → 1.6.49

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 (167) hide show
  1. package/bin/experimentalGenTypedRoutes.ts +18 -19
  2. package/bin/utils.ts +4 -4
  3. package/dist/components/AddressSearch.vue.d.ts.map +1 -1
  4. package/dist/components/Alert.vue.d.ts.map +1 -1
  5. package/dist/components/BglVideo.vue.d.ts.map +1 -1
  6. package/dist/components/Card.vue.d.ts.map +1 -1
  7. package/dist/components/Carousel.vue.d.ts +2 -2
  8. package/dist/components/Carousel.vue.d.ts.map +1 -1
  9. package/dist/components/Dropdown.vue.d.ts.map +1 -1
  10. package/dist/components/Flag.vue.d.ts.map +1 -1
  11. package/dist/components/IframeVue.vue.d.ts.map +1 -1
  12. package/dist/components/ListItem.vue.d.ts.map +1 -1
  13. package/dist/components/Loading.vue.d.ts.map +1 -1
  14. package/dist/components/Modal.vue.d.ts.map +1 -1
  15. package/dist/components/ModalForm.vue.d.ts.map +1 -1
  16. package/dist/components/NavBar.vue.d.ts +1 -1
  17. package/dist/components/Pill.vue.d.ts.map +1 -1
  18. package/dist/components/Zoomer.vue.d.ts.map +1 -1
  19. package/dist/components/analytics/LineChart.vue.d.ts.map +1 -1
  20. package/dist/components/analytics/PieChart.vue.d.ts +2 -1
  21. package/dist/components/analytics/PieChart.vue.d.ts.map +1 -1
  22. package/dist/components/analytics/index.d.ts +1 -1
  23. package/dist/components/analytics/index.d.ts.map +1 -1
  24. package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -1
  25. package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -1
  26. package/dist/components/form/inputs/ColorInput.vue.d.ts.map +1 -1
  27. package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
  28. package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
  29. package/dist/components/form/inputs/RadioGroup.vue.d.ts.map +1 -1
  30. package/dist/components/form/inputs/RangeInput.vue.d.ts +11 -11
  31. package/dist/components/form/inputs/RichText/components/EditorToolbar.vue.d.ts.map +1 -1
  32. package/dist/components/form/inputs/RichText/components/TableGridSelector.vue.d.ts.map +1 -1
  33. package/dist/components/form/inputs/RichText/utils/commands.d.ts.map +1 -1
  34. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  35. package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
  36. package/dist/components/layout/AppSidebar.vue.d.ts +1 -0
  37. package/dist/components/layout/AppSidebar.vue.d.ts.map +1 -1
  38. package/dist/components/layout/Layout.vue.d.ts.map +1 -1
  39. package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
  40. package/dist/components/layout/index.d.ts +3 -3
  41. package/dist/components/layout/index.d.ts.map +1 -1
  42. package/dist/index.cjs +24 -15
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.mjs +4863 -4781
  46. package/dist/style.css +1 -1
  47. package/package.json +1 -2
  48. package/src/components/AccordionItem.vue +11 -11
  49. package/src/components/AddToCalendar.vue +1 -1
  50. package/src/components/AddressSearch.vue +9 -8
  51. package/src/components/Alert.vue +2 -1
  52. package/src/components/Badge.vue +5 -5
  53. package/src/components/BglVideo.vue +44 -45
  54. package/src/components/Btn.vue +15 -15
  55. package/src/components/Card.vue +10 -8
  56. package/src/components/Carousel.vue +159 -162
  57. package/src/components/DataPreview.vue +1 -1
  58. package/src/components/DragOver.vue +6 -6
  59. package/src/components/Dropdown.vue +39 -38
  60. package/src/components/Flag.vue +7 -6
  61. package/src/components/Icon/Icon.vue +22 -22
  62. package/src/components/IframeVue.vue +5 -5
  63. package/src/components/Image.vue +17 -17
  64. package/src/components/ImportData.vue +79 -79
  65. package/src/components/ListItem.vue +12 -11
  66. package/src/components/Loading.vue +10 -9
  67. package/src/components/MapEmbed/Index.vue +24 -24
  68. package/src/components/Modal.vue +11 -9
  69. package/src/components/ModalForm.vue +9 -8
  70. package/src/components/NavBar.vue +6 -6
  71. package/src/components/Pagination.vue +27 -27
  72. package/src/components/Pill.vue +11 -12
  73. package/src/components/Rating.vue +2 -2
  74. package/src/components/Slider.vue +75 -75
  75. package/src/components/Spreadsheet/Index.vue +34 -34
  76. package/src/components/Spreadsheet/SpreadsheetTable.vue +3 -3
  77. package/src/components/Zoomer.vue +165 -168
  78. package/src/components/analytics/BarChart.vue +6 -6
  79. package/src/components/analytics/KpiCard.vue +2 -2
  80. package/src/components/analytics/LineChart.vue +63 -61
  81. package/src/components/analytics/PieChart.vue +104 -90
  82. package/src/components/analytics/index.ts +2 -2
  83. package/src/components/calendar/CalendarPopover.vue +1 -1
  84. package/src/components/calendar/Index.vue +1 -1
  85. package/src/components/calendar/views/AgendaView.vue +3 -3
  86. package/src/components/calendar/views/DayView.vue +6 -6
  87. package/src/components/calendar/views/MonthView.vue +2 -2
  88. package/src/components/calendar/views/WeekView.vue +18 -18
  89. package/src/components/dataTable/DataTable.vue +4 -4
  90. package/src/components/dataTable/useSorting.ts +1 -1
  91. package/src/components/dataTable/useTableData.ts +15 -15
  92. package/src/components/dataTable/useTableSelection.ts +15 -15
  93. package/src/components/dataTable/useTableVirtualization.ts +1 -1
  94. package/src/components/draggable/useDraggable.ts +42 -42
  95. package/src/components/form/BagelForm.vue +15 -15
  96. package/src/components/form/BglFieldSet.vue +5 -3
  97. package/src/components/form/BglMultiStepForm.vue +20 -21
  98. package/src/components/form/inputs/CheckInput.vue +2 -2
  99. package/src/components/form/inputs/CodeEditor/format.ts +7 -7
  100. package/src/components/form/inputs/CodeEditor/useHighlight.ts +6 -6
  101. package/src/components/form/inputs/ColorInput.vue +5 -4
  102. package/src/components/form/inputs/DateInput.vue +8 -9
  103. package/src/components/form/inputs/DatePicker.vue +24 -24
  104. package/src/components/form/inputs/EmailInput.vue +24 -24
  105. package/src/components/form/inputs/NumberInput.vue +26 -26
  106. package/src/components/form/inputs/OTP.vue +7 -7
  107. package/src/components/form/inputs/PasswordInput.vue +3 -2
  108. package/src/components/form/inputs/RadioGroup.vue +28 -25
  109. package/src/components/form/inputs/RadioPillsInput.vue +12 -12
  110. package/src/components/form/inputs/RangeInput.vue +21 -21
  111. package/src/components/form/inputs/RichText/components/EditorToolbar.vue +107 -92
  112. package/src/components/form/inputs/RichText/components/TableGridSelector.vue +64 -64
  113. package/src/components/form/inputs/RichText/components/gridBox.vue +10 -8
  114. package/src/components/form/inputs/RichText/composables/useCommands.ts +1 -1
  115. package/src/components/form/inputs/RichText/composables/useEditor.ts +12 -12
  116. package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +1 -1
  117. package/src/components/form/inputs/RichText/index.vue +138 -138
  118. package/src/components/form/inputs/RichText/utils/commands.ts +84 -85
  119. package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
  120. package/src/components/form/inputs/RichText/utils/formatting.ts +39 -39
  121. package/src/components/form/inputs/RichText/utils/selection.ts +28 -28
  122. package/src/components/form/inputs/RichText/utils/table.ts +19 -19
  123. package/src/components/form/inputs/SelectBtn.vue +1 -1
  124. package/src/components/form/inputs/SelectInput.vue +54 -54
  125. package/src/components/form/inputs/SignaturePad.vue +40 -40
  126. package/src/components/form/inputs/TableField.vue +1 -1
  127. package/src/components/form/inputs/TelInput.vue +54 -53
  128. package/src/components/form/inputs/TextInput.vue +19 -19
  129. package/src/components/form/inputs/ToggleInput.vue +2 -2
  130. package/src/components/form/inputs/Upload/useFileUpload.ts +6 -6
  131. package/src/components/form/useBagelFormState.ts +5 -5
  132. package/src/components/layout/AppLayout.vue +2 -2
  133. package/src/components/layout/AppSidebar.vue +77 -16
  134. package/src/components/layout/Layout.vue +12 -10
  135. package/src/components/layout/SidebarMenu.vue +4 -4
  136. package/src/components/layout/TabbedLayout.vue +17 -17
  137. package/src/components/layout/Tabs.vue +4 -5
  138. package/src/components/layout/TabsNav.vue +14 -14
  139. package/src/components/layout/index.ts +3 -5
  140. package/src/components/lightbox/Lightbox.vue +22 -22
  141. package/src/components/lightbox/index.ts +8 -8
  142. package/src/composables/index.ts +8 -8
  143. package/src/composables/useAddToCalendar.ts +13 -13
  144. package/src/composables/useDevice.ts +2 -2
  145. package/src/composables/useFormField.ts +4 -4
  146. package/src/composables/usePolling.ts +8 -8
  147. package/src/composables/useSchemaField.ts +38 -38
  148. package/src/composables/useTheme.ts +9 -9
  149. package/src/composables/useValidateFieldValue.ts +2 -2
  150. package/src/directives/pattern.ts +25 -25
  151. package/src/directives/ripple.ts +4 -4
  152. package/src/directives/vResize.ts +6 -6
  153. package/src/index.ts +1 -0
  154. package/src/plugins/bagel.ts +4 -4
  155. package/src/styles/layout.css +1 -1
  156. package/src/types/index.ts +1 -1
  157. package/src/utils/BagelFormUtils.ts +7 -7
  158. package/src/utils/calendar/Helpers.ts +8 -8
  159. package/src/utils/calendar/dateUtils.ts +22 -22
  160. package/src/utils/calendar/time.ts +25 -25
  161. package/src/utils/calendar/week.ts +25 -25
  162. package/src/utils/elementUtils.ts +27 -27
  163. package/src/utils/sizeParsing.ts +2 -2
  164. package/src/utils/strings.ts +5 -5
  165. package/src/utils/tapDetector.ts +11 -11
  166. package/src/utils/useSearch.ts +29 -29
  167. package/vite.config.ts +0 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.6.47",
4
+ "version": "1.6.49",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -60,7 +60,6 @@
60
60
  "swiper": "^12.0.3",
61
61
  "@types/leaflet": "^1.9.18",
62
62
  "@types/signature_pad": "^4.0.0",
63
- "@vue-macros/reactivity-transform": "^1.1.6",
64
63
  "vue": "^3.5.16",
65
64
  "vue-component-type-helpers": "^2.2.10",
66
65
  "vue-toastification": "^2.0.0-rc.5"
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import { Icon } from '@bagelink/vue'
3
- import { inject, watch, computed } from 'vue'
3
+ import { computed, inject, ref, watch } from 'vue'
4
4
 
5
5
  const props = defineProps<{
6
6
  label?: string
@@ -14,12 +14,12 @@ const props = defineProps<{
14
14
 
15
15
  const emit = defineEmits(['update:open'])
16
16
 
17
- let openVal = $ref(!!props.open)
17
+ const openVal = ref(!!props.open)
18
18
 
19
- let isOpen = $computed({
20
- get: () => openVal,
19
+ const isOpen = computed({
20
+ get: () => openVal.value,
21
21
  set: (value: boolean) => {
22
- openVal = value
22
+ openVal.value = value
23
23
  emit('update:open', value)
24
24
  },
25
25
  })
@@ -33,29 +33,29 @@ const id = props.id || Math.random().toString(36).slice(7)
33
33
 
34
34
  const computedIcon = computed(() => {
35
35
  return props.iconType === 'plus_minus'
36
- ? (isOpen ? 'remove' : 'add')
36
+ ? (isOpen.value ? 'remove' : 'add')
37
37
  : 'expand_more'
38
38
  })
39
39
  const iconPosition = computed(() => props.iconPosition || 'end')
40
40
 
41
- watch(() => props.open, () => isOpen = props.open, { immediate: true })
41
+ watch(() => props.open, () => isOpen.value = props.open, { immediate: true })
42
42
 
43
43
  if (accordionState) {
44
44
  watch(
45
45
  () => accordionState.openItem,
46
46
  (currentOpenId) => {
47
- if (currentOpenId !== id) { isOpen = false }
47
+ if (currentOpenId !== id) { isOpen.value = false }
48
48
  },
49
49
  { immediate: true }
50
50
  )
51
51
  }
52
52
 
53
53
  function toggle() {
54
- isOpen = !isOpen
54
+ isOpen.value = !isOpen.value
55
55
  if (accordionState) {
56
- if (isOpen) {
56
+ if (isOpen.value) {
57
57
  accordionState.openItem = id
58
- } else if (accordionState.openItem === id) {
58
+ } else if (accordionState.openItem !== undefined && accordionState.openItem === id) {
59
59
  accordionState.openItem = undefined
60
60
  }
61
61
  }
@@ -39,7 +39,7 @@ const calendarProviders = [
39
39
  ]
40
40
 
41
41
  const includedProviders = computed(() => {
42
- if (!props.providers || !props.providers.length) {return calendarProviders}
42
+ if (!props.providers || !props.providers.length) { return calendarProviders }
43
43
  return calendarProviders.filter(provider => props.providers?.includes(provider.id))
44
44
  })
45
45
 
@@ -1,28 +1,29 @@
1
1
  <script setup lang="ts">
2
2
  import { Dropdown, ListItem, ListView, TextInput } from '@bagelink/vue'
3
+ import { ref } from 'vue'
3
4
 
4
5
  const emit = defineEmits(['addressSelected'])
5
- let addressInput = $ref('')
6
- let searchResults = $ref<any[]>([])
6
+ const addressInput = ref('')
7
+ const searchResults = ref<any[]>([])
7
8
 
8
9
  type MapMarker = {
9
10
  lat: number
10
11
  lon: number
11
12
  } | [number, number]
12
13
 
13
- const suggestion = $ref<typeof Dropdown>()
14
+ const suggestion = ref<typeof Dropdown>()
14
15
  function emitAddress(address: MapMarker) {
15
16
  emit('addressSelected', address)
16
- searchResults = []
17
- addressInput = ''
17
+ searchResults.value = []
18
+ addressInput.value = ''
18
19
  }
19
20
 
20
21
  async function searchAddresses() {
21
- const addressURL = addressInput.replaceAll(/\s+/g, '+')
22
+ const addressURL = addressInput.value.replaceAll(/\s+/g, '+')
22
23
  const geocodeUrl = `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURI(addressURL)}`
23
24
  const res = await fetch(geocodeUrl)
24
- searchResults = await res.json() || []
25
- suggestion?.show()
25
+ searchResults.value = await res.json() ?? []
26
+ suggestion.value?.show()
26
27
  }
27
28
  </script>
28
29
 
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import type { IconType } from '@bagelink/vue'
3
3
  import { Icon } from '@bagelink/vue'
4
+ import { ref } from 'vue'
4
5
  import Btn from './Btn.vue'
5
6
 
6
7
  interface Props {
@@ -19,7 +20,7 @@ withDefaults(
19
20
  },
20
21
  )
21
22
 
22
- const isDismissed = $ref(false)
23
+ const isDismissed = ref(false)
23
24
 
24
25
  const color = {
25
26
  info: 'var(--bgl-primary)',
@@ -14,11 +14,11 @@ defineProps<Props>()
14
14
  </script>
15
15
 
16
16
  <template>
17
- <div class="pill" :class="[color]">
18
- <Icon v-if="icon" class="inline" :icon="icon" />
19
- {{ text }}
20
- <Icon v-if="iconEnd" class="inline" :icon="iconEnd" />
21
- </div>
17
+ <div class="pill" :class="[color]">
18
+ <Icon v-if="icon" class="inline" :icon="icon" />
19
+ {{ text }}
20
+ <Icon v-if="iconEnd" class="inline" :icon="iconEnd" />
21
+ </div>
22
22
  </template>
23
23
 
24
24
  <style scoped>
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { useIntersectionObserver } from '@vueuse/core'
3
- import { watch } from 'vue'
3
+ import { computed, ref, watch } from 'vue'
4
4
 
5
5
  type Autoplay = boolean | 'visible'
6
6
  interface Props {
@@ -16,33 +16,33 @@ interface Props {
16
16
 
17
17
  const props = defineProps<Props>()
18
18
 
19
- const videoFormat = $computed(() => props.src?.split('.').pop()?.split('?').shift()?.toLowerCase() || 'mp4')
19
+ const videoFormat = computed(() => props.src?.split('.').pop()?.split('?').shift()?.toLowerCase() ?? 'mp4')
20
20
 
21
- const videoContainer = $ref<HTMLElement | null>()
21
+ const videoContainer = ref<HTMLElement | null>()
22
22
 
23
- const isYoutubeShort = $computed(() => {
24
- return props.src?.includes('youtube.com/shorts/') || false
23
+ const isYoutubeShort = computed(() => {
24
+ return props.src?.includes('youtube.com/shorts/') ?? false
25
25
  })
26
26
 
27
- const aspectRatio = $computed(
27
+ const aspectRatio = computed(
28
28
  () => {
29
- if (isYoutubeShort) {return '9/16'} // Vertical aspect ratio for Shorts
30
- return props.aspectRatio?.replace(':', '/') || '16/9'
29
+ if (isYoutubeShort.value) { return '9/16' } // Vertical aspect ratio for Shorts
30
+ return props.aspectRatio?.replace(':', '/') ?? '16/9'
31
31
  }
32
32
  )
33
33
 
34
- const video = $ref<HTMLVideoElement | null>()
34
+ const video = ref<HTMLVideoElement | null>()
35
35
 
36
36
  function play() {
37
- video?.play()
37
+ video.value?.play()
38
38
  }
39
39
 
40
40
  function pause() {
41
- video?.pause()
41
+ video.value?.pause()
42
42
  }
43
43
 
44
44
  // Setup intersection observer for autoplay="visible"
45
- if ('visible' === props.autoplay) {
45
+ if (props.autoplay === 'visible') {
46
46
  useIntersectionObserver(
47
47
  videoContainer,
48
48
  ([{ isIntersecting }]) => {
@@ -57,50 +57,49 @@ if ('visible' === props.autoplay) {
57
57
  }
58
58
 
59
59
  watch(() => props.status, (status) => {
60
- if ('play' === status) {play()}
61
- if ('pause' === status) {pause()}
60
+ if (status === 'play') { play() }
61
+ if (status === 'pause') { pause() }
62
62
  })
63
63
 
64
64
  defineExpose({ play, pause })
65
65
 
66
- const embedType = $computed<'YouTube' | 'Vimeo' | undefined>(() => {
66
+ const embedType = computed<'YouTube' | 'Vimeo' | undefined>(() => {
67
67
  const youtubeRegex = /youtube\.com|youtu\.be/
68
- if (youtubeRegex.test(props.src || '')) {return 'YouTube'}
68
+ if (youtubeRegex.test(props.src ?? '')) { return 'YouTube' }
69
69
  const vimeoRegex = /(?:player\.)?vimeo\.com/
70
- if (vimeoRegex.test(props.src || '')) {return 'Vimeo'}
70
+ if (vimeoRegex.test(props.src ?? '')) { return 'Vimeo' }
71
+ return undefined
71
72
  })
72
73
 
73
- const videoUrl = $computed(() => {
74
- if (embedType) {
75
- if ('YouTube' === embedType) {
76
- // Extract video ID from YouTube regular or Shorts URL
77
- let videoId = ''
78
- if (props.src?.includes('youtube.com/shorts/')) {
79
- videoId = props.src.split('/shorts/')[1]?.split('?')[0] || ''
80
- } else {
81
- videoId = props.src?.split(/v=|youtu\.be\//)[1]?.split('&')?.[0] || ''
82
- }
83
-
84
- const queryParams = new URLSearchParams({
85
- autoplay: props.autoplay ? '1' : '0',
86
- controls: '0',
87
- showinfo: '0',
88
- modestbranding: '1'
89
- })
90
- return `https://www.youtube.com/embed/${videoId}?${queryParams}`
74
+ const videoUrl = computed(() => {
75
+ if (embedType.value === 'YouTube') {
76
+ // Extract video ID from YouTube regular or Shorts URL
77
+ let videoId = ''
78
+ if (props.src?.includes('youtube.com/shorts/') === true) {
79
+ videoId = props.src.split('/shorts/')[1]?.split('?')[0] ?? ''
80
+ } else {
81
+ videoId = props.src?.split(/v=|youtu\.be\//)[1]?.split('&')?.[0] ?? ''
91
82
  }
92
- if ('Vimeo' === embedType) {
93
- // Handle both regular Vimeo URLs and player.vimeo.com embed URLs
94
- const playerVimeoRegex = /player\.vimeo\.com\/video\/(\d+)/
95
- const regularVimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
96
83
 
97
- const playerMatch = props.src?.match(playerVimeoRegex)
98
- const regularMatch = props.src?.match(regularVimeoRegex)
84
+ const queryParams = new URLSearchParams({
85
+ autoplay: (props.autoplay === true || props.autoplay === 'visible') ? '1' : '0',
86
+ controls: '0',
87
+ showinfo: '0',
88
+ modestbranding: '1'
89
+ })
90
+ return `https://www.youtube.com/embed/${videoId}?${queryParams}`
91
+ }
92
+ if (embedType.value === 'Vimeo') {
93
+ // Handle both regular Vimeo URLs and player.vimeo.com embed URLs
94
+ const playerVimeoRegex = /player\.vimeo\.com\/video\/(\d+)/
95
+ const regularVimeoRegex = /vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/)?(\d+)(?:$|\/|\?)/
99
96
 
100
- const videoId = playerMatch?.[1] || regularMatch?.[3]
101
- console.log(videoId, { playerMatch, regularMatch })
102
- return `https://player.vimeo.com/video/${videoId}`
103
- }
97
+ const playerMatch = props.src?.match(playerVimeoRegex) ?? null
98
+ const regularMatch = props.src?.match(regularVimeoRegex) ?? null
99
+
100
+ const videoId = playerMatch?.[1] ?? regularMatch?.[3]
101
+ console.log(videoId, { playerMatch, regularMatch })
102
+ return `https://player.vimeo.com/video/${videoId}`
104
103
  }
105
104
  return props.src
106
105
  })
@@ -2,7 +2,7 @@
2
2
  import type { IconType, ExtendedThemeType } from '@bagelink/vue'
3
3
  import type { SetupContext } from 'vue'
4
4
  import { Icon, Loading, useModal } from '@bagelink/vue'
5
- import { useSlots, ref, onMounted, onUnmounted } from 'vue'
5
+ import { useSlots, ref, onMounted, onUnmounted, computed } from 'vue'
6
6
  import { RouterLink } from 'vue-router'
7
7
 
8
8
  const props = withDefaults(
@@ -60,7 +60,7 @@ const emit = defineEmits<{
60
60
  const isMobileScreen = ref(false)
61
61
 
62
62
  function checkMobile() {
63
- isMobileScreen.value = 910 >= window.innerWidth
63
+ isMobileScreen.value = window.innerWidth <= 910
64
64
  }
65
65
 
66
66
  onMounted(() => {
@@ -73,15 +73,15 @@ onUnmounted(() => {
73
73
  })
74
74
 
75
75
  async function handleClick(event: MouseEvent) {
76
- if (props.confirm) {
76
+ if (props.confirm !== undefined && props.confirm !== false) {
77
77
  const { confirmModal } = useModal()
78
- const message = 'string' === typeof props.confirm ? props.confirm : 'Are you sure?'
78
+ const message = typeof props.confirm === 'string' ? props.confirm : 'Are you sure?'
79
79
  const confirmed = await confirmModal({
80
80
  title: 'Confirm',
81
81
  message
82
82
  })
83
83
 
84
- if (!confirmed) {return}
84
+ if (!confirmed) { return }
85
85
 
86
86
  props.onClick(event)
87
87
  emit('confirmed', event)
@@ -90,8 +90,8 @@ async function handleClick(event: MouseEvent) {
90
90
  }
91
91
  }
92
92
 
93
- const iconSizeComputed = $computed(() => {
94
- if (props.iconSize !== undefined) {return props.iconSize}
93
+ const iconSizeComputed = computed(() => {
94
+ if (props.iconSize !== undefined) { return props.iconSize }
95
95
 
96
96
  // Default icon sizes based on button size
97
97
  const sizeMap = {
@@ -114,20 +114,20 @@ const iconSizeComputed = $computed(() => {
114
114
  return isMobileScreen.value ? 1 : 1.2
115
115
  })
116
116
 
117
- const isComponent = $computed(() => {
118
- if (props.disabled) {return props.is}
119
- if (props.to) {return RouterLink}
120
- if (props.href) {return 'a'}
117
+ const isComponent = computed(() => {
118
+ if (props.disabled) { return props.is }
119
+ if (props.to !== undefined && props.to !== '') { return RouterLink }
120
+ if (props.href !== undefined && props.href !== '') { return 'a' }
121
121
  return props.is
122
122
  })
123
123
 
124
- const bind = $computed(() => {
124
+ const bind = computed(() => {
125
125
  const obj: { [key: string]: any } = {}
126
126
  if (!props.disabled) {
127
- if (props.to) {obj.to = props.to}
128
- else if (props.href) {obj.href = props.href}
127
+ if (props.to !== undefined && props.to !== '') { obj.to = props.to }
128
+ else if (props.href !== undefined && props.href !== '') { obj.href = props.href }
129
129
  }
130
- if (!props.to && !props.href) {
130
+ if ((props.to === undefined || props.to === '') && (props.href === undefined || props.href === '')) {
131
131
  obj.role = props.role
132
132
  obj.type = props.type
133
133
  }
@@ -1,4 +1,6 @@
1
1
  <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
2
4
  const props = defineProps<{
3
5
  label?: string
4
6
  thin?: boolean
@@ -23,16 +25,16 @@ const props = defineProps<{
23
25
  | 'transparent'
24
26
  }>()
25
27
 
26
- const bind = $computed(() => {
28
+ const bind = computed(() => {
27
29
  const obj: { [key: string]: any } = {}
28
- if (props.href) {obj.href = props.href}
29
- else if (props.to) {obj.to = props.to}
30
+ if (props.href !== undefined && props.href !== '') { obj.href = props.href }
31
+ else if (props.to !== undefined && props.to !== '') { obj.to = props.to }
30
32
  return obj
31
33
  })
32
34
 
33
- const is = $computed(() => {
34
- if (props.href) {return 'a'}
35
- if (props.to) {return 'router-link'}
35
+ const is = computed(() => {
36
+ if (props.href !== undefined && props.href !== '') { return 'a' }
37
+ if (props.to !== undefined && props.to !== '') { return 'router-link' }
36
38
  return 'div'
37
39
  })
38
40
  </script>
@@ -46,8 +48,8 @@ const is = $computed(() => {
46
48
  [bg || '']: bg,
47
49
  'overflow-x': overflowX,
48
50
  'overflow-y': overflowY,
49
- 'card_frame': frame,
50
- }"
51
+ 'card_frame': frame,
52
+ }"
51
53
  >
52
54
  <span v-if="label" class="card_label">
53
55
  {{ label }}