@worksafevictoria/wcl7.5 1.1.14 → 1.1.16

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.14",
3
+ "version": "1.1.16",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -159,7 +159,8 @@ export default {
159
159
  }
160
160
  }
161
161
  .modal-body {
162
- padding: 32px;
162
+ padding: 0px 32px 0px;
163
+ margin-top: 16px;
163
164
  fieldset {
164
165
  display: flex;
165
166
  flex-direction: row;
@@ -98,9 +98,7 @@
98
98
  >
99
99
  </column>
100
100
  </row>
101
- <template v-if="showSocial && type !== 'hero'">
102
- <social-share :rtl="rtl" />
103
- </template>
101
+ <social-share v-show="showSocial && type !== 'hero'" :rtl="rtl" />
104
102
  </container>
105
103
  </div>
106
104
  <!-- Type Default -->
@@ -152,7 +150,7 @@
152
150
  </column>
153
151
  <!-- No Col needed for type Hero -->
154
152
  </row>
155
- <social-share v-if="showSocial && type === 'hero'" :rtl="rtl" />
153
+ <social-share v-show="showSocial && type === 'hero'" :rtl="rtl" />
156
154
  </container>
157
155
  </template>
158
156
  <script>
@@ -20,7 +20,7 @@
20
20
  :content-class="`tabbed-cards-content`"
21
21
  class="tabbed-cards__grid"
22
22
  @selected="(card, cardIndex) => setCurrentRow(rIndex, card)"
23
- @focusin="focussed($event)"
23
+ @keydown.tab="focussed($event)"
24
24
  >
25
25
  <template v-slot:cardItem="{ card }">
26
26
  <card-grid-item
@@ -40,11 +40,10 @@
40
40
  :is-expandable="true"
41
41
  />
42
42
  </template>
43
- <template
44
- v-if="selectedRow === rIndex && selectedCard"
43
+ <template
45
44
  v-slot:cardGridFooter
46
45
  >
47
- <column class="listgroup-column">
46
+ <column v-if="selectedRow === rIndex && selectedCard" class="listgroup-column">
48
47
  <div ref="listgroup" class="tabbed-cards__listGroup">
49
48
  <list-group
50
49
  :list="selectedCard.links"
@@ -69,6 +68,8 @@ import CardGridItem from './../../Common/CardGridItem/index.vue'
69
68
  import Column from './../../Containers/Column/index.vue'
70
69
  import Icon from './../../SubComponents/Icon/index.vue'
71
70
  import ListGroup from './../../Paragraphs/ListGroup/index.vue'
71
+ import VueScrollTo from 'vue-scrollto'
72
+ import { nextTick } from 'vue'
72
73
 
73
74
  export default {
74
75
  name: 'TabbedCards',
@@ -100,7 +101,8 @@ export default {
100
101
  selectedCard: undefined,
101
102
  selectedRow: undefined,
102
103
  screenWidth: 0,
103
- loaded: false
104
+ loaded: false,
105
+ tabList: null
104
106
  }
105
107
  },
106
108
  computed: {
@@ -147,7 +149,7 @@ export default {
147
149
  let end = start + this.cols
148
150
  return rows.slice(start, end)
149
151
  },
150
- setCurrentRow(rowIndex, card) {
152
+ async setCurrentRow(rowIndex, card) {
151
153
  const sameCardSelected =
152
154
  card.selectedCard === this.selectedCard || !card.selectedCard
153
155
  this.selectedCard = null
@@ -158,11 +160,12 @@ export default {
158
160
  cardGrid.clearCards()
159
161
  }
160
162
  })
163
+ await nextTick()
164
+ this.tabList = this.getFocusElements()
161
165
  setTimeout(() => {
162
166
  if (window && !sameCardSelected) {
163
167
  this.selectedCard = card.selectedCard
164
168
  this.selectedRow = rowIndex
165
- let VueScrollTo = require('vue-scrollto')
166
169
  let options = {
167
170
  container: 'body',
168
171
  easing: 'ease-in',
@@ -188,44 +191,21 @@ export default {
188
191
  return cols
189
192
  },
190
193
  focussed(ev) {
191
- if (ev.shiftKey) {
192
- let prevTabbedCard = ev.target?.parentElement?.parentElement?.previousSibling?.getElementsByTagName('button')[0]
193
- if (
194
- prevTabbedCard &&
195
- prevTabbedCard.getAttribute('aria-expanded') === 'true'
196
- ) {
197
- ev.preventDefault()
198
- const lG = this.$refs.listgroup
199
- let itemsOfLG = lG[0].getElementsByTagName('button')
200
- itemsOfLG[itemsOfLG.length - 1].focus()
201
- }
202
- return
203
- }
204
- const lG = this.$refs.listgroup
205
- const isListGroupOpen = Array.isArray(lG) && lG.length > 0
206
- const cardIsSelected = ev.target.parentElement.classList.contains('isSelected')
207
- if (cardIsSelected && isListGroupOpen) {
208
- ev.preventDefault()
209
- lG[0].getElementsByTagName('button')[0].focus()
210
- } else if (!cardIsSelected && isListGroupOpen) {
211
- ev.preventDefault()
212
- let nextTabbedCard = ev.target?.parentElement?.parentElement?.nextSibling?.getElementsByTagName('button')[0]
213
- if (nextTabbedCard) {
214
- nextTabbedCard.focus()
215
- } else {
216
- let itemsOfLG = lG[0].getElementsByTagName('button')
217
- let lastItemOfLG = itemsOfLG[itemsOfLG.length - 1]
218
- let nextFocusElement = this.focusNextElement(false, lastItemOfLG)
219
- nextFocusElement.focus()
220
- }
194
+ ev.preventDefault()
195
+ let activeElem = ev.target
196
+ if(!this.tabList){
197
+ this.tabList = this.getFocusElements()
198
+ } else {
199
+ let newList = this.getFocusElements().filter(item => this.tabList.indexOf(item) == -1)
200
+ this.tabList.splice(this.tabList.indexOf(activeElem) + 1,0,...newList)
221
201
  }
222
- // if its the next card from the selected
202
+ let newTab = ev.shiftKey ? this.tabList[this.tabList.indexOf(activeElem) - 1] ||
203
+ this.tabList[this.tabList.length - 1]
204
+ : this.tabList[this.tabList.indexOf(activeElem) + 1] || this.tabList[0]
205
+ newTab.focus()
223
206
  },
224
- focusNextElement(reverse, activeElem) {
225
- /*check if an element is defined or use activeElement*/
226
- activeElem =
227
- activeElem instanceof HTMLElement ? activeElem : document.activeElement
228
207
 
208
+ getFocusElements() {
229
209
  let queryString = [
230
210
  'a:not([disabled]):not([tabindex="-1"])',
231
211
  'button:not([disabled]):not([tabindex="-1"])',
@@ -237,11 +217,9 @@ export default {
237
217
  queryResult = Array.prototype.filter.call(
238
218
  document.querySelectorAll(queryString),
239
219
  (elem) => {
240
- /*check for visibility while always include the current activeElement*/
241
220
  return (
242
221
  elem.offsetWidth > 0 ||
243
- elem.offsetHeight > 0 ||
244
- elem === activeElem
222
+ elem.offsetHeight > 0
245
223
  )
246
224
  }
247
225
  ),
@@ -272,13 +250,7 @@ export default {
272
250
  return elem.tabIndex == 0 || elem.tabIndex == -1 ? true : false
273
251
  })
274
252
  )
275
-
276
- /* if reverse is true return the previous focusable element
277
- if reverse is false return the next focusable element */
278
- return reverse
279
- ? focusable[focusable.indexOf(activeElem) - 1] ||
280
- focusable[focusable.length - 1]
281
- : focusable[focusable.indexOf(activeElem) + 1] || focusable[0]
253
+ return focusable
282
254
  }
283
255
  }
284
256
  }
@@ -15,8 +15,7 @@ export default {
15
15
  headingTag: 'h2',
16
16
  rtl: false,
17
17
  workwell: false
18
- },
19
- template: '<task-finder v-bind="args" :storybook="true"/>'
18
+ }
20
19
  }
21
20
 
22
21
  export const Default = {}
@@ -3,34 +3,7 @@ import FormAddressPostcode from './index.vue'
3
3
  export default {
4
4
  title: 'SubComponents/FormAddressPostcode',
5
5
  component: FormAddressPostcode,
6
- argTypes: {
7
- showShadow: {
8
- control: 'boolean'
9
- },
10
- inputPlaceholder: {
11
- control: 'text'
12
- },
13
- showFullAddress: {
14
- control: 'boolean'
15
- },
16
- geocode: {
17
- control: 'boolean'
18
- },
19
- reverseGeocode: {
20
- control: 'boolean'
21
- },
22
- baseUrl: {
23
- control: 'text'
24
- },
25
- inputClassName: {
26
- control: 'text'
27
- }
28
- }
29
- }
30
-
31
-
32
- export const Default = {
33
-
6
+ tags: ['autodocs'],
34
7
  args: {
35
8
  showShadow: false,
36
9
  inputPlaceholder: 'Search for a suburb or postcode',
@@ -41,3 +14,5 @@ export const Default = {
41
14
  inputClassName: 'class-name'
42
15
  }
43
16
  }
17
+
18
+ export const Default = {}