@explorer-1/vue 1.1.16 → 1.1.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @explorer-1/vue
2
2
 
3
+ ## 1.1.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 008fc92: Fixing NuxtLink resolution error in BaseLink
8
+
9
+ ## 1.1.17
10
+
11
+ ### Patch Changes
12
+
13
+ - 873cf1d: Fixing bug in AttractionCard with nested BaseLink components
14
+
3
15
  ## 1.1.16
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -94,7 +94,7 @@ const props = defineProps({
94
94
  >
95
95
  <div class="col-span-9">
96
96
  <div
97
- v-if="theme"
97
+ v-if="props.theme"
98
98
  class="text-subtitle-sm md:text-subtitle mb-3 md:mb-5 text-gray-mid-dark"
99
99
  >
100
100
  {{ props.theme }}
@@ -121,6 +121,7 @@ const props = defineProps({
121
121
  </div>
122
122
  <BaseLink
123
123
  v-if="props.url"
124
+ custom-element-type="div"
124
125
  class="mt-5"
125
126
  variant="primary"
126
127
  :href="props.url"
@@ -135,7 +136,7 @@ const props = defineProps({
135
136
  >
136
137
  <BaseImagePlaceholder aspect-ratio="square">
137
138
  <BaseImage
138
- v-if="props.image.src"
139
+ v-if="props.image?.src"
139
140
  :src="props.image.src.url"
140
141
  :width="props.image.src.width"
141
142
  :height="props.image.src.height"
@@ -154,6 +155,7 @@ const props = defineProps({
154
155
  </div>
155
156
  <BaseLink
156
157
  v-if="props.url"
158
+ custom-element-type="div"
157
159
  class="mt-5"
158
160
  variant="primary"
159
161
  :href="props.url"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { defineComponent, type PropType } from 'vue'
2
+ import { defineComponent, resolveComponent, type PropType } from 'vue'
3
3
  import { mapStores } from 'pinia'
4
4
  import { useThemeStore } from '../../store/theme'
5
5
  import { eventBus } from './../../utils/eventBus'
@@ -30,6 +30,13 @@ export default defineComponent({
30
30
  MixinAnimationCaret
31
31
  },
32
32
  props: {
33
+ /** Override html element (useful for things that should look like a link but aren't links) */
34
+ customElementType: {
35
+ type: String,
36
+ default: undefined,
37
+ validator: (prop: string): boolean => ['span', 'button', 'div'].includes(prop)
38
+ },
39
+ /** Style of link: primary, secondary, default, none */
33
40
  variant: {
34
41
  type: String as PropType<VariantsKey>,
35
42
  required: false,
@@ -141,6 +148,10 @@ export default defineComponent({
141
148
  ],
142
149
  computed: {
143
150
  ...mapStores(useThemeStore),
151
+ dynamicLinkComponent() {
152
+ // Resolves the NuxtLink component for Vue 3's dynamic <component> binding
153
+ return this.customElementType || resolveComponent('NuxtLink')
154
+ },
144
155
  computedVariants() {
145
156
  if (this.usePrimaryColor) {
146
157
  return primaryColorVariants
@@ -263,7 +274,8 @@ export default defineComponent({
263
274
  <template>
264
275
  <div>
265
276
  <!-- annoyingly repetive due to complexities around `to` and @click.native -->
266
- <nuxt-link
277
+ <component
278
+ :is="dynamicLinkComponent"
267
279
  v-if="computedTo"
268
280
  class="group"
269
281
  :class="computedClass"
@@ -302,8 +314,9 @@ export default defineComponent({
302
314
  <template v-else>
303
315
  <slot></slot>
304
316
  </template>
305
- </nuxt-link>
306
- <a
317
+ </component>
318
+ <component
319
+ :is="customElementType || 'a'"
307
320
  v-else-if="computedHref"
308
321
  :href="computedHref"
309
322
  class="group"
@@ -341,6 +354,6 @@ export default defineComponent({
341
354
  <template v-else>
342
355
  <slot></slot>
343
356
  </template>
344
- </a>
357
+ </component>
345
358
  </div>
346
359
  </template>