@worksafevictoria/wcl7.5 1.3.0 → 1.4.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.
@@ -510,14 +510,13 @@ export default {
510
510
  window.addEventListener('resize', this.screenWidth)
511
511
  this.screenWidth()
512
512
  }
513
- if (this.$nuxt) {
514
- //console.log('🚀 ~ this.$nuxt.$on ~ this.$nuxt:', this.$nuxt)
515
- // this.$nuxt.$on('site-search', (query) => {
516
- // this.searchQuery = query
517
- // if (query) {
518
- // this.showSearch()
519
- // }
520
- // })
513
+ if (this.$bus) {
514
+ this.$bus.$on('site-search', (query) => {
515
+ this.searchQuery = query
516
+ if (query) {
517
+ this.showSearch()
518
+ }
519
+ })
521
520
  }
522
521
  },
523
522
  methods: {
@@ -863,8 +862,8 @@ export default {
863
862
  // this.$store.dispatch('tracking/event', payload)
864
863
  },
865
864
  skipToContent() {
866
- if (this.$nuxt) {
867
- this.$nuxt.$emit('scrollToTop')
865
+ if (this.$bus) {
866
+ this.$bus.$emit('scrollToTop')
868
867
  }
869
868
  },
870
869
  },
@@ -619,14 +619,14 @@ export default {
619
619
  window.addEventListener('resize', this.screenWidth)
620
620
  this.screenWidth()
621
621
  }
622
- if (this.$nuxt) {
623
- //console.log('🚀 ~ this.$nuxt.$on ~ this.$nuxt:', this.$nuxt)
624
- // this.$nuxt.$on('site-search', (query) => {
625
- // this.searchQuery = query
626
- // if (query) {
627
- // this.showSearch()
628
- // }
629
- // })
622
+ if (this.$bus) {
623
+ console.log('🚀 ~ this.$bus.$on ~ this.$bus:', this.$bus)
624
+ this.$bus.$on('site-search', (query) => {
625
+ this.searchQuery = query
626
+ if (query) {
627
+ this.showSearch()
628
+ }
629
+ })
630
630
  }
631
631
  },
632
632
  methods: {
@@ -1034,8 +1034,8 @@ export default {
1034
1034
  // this.$store.dispatch('tracking/event', payload)
1035
1035
  },
1036
1036
  skipToContent() {
1037
- if (this.$nuxt) {
1038
- this.$nuxt.$emit('scrollToTop')
1037
+ if (this.$bus) {
1038
+ this.$bus.$emit('scrollToTop')
1039
1039
  }
1040
1040
  },
1041
1041
  goToLocation(path) {
@@ -281,22 +281,21 @@ export default {
281
281
  // }
282
282
  },
283
283
  mounted() {
284
- if (this.$nuxt?.$on) {
285
- // console.log('🚀 ~ this.$nuxt.$on ~ this.$nuxt:', this.$nuxt)
286
- // this.$nuxt.$on('scrollToTop', () => {
287
- // setTimeout(() => {
288
- // const title = this.$refs.title
289
- // if (title) {
290
- // title.$el.setAttribute('tabindex', 0)
291
- // title.$el.focus()
292
- // }
293
- // }, 500)
294
- // })
284
+ if (this.$bus) {
285
+ this.$bus.$on('scrollToTop', () => {
286
+ setTimeout(() => {
287
+ const title = this.$refs.title
288
+ if (title) {
289
+ title.$el.setAttribute('tabindex', 0)
290
+ title.$el.focus()
291
+ }
292
+ }, 500)
293
+ })
295
294
  }
296
295
  },
297
296
  beforeDestroy() {
298
- if (this.$nuxt?.$off) {
299
- this.$nuxt.$off('scrollToTop')
297
+ if (this.$bus) {
298
+ this.$bus.$off('scrollToTop')
300
299
  }
301
300
  },
302
301
  methods: {
@@ -6,7 +6,7 @@
6
6
  class="accordion-item"
7
7
  :class="{
8
8
  rtl: rtl,
9
- '--with-pre-heading': preHeading && showPreHeading
9
+ '--with-pre-heading': preHeading && showPreHeading,
10
10
  }"
11
11
  >
12
12
  <a
@@ -33,7 +33,7 @@
33
33
  :icon-alt="'collapse'"
34
34
  :glyph="CaretUp"
35
35
  :class="{
36
- '--with-pre-heading': preHeading && showPreHeading
36
+ '--with-pre-heading': preHeading && showPreHeading,
37
37
  }"
38
38
  />
39
39
  <icon
@@ -44,7 +44,7 @@
44
44
  :icon-alt="'expand'"
45
45
  :glyph="CaretDown"
46
46
  :class="{
47
- '--with-pre-heading': preHeading && showPreHeading
47
+ '--with-pre-heading': preHeading && showPreHeading,
48
48
  }"
49
49
  />
50
50
  </a>
@@ -76,42 +76,42 @@ export default {
76
76
  RichText,
77
77
  Icon,
78
78
  BCard,
79
- BCardBody
79
+ BCardBody,
80
80
  },
81
81
  props: {
82
82
  title: {
83
83
  type: String,
84
- default: 'Item'
84
+ default: 'Item',
85
85
  },
86
86
  preHeading: {
87
87
  type: String,
88
- default: 'PRE-HEADING'
88
+ default: 'PRE-HEADING',
89
89
  },
90
90
  content: {
91
91
  type: String,
92
- default: null
92
+ default: null,
93
93
  },
94
94
  rtl: {
95
95
  type: Boolean,
96
- default: false
96
+ default: false,
97
97
  },
98
98
  open: {
99
99
  type: Boolean,
100
- default: false
100
+ default: false,
101
101
  },
102
102
  showPreHeading: {
103
103
  type: Boolean,
104
- default: false
104
+ default: false,
105
105
  },
106
106
  meta: {
107
107
  type: Array,
108
- default: () => []
109
- }
108
+ default: () => [],
109
+ },
110
110
  },
111
111
  data: () => ({
112
112
  showAccordion: false,
113
113
  CaretDown,
114
- CaretUp
114
+ CaretUp,
115
115
  }),
116
116
  mounted() {
117
117
  this.$nextTick(() => {
@@ -122,12 +122,16 @@ export default {
122
122
  toggleAccordion() {
123
123
  this.showAccordion = !this.showAccordion
124
124
  if (this.showAccordion) {
125
- this.$root.$emit('accordionItemOpen', this.meta)
125
+ if (this.$bus) {
126
+ this.$bus.$emit('accordionItemOpen', this.meta) // this.$root.$emit('accordionItemOpen', this.meta)
127
+ }
126
128
  } else {
127
- this.$root.$emit('accordionItemClose', this.meta)
129
+ if (this.$bus) {
130
+ this.$bus.$emit('accordionItemClose', this.meta) // this.$root.$emit('accordionItemClose', this.meta)
131
+ }
128
132
  }
129
- }
130
- }
133
+ },
134
+ },
131
135
  }
132
136
  </script>
133
137
 
@@ -166,12 +166,8 @@ export default {
166
166
  return allCards
167
167
  },
168
168
  async loadMoreCards(init) {
169
- // Preference pinia
170
169
  const attrs = {
171
- group: this.$pinia?.state?.value?.page?.content?.title
172
- ? this.$pinia?.state?.value?.page?.content?.title
173
- : this.$store?.state?.page?.content?.title,
174
- // group: this.$store?.state?.page?.content?.title ? this.$store?.state?.page?.content?.title : this.$pinia?.state?.page?.content?.title
170
+ group: this.$pageStore?.content?.title,
175
171
  }
176
172
  if (this.$gtm && !init) {
177
173
  this.$gtm.push({ event: 'custom.interaction.showmore.click', ...attrs })
@@ -48,7 +48,7 @@
48
48
  :taxonomies="{
49
49
  industry: card.industry,
50
50
  topic: card.topic,
51
- language: card.language
51
+ language: card.language,
52
52
  }"
53
53
  />
54
54
  </template>
@@ -69,7 +69,7 @@ import RichText from './../../Paragraphs/RichText/index.vue'
69
69
  import {
70
70
  isAbsoluteUrl,
71
71
  navigateToPath,
72
- isGovSite
72
+ isGovSite,
73
73
  } from './../../../../lib/utility'
74
74
 
75
75
  export default {
@@ -80,48 +80,48 @@ export default {
80
80
  type: Array,
81
81
  default() {
82
82
  return []
83
- }
83
+ },
84
84
  },
85
85
  role: {
86
86
  type: String,
87
- default: 'button'
87
+ default: 'button',
88
88
  },
89
89
  darkBackground: {
90
90
  type: Boolean,
91
- default: false
91
+ default: false,
92
92
  },
93
93
  title: {
94
94
  type: String,
95
- default: ''
95
+ default: '',
96
96
  },
97
97
  titleTag: {
98
98
  type: String,
99
- default: 'h3'
99
+ default: 'h3',
100
100
  },
101
101
  subHeading: {
102
102
  type: String,
103
- default: null
103
+ default: null,
104
104
  },
105
105
  footerHeading: {
106
106
  type: String,
107
- default: null
107
+ default: null,
108
108
  },
109
109
  rtl: {
110
110
  type: Boolean,
111
- default: false
111
+ default: false,
112
112
  },
113
113
  showListItemNavigationArrow: {
114
114
  type: Boolean,
115
- default: false
115
+ default: false,
116
116
  },
117
117
  showLargeSpacing: {
118
118
  type: Boolean,
119
- default: false
119
+ default: false,
120
120
  },
121
121
  showListLink: {
122
122
  type: Boolean,
123
- default: false
124
- }
123
+ default: false,
124
+ },
125
125
  },
126
126
  methods: {
127
127
  getCaret(card) {
@@ -138,37 +138,43 @@ export default {
138
138
  // Some custom logic for gov caretaker logic
139
139
  if (process.env.CARETAKER && process.env.CARETAKER === 'true') {
140
140
  if (!isGovSite(card?.selectedCard?.link)) {
141
- this.$store.commit('page/SET_CARETAKER_REF', 'list-group')
142
- this.$root.$emit('caretaker-open', card?.selectedCard?.link)
141
+ // this.$store.commit('page/SET_CARETAKER_REF', 'list-group')
142
+ // this.$root.$emit('caretaker-open', card?.selectedCard?.link)
143
+ if (this.$pageStore) {
144
+ this.$pageStore.caretaker.referrer = 'list-group'
145
+ }
146
+ if (this.$bus) {
147
+ this.$bus.$emit('caretaker-open', card?.selectedCard?.link)
148
+ }
143
149
  } else {
144
150
  navigateToPath.call(
145
151
  this,
146
152
  card?.selectedCard?.link,
147
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
153
+ card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
148
154
  )
149
155
  }
150
156
  } else {
151
157
  navigateToPath.call(
152
158
  this,
153
159
  card?.selectedCard?.link,
154
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
160
+ card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
155
161
  )
156
162
  }
157
163
  },
158
164
  focussed(ev) {
159
165
  const path = ev.path || (ev.composedPath && ev.composedPath())
160
166
  const theTabbedCards = path.find(
161
- (el) => el['_prevClass'] === 'tabbed-cards'
167
+ (el) => el['_prevClass'] === 'tabbed-cards',
162
168
  )
163
169
  if (ev.shiftKey && theTabbedCards) {
164
170
  ev.preventDefault()
165
- let selectedTabbedCards = theTabbedCards.getElementsByClassName(
166
- 'isSelected'
167
- )
171
+ let selectedTabbedCards =
172
+ theTabbedCards.getElementsByClassName('isSelected')
168
173
  let selectedCard = selectedTabbedCards[0].getElementsByTagName('button')
169
- let thePrevLGItem = ev.target?.parentElement?.parentElement?.previousSibling?.getElementsByTagName(
170
- 'button'
171
- )
174
+ let thePrevLGItem =
175
+ ev.target?.parentElement?.parentElement?.previousSibling?.getElementsByTagName(
176
+ 'button',
177
+ )
172
178
  if (thePrevLGItem) {
173
179
  thePrevLGItem[0].focus()
174
180
  } else {
@@ -176,22 +182,25 @@ export default {
176
182
  }
177
183
  } else if (!ev.shiftKey && theTabbedCards) {
178
184
  ev.preventDefault()
179
- let selectedTabbedCards = theTabbedCards.getElementsByClassName(
180
- 'isSelected'
181
- )
182
- let nextTabbedCard = selectedTabbedCards[0]?.parentElement?.nextSibling?.getElementsByTagName(
183
- 'button'
184
- )
185
- let theNextLGItem = ev.target?.parentElement?.parentElement?.nextSibling?.getElementsByTagName(
186
- 'button'
187
- )
185
+ let selectedTabbedCards =
186
+ theTabbedCards.getElementsByClassName('isSelected')
187
+ let nextTabbedCard =
188
+ selectedTabbedCards[0]?.parentElement?.nextSibling?.getElementsByTagName(
189
+ 'button',
190
+ )
191
+ let theNextLGItem =
192
+ ev.target?.parentElement?.parentElement?.nextSibling?.getElementsByTagName(
193
+ 'button',
194
+ )
188
195
  if (theNextLGItem) {
189
196
  theNextLGItem[0].focus()
190
197
  } else if (nextTabbedCard) {
191
198
  nextTabbedCard[0].focus()
192
199
  } else {
193
200
  let nextFocus = this.focusNextElement()
194
- this.$root.$emit('last-focus-out')
201
+ if (this.$bus) {
202
+ this.$bus.$emit('last-focus-out')
203
+ }
195
204
  nextFocus.focus()
196
205
  }
197
206
  } else {
@@ -208,7 +217,7 @@ export default {
208
217
  'button:not([disabled]):not([tabindex="-1"])',
209
218
  'input:not([disabled]):not([tabindex="-1"])',
210
219
  'select:not([disabled]):not([tabindex="-1"])',
211
- '[tabindex]:not([disabled]):not([tabindex="-1"])'
220
+ '[tabindex]:not([disabled]):not([tabindex="-1"])',
212
221
  /* add custom queries here */
213
222
  ].join(','),
214
223
  queryResult = Array.prototype.filter.call(
@@ -220,7 +229,7 @@ export default {
220
229
  elem.offsetHeight > 0 ||
221
230
  elem === activeElem
222
231
  )
223
- }
232
+ },
224
233
  ),
225
234
  indexedList = queryResult
226
235
  .slice()
@@ -234,20 +243,20 @@ export default {
234
243
  ? a.tabIndex < b.tabIndex
235
244
  ? -1
236
245
  : b.tabIndex < a.tabIndex
237
- ? 1
238
- : 0
246
+ ? 1
247
+ : 0
239
248
  : a.tabIndex != 0
240
- ? -1
241
- : b.tabIndex != 0
242
- ? 1
243
- : 0
249
+ ? -1
250
+ : b.tabIndex != 0
251
+ ? 1
252
+ : 0
244
253
  }),
245
254
  focusable = [].concat(
246
255
  indexedList,
247
256
  queryResult.filter((elem) => {
248
257
  /* filter out all indexes above 0 */
249
258
  return elem.tabIndex == 0 || elem.tabIndex == -1 ? true : false
250
- })
259
+ }),
251
260
  )
252
261
 
253
262
  /* if reverse is true return the previous focusable element
@@ -256,8 +265,8 @@ export default {
256
265
  ? focusable[focusable.indexOf(activeElem) - 1] ||
257
266
  focusable[focusable.length - 1]
258
267
  : focusable[focusable.indexOf(activeElem) + 1] || focusable[0]
259
- }
260
- }
268
+ },
269
+ },
261
270
  }
262
271
  </script>
263
272
  <style lang="scss" scoped>
@@ -80,6 +80,7 @@ export default {
80
80
  border-radius: 10px 10px 10px 10px;
81
81
  margin-bottom: 16px;
82
82
  border-top: none;
83
+ opacity: unset;
83
84
  }
84
85
  :deep(.card-title) {
85
86
  line-height: 1.2;
@@ -40,10 +40,11 @@
40
40
  :is-expandable="true"
41
41
  />
42
42
  </template>
43
- <template
44
- v-slot:cardGridFooter
45
- >
46
- <column v-if="selectedRow === rIndex && selectedCard" class="listgroup-column">
43
+ <template v-slot:cardGridFooter>
44
+ <column
45
+ v-if="selectedRow === rIndex && selectedCard"
46
+ class="listgroup-column"
47
+ >
47
48
  <div ref="listgroup" class="tabbed-cards__listGroup">
48
49
  <list-group
49
50
  :list="selectedCard.links"
@@ -77,24 +78,24 @@ export default {
77
78
  props: {
78
79
  heading: {
79
80
  type: String,
80
- default: ''
81
+ default: '',
81
82
  },
82
83
  description: {
83
84
  type: String,
84
- default: ''
85
+ default: '',
85
86
  },
86
87
  tabbedCards: {
87
88
  type: Array,
88
- default: () => []
89
+ default: () => [],
89
90
  },
90
91
  rtl: {
91
92
  type: Boolean,
92
- default: false
93
+ default: false,
93
94
  },
94
95
  workwell: {
95
96
  type: Boolean,
96
- default: false
97
- }
97
+ default: false,
98
+ },
98
99
  },
99
100
  data() {
100
101
  return {
@@ -102,7 +103,7 @@ export default {
102
103
  selectedRow: undefined,
103
104
  screenWidth: 0,
104
105
  loaded: false,
105
- tabList: null
106
+ tabList: null,
106
107
  }
107
108
  },
108
109
  computed: {
@@ -122,15 +123,18 @@ export default {
122
123
  } else {
123
124
  return 3
124
125
  }
125
- }
126
+ },
126
127
  },
127
128
  mounted() {
128
129
  window.addEventListener('resize', this.updateScreenWidth)
129
130
  this.screenWidth = document.documentElement.clientWidth
130
- /* this.$root.$on('last-focus-out', () => {
131
- this.selectedCard = null
132
- this.selectedRow = null
133
- }) */
131
+ if (this.$bus) {
132
+ this.$bus.$on('last-focus-out', () => {
133
+ this.selectedCard = null
134
+ this.selectedRow = null
135
+ })
136
+ }
137
+
134
138
  this.loaded = true
135
139
  },
136
140
  beforeDestroy() {
@@ -171,7 +175,7 @@ export default {
171
175
  easing: 'ease-in',
172
176
  offset: -100,
173
177
  force: true,
174
- cancelable: true
178
+ cancelable: true,
175
179
  }
176
180
  setTimeout(() => {
177
181
  const listGroup = this.$refs.listgroup[0]
@@ -193,14 +197,17 @@ export default {
193
197
  focussed(ev) {
194
198
  ev.preventDefault()
195
199
  let activeElem = ev.target
196
- if(!this.tabList){
200
+ if (!this.tabList) {
197
201
  this.tabList = this.getFocusElements()
198
202
  } else {
199
- let newList = this.getFocusElements().filter(item => this.tabList.indexOf(item) == -1)
200
- this.tabList.splice(this.tabList.indexOf(activeElem) + 1,0,...newList)
203
+ let newList = this.getFocusElements().filter(
204
+ (item) => this.tabList.indexOf(item) == -1,
205
+ )
206
+ this.tabList.splice(this.tabList.indexOf(activeElem) + 1, 0, ...newList)
201
207
  }
202
- let newTab = ev.shiftKey ? this.tabList[this.tabList.indexOf(activeElem) - 1] ||
203
- this.tabList[this.tabList.length - 1]
208
+ let newTab = ev.shiftKey
209
+ ? this.tabList[this.tabList.indexOf(activeElem) - 1] ||
210
+ this.tabList[this.tabList.length - 1]
204
211
  : this.tabList[this.tabList.indexOf(activeElem) + 1] || this.tabList[0]
205
212
  newTab.focus()
206
213
  },
@@ -211,17 +218,14 @@ export default {
211
218
  'button:not([disabled]):not([tabindex="-1"])',
212
219
  'input:not([disabled]):not([tabindex="-1"])',
213
220
  'select:not([disabled]):not([tabindex="-1"])',
214
- '[tabindex]:not([disabled]):not([tabindex="-1"])'
221
+ '[tabindex]:not([disabled]):not([tabindex="-1"])',
215
222
  /* add custom queries here */
216
223
  ].join(','),
217
224
  queryResult = Array.prototype.filter.call(
218
225
  document.querySelectorAll(queryString),
219
226
  (elem) => {
220
- return (
221
- elem.offsetWidth > 0 ||
222
- elem.offsetHeight > 0
223
- )
224
- }
227
+ return elem.offsetWidth > 0 || elem.offsetHeight > 0
228
+ },
225
229
  ),
226
230
  indexedList = queryResult
227
231
  .slice()
@@ -235,24 +239,24 @@ export default {
235
239
  ? a.tabIndex < b.tabIndex
236
240
  ? -1
237
241
  : b.tabIndex < a.tabIndex
238
- ? 1
239
- : 0
242
+ ? 1
243
+ : 0
240
244
  : a.tabIndex != 0
241
- ? -1
242
- : b.tabIndex != 0
243
- ? 1
244
- : 0
245
+ ? -1
246
+ : b.tabIndex != 0
247
+ ? 1
248
+ : 0
245
249
  }),
246
250
  focusable = [].concat(
247
251
  indexedList,
248
252
  queryResult.filter((elem) => {
249
253
  /* filter out all indexes above 0 */
250
254
  return elem.tabIndex == 0 || elem.tabIndex == -1 ? true : false
251
- })
255
+ }),
252
256
  )
253
- return focusable
254
- }
255
- }
257
+ return focusable
258
+ },
259
+ },
256
260
  }
257
261
  </script>
258
262
  <style lang="scss" scoped>