@worksafevictoria/wcl7.5 1.1.14 → 1.1.15
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 +1 -1
- package/src/components/Global/DirectoryFilters/SingleTaxonomy/index.vue +2 -1
- package/src/components/Global/HeroHeader/index.vue +1 -3
- package/src/components/Paragraphs/TabbedCards/index.vue +24 -52
- package/src/components/Paragraphs/TaskFinder/index.stories.js +1 -2
- package/src/components/SubComponents/FormAddressPostcode/index.stories.js +3 -28
package/package.json
CHANGED
|
@@ -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
|
-
@
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
)
|
|
197
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -3,34 +3,7 @@ import FormAddressPostcode from './index.vue'
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'SubComponents/FormAddressPostcode',
|
|
5
5
|
component: FormAddressPostcode,
|
|
6
|
-
|
|
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 = {}
|