@explorer-1/vue 0.2.69 → 0.2.71

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.69",
3
+ "version": "0.2.71",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  "vue-bind-once": "^0.2.1",
31
31
  "vue3-compare-image": "^1.2.5",
32
32
  "vue3-observe-visibility": "^1.0.1",
33
- "@explorer-1/common": "1.1.18"
33
+ "@explorer-1/common": "1.1.19"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@vitejs/plugin-vue": "^5.0.4",
@@ -92,3 +92,6 @@ export const BaseStory = {
92
92
  name: 'BlockCardGrid',
93
93
  args: { cards: BlockCardGridData }
94
94
  }
95
+ export const ThreeCards = {
96
+ args: { cards: BlockCardGridData.slice(0, 3) }
97
+ }
@@ -3,9 +3,7 @@
3
3
  v-if="cards"
4
4
  class="BlockCardGrid"
5
5
  >
6
- <div
7
- :class="`hidden md:grid md:grid-cols-2 lg:grid-cols-3 ${compact ? ' gap-5' : '3xl:grid-cols-4 gap-8'}`"
8
- >
6
+ <div :class="computedClasses">
9
7
  <BlockCardGridItem
10
8
  v-for="(card, index) of cards"
11
9
  :key="`item-${index}`"
@@ -65,6 +63,23 @@ export default defineComponent({
65
63
  type: Array as PropType<CardGridItem[]>,
66
64
  default: undefined
67
65
  }
66
+ },
67
+ computed: {
68
+ fourColumns() {
69
+ return this.cards && this.cards.length > 3
70
+ },
71
+ computedClasses() {
72
+ let classes = 'hidden md:grid md:grid-cols-2 lg:grid-cols-3'
73
+ if (this.compact) {
74
+ classes += ' gap-5'
75
+ } else {
76
+ classes += ' gap-8'
77
+ }
78
+ if (this.fourColumns) {
79
+ classes += ' xl:grid-cols-4'
80
+ }
81
+ return classes
82
+ }
68
83
  }
69
84
  })
70
85
  </script>
@@ -109,34 +109,32 @@ export default defineComponent({
109
109
  v-if="theData"
110
110
  class="BlockImageFullBleed"
111
111
  >
112
- <div class="bg-gray-light">
113
- <div class="max-w-screen-3xl mx-auto">
114
- <MixinFancybox
115
- v-if="theData.src"
116
- :src="theData.original || theData.src?.url"
117
- :caption="theData.caption"
118
- :credit="theData.credit"
119
- :detail-url="customDetailUrl || theData.detailUrl"
112
+ <div class="max-w-screen-3xl mx-auto">
113
+ <MixinFancybox
114
+ v-if="theData.src"
115
+ :src="theData.original || theData.src?.url"
116
+ :caption="theData.caption"
117
+ :credit="theData.credit"
118
+ :detail-url="customDetailUrl || theData.detailUrl"
119
+ >
120
+ <BaseImagePlaceholder
121
+ :aspect-ratio="constrain ? '16:9' : 'none'"
122
+ :responsive-aspect-ratio="constrain ? 'lg:aspect-ratio-two-one' : ''"
123
+ dark-mode
120
124
  >
121
- <BaseImagePlaceholder
122
- :aspect-ratio="constrain ? '16:9' : 'none'"
123
- :responsive-aspect-ratio="constrain ? 'lg:aspect-ratio-two-one' : ''"
124
- dark-mode
125
- >
126
- <BaseImage
127
- v-if="theData.src && theData.srcCropped"
128
- :src="constrain ? theData.srcCropped.url : theData.src.url"
129
- :srcset="theData.srcSet && !constrain ? theData.srcSet : theSrcSet"
130
- :width="constrain ? theData.srcCropped.width : theData.src.width"
131
- :height="constrain ? theData.srcCropped.height : theData.src.height"
132
- :alt="theData.alt"
133
- :image-class="!constrain ? 'w-full h-auto' : undefined"
134
- :object-fit-class="constrain ? 'cover' : undefined"
135
- loading="lazy"
136
- />
137
- </BaseImagePlaceholder>
138
- </MixinFancybox>
139
- </div>
125
+ <BaseImage
126
+ v-if="theData.src && theData.srcCropped"
127
+ :src="constrain ? theData.srcCropped.url : theData.src.url"
128
+ :srcset="theData.srcSet && !constrain ? theData.srcSet : theSrcSet"
129
+ :width="constrain ? theData.srcCropped.width : theData.src.width"
130
+ :height="constrain ? theData.srcCropped.height : theData.src.height"
131
+ :alt="theData.alt"
132
+ :image-class="!constrain ? 'w-full h-auto' : undefined"
133
+ :object-fit-class="constrain ? 'cover' : undefined"
134
+ loading="lazy"
135
+ />
136
+ </BaseImagePlaceholder>
137
+ </MixinFancybox>
140
138
  </div>
141
139
  <div
142
140
  v-if="data && hasCaptionArea"
@@ -25,15 +25,24 @@ export default defineComponent({
25
25
  >
26
26
  <div class="overflow-x-auto scrolling-touch max-w-screen-3xl mx-auto !mb-0">
27
27
  <table
28
- class="min-w-full border-gray-light-mid w-full border-t border-b border-collapse table-auto"
28
+ v-if="table.tableContent"
29
+ class="min-w-full border-gray-light-mid w-full border-t border-b border-collapse table-auto m-0 p-0"
29
30
  >
31
+ <caption
32
+ v-if="table.tableCaption"
33
+ class="sr-only"
34
+ >
35
+ {{
36
+ table.tableCaption
37
+ }}
38
+ </caption>
30
39
  <thead v-if="table.tableContent.tableHead?.length">
31
40
  <tr>
32
41
  <th
33
42
  v-for="(headCell, headIndex) in table.tableContent.tableHead[0]"
34
43
  :key="headIndex"
35
44
  scope="col"
36
- class="min-w-[6rem] bg-jpl-blue-darker edu:bg-jpl-violet-darker text-subtitle text-white border-gray-light-mid lg:p-5 p-3 border-b"
45
+ class="min-w-[6rem] bg-jpl-blue-darker edu:bg-jpl-violet-darker text-subtitle text-white border-gray-light-mid lg:p-5 p-3 border-b text-left"
37
46
  >
38
47
  {{ headCell.text }}
39
48
  </th>
@@ -47,7 +56,7 @@ export default defineComponent({
47
56
  <td
48
57
  v-for="(cell, cellIndex) in row"
49
58
  :key="cellIndex"
50
- class="min-w-[6rem] bg-white text-gray-dark border-gray-light-mid"
59
+ class="min-w-[6rem] bg-white text-gray-dark border-gray-light-mid lg:p-5 p-3 align-top"
51
60
  >
52
61
  <template v-if="cell.blockType === 'CharBlock'">
53
62
  <p class="">
@@ -75,11 +84,12 @@ export default defineComponent({
75
84
  </table>
76
85
  </div>
77
86
  <template v-if="table.tableCaption">
78
- <caption class="block text-left px-0 text-gray-mid-dark text-body-sm mt-4">
79
- {{
80
- table.tableCaption
81
- }}
82
- </caption>
87
+ <div
88
+ class="max-w-screen-3xl mx-auto block text-left px-0 text-gray-mid-dark text-body-sm mt-4"
89
+ aria-hidden
90
+ >
91
+ {{ table.tableCaption }}
92
+ </div>
83
93
  </template>
84
94
  </div>
85
95
  </template>
@@ -16,6 +16,7 @@ import { BlockTeaserData } from './../BlockTeaser/BlockTeaser.stories'
16
16
  import { BlockIframeEmbedData } from './../BlockIframeEmbed/BlockIframeEmbed.stories'
17
17
  import { BlockVideoData } from './../BlockVideo/BlockVideo.stories'
18
18
  import { BlockVideoEmbedData } from './../BlockVideoEmbed/BlockVideoEmbed.stories'
19
+ import { MixedColumnWidths } from './../BlockRichTable/BlockRichTable.stories'
19
20
  import BlockStreamfield, { variants } from './BlockStreamfield.vue'
20
21
 
21
22
  export default {
@@ -127,6 +128,45 @@ export const BlockStreamfieldData = {
127
128
  alignTo: 'left'
128
129
  },
129
130
  BlockRichTableData,
131
+ MixedColumnWidths.args.table,
132
+ {
133
+ blockType: 'RichTableBlock',
134
+ tableCaption: 'table caption',
135
+ tableContent: {
136
+ tableHead: [
137
+ [
138
+ {
139
+ text: '1. Learn'
140
+ }
141
+ ]
142
+ ],
143
+ tableBody: [
144
+ [
145
+ {
146
+ ...BlockImageData,
147
+ caption: '<p>My custom caption.</p>',
148
+ displayCaption: true,
149
+ blockType: 'ImageBlock'
150
+ }
151
+ ],
152
+ [
153
+ {
154
+ blockType: 'RichTextBlock',
155
+ value:
156
+ '<p>Rich text. Lorem ipsum <a href="/missions/test-mission/">dolor</a> sit amet, consectetur adipiscing elit. Quisque vitae justo quis justo malesuada molestie. Cras sed tincidunt dui.</p>\n'
157
+ }
158
+ ],
159
+
160
+ [
161
+ {
162
+ blockType: 'CharBlock',
163
+ value:
164
+ "Geologists are scientists who study a planet's solid features, like soil, rocks, and minerals. There are all kinds of rocks and minerals that make up our planet – as well as the Moon, Mars, and other rocky worlds. By studying these features, we can learn more about how rocky worlds form and change over time."
165
+ }
166
+ ]
167
+ ]
168
+ }
169
+ },
130
170
  {
131
171
  blockType: 'ListBlock',
132
172
  field: 'card_grid',
@@ -3,52 +3,50 @@
3
3
  v-if="image || video"
4
4
  class="HeroMedia"
5
5
  >
6
- <div class="bg-gray-light">
7
- <div class="vh-crop max-w-screen-3xl relative flex items-center mx-auto overflow-hidden">
8
- <div class="hero">
9
- <template v-if="theImageData">
10
- <img
11
- v-if="theImageData.src"
12
- class="object-cover object-center w-full h-full"
13
- :srcset="theSrcSet"
14
- :src="theImageData.src.url"
15
- :width="theImageData.src.width"
16
- :height="theImageData.src.height"
17
- :alt="theImageData.alt"
18
- itemprop="image"
19
- data-chromatic="ignore"
20
- />
21
- </template>
22
- <template v-else-if="video">
23
- <MixinVideoBg :video="video" />
24
- </template>
25
- </div>
26
- <div
27
- v-if="hasCaptionArea"
28
- class="lg:hidden absolute bottom-0 left-0 w-full h-auto mx-auto print:hidden"
29
- >
30
- <button
31
- class="bg-opacity-90 text-gray-dark flex items-center justify-center w-12 h-12 ml-auto bg-white cursor-pointer"
32
- aria-label="Toggle caption"
33
- @click="toggleCaption"
34
- >
35
- <IconInfo
36
- v-show="!captionVisible"
37
- class="text-xl"
38
- />
39
- <IconClose v-show="captionVisible" />
40
- </button>
41
- </div>
6
+ <div class="vh-crop max-w-screen-3xl relative flex items-center mx-auto overflow-hidden">
7
+ <div class="hero">
8
+ <template v-if="theImageData">
9
+ <img
10
+ v-if="theImageData.src"
11
+ class="object-cover object-center w-full h-full"
12
+ :srcset="theSrcSet"
13
+ :src="theImageData.src.url"
14
+ :width="theImageData.src.width"
15
+ :height="theImageData.src.height"
16
+ :alt="theImageData.alt"
17
+ itemprop="image"
18
+ data-chromatic="ignore"
19
+ />
20
+ </template>
21
+ <template v-else-if="video">
22
+ <MixinVideoBg :video="video" />
23
+ </template>
42
24
  </div>
43
-
44
25
  <div
45
26
  v-if="hasCaptionArea"
46
- :class="captionVisibilityClass"
47
- class="caption-area max-w-screen-3xl ThemeVariantGray bg-gray-light bg-opacity-90 lg:bg-opacity-100 ThemeVariantGray lg:block lg:pb-4 lg:px-3 xl:px-8 lg:pt-4 items-start p-4 mx-auto print:block"
27
+ class="lg:hidden absolute bottom-0 left-0 w-full h-auto mx-auto print:hidden"
48
28
  >
49
- <BaseImageCaption :data="theImageData || customCaption" />
29
+ <button
30
+ class="bg-opacity-90 text-gray-dark flex items-center justify-center w-12 h-12 ml-auto bg-white cursor-pointer"
31
+ aria-label="Toggle caption"
32
+ @click="toggleCaption"
33
+ >
34
+ <IconInfo
35
+ v-show="!captionVisible"
36
+ class="text-xl"
37
+ />
38
+ <IconClose v-show="captionVisible" />
39
+ </button>
50
40
  </div>
51
41
  </div>
42
+
43
+ <div
44
+ v-if="hasCaptionArea"
45
+ :class="captionVisibilityClass"
46
+ class="caption-area max-w-screen-3xl ThemeVariantGray bg-gray-light bg-opacity-90 lg:bg-opacity-100 ThemeVariantGray lg:block lg:pb-4 lg:px-3 xl:px-8 lg:pt-4 items-start p-4 mx-auto print:block"
47
+ >
48
+ <BaseImageCaption :data="theImageData || customCaption" />
49
+ </div>
52
50
  </div>
53
51
  </template>
54
52
  <script lang="ts">
@@ -12,7 +12,7 @@
12
12
  }"
13
13
  >
14
14
  <!-- navbar -->
15
- <div class="header-bg z-10 max-w-screen-3xl absolute inset-0 mx-auto"></div>
15
+ <div class="header-bg z-10 absolute inset-0 mx-auto"></div>
16
16
  <div class="px-4">
17
17
  <div class="h-18 container flex items-center justify-between mx-auto">
18
18
  <!-- branding -->