@worksafevictoria/wcl7.5 1.1.0-beta.110 → 1.1.0-beta.111

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": "@worksafevictoria/wcl7.5",
3
- "version": "1.1.0-beta.110",
3
+ "version": "1.1.0-beta.111",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -4,18 +4,12 @@
4
4
  <b-card
5
5
  :id="cardId"
6
6
  no-body
7
- :tag="
8
- buttonRole === 'radio' ? 'div' : isSelectable ? 'button' : 'article'
9
- "
7
+ :tag="buttonRole === 'radio' ? 'div' : isSelectable ? 'button' : 'article'"
10
8
  class="card-grid-item__card"
11
9
  :class="cardClass"
12
10
  :role="buttonRole"
13
11
  :aria-checked="
14
- buttonRole === 'radio'
15
- ? isSelectable && selected
16
- ? 'true'
17
- : 'false'
18
- : false
12
+ buttonRole === 'radio' ? (isSelectable && selected ? 'true' : 'false') : false
19
13
  "
20
14
  :aria-expanded="
21
15
  isExpandable ? (isSelectable && selected ? 'true' : 'false') : false
@@ -30,10 +24,8 @@
30
24
  :class="[
31
25
  {
32
26
  rtl: rtl,
33
- [`card-grid-item__control-radio`]:
34
- isSelectable && buttonRole === 'radio',
35
- [`card-grid-item__selected-radio`]:
36
- selected && buttonRole === 'radio',
27
+ [`card-grid-item__control-radio`]: isSelectable && buttonRole === 'radio',
28
+ [`card-grid-item__selected-radio`]: selected && buttonRole === 'radio',
37
29
  },
38
30
  ]"
39
31
  >
@@ -101,11 +93,7 @@
101
93
  >
102
94
  </card-grid-item-icon>
103
95
  </b-card-title>
104
- <card-grid-item-caret
105
- v-if="caretPosition === 'top'"
106
- :caret="caret"
107
- :rtl="rtl"
108
- >
96
+ <card-grid-item-caret v-if="caretPosition === 'top'" :caret="caret" :rtl="rtl">
109
97
  </card-grid-item-caret>
110
98
 
111
99
  <card-grid-item-icon
@@ -131,13 +119,14 @@
131
119
  </div>
132
120
  <b-card-text
133
121
  v-if="$slots.cardDescription || description"
134
- text-tag="div"
122
+ tag="div"
135
123
  class="card-grid-item__body"
136
124
  :class="{
137
125
  rtl: rtl,
138
126
  }"
139
127
  >
140
128
  <div
129
+ v-if="$slots.cardDescription || description"
141
130
  class="card-grid-item__description"
142
131
  :class="{
143
132
  [descriptionClass]: !!descriptionClass,
@@ -170,11 +159,7 @@
170
159
  </div>
171
160
  </b-card-text>
172
161
  </b-card-body>
173
- <div
174
- v-if="$slots.cardFooter"
175
- class="card-grid-item__footer"
176
- :class="{ rtl: rtl }"
177
- >
162
+ <div v-if="$slots.cardFooter" class="card-grid-item__footer" :class="{ rtl: rtl }">
178
163
  <slot name="cardFooter"></slot>
179
164
  </div>
180
165
  <div
@@ -193,15 +178,15 @@
193
178
  </template>
194
179
 
195
180
  <script>
196
- import CardGridItemIcon from './card-grid-item-icon.vue'
197
- import CardGridItemCaret from './card-grid-item-caret.vue'
198
- import RichText from '../../Paragraphs/RichText/index.vue'
199
- import { parseISO } from 'date-fns'
200
- import { isAbsoluteUrl, isGovSite } from '../../../../lib/utility'
201
- import { BCard, BCardBody, BCardTitle, BCardText } from 'bootstrap-vue-next'
181
+ import CardGridItemIcon from "./card-grid-item-icon.vue";
182
+ import CardGridItemCaret from "./card-grid-item-caret.vue";
183
+ import RichText from "../../Paragraphs/RichText/index.vue";
184
+ import { parseISO } from "date-fns";
185
+ import { isAbsoluteUrl, isGovSite } from "../../../../lib/utility";
186
+ import { BCard, BCardBody, BCardTitle, BCardText } from "bootstrap-vue-next";
202
187
 
203
188
  export default {
204
- name: 'CardGridItem',
189
+ name: "CardGridItem",
205
190
  components: {
206
191
  CardGridItemIcon,
207
192
  CardGridItemCaret,
@@ -214,9 +199,8 @@ export default {
214
199
  props: {
215
200
  backgroundVariant: {
216
201
  type: String,
217
- default: 'white',
218
- validator: (value) =>
219
- ['white', 'transparent', 'light'].indexOf(value) >= 0,
202
+ default: "white",
203
+ validator: (value) => ["white", "transparent", "light"].indexOf(value) >= 0,
220
204
  },
221
205
  imageSrc: {
222
206
  type: String,
@@ -235,7 +219,7 @@ export default {
235
219
  },
236
220
  descriptionClass: {
237
221
  type: String,
238
- default: '',
222
+ default: "",
239
223
  },
240
224
  glyphSrc: {
241
225
  type: [Object, String],
@@ -247,21 +231,16 @@ export default {
247
231
  },
248
232
  iconSize: {
249
233
  type: String,
250
- default: 'small',
251
- validator: (value) =>
252
- ['xsmall', 'small', 'medium', 'large'].indexOf(value) >= 0,
234
+ default: "small",
235
+ validator: (value) => ["xsmall", "small", "medium", "large"].indexOf(value) >= 0,
253
236
  },
254
237
  iconPosition: {
255
238
  type: String,
256
- default: 'top',
239
+ default: "top",
257
240
  validator: (value) =>
258
- [
259
- 'top',
260
- 'top-left',
261
- 'top-right',
262
- 'after-title',
263
- 'before-description',
264
- ].indexOf(value) >= 0,
241
+ ["top", "top-left", "top-right", "after-title", "before-description"].indexOf(
242
+ value
243
+ ) >= 0,
265
244
  },
266
245
  iconIsBordered: {
267
246
  type: Boolean,
@@ -276,14 +255,13 @@ export default {
276
255
  },
277
256
  invertOnSelectBackground: {
278
257
  type: String,
279
- default: 'none',
280
- validator: (value) => ['none', 'yellow', 'black'].indexOf(value) >= 0,
258
+ default: "none",
259
+ validator: (value) => ["none", "yellow", "black"].indexOf(value) >= 0,
281
260
  },
282
261
  borderOnSelectBackground: {
283
262
  type: String,
284
- default: 'none',
285
- validator: (value) =>
286
- ['none', 'yellow', 'black', 'blue'].indexOf(value) >= 0,
263
+ default: "none",
264
+ validator: (value) => ["none", "yellow", "black", "blue"].indexOf(value) >= 0,
287
265
  },
288
266
  rtl: {
289
267
  type: Boolean,
@@ -291,49 +269,47 @@ export default {
291
269
  },
292
270
  headerSize: {
293
271
  type: String,
294
- default: 'custom',
272
+ default: "custom",
295
273
  validator: (value) =>
296
- ['medium', 'large', 'extra-large', 'extra-2x-large', 'custom'].indexOf(
297
- value,
298
- ) >= 0,
274
+ ["medium", "large", "extra-large", "extra-2x-large", "custom"].indexOf(value) >=
275
+ 0,
299
276
  },
300
277
  headerTextAlign: {
301
278
  type: String,
302
- default: 'left',
303
- validator: (value) => ['left', 'center', 'right'].indexOf(value) >= 0,
279
+ default: "left",
280
+ validator: (value) => ["left", "center", "right"].indexOf(value) >= 0,
304
281
  },
305
282
  headerTag: {
306
283
  type: String,
307
284
  required: false,
308
- default: 'h3',
285
+ default: "h3",
309
286
  },
310
287
  caret: {
311
288
  type: String,
312
289
  default: undefined,
313
290
  validator: (value) =>
314
- ['down', 'up', 'right', 'left', 'external'].indexOf(value) >= 0,
291
+ ["down", "up", "right", "left", "external"].indexOf(value) >= 0,
315
292
  },
316
293
  caretPosition: {
317
294
  type: String,
318
- default: 'top',
319
- validator: (value) =>
320
- ['top', 'bottom', 'after-title'].indexOf(value) >= 0,
295
+ default: "top",
296
+ validator: (value) => ["top", "bottom", "after-title"].indexOf(value) >= 0,
321
297
  },
322
298
  cardPadding: {
323
299
  type: String,
324
- default: 'none',
300
+ default: "none",
325
301
  validator: (value) =>
326
- ['none', 'xsmall', 'small', 'medium', 'large'].indexOf(value) >= 0,
302
+ ["none", "xsmall", "small", "medium", "large"].indexOf(value) >= 0,
327
303
  },
328
304
  borderType: {
329
305
  type: String,
330
- default: 'none',
306
+ default: "none",
331
307
  validator: (value) =>
332
- ['none', 'thin', 'shadow', 'thick', 'dark'].indexOf(value) >= 0,
308
+ ["none", "thin", "shadow", "thick", "dark"].indexOf(value) >= 0,
333
309
  },
334
310
  cardTextAlign: {
335
311
  type: String,
336
- default: 'left',
312
+ default: "left",
337
313
  },
338
314
  disableSelect: {
339
315
  type: Boolean,
@@ -341,11 +317,11 @@ export default {
341
317
  },
342
318
  pillText: {
343
319
  type: String,
344
- default: '',
320
+ default: "",
345
321
  },
346
322
  buttonRole: {
347
323
  type: String,
348
- default: 'link',
324
+ default: "link",
349
325
  },
350
326
  isSelected: {
351
327
  type: Boolean,
@@ -383,20 +359,18 @@ export default {
383
359
  return {
384
360
  [`card-grid-item__card--hasIcon`]:
385
361
  (this.imageSrc || this.glyphSrc) &&
386
- (this.iconPosition === 'top' || this.iconPosition === 'top-left'),
362
+ (this.iconPosition === "top" || this.iconPosition === "top-left"),
387
363
  [`card-grid-item__card--selectable`]: this.isSelectable,
388
- [`card-grid-item__card--selected-inverted--` +
389
- this.invertOnSelectBackground]:
364
+ [`card-grid-item__card--selected-inverted--` + this.invertOnSelectBackground]:
390
365
  this.selected &&
391
366
  this.invertOnSelectBackground &&
392
- this.invertOnSelectBackground !== 'none',
393
- [`card-grid-item__card--selected-border--` +
394
- this.borderOnSelectBackground]:
367
+ this.invertOnSelectBackground !== "none",
368
+ [`card-grid-item__card--selected-border--` + this.borderOnSelectBackground]:
395
369
  this.selected &&
396
370
  this.borderOnSelectBackground &&
397
- this.borderOnSelectBackground !== 'none',
371
+ this.borderOnSelectBackground !== "none",
398
372
  [`card-grid-item__card--selected-focus`]:
399
- this.selected && this.buttonRole === 'radio',
373
+ this.selected && this.buttonRole === "radio",
400
374
  [`card-grid-item__card--selected-link`]:
401
375
  this.selected && !this.invertOnSelectBackground,
402
376
  [`card-grid-item__card--padding-${this.cardPadding}`]: true,
@@ -404,89 +378,87 @@ export default {
404
378
  [`card-grid-item__card--bg-${this.backgroundVariant}`]: true,
405
379
  [`card-grid-item__card--select-${this.buttonRole}`]: true,
406
380
  [`card-grid-item__card--align-${this.cardTextAlign}`]: true,
407
- }
381
+ };
408
382
  },
409
383
  urlHostname() {
410
- return window.location.protocol + '//' + window.location.host
384
+ return window.location.protocol + "//" + window.location.host;
411
385
  },
412
386
  },
413
387
  mounted() {
414
- this.selected = this.isSelected
388
+ this.selected = this.isSelected;
415
389
  },
416
390
  created() {
417
- this.parentGrid = this.getParentGridItem()
391
+ this.parentGrid = this.getParentGridItem();
418
392
  if (this.parentGrid) {
419
- this.parentGrid.registerChild(this)
420
- this.setCardId()
421
- this.isSelectable = !this.disableSelect && this.parentGrid.isSelectable
393
+ this.parentGrid.registerChild(this);
394
+ this.setCardId();
395
+ this.isSelectable = !this.disableSelect && this.parentGrid.isSelectable;
422
396
  }
423
397
  },
424
398
  beforeDestroy() {
425
399
  if (this.parentGrid) {
426
- this.parentGrid.deregisterChild(this)
400
+ this.parentGrid.deregisterChild(this);
427
401
  }
428
402
  },
429
403
  methods: {
430
404
  cardClicked(ev) {
431
405
  if (this.isSelectable) {
432
- this.parentGrid.cardSelected(this, ev)
406
+ this.parentGrid.cardSelected(this, ev);
433
407
  }
434
408
 
435
409
  if (this.$gtm) {
436
- this.fireGTM()
410
+ this.fireGTM();
437
411
  }
438
412
  },
439
413
  cardTitleClicked(ev) {
440
414
  if (this.isCardTitleSelectable) {
441
- this.parentGrid.cardTitleSelected(this, ev)
415
+ this.parentGrid.cardTitleSelected(this, ev);
442
416
  }
443
417
  },
444
418
  getParentGridItem() {
445
- let counter = 0
446
- const maxParentDepth = 10
447
- let currentParent = this.$parent
448
- let gridParent
419
+ let counter = 0;
420
+ const maxParentDepth = 10;
421
+ let currentParent = this.$parent;
422
+ let gridParent;
449
423
  while (maxParentDepth > counter) {
450
- counter += 1
424
+ counter += 1;
451
425
  if (currentParent && Array.isArray(currentParent.cards)) {
452
- gridParent = currentParent
453
- break
426
+ gridParent = currentParent;
427
+ break;
454
428
  } else if (currentParent) {
455
- currentParent = currentParent.$parent
429
+ currentParent = currentParent.$parent;
456
430
  }
457
431
  }
458
- return gridParent
432
+ return gridParent;
459
433
  },
460
434
  setCardId() {
461
435
  this.cardId = this.parentGrid.cardIdPrefix
462
- ? this.parentGrid.cardIdPrefix +
463
- '-' +
464
- this.parentGrid.getChildIndex(this)
465
- : undefined
436
+ ? this.parentGrid.cardIdPrefix + "-" + this.parentGrid.getChildIndex(this)
437
+ : undefined;
466
438
  },
467
439
  setGridMetaData(gridColumnSize, isMobileView, isTabletView) {
468
- this.gridColumnSize = gridColumnSize
469
- this.isMobileView = isMobileView
470
- this.isTabletView = isTabletView
440
+ this.gridColumnSize = gridColumnSize;
441
+ this.isMobileView = isMobileView;
442
+ this.isTabletView = isTabletView;
471
443
  },
472
444
  handleFocus(ev) {
473
- this.parentGrid.handleFocus(ev)
445
+ this.parentGrid.handleFocus(ev);
474
446
  },
475
447
  fireGTM() {
476
- let theEl = this.$slots?.cardDescription
448
+ let theEl = this.$slots?.cardDescription;
477
449
  if (theEl && theEl.length > 0) {
478
450
  var content = {
479
451
  content: this.$diffInDays(
480
- parseISO(theEl[0]?.componentOptions?.propsData?.card?.created),
452
+ parseISO(theEl[0]?.componentOptions?.propsData?.card?.created)
481
453
  ),
482
- }
454
+ };
483
455
  }
484
456
  if (this.$gtm) {
485
457
  // format link
486
- const linkStr = this.link
487
- let linkURL = linkStr
458
+ const linkStr = this.link;
459
+ let linkURL = linkStr;
488
460
  if (linkStr !== false && !linkStr.includes(this.urlHostname)) {
489
- linkURL = this.urlHostname + linkStr
461
+ linkURL = this.urlHostname + linkStr;
490
462
  }
491
463
  // gather attrs
492
464
  let attrs = {
@@ -494,46 +466,45 @@ export default {
494
466
  data: linkURL,
495
467
  ...content,
496
468
  ...this.taxonomies,
497
- }
469
+ };
498
470
  // fire the default event
499
471
  this.$gtm.push({
500
- event: 'custom.interaction.tile.click',
472
+ event: "custom.interaction.tile.click",
501
473
  group: this?.parentGrid?.title,
502
474
  ...attrs,
503
- })
504
- if (this.pillText === 'News') {
475
+ });
476
+ if (this.pillText === "News") {
505
477
  this.$gtm.push({
506
- event: 'custom.interaction.news.click',
507
- group: 'News',
478
+ event: "custom.interaction.news.click",
479
+ group: "News",
508
480
  ...attrs,
509
- })
481
+ });
510
482
  }
511
- if (this.pillText === 'Event') {
483
+ if (this.pillText === "Event") {
512
484
  this.$gtm.push({
513
- event: 'custom.interaction.event.click',
514
- group: 'Event',
485
+ event: "custom.interaction.event.click",
486
+ group: "Event",
515
487
  ...attrs,
516
- })
488
+ });
517
489
  }
518
- if (this.pillText === 'Safety alert') {
490
+ if (this.pillText === "Safety alert") {
519
491
  this.$gtm.push({
520
- event: 'custom.interaction.safety.click',
521
- group: 'Safety alert',
492
+ event: "custom.interaction.safety.click",
493
+ group: "Safety alert",
522
494
  ...attrs,
523
- })
495
+ });
524
496
  }
525
497
  if (
526
498
  (this.link,
527
499
  this.isAbsoluteUrl(this.link) &&
528
- (this.$config
529
- ? this.$config.public.caretaker
530
- : process.env.CARETAKER) === 'false')
500
+ (this.$config ? this.$config.public.caretaker : process.env.CARETAKER) ===
501
+ "false")
531
502
  ) {
532
503
  this.$gtm.push({
533
- event: 'custom.interaction.outboundlink',
504
+ event: "custom.interaction.outboundlink",
534
505
  category: this.cardHeaderTitle,
535
506
  label: this.link,
536
- })
507
+ });
537
508
  }
538
509
  }
539
510
  // for non gov sites and when caretaker mode is on, analytics is fired from listenersCaretaker.js
@@ -541,23 +512,21 @@ export default {
541
512
  this.link &&
542
513
  this.isAbsoluteUrl(this.link) &&
543
514
  isGovSite(this.link) &&
544
- (this.$config
545
- ? this.$config.public.caretaker
546
- : process.env.CARETAKER) === 'true'
515
+ (this.$config ? this.$config.public.caretaker : process.env.CARETAKER) === "true"
547
516
  ) {
548
517
  this.$gtm.push({
549
- event: 'custom.interaction.outboundlink',
518
+ event: "custom.interaction.outboundlink",
550
519
  category: this.cardHeaderTitle,
551
520
  label: this.link,
552
- })
521
+ });
553
522
  }
554
523
  },
555
524
  },
556
- }
525
+ };
557
526
  </script>
558
527
 
559
528
  <style lang="scss" scoped>
560
- @import '../../../includes/scss/all';
529
+ @import "../../../includes/scss/all";
561
530
 
562
531
  .card-grid-item {
563
532
  height: 100%;
@@ -809,7 +778,7 @@ export default {
809
778
  align-items: center;
810
779
  }
811
780
  :deep(.card_item__control-radio span) {
812
- background-image: url('../../../assets/icons/tick.svg');
781
+ background-image: url("../../../assets/icons/tick.svg");
813
782
  background-position: center;
814
783
  background-repeat: no-repeat;
815
784
  filter: invert(1);
@@ -858,7 +827,7 @@ export default {
858
827
  line-height: 80px;
859
828
 
860
829
  @media screen and (max-width: 1199px) and (min-width: 768px) {
861
- @include fp('font-size', 60, 72);
830
+ @include fp("font-size", 60, 72);
862
831
  }
863
832
  }
864
833
 
@@ -14,10 +14,7 @@
14
14
  :background-variant="background"
15
15
  @selected="selectedCard"
16
16
  >
17
- <template
18
- v-if="enableBundleFilter && bundle.length > 1"
19
- v-slot:gridHeaderRight
20
- >
17
+ <template v-if="enableBundleFilter && bundle.length > 1" v-slot:gridHeaderRight>
21
18
  <switcher
22
19
  v-if="enableBundleFilter"
23
20
  :options="bundle"
@@ -48,8 +45,7 @@
48
45
  :class="{
49
46
  [`card_group__card--${card.colour}`]: card.pillText,
50
47
  [`card_group__card--none`]: !card.pillText,
51
- [`card_group__card--${cardResourseType}`]:
52
- 'card_group__card--resourse-group',
48
+ [`card_group__card--${cardResourseType}`]: 'card_group__card--resourse-group',
53
49
  }"
54
50
  :card-header-title="card.title"
55
51
  :caret="getCaret(card)"
@@ -75,10 +71,7 @@
75
71
  </template>
76
72
 
77
73
  <!-- footer - download button -->
78
- <template
79
- v-if="cardResourseType === 'resource-group'"
80
- v-slot:cardFooter
81
- >
74
+ <template v-if="cardResourseType === 'resource-group'" v-slot:cardFooter>
82
75
  <card-footer :card="card" :resource-type="cardResourseType" />
83
76
  </template>
84
77
  </card-grid-item>
@@ -120,24 +113,20 @@
120
113
  </template>
121
114
 
122
115
  <script>
123
- import Column from './../../Containers/Column/index.vue'
124
- import CardGrid from './../../Common/CardGrid/index.vue'
125
- import CardGridItem from './../../Common/CardGridItem/index.vue'
126
- import CardTop from './cardtop.vue'
127
- import CardBody from './cardbody.vue'
128
- import CardFooter from './cardfooter.vue'
129
- import CtaButton from './../CtaButton/index.vue'
130
- import DirectoryFilters from './../../Global/DirectoryFilters/index.vue'
131
- import Switcher from './switcher.vue'
132
- import {
133
- isAbsoluteUrl,
134
- navigateToPath,
135
- isGovSite,
136
- } from './../../../../lib/utility'
137
- import { BSpinner } from 'bootstrap-vue-next'
116
+ import Column from "./../../Containers/Column/index.vue";
117
+ import CardGrid from "./../../Common/CardGrid/index.vue";
118
+ import CardGridItem from "./../../Common/CardGridItem/index.vue";
119
+ import CardTop from "./cardtop.vue";
120
+ import CardBody from "./cardbody.vue";
121
+ import CardFooter from "./cardfooter.vue";
122
+ import CtaButton from "./../CtaButton/index.vue";
123
+ import DirectoryFilters from "./../../Global/DirectoryFilters/index.vue";
124
+ import Switcher from "./switcher.vue";
125
+ import { isAbsoluteUrl, navigateToPath, isGovSite } from "./../../../../lib/utility";
126
+ import { BSpinner } from "bootstrap-vue-next";
138
127
 
139
128
  export default {
140
- name: 'ResourceGroup',
129
+ name: "ResourceGroup",
141
130
  components: {
142
131
  Column,
143
132
  CardGrid,
@@ -153,15 +142,15 @@ export default {
153
142
  props: {
154
143
  background: {
155
144
  type: String,
156
- default: 'white',
145
+ default: "white",
157
146
  },
158
147
  title: {
159
148
  type: String,
160
- default: '',
149
+ default: "",
161
150
  },
162
151
  titleTag: {
163
152
  type: String,
164
- default: 'h2',
153
+ default: "h2",
165
154
  },
166
155
  rtl: {
167
156
  type: Boolean,
@@ -169,7 +158,7 @@ export default {
169
158
  },
170
159
  bundle: {
171
160
  type: Array,
172
- default: () => [''],
161
+ default: () => [""],
173
162
  },
174
163
  columns: {
175
164
  type: Number,
@@ -202,7 +191,7 @@ export default {
202
191
  },
203
192
  resourceType: {
204
193
  type: String,
205
- default: 'resource-group',
194
+ default: "resource-group",
206
195
  },
207
196
  showLoadMore: {
208
197
  type: Boolean,
@@ -210,7 +199,7 @@ export default {
210
199
  },
211
200
  emptyCardsText: {
212
201
  type: String,
213
- default: 'No results returned',
202
+ default: "No results returned",
214
203
  },
215
204
  loading: {
216
205
  type: Boolean,
@@ -221,10 +210,10 @@ export default {
221
210
  async mounted() {
222
211
  if (this.displayedCards.length === 0) {
223
212
  console.log(
224
- '🚀 ~ mounted ~ this.displayedCards.length:',
225
- this.displayedCards.length,
226
- )
227
- await this.loadFiltersAndContent()
213
+ "🚀 ~ mounted ~ this.displayedCards.length:",
214
+ this.displayedCards.length
215
+ );
216
+ await this.loadFiltersAndContent();
228
217
  }
229
218
  },
230
219
  // TODO useAsyncData <script setup>
@@ -248,96 +237,91 @@ export default {
248
237
  selected: {},
249
238
  availableBundles: [],
250
239
  },
251
- }
240
+ };
252
241
  },
253
242
  computed: {
254
243
  allCardsRTL() {
255
244
  if (this.displayedCards.length === 0) {
256
- return this.rtl
245
+ return this.rtl;
257
246
  }
258
- return this.displayedCards.every((card) => this.rtl || card.rtl)
247
+ return this.displayedCards.every((card) => this.rtl || card.rtl);
259
248
  },
260
249
  },
261
250
  fetchOnServer: true,
262
- fetchKey: 'wcl-card-group',
251
+ fetchKey: "wcl-card-group",
263
252
  methods: {
264
253
  async loadFiltersAndContent() {
265
254
  await Promise.all([
266
255
  this.fetchFilters ? this.loadFilters() : Promise.resolve(),
267
256
  this.loadMoreCards(true),
268
- ])
269
- console.log(
270
- '🚀 ~ loadFiltersAndContent ~ this.fetchFilters:',
271
- this.fetchFilters,
272
- )
257
+ ]);
258
+ console.log("🚀 ~ loadFiltersAndContent ~ this.fetchFilters:", this.fetchFilters);
273
259
  },
274
260
  init() {
275
261
  this.allCards = {
276
262
  total: 0,
277
263
  cards: [],
278
- }
279
- this.displayLimit = 0
280
- this.hasMorePages = false
281
- this.displayedCards = []
282
- this.bundleCache = {}
264
+ };
265
+ this.displayLimit = 0;
266
+ this.hasMorePages = false;
267
+ this.displayedCards = [];
268
+ this.bundleCache = {};
283
269
  },
284
270
  async fetchCards(currentDisplayedCards, allCards, addMoreBy, bundles) {
285
271
  const shouldMakeNewFetchCall =
286
- currentDisplayedCards.length + addMoreBy > allCards.cards.length
272
+ currentDisplayedCards.length + addMoreBy > allCards.cards.length;
287
273
 
288
274
  if (shouldMakeNewFetchCall) {
289
275
  const cardBundles = await Promise.all(
290
- bundles.map((bundle, index) =>
291
- this.getBundle(bundle, addMoreBy, index),
292
- ),
293
- )
276
+ bundles.map((bundle, index) => this.getBundle(bundle, addMoreBy, index))
277
+ );
294
278
 
295
- allCards = this.getShuffledCards(cardBundles)
279
+ allCards = this.getShuffledCards(cardBundles);
296
280
 
297
281
  if (
298
- this.type === 'paragraph--cards_group_latest' ||
299
- this.type === 'paragraph--browse_content' ||
300
- this.type === 'paragraph--resource_group' ||
301
- this.type === 'paragraph--resource_list'
282
+ this.type === "paragraph--cards_group_latest" ||
283
+ this.type === "paragraph--browse_content" ||
284
+ this.type === "paragraph--resource_group" ||
285
+ this.type === "paragraph--resource_list"
302
286
  ) {
303
- allCards.cards = this.sortByDate(allCards.cards)
287
+ allCards.cards = this.sortByDate(allCards.cards);
304
288
  }
305
289
  }
306
- return allCards
290
+ return allCards;
307
291
  },
308
292
  async loadMoreCards(init) {
309
293
  const attrs = {
310
294
  group: this.$pageStore?.content?.title,
311
295
  //group: this.$store?.state?.page?.content?.title,
312
- }
296
+ };
313
297
  if (this.$gtm && !init) {
314
- this.$gtm.push({ event: 'custom.interaction.showmore.click', ...attrs })
298
+ this.$gtm.push({ event: "custom.interaction.showmore.click", ...attrs });
315
299
  }
316
300
  if (init) {
317
- this.init()
301
+ this.init();
318
302
  }
319
- this.loader = true
320
- const addMoreBy = this.initialDisplyLimit
321
- this.displayLimit += addMoreBy
303
+ this.loader = true;
304
+ const addMoreBy = this.initialDisplyLimit;
305
+ this.displayLimit += addMoreBy;
322
306
  const bundles =
323
307
  this.filters.availableBundles.length > 0
324
308
  ? this.filters.availableBundles
325
- : this.bundle
309
+ : this.bundle;
326
310
  this.allCards = await this.fetchCards(
327
311
  this.displayedCards,
328
312
  this.allCards,
329
313
  addMoreBy,
330
- bundles,
331
- )
314
+ bundles
315
+ );
332
316
 
333
- this.hasMorePages = this.allCards.total > this.allCards.cards.length
334
- this.displayedCards = this.allCards.cards.slice(0, this.displayLimit)
317
+ this.hasMorePages = this.allCards.total > this.allCards.cards.length;
318
+ this.displayedCards = this.allCards.cards.slice(0, this.displayLimit);
335
319
 
336
- this.loader = false
320
+ this.loader = false;
337
321
  },
338
322
  getBundle(bundle, addMoreBy, index) {
339
- let start
340
- const rows = addMoreBy
323
+ let start;
324
+ const rows = addMoreBy;
341
325
  const cache = (this.bundleCache[bundle] = this.bundleCache[bundle] || {
342
326
  response: {
343
327
  results: [],
@@ -346,177 +330,166 @@ export default {
346
330
  qs: {
347
331
  start,
348
332
  },
349
- })
333
+ });
350
334
 
351
335
  if (cache.qs.start === undefined) {
352
- start = 0
336
+ start = 0;
353
337
  } else if (cache.response.numFound > cache.response.results.length) {
354
- start = cache.response.results.length
338
+ start = cache.response.results.length;
355
339
  } else {
356
- return Promise.resolve(cache.response)
340
+ return Promise.resolve(cache.response);
357
341
  }
358
342
 
359
343
  const qs = {
360
344
  bundle,
361
345
  rows,
362
346
  start,
363
- }
364
- return this.fetchContent(qs, this.filters.selected, index).then(
365
- (response) => {
366
- cache.qs.start = qs.start
367
- cache.response.numFound = response.numFound
368
- cache.response.results.push(...response.results)
369
- return cache.response
370
- },
371
- )
347
+ };
348
+ return this.fetchContent(qs, this.filters.selected, index).then((response) => {
349
+ cache.qs.start = qs.start;
350
+ cache.response.numFound = response.numFound;
351
+ cache.response.results.push(...response.results);
352
+ return cache.response;
353
+ });
372
354
  },
373
355
  getShuffledCards(cardBundles) {
374
- const shuffled = []
356
+ const shuffled = [];
375
357
  const bundleWithMostCards = cardBundles.reduce(
376
358
  (a, b) => (a.results.length > b.results.length ? a : b),
377
- { results: [] },
378
- ).results.length
359
+ { results: [] }
360
+ ).results.length;
379
361
 
380
362
  for (let i = 0; i < bundleWithMostCards; i++) {
381
363
  cardBundles.forEach((bundle) => {
382
364
  if (bundle.results[i]) {
383
- shuffled.push(bundle.results[i])
365
+ shuffled.push(bundle.results[i]);
384
366
  }
385
- })
367
+ });
386
368
  }
387
369
 
388
370
  const total = cardBundles.reduce((acc, bundle) => {
389
- return acc + bundle.numFound
390
- }, 0)
371
+ return acc + bundle.numFound;
372
+ }, 0);
391
373
 
392
- return { cards: shuffled, total }
374
+ return { cards: shuffled, total };
393
375
  },
394
376
  loadFilters() {
395
377
  return this.fetchFilters().then((taxonomies) => {
396
- console.log('🚀 ~ returnthis.fetchFilters ~ taxonomies:', taxonomies)
397
- this.filters.taxonomies = taxonomies
398
- return Promise.resolve(taxonomies)
399
- })
378
+ console.log("🚀 ~ returnthis.fetchFilters ~ taxonomies:", taxonomies);
379
+ this.filters.taxonomies = taxonomies;
380
+ return Promise.resolve(taxonomies);
381
+ });
400
382
  },
401
383
  onFilter(filters) {
402
- this.bundleCache = {}
384
+ this.bundleCache = {};
403
385
  Object.keys(filters).forEach((filter) => {
404
- this.filters.selected[filter] = filters[filter].map((obj) => obj.tid)
405
- })
406
- this.loadMoreCards(true)
386
+ this.filters.selected[filter] = filters[filter].map((obj) => obj.tid);
387
+ });
388
+ this.loadMoreCards(true);
407
389
  },
408
390
  onSwitcher(switchToBundle) {
409
- this.filters.selected = {}
410
- this.filters.availableBundles.length = 0
391
+ this.filters.selected = {};
392
+ this.filters.availableBundles.length = 0;
411
393
  if (switchToBundle) {
412
- this.filters.availableBundles.push(switchToBundle)
394
+ this.filters.availableBundles.push(switchToBundle);
413
395
  }
414
- this.loadMoreCards(true)
396
+ this.loadMoreCards(true);
415
397
  },
416
398
  async reset() {
417
- this.bundleCache = {}
418
- this.filters.selected = {}
419
- this.filters.availableBundles.length = 0
420
- await this.loadMoreCards(true)
399
+ this.bundleCache = {};
400
+ this.filters.selected = {};
401
+ this.filters.availableBundles.length = 0;
402
+ await this.loadMoreCards(true);
421
403
  },
422
404
  sortByDate(cards) {
423
405
  const sorted = cards.sort((a, b) => {
424
- return new Date(b.dateSort) - new Date(a.dateSort)
425
- })
426
- return sorted
406
+ return new Date(b.dateSort) - new Date(a.dateSort);
407
+ });
408
+ return sorted;
427
409
  },
428
410
  handleLoadMore() {
429
- this.loadMoreCards(false)
411
+ this.loadMoreCards(false);
430
412
  },
431
413
 
432
414
  getCaret(card) {
433
415
  if (card.link && isAbsoluteUrl(card.link)) {
434
- return 'external'
416
+ return "external";
435
417
  } else {
436
- return undefined
418
+ return undefined;
437
419
  }
438
420
  },
439
421
  selectedCard(card) {
440
422
  // Some custom logic for gov caretaker logic
441
423
  if (
442
- (this.$config
443
- ? this.$config.public.caretaker
444
- : process.env.CARETAKER) === 'true'
424
+ (this.$config ? this.$config.public.caretaker : process.env.CARETAKER) === "true"
445
425
  ) {
446
426
  if (!isGovSite(card?.selectedCard?.link)) {
447
427
  // this.$store.commit('page/SET_CARETAKER_REF', 'list-group')
448
428
  // this.$root.$emit('caretaker-open', card?.selectedCard?.link)
449
429
  if (this.$pageStore) {
450
- this.$pageStore.caretaker.referrer = 'list-group'
430
+ this.$pageStore.caretaker.referrer = "list-group";
451
431
  }
452
432
  if (this.$bus) {
453
- this.$bus.$emit('caretaker-open', card?.selectedCard?.link)
433
+ this.$bus.$emit("caretaker-open", card?.selectedCard?.link);
454
434
  }
455
435
  } else {
456
436
  navigateToPath.call(
457
437
  this,
458
438
  card?.selectedCard?.link,
459
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
460
- )
439
+ card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
440
+ );
461
441
  }
462
442
  } else {
463
443
  navigateToPath.call(
464
444
  this,
465
445
  card?.selectedCard?.link,
466
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
467
- )
446
+ card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
447
+ );
468
448
  }
469
449
  },
470
450
  focussed(ev) {
471
- const path = ev.path || (ev.composedPath && ev.composedPath())
472
- const theTabbedCards = path.find(
473
- (el) => el['_prevClass'] === 'tabbed-cards',
474
- )
451
+ const path = ev.path || (ev.composedPath && ev.composedPath());
452
+ const theTabbedCards = path.find((el) => el["_prevClass"] === "tabbed-cards");
475
453
  if (ev.shiftKey && theTabbedCards) {
476
- ev.preventDefault()
477
- let selectedTabbedCards =
478
- theTabbedCards.getElementsByClassName('isSelected')
479
- let selectedCard = selectedTabbedCards[0].getElementsByTagName('button')
480
- let thePrevLGItem =
481
- ev.target?.parentElement?.parentElement?.previousSibling?.getElementsByTagName(
482
- 'button',
483
- )
454
+ ev.preventDefault();
455
+ let selectedTabbedCards = theTabbedCards.getElementsByClassName("isSelected");
456
+ let selectedCard = selectedTabbedCards[0].getElementsByTagName("button");
457
+ let thePrevLGItem = ev.target?.parentElement?.parentElement?.previousSibling?.getElementsByTagName(
458
+ "button"
459
+ );
484
460
  if (thePrevLGItem) {
485
- thePrevLGItem[0].focus()
461
+ thePrevLGItem[0].focus();
486
462
  } else {
487
- selectedCard[0].focus()
463
+ selectedCard[0].focus();
488
464
  }
489
465
  } else if (!ev.shiftKey && theTabbedCards) {
490
- ev.preventDefault()
491
- let selectedTabbedCards =
492
- theTabbedCards.getElementsByClassName('isSelected')
493
- let nextTabbedCard =
494
- selectedTabbedCards[0]?.parentElement?.nextSibling?.getElementsByTagName(
495
- 'button',
496
- )
497
- let theNextLGItem =
498
- ev.target?.parentElement?.parentElement?.nextSibling?.getElementsByTagName(
499
- 'button',
500
- )
466
+ ev.preventDefault();
467
+ let selectedTabbedCards = theTabbedCards.getElementsByClassName("isSelected");
468
+ let nextTabbedCard = selectedTabbedCards[0]?.parentElement?.nextSibling?.getElementsByTagName(
469
+ "button"
470
+ );
471
+ let theNextLGItem = ev.target?.parentElement?.parentElement?.nextSibling?.getElementsByTagName(
472
+ "button"
473
+ );
501
474
  if (theNextLGItem) {
502
- theNextLGItem[0].focus()
475
+ theNextLGItem[0].focus();
503
476
  } else if (nextTabbedCard) {
504
- nextTabbedCard[0].focus()
477
+ nextTabbedCard[0].focus();
505
478
  } else {
506
- let nextFocus = this.focusNextElement()
479
+ let nextFocus = this.focusNextElement();
507
480
  if (this.$bus) {
508
- this.$bus.$emit('last-focus-out')
481
+ this.$bus.$emit("last-focus-out");
509
482
  }
510
- nextFocus.focus()
483
+ nextFocus.focus();
511
484
  }
512
485
  } else {
513
- return true
486
+ return true;
514
487
  }
515
488
  },
516
489
  focusNextElement(reverse, activeElem) {
517
490
  /*check if an element is defined or use activeElement*/
518
491
  activeElem =
519
- activeElem instanceof HTMLElement ? activeElem : document.activeElement
492
+ activeElem instanceof HTMLElement ? activeElem : document.activeElement;
520
493
 
521
494
  let queryString = [
522
495
  'a:not([disabled]):not([tabindex="-1"])',
@@ -525,23 +498,19 @@ export default {
525
498
  'select:not([disabled]):not([tabindex="-1"])',
526
499
  '[tabindex]:not([disabled]):not([tabindex="-1"])',
527
500
  /* add custom queries here */
528
- ].join(','),
501
+ ].join(","),
529
502
  queryResult = Array.prototype.filter.call(
530
503
  document.querySelectorAll(queryString),
531
504
  (elem) => {
532
505
  /*check for visibility while always include the current activeElement*/
533
- return (
534
- elem.offsetWidth > 0 ||
535
- elem.offsetHeight > 0 ||
536
- elem === activeElem
537
- )
538
- },
506
+ return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem === activeElem;
507
+ }
539
508
  ),
540
509
  indexedList = queryResult
541
510
  .slice()
542
511
  .filter((elem) => {
543
512
  /* filter out all indexes not greater than 0 */
544
- return elem.tabIndex == 0 || elem.tabIndex == -1 ? false : true
513
+ return elem.tabIndex == 0 || elem.tabIndex == -1 ? false : true;
545
514
  })
546
515
  .sort((a, b) => {
547
516
  /* sort the array by index from smallest to largest */
@@ -549,34 +518,33 @@ export default {
549
518
  ? a.tabIndex < b.tabIndex
550
519
  ? -1
551
520
  : b.tabIndex < a.tabIndex
552
- ? 1
553
- : 0
521
+ ? 1
522
+ : 0
554
523
  : a.tabIndex != 0
555
- ? -1
556
- : b.tabIndex != 0
557
- ? 1
558
- : 0
524
+ ? -1
525
+ : b.tabIndex != 0
526
+ ? 1
527
+ : 0;
559
528
  }),
560
529
  focusable = [].concat(
561
530
  indexedList,
562
531
  queryResult.filter((elem) => {
563
532
  /* filter out all indexes above 0 */
564
- return elem.tabIndex == 0 || elem.tabIndex == -1 ? true : false
565
- }),
566
- )
533
+ return elem.tabIndex == 0 || elem.tabIndex == -1 ? true : false;
534
+ })
535
+ );
567
536
 
568
537
  /* if reverse is true return the previous focusable element
569
538
  if reverse is false return the next focusable element */
570
539
  return reverse
571
- ? focusable[focusable.indexOf(activeElem) - 1] ||
572
- focusable[focusable.length - 1]
573
- : focusable[focusable.indexOf(activeElem) + 1] || focusable[0]
540
+ ? focusable[focusable.indexOf(activeElem) - 1] || focusable[focusable.length - 1]
541
+ : focusable[focusable.indexOf(activeElem) + 1] || focusable[0];
574
542
  },
575
543
  },
576
- }
544
+ };
577
545
  </script>
578
546
  <style lang="scss" scoped>
579
- @import '../../../includes/scss/all';
547
+ @import "../../../includes/scss/all";
580
548
  $cardTextPadding: 16px;
581
549
  $borderRadius: 8px;
582
550
 
@@ -597,8 +565,14 @@ $borderRadius: 8px;
597
565
  .card_group {
598
566
  &--resource-list {
599
567
  :deep(.card-body) {
600
- padding-left: $cardTextPadding !important;
601
- padding-right: $cardTextPadding !important;
568
+ padding-left: 13px !important;
569
+ padding-right: 13px !important;
570
+ }
571
+ @media screen and (min-width: 768px) {
572
+ :deep(.card-body) {
573
+ padding-left: $cardTextPadding !important;
574
+ padding-right: $cardTextPadding !important;
575
+ }
602
576
  }
603
577
  }
604
578
  }
@@ -185,6 +185,7 @@ $white: #ffffff !default;
185
185
  &--resource-list {
186
186
  flex: 0 0 100%;
187
187
  max-width: 100%;
188
+ padding: 0;
188
189
  @media screen and (min-width: 768px) {
189
190
  flex: 0 0 29%;
190
191
  max-width: 29%;
@@ -209,6 +210,7 @@ $white: #ffffff !default;
209
210
  background-color: $lightgray;
210
211
  border-radius: 0 0px 5px 5px;
211
212
  margin-left: -16px;
213
+ margin-right: -16px;
212
214
  justify-content: space-between;
213
215
  }
214
216