@worksafevictoria/wcl7.5 1.11.0 → 1.12.0

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.11.0",
3
+ "version": "1.12.0",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,7 +10,7 @@
10
10
  tabCaretContainerBottom: isTabbedCard,
11
11
  }"
12
12
  >
13
- <div class="tabCaretText" aria-hidden="true">
13
+ <div class="tabCaretText" tabindex="0">
14
14
  {{ supportText }}
15
15
  </div>
16
16
  <icon :glyph="caretSrc" icon-alt="Show more" width="18" float: right :height="caret
@@ -1,16 +1,22 @@
1
1
  <template>
2
2
  <div class="card-grid-item">
3
3
  <slot v-if="$slots.beforeCard" name="beforeCard"></slot>
4
- <b-card
4
+ <BCard
5
5
  :id="cardId"
6
6
  no-body
7
- :tag="buttonRole === 'radio' ? 'div' : isSelectable ? 'button' : 'article'"
7
+ :tag="buttonRole === 'radio' ? 'div' : isSelectable ? 'button' : 'div'"
8
8
  class="card-grid-item__card"
9
9
  :class="cardClass"
10
10
  :role="buttonRole"
11
- :tabindex="['button', 'radio'].includes(buttonRole) ? 0 : undefined"
11
+ :tabindex="
12
+ isSelectable ? 0 : ['button', 'radio'].includes(buttonRole) ? 0 : -1
13
+ "
12
14
  :aria-checked="
13
- buttonRole === 'radio' ? (isSelectable && selected ? 'true' : 'false') : undefined
15
+ buttonRole === 'radio'
16
+ ? isSelectable && selected
17
+ ? 'true'
18
+ : 'false'
19
+ : undefined
14
20
  "
15
21
  :aria-expanded="
16
22
  buttonRole === 'button' && isExpandable
@@ -30,8 +36,10 @@
30
36
  :class="[
31
37
  {
32
38
  rtl: rtl,
33
- [`card-grid-item__control-radio`]: isSelectable && buttonRole === 'radio',
34
- [`card-grid-item__selected-radio`]: selected && buttonRole === 'radio',
39
+ [`card-grid-item__control-radio`]:
40
+ isSelectable && buttonRole === 'radio',
41
+ [`card-grid-item__selected-radio`]:
42
+ selected && buttonRole === 'radio',
35
43
  },
36
44
  ]"
37
45
  >
@@ -54,7 +62,7 @@
54
62
  }"
55
63
  >
56
64
  </card-grid-item-icon>
57
- <b-card-body>
65
+ <BCardBody>
58
66
  <div
59
67
  class="card-grid-item__caretContainer"
60
68
  :class="[
@@ -65,7 +73,7 @@
65
73
  },
66
74
  ]"
67
75
  >
68
- <b-card-title
76
+ <BCardTitle
69
77
  v-if="cardHeaderTitle !== null && cardHeaderTitle !== undefined"
70
78
  :tag="headerTag"
71
79
  class="card-grid-item__header"
@@ -98,8 +106,12 @@
98
106
  class="d-inline"
99
107
  >
100
108
  </card-grid-item-icon>
101
- </b-card-title>
102
- <card-grid-item-caret v-if="caretPosition === 'top'" :caret="caret" :rtl="rtl">
109
+ </BCardTitle>
110
+ <card-grid-item-caret
111
+ v-if="caretPosition === 'top'"
112
+ :caret="caret"
113
+ :rtl="rtl"
114
+ >
103
115
  </card-grid-item-caret>
104
116
 
105
117
  <card-grid-item-icon
@@ -123,7 +135,7 @@
123
135
  </card-grid-item-icon>
124
136
  <span v-if="pillText" class="visually-hidden">{{ pillText }}</span>
125
137
  </div>
126
- <b-card-text
138
+ <BCardText
127
139
  v-if="$slots.cardDescription || description"
128
140
  tag="div"
129
141
  class="card-grid-item__body"
@@ -162,9 +174,13 @@
162
174
  :strip-html="stripDescriptionHtml"
163
175
  />
164
176
  </div>
165
- </b-card-text>
166
- </b-card-body>
167
- <div v-if="$slots.cardFooter" class="card-grid-item__footer" :class="{ rtl: rtl }">
177
+ </BCardText>
178
+ </BCardBody>
179
+ <div
180
+ v-if="$slots.cardFooter"
181
+ class="card-grid-item__footer"
182
+ :class="{ rtl: rtl }"
183
+ >
168
184
  <slot name="cardFooter"></slot>
169
185
  </div>
170
186
  <div
@@ -177,21 +193,21 @@
177
193
  <card-grid-item-caret :caret="caret" :rtl="rtl" />
178
194
  <span class="card-bottom-border"></span>
179
195
  </div>
180
- </b-card>
196
+ </BCard>
181
197
  <slot v-if="$slots.afterCard" name="afterCard"></slot>
182
198
  </div>
183
199
  </template>
184
200
 
185
201
  <script>
186
- import CardGridItemIcon from "./card-grid-item-icon.vue";
187
- import CardGridItemCaret from "./card-grid-item-caret.vue";
188
- import RichText from "../../Paragraphs/RichText/index.vue";
189
- import { parseISO } from "date-fns";
190
- import { isAbsoluteUrl, isGovSite } from "../../../../lib/utility";
191
- import { BCard, BCardBody, BCardTitle, BCardText } from "bootstrap-vue-next";
202
+ import CardGridItemIcon from './card-grid-item-icon.vue'
203
+ import CardGridItemCaret from './card-grid-item-caret.vue'
204
+ import RichText from '../../Paragraphs/RichText/index.vue'
205
+ import { parseISO } from 'date-fns'
206
+ import { isAbsoluteUrl, isGovSite } from '../../../../lib/utility'
207
+ import { BCard, BCardBody, BCardTitle, BCardText } from 'bootstrap-vue-next'
192
208
 
193
209
  export default {
194
- name: "CardGridItem",
210
+ name: 'CardGridItem',
195
211
  components: {
196
212
  CardGridItemIcon,
197
213
  CardGridItemCaret,
@@ -204,8 +220,9 @@ export default {
204
220
  props: {
205
221
  backgroundVariant: {
206
222
  type: String,
207
- default: "white",
208
- validator: (value) => ["white", "transparent", "light"].indexOf(value) >= 0,
223
+ default: 'white',
224
+ validator: (value) =>
225
+ ['white', 'transparent', 'light'].indexOf(value) >= 0,
209
226
  },
210
227
  imageSrc: {
211
228
  type: String,
@@ -224,7 +241,7 @@ export default {
224
241
  },
225
242
  descriptionClass: {
226
243
  type: String,
227
- default: "",
244
+ default: '',
228
245
  },
229
246
  glyphSrc: {
230
247
  type: [Object, String],
@@ -236,16 +253,21 @@ export default {
236
253
  },
237
254
  iconSize: {
238
255
  type: String,
239
- default: "small",
240
- validator: (value) => ["xsmall", "small", "medium", "large"].indexOf(value) >= 0,
256
+ default: 'small',
257
+ validator: (value) =>
258
+ ['xsmall', 'small', 'medium', 'large'].indexOf(value) >= 0,
241
259
  },
242
260
  iconPosition: {
243
261
  type: String,
244
- default: "top",
262
+ default: 'top',
245
263
  validator: (value) =>
246
- ["top", "top-left", "top-right", "after-title", "before-description"].indexOf(
247
- value
248
- ) >= 0,
264
+ [
265
+ 'top',
266
+ 'top-left',
267
+ 'top-right',
268
+ 'after-title',
269
+ 'before-description',
270
+ ].indexOf(value) >= 0,
249
271
  },
250
272
  iconIsBordered: {
251
273
  type: Boolean,
@@ -260,13 +282,14 @@ export default {
260
282
  },
261
283
  invertOnSelectBackground: {
262
284
  type: String,
263
- default: "none",
264
- validator: (value) => ["none", "yellow", "black"].indexOf(value) >= 0,
285
+ default: 'none',
286
+ validator: (value) => ['none', 'yellow', 'black'].indexOf(value) >= 0,
265
287
  },
266
288
  borderOnSelectBackground: {
267
289
  type: String,
268
- default: "none",
269
- validator: (value) => ["none", "yellow", "black", "blue"].indexOf(value) >= 0,
290
+ default: 'none',
291
+ validator: (value) =>
292
+ ['none', 'yellow', 'black', 'blue'].indexOf(value) >= 0,
270
293
  },
271
294
  rtl: {
272
295
  type: Boolean,
@@ -274,47 +297,49 @@ export default {
274
297
  },
275
298
  headerSize: {
276
299
  type: String,
277
- default: "custom",
300
+ default: 'custom',
278
301
  validator: (value) =>
279
- ["medium", "large", "extra-large", "extra-2x-large", "custom"].indexOf(value) >=
280
- 0,
302
+ ['medium', 'large', 'extra-large', 'extra-2x-large', 'custom'].indexOf(
303
+ value,
304
+ ) >= 0,
281
305
  },
282
306
  headerTextAlign: {
283
307
  type: String,
284
- default: "left",
285
- validator: (value) => ["left", "center", "right"].indexOf(value) >= 0,
308
+ default: 'left',
309
+ validator: (value) => ['left', 'center', 'right'].indexOf(value) >= 0,
286
310
  },
287
311
  headerTag: {
288
312
  type: String,
289
313
  required: false,
290
- default: "h3",
314
+ default: 'h3',
291
315
  },
292
316
  caret: {
293
317
  type: String,
294
318
  default: undefined,
295
319
  validator: (value) =>
296
- ["down", "up", "right", "left", "external"].indexOf(value) >= 0,
320
+ ['down', 'up', 'right', 'left', 'external'].indexOf(value) >= 0,
297
321
  },
298
322
  caretPosition: {
299
323
  type: String,
300
- default: "top",
301
- validator: (value) => ["top", "bottom", "after-title"].indexOf(value) >= 0,
324
+ default: 'top',
325
+ validator: (value) =>
326
+ ['top', 'bottom', 'after-title'].indexOf(value) >= 0,
302
327
  },
303
328
  cardPadding: {
304
329
  type: String,
305
- default: "none",
330
+ default: 'none',
306
331
  validator: (value) =>
307
- ["none", "xsmall", "small", "medium", "large"].indexOf(value) >= 0,
332
+ ['none', 'xsmall', 'small', 'medium', 'large'].indexOf(value) >= 0,
308
333
  },
309
334
  borderType: {
310
335
  type: String,
311
- default: "none",
336
+ default: 'none',
312
337
  validator: (value) =>
313
- ["none", "thin", "shadow", "thick", "dark"].indexOf(value) >= 0,
338
+ ['none', 'thin', 'shadow', 'thick', 'dark'].indexOf(value) >= 0,
314
339
  },
315
340
  cardTextAlign: {
316
341
  type: String,
317
- default: "left",
342
+ default: 'left',
318
343
  },
319
344
  disableSelect: {
320
345
  type: Boolean,
@@ -322,11 +347,11 @@ export default {
322
347
  },
323
348
  pillText: {
324
349
  type: String,
325
- default: "",
350
+ default: '',
326
351
  },
327
352
  buttonRole: {
328
353
  type: String,
329
- default: "link",
354
+ default: 'link',
330
355
  },
331
356
  isSelected: {
332
357
  type: Boolean,
@@ -364,18 +389,20 @@ export default {
364
389
  return {
365
390
  [`card-grid-item__card--hasIcon`]:
366
391
  (this.imageSrc || this.glyphSrc) &&
367
- (this.iconPosition === "top" || this.iconPosition === "top-left"),
392
+ (this.iconPosition === 'top' || this.iconPosition === 'top-left'),
368
393
  [`card-grid-item__card--selectable`]: this.isSelectable,
369
- [`card-grid-item__card--selected-inverted--` + this.invertOnSelectBackground]:
394
+ [`card-grid-item__card--selected-inverted--` +
395
+ this.invertOnSelectBackground]:
370
396
  this.selected &&
371
397
  this.invertOnSelectBackground &&
372
- this.invertOnSelectBackground !== "none",
373
- [`card-grid-item__card--selected-border--` + this.borderOnSelectBackground]:
398
+ this.invertOnSelectBackground !== 'none',
399
+ [`card-grid-item__card--selected-border--` +
400
+ this.borderOnSelectBackground]:
374
401
  this.selected &&
375
402
  this.borderOnSelectBackground &&
376
- this.borderOnSelectBackground !== "none",
403
+ this.borderOnSelectBackground !== 'none',
377
404
  [`card-grid-item__card--selected-focus`]:
378
- this.selected && this.buttonRole === "radio",
405
+ this.selected && this.buttonRole === 'radio',
379
406
  [`card-grid-item__card--selected-link`]:
380
407
  this.selected && !this.invertOnSelectBackground,
381
408
  [`card-grid-item__card--padding-${this.cardPadding}`]: true,
@@ -383,87 +410,89 @@ export default {
383
410
  [`card-grid-item__card--bg-${this.backgroundVariant}`]: true,
384
411
  [`card-grid-item__card--select-${this.buttonRole}`]: true,
385
412
  [`card-grid-item__card--align-${this.cardTextAlign}`]: true,
386
- };
413
+ }
387
414
  },
388
415
  urlHostname() {
389
- return window.location.protocol + "//" + window.location.host;
416
+ return window.location.protocol + '//' + window.location.host
390
417
  },
391
418
  },
392
419
  mounted() {
393
- this.selected = this.isSelected;
420
+ this.selected = this.isSelected
394
421
  },
395
422
  created() {
396
- this.parentGrid = this.getParentGridItem();
423
+ this.parentGrid = this.getParentGridItem()
397
424
  if (this.parentGrid) {
398
- this.parentGrid.registerChild(this);
399
- this.setCardId();
400
- this.isSelectable = !this.disableSelect && this.parentGrid.isSelectable;
425
+ this.parentGrid.registerChild(this)
426
+ this.setCardId()
427
+ this.isSelectable = !this.disableSelect && this.parentGrid.isSelectable
401
428
  }
402
429
  },
403
430
  beforeDestroy() {
404
431
  if (this.parentGrid) {
405
- this.parentGrid.deregisterChild(this);
432
+ this.parentGrid.deregisterChild(this)
406
433
  }
407
434
  },
408
435
  methods: {
409
436
  cardClicked(ev) {
410
437
  if (this.isSelectable) {
411
- this.parentGrid.cardSelected(this, ev);
438
+ this.parentGrid.cardSelected(this, ev)
412
439
  }
413
440
 
414
441
  if (this.$gtm) {
415
- this.fireGTM();
442
+ this.fireGTM()
416
443
  }
417
444
  },
418
445
  cardTitleClicked(ev) {
419
446
  if (this.isCardTitleSelectable) {
420
- this.parentGrid.cardTitleSelected(this, ev);
447
+ this.parentGrid.cardTitleSelected(this, ev)
421
448
  }
422
449
  },
423
450
  getParentGridItem() {
424
- let counter = 0;
425
- const maxParentDepth = 10;
426
- let currentParent = this.$parent;
427
- let gridParent;
451
+ let counter = 0
452
+ const maxParentDepth = 10
453
+ let currentParent = this.$parent
454
+ let gridParent
428
455
  while (maxParentDepth > counter) {
429
- counter += 1;
456
+ counter += 1
430
457
  if (currentParent && Array.isArray(currentParent.cards)) {
431
- gridParent = currentParent;
432
- break;
458
+ gridParent = currentParent
459
+ break
433
460
  } else if (currentParent) {
434
- currentParent = currentParent.$parent;
461
+ currentParent = currentParent.$parent
435
462
  }
436
463
  }
437
- return gridParent;
464
+ return gridParent
438
465
  },
439
466
  setCardId() {
440
467
  this.cardId = this.parentGrid.cardIdPrefix
441
- ? this.parentGrid.cardIdPrefix + "-" + this.parentGrid.getChildIndex(this)
442
- : undefined;
468
+ ? this.parentGrid.cardIdPrefix +
469
+ '-' +
470
+ this.parentGrid.getChildIndex(this)
471
+ : undefined
443
472
  },
444
473
  setGridMetaData(gridColumnSize, isMobileView, isTabletView) {
445
- this.gridColumnSize = gridColumnSize;
446
- this.isMobileView = isMobileView;
447
- this.isTabletView = isTabletView;
474
+ this.gridColumnSize = gridColumnSize
475
+ this.isMobileView = isMobileView
476
+ this.isTabletView = isTabletView
448
477
  },
449
478
  handleFocus(ev) {
450
- this.parentGrid.handleFocus(ev);
479
+ this.parentGrid.handleFocus(ev)
451
480
  },
452
481
  fireGTM() {
453
- let theEl = this.$slots?.cardDescription;
482
+ let theEl = this.$slots?.cardDescription
454
483
  if (theEl && theEl.length > 0) {
455
484
  var content = {
456
485
  content: this.$diffInDays(
457
- parseISO(theEl[0]?.componentOptions?.propsData?.card?.created)
486
+ parseISO(theEl[0]?.componentOptions?.propsData?.card?.created),
458
487
  ),
459
- };
488
+ }
460
489
  }
461
490
  if (this.$gtm) {
462
491
  // format link
463
- const linkStr = this.link;
464
- let linkURL = linkStr;
492
+ const linkStr = this.link
493
+ let linkURL = linkStr
465
494
  if (linkStr !== false && !linkStr.includes(this.urlHostname)) {
466
- linkURL = this.urlHostname + linkStr;
495
+ linkURL = this.urlHostname + linkStr
467
496
  }
468
497
  // gather attrs
469
498
  let attrs = {
@@ -471,45 +500,46 @@ export default {
471
500
  data: linkURL,
472
501
  ...content,
473
502
  ...this.taxonomies,
474
- };
503
+ }
475
504
  // fire the default event
476
505
  this.$gtm.push({
477
- event: "custom.interaction.tile.click",
506
+ event: 'custom.interaction.tile.click',
478
507
  group: this?.parentGrid?.title,
479
508
  ...attrs,
480
- });
481
- if (this.pillText === "News") {
509
+ })
510
+ if (this.pillText === 'News') {
482
511
  this.$gtm.push({
483
- event: "custom.interaction.news.click",
484
- group: "News",
512
+ event: 'custom.interaction.news.click',
513
+ group: 'News',
485
514
  ...attrs,
486
- });
515
+ })
487
516
  }
488
- if (this.pillText === "Event") {
517
+ if (this.pillText === 'Event') {
489
518
  this.$gtm.push({
490
- event: "custom.interaction.event.click",
491
- group: "Event",
519
+ event: 'custom.interaction.event.click',
520
+ group: 'Event',
492
521
  ...attrs,
493
- });
522
+ })
494
523
  }
495
- if (this.pillText === "Safety alert") {
524
+ if (this.pillText === 'Safety alert') {
496
525
  this.$gtm.push({
497
- event: "custom.interaction.safety.click",
498
- group: "Safety alert",
526
+ event: 'custom.interaction.safety.click',
527
+ group: 'Safety alert',
499
528
  ...attrs,
500
- });
529
+ })
501
530
  }
502
531
  if (
503
532
  (this.link,
504
533
  this.isAbsoluteUrl(this.link) &&
505
- (this.$config ? this.$config.public.caretaker : process.env.CARETAKER) ===
506
- "false")
534
+ (this.$config
535
+ ? this.$config.public.caretaker
536
+ : process.env.CARETAKER) === 'false')
507
537
  ) {
508
538
  this.$gtm.push({
509
- event: "custom.interaction.outboundlink",
539
+ event: 'custom.interaction.outboundlink',
510
540
  category: this.cardHeaderTitle,
511
541
  label: this.link,
512
- });
542
+ })
513
543
  }
514
544
  }
515
545
  // for non gov sites and when caretaker mode is on, analytics is fired from listenersCaretaker.js
@@ -517,21 +547,23 @@ export default {
517
547
  this.link &&
518
548
  this.isAbsoluteUrl(this.link) &&
519
549
  isGovSite(this.link) &&
520
- (this.$config ? this.$config.public.caretaker : process.env.CARETAKER) === "true"
550
+ (this.$config
551
+ ? this.$config.public.caretaker
552
+ : process.env.CARETAKER) === 'true'
521
553
  ) {
522
554
  this.$gtm.push({
523
- event: "custom.interaction.outboundlink",
555
+ event: 'custom.interaction.outboundlink',
524
556
  category: this.cardHeaderTitle,
525
557
  label: this.link,
526
- });
558
+ })
527
559
  }
528
560
  },
529
561
  },
530
- };
562
+ }
531
563
  </script>
532
564
 
533
565
  <style lang="scss" scoped>
534
- @import "../../../includes/scss/all";
566
+ @import '../../../includes/scss/all';
535
567
 
536
568
  .card-grid-item {
537
569
  height: 100%;
@@ -783,7 +815,7 @@ export default {
783
815
  align-items: center;
784
816
  }
785
817
  :deep(.card_item__control-radio span) {
786
- background-image: url("../../../assets/icons/tick.svg");
818
+ background-image: url('../../../assets/icons/tick.svg');
787
819
  background-position: center;
788
820
  background-repeat: no-repeat;
789
821
  filter: invert(1);
@@ -832,7 +864,7 @@ export default {
832
864
  line-height: 80px;
833
865
 
834
866
  @media screen and (max-width: 1199px) and (min-width: 768px) {
835
- @include fp("font-size", 60, 72);
867
+ @include fp('font-size', 60, 72);
836
868
  }
837
869
  }
838
870