@explorer-1/vue 1.1.6 → 1.1.8

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.8
4
+
5
+ ### Patch Changes
6
+
7
+ - a8c2efe: Updating types of SearchFilterGroup to be compatible with radio inputs.
8
+
9
+ ## 1.1.7
10
+
11
+ ### Patch Changes
12
+
13
+ - 391a6be: Adds option to use radio input in SearchFilterGroup
14
+
3
15
  ## 1.1.6
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.6",
3
+ "version": "1.1.8",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -59,6 +59,23 @@ export const DateFilter = {
59
59
  truncateFilters: true
60
60
  }
61
61
  }
62
+
63
+ export const RadioInput = {
64
+ name: 'Radio Group',
65
+ args: {
66
+ inputType: 'radio',
67
+ filterBy: '',
68
+ buckets: [
69
+ { key: 'Solar System', doc_count: 3308 },
70
+ { key: 'Earth', doc_count: 1179 },
71
+ { key: 'Stars and Galaxies', doc_count: 979 },
72
+ { key: 'Technology', doc_count: 480 }
73
+ ],
74
+ groupKey: 'topics',
75
+ groupTitle: 'Topic',
76
+ truncateFilters: false
77
+ }
78
+ }
62
79
  export const SubFilters = {
63
80
  decorators: [
64
81
  () => ({
@@ -36,7 +36,7 @@
36
36
  : generateId(bucket.key, groupKey)
37
37
  "
38
38
  v-model="filterByHandler"
39
- type="checkbox"
39
+ :type="inputType"
40
40
  :value="bucket.key_as_string ? bucket.key_as_string : bucket.key"
41
41
  class="text-primary focus:ring-2 focus:ring-primary flex-shrink-0 w-5 h-5 mt-px mr-1 align-middle border rounded-none"
42
42
  />
@@ -94,9 +94,11 @@
94
94
  : generateId(bucket.key, groupKey)
95
95
  "
96
96
  v-model="filterByHandler"
97
- type="checkbox"
97
+ :name="inputType === 'radio' ? groupKey : undefined"
98
+ :type="inputType"
98
99
  :value="bucket.key_as_string ? bucket.key_as_string : bucket.key"
99
- class="text-primary focus:ring-2 focus:ring-primary flex-shrink-0 w-5 h-5 mt-px mr-1 align-middle border rounded-none"
100
+ class="text-primary focus:ring-2 focus:ring-primary flex-shrink-0 w-5 h-5 mt-px mr-1 align-middle border"
101
+ :class="inputType === 'radio' ? 'rounded-full' : 'rounded-none'"
100
102
  />
101
103
  <!-- 'key_as_string' exists for dates to have a human readable version -->
102
104
  <label
@@ -156,9 +158,21 @@ export default {
156
158
  SearchFilterGroupAccordionItem
157
159
  },
158
160
  props: {
161
+ /* Input type */
162
+ inputType: {
163
+ type: String as PropType<'checkbox' | 'radio'>,
164
+ default: 'checkbox'
165
+ },
159
166
  filterBy: {
160
- type: Array,
161
- default: undefined
167
+ /* array for checkbox, string for radio */
168
+ type: [Array, String] as PropType<string[] | string>,
169
+ required: true,
170
+ validator: (value: string[] | string, props: any) => {
171
+ if (props.inputType === 'radio') {
172
+ return typeof value === 'string'
173
+ }
174
+ return Array.isArray(value)
175
+ }
162
176
  },
163
177
  buckets: {
164
178
  type: Object,
package/src/interfaces.ts CHANGED
@@ -58,7 +58,8 @@ export interface ThumbnailObject {
58
58
  original: string
59
59
  width: number
60
60
  height: number
61
- url: string
61
+ src?: ImageSrcObject
62
+ srcCropped?: ImageSrcObject
62
63
  }
63
64
  export interface ImageObject {
64
65
  title?: string
@@ -23,9 +23,17 @@ export const ExploreAppSitePageData = {
23
23
  displayLabel: 'Explore JPL',
24
24
  showShareLinks: false,
25
25
  thumbnailImage: {
26
- url: 'https://picsum.photos/512/288',
27
- width: 512,
28
- height: 288,
26
+ original: 'https://picsum.photos/512/288',
27
+ src: {
28
+ url: 'https://picsum.photos/512/288',
29
+ width: 512,
30
+ height: 288
31
+ },
32
+ srcCropped: {
33
+ url: 'https://picsum.photos/512/288',
34
+ width: 512,
35
+ height: 288
36
+ },
29
37
  id: 12345
30
38
  },
31
39
  location: 'Cafe 186',
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, reactive } from 'vue'
3
3
  import { useRoute } from 'vue-router'
4
- import type { PageObject } from '../../../interfaces'
4
+ import type { PageObject, ImageObject } from '../../../interfaces'
5
5
  import { useThemeStore } from '../../../store/theme'
6
6
  import LayoutHelper from './../../../components/LayoutHelper/LayoutHelper.vue'
7
7
  import DetailHeadline from './../../../components/DetailHeadline/DetailHeadline.vue'
@@ -27,22 +27,6 @@ const props = defineProps({
27
27
  })
28
28
  const { data } = reactive(props)
29
29
 
30
- // Convert thumbnailImage data for BlockImageStandard compatibility
31
- const detailImage = computed(() => {
32
- return {
33
- src: {
34
- url: data?.thumbnailImage?.url!,
35
- width: data?.thumbnailImage?.width!,
36
- height: data?.thumbnailImage?.height!
37
- },
38
- srcCropped: {
39
- url: data?.thumbnailImage?.url!,
40
- width: data?.thumbnailImage?.width!,
41
- height: data?.thumbnailImage?.height!
42
- }
43
- }
44
- })
45
-
46
30
  // Handle navigating back to Sites page
47
31
  const previousPath = computed(() => {
48
32
  try {
@@ -113,14 +97,16 @@ const mapPath = computed(() => {
113
97
 
114
98
  <!-- inline hero image -->
115
99
  <LayoutHelper
100
+ v-if="data.thumbnailImage?.src"
116
101
  indent="col-2"
117
102
  class="mt-10 mb-22 hidden lg:block"
118
103
  >
119
- <BlockImageStandard :data="detailImage" />
104
+ <BlockImageStandard :data="data.thumbnailImage as ImageObject" />
120
105
  </LayoutHelper>
121
106
 
122
107
  <BlockImageFullBleed
123
- :data="detailImage"
108
+ v-if="data.thumbnailImage?.src"
109
+ :data="data.thumbnailImage as ImageObject"
124
110
  class="lg:hidden mt-10 mb-10"
125
111
  />
126
112