@worksafevictoria/wcl7.5 1.3.0 → 1.5.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.
Files changed (29) hide show
  1. package/lib/utility.js +1 -1
  2. package/package.json +1 -2
  3. package/src/components/Common/CardGrid/index.vue +17 -2
  4. package/src/components/Common/CardGridItem/index.vue +20 -10
  5. package/src/components/Containers/Carousel/index.stories.js +30 -0
  6. package/src/components/Containers/Carousel/index.vue +165 -0
  7. package/src/components/Containers/HomepageHeaderNew/index.stories.js +75 -0
  8. package/src/components/Containers/HomepageHeaderNew/index.vue +198 -0
  9. package/src/components/Containers/Subheader/index.vue +8 -2
  10. package/src/components/Global/AppFooter/index.vue +30 -28
  11. package/src/components/Global/AppHeader/index.vue +9 -10
  12. package/src/components/Global/AppHeaderNew/index.vue +313 -242
  13. package/src/components/Global/AppHeaderNew/styles.scss +26 -0
  14. package/src/components/Global/ContrastMode/index.vue +1 -1
  15. package/src/components/Global/Cookies/index.vue +7 -0
  16. package/src/components/Global/HeroHeader/index.vue +12 -13
  17. package/src/components/Paragraphs/Accordion/AccordionItem/index.vue +21 -17
  18. package/src/components/Paragraphs/BrowseContent/index.vue +1 -5
  19. package/src/components/Paragraphs/Directory/Records/ISP/index.vue +2 -2
  20. package/src/components/Paragraphs/ListGroup/index.vue +55 -46
  21. package/src/components/Paragraphs/Statistics/index.vue +1 -0
  22. package/src/components/Paragraphs/TabbedCards/index.vue +42 -38
  23. package/src/components/SubComponents/CardGroup/index.vue +33 -27
  24. package/src/components/SubComponents/CtaButton/index.vue +27 -25
  25. package/src/components/SubComponents/ResourceGroup/index.vue +13 -4
  26. package/src/includes/scss/mixins/src/grid.scss +4 -2
  27. package/src/includes/scss/mixins/src/units.scss +25 -4
  28. package/src/mock/app-header-new.js +27 -15
  29. package/src/mock/carousel-items.js +57 -0
package/lib/utility.js CHANGED
@@ -49,7 +49,7 @@ function navigateToPath(path, newTab) {
49
49
  hrefTag.click()
50
50
  } else {
51
51
  const hrefTag = Object.assign(document.createElement('a'), {
52
- target: isAbsolute ? '_blank' : '_self',
52
+ target: newTab ? '_blank' : '_self',
53
53
  href: url
54
54
  })
55
55
  hrefTag.click()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worksafevictoria/wcl7.5",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -88,7 +88,6 @@
88
88
  "react": "^18.2.0",
89
89
  "react-dom": "^18.2.0",
90
90
  "sass": "1.77.6",
91
- "sass-loader": "^13.3.2",
92
91
  "semantic-release": "^19.0.3",
93
92
  "storybook": "^7.5.1",
94
93
  "stylelint": "^15.11.0",
@@ -31,7 +31,7 @@
31
31
  >
32
32
  <column
33
33
  v-for="(item, index) in cards"
34
- :key="`${redrawCounter}-${index}-${_uid}`"
34
+ :key="`${redrawCounter}-${index}-${$options._uid}`"
35
35
  ref="cardColumns"
36
36
  :lg="largeViewPort"
37
37
  :md="mediumViewPort"
@@ -58,6 +58,7 @@ import Column from './../../Containers/Column/index.vue'
58
58
  import SectionGroup from './../../Containers/SectionGroup/index.vue'
59
59
  import debounce from 'lodash/debounce'
60
60
 
61
+
61
62
  export default {
62
63
  name: 'CardGrid',
63
64
  components: { Row, Column, SectionGroup },
@@ -188,7 +189,7 @@ export default {
188
189
  return 6
189
190
  },
190
191
  uniqueClass() {
191
- return 'cardGrid' + this._uid
192
+ return `cardGrid-${this.$options._uid}`
192
193
  }
193
194
  },
194
195
  watch: {
@@ -228,10 +229,24 @@ export default {
228
229
  window.removeEventListener('resize', this.setColumnSizeDebounce)
229
230
  },
230
231
  methods: {
232
+ cardTitleSelected(selectedCard, ev) {
233
+ this.clearCards()
234
+ selectedCard.selected = !!!selectedCard.selected
235
+ const selectedCardModelIndex = this.getChildIndex(selectedCard)
236
+
237
+ this.$emit('selected-title', {
238
+ selectedCard: selectedCard.selected
239
+ ? this.cards[selectedCardModelIndex]
240
+ : null,
241
+ selectedCardModelIndex,
242
+ ev
243
+ })
244
+ },
231
245
  cardSelected(selectedCard, ev) {
232
246
  this.clearCards()
233
247
  selectedCard.selected = !!!selectedCard.selected
234
248
  const selectedCardModelIndex = this.getChildIndex(selectedCard)
249
+
235
250
  this.$emit('selected', {
236
251
  selectedCard: selectedCard.selected
237
252
  ? this.cards[selectedCardModelIndex]
@@ -15,10 +15,10 @@
15
15
  ? isSelectable && selected
16
16
  ? 'true'
17
17
  : 'false'
18
- : null
18
+ : false
19
19
  "
20
20
  :aria-expanded="
21
- isExpandable ? (isSelectable && selected ? 'true' : 'false') : null
21
+ isExpandable ? (isSelectable && selected ? 'true' : 'false') : false
22
22
  "
23
23
  :data-href="link"
24
24
  @click="cardClicked($event)"
@@ -67,15 +67,16 @@
67
67
  }
68
68
  ]"
69
69
  >
70
- <div>
71
70
  <b-card-title
72
71
  v-if="cardHeaderTitle !== null && cardHeaderTitle !== undefined"
73
72
  :tag="headerTag"
74
73
  class="card-grid-item__header"
75
74
  :class="{
76
75
  [`card-grid-item__header--${headerSize}`]: true,
77
- [`card-grid-item__header--align-${headerTextAlign}`]: true
76
+ [`card-grid-item__header--align-${headerTextAlign}`]: true,
77
+ 'card-grid-item__header--cursor': isCardTitleSelectable
78
78
  }"
79
+ @click="cardTitleClicked($event)"
79
80
  >
80
81
  <span>{{ cardHeaderTitle }}</span> &nbsp;
81
82
  <card-grid-item-caret
@@ -100,9 +101,7 @@
100
101
  >
101
102
  </card-grid-item-icon>
102
103
  </b-card-title>
103
- </div>
104
- <div>
105
- <card-grid-item-caret
104
+ <card-grid-item-caret
106
105
  v-if="caretPosition === 'top'"
107
106
  :caret="caret"
108
107
  :rtl="rtl"
@@ -128,10 +127,7 @@
128
127
  :rtl="rtl"
129
128
  >
130
129
  </card-grid-item-icon>
131
-
132
130
  <span v-if="pillText" class="visually-hidden">{{ pillText }}</span>
133
- </div>
134
-
135
131
  </div>
136
132
  <b-card-text
137
133
  v-if="$slots.cardDescription || description"
@@ -357,6 +353,10 @@ export default {
357
353
  taxonomies: {
358
354
  type: Object,
359
355
  default: () => {}
356
+ },
357
+ isCardTitleSelectable: {
358
+ type: Boolean,
359
+ default: false
360
360
  }
361
361
  },
362
362
  data: () => ({
@@ -422,10 +422,16 @@ export default {
422
422
  if (this.isSelectable) {
423
423
  this.parentGrid.cardSelected(this, ev)
424
424
  }
425
+
425
426
  if (this.$gtm) {
426
427
  this.fireGTM()
427
428
  }
428
429
  },
430
+ cardTitleClicked(ev) {
431
+ if (this.isCardTitleSelectable) {
432
+ this.parentGrid.cardTitleSelected(this, ev)
433
+ }
434
+ },
429
435
  getParentGridItem() {
430
436
  let counter = 0
431
437
  const maxParentDepth = 10
@@ -845,6 +851,10 @@ export default {
845
851
  &--align-right {
846
852
  direction: rtl;
847
853
  }
854
+
855
+ &--cursor {
856
+ cursor: pointer;
857
+ }
848
858
  }
849
859
  }
850
860
 
@@ -0,0 +1,30 @@
1
+ import CarouselComponent from './index.vue'
2
+ import { mockCarouselItems } from '../../../mock/carousel-items'
3
+
4
+ export default {
5
+ title: 'Website-Redesign/Carousel',
6
+ component: CarouselComponent,
7
+ data() {
8
+ return {
9
+ mockCarouselItems
10
+ }
11
+ },
12
+ args: {
13
+ carouselItems: mockCarouselItems,
14
+ storybook: true
15
+ },
16
+
17
+ }
18
+
19
+ const DefaultCarousel = (args) => ({
20
+ components: { CarouselComponent },
21
+ setup() {
22
+ return { args }
23
+ },
24
+ template: `<div style="width: 50%; height: auto;">
25
+ <h2>Carousel Component</h2>
26
+ <carousel-component v-bind="args"></carousel-component>
27
+ </div>`
28
+ })
29
+
30
+ export const Default = DefaultCarousel.bind({})
@@ -0,0 +1,165 @@
1
+ <template>
2
+ <div>
3
+ <b-carousel
4
+ id="carousel-1"
5
+ v-model="slide"
6
+ interval=0
7
+ controls
8
+ indicators
9
+ keyboard
10
+ background="#ababab"
11
+ >
12
+ <b-carousel-slide
13
+ v-for="item in filteredCarouselItems"
14
+ :key="item.id"
15
+
16
+ :img-src="item.image"
17
+ @click.prevent="handleClick(item.link)"
18
+ >
19
+ <h4>{{ item.content}}</h4>
20
+ </b-carousel-slide>
21
+ </b-carousel>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ import { BCarousel, BCarouselSlide } from 'bootstrap-vue-next'
27
+ import { isAbsoluteUrl, navigateToPath } from '../../../../lib/utility'
28
+
29
+ export default {
30
+ name: 'CarouselComponent',
31
+ data() {
32
+ return {
33
+ slide: 0,
34
+ }
35
+ },
36
+ components: {
37
+ BCarousel,
38
+ BCarouselSlide
39
+ },
40
+ props: {
41
+ carouselItems: {
42
+ type: Array,
43
+ required: true,
44
+ default: () => [],
45
+ },
46
+ storybook: {
47
+ type: Boolean,
48
+ default: false
49
+ }
50
+ },
51
+ computed: {
52
+ filteredCarouselItems() {
53
+
54
+ var todayDate = new Date()
55
+
56
+ for (var i = 0, length = this.carouselItems.length; i < length; i++) {
57
+ if (this.carouselItems[i].favorite === 'Yes') {
58
+ this.carouselItems[i].active = 'Yes'
59
+ } else if (new Date(this.carouselItems[i].dateStart).valueOf() <= todayDate.valueOf()) {
60
+ if (new Date(this.carouselItems[i].dateEnd).valueOf() >= todayDate.valueOf()) {
61
+ this.carouselItems[i].active = 'Yes'
62
+ }
63
+ }
64
+ }
65
+
66
+ let filtered = this.carouselItems.filter(e =>
67
+ e.active === 'Yes');
68
+ return filtered
69
+ }
70
+ },
71
+ methods: {
72
+
73
+ handleClick(link) {
74
+ if (link) {
75
+ if (isAbsoluteUrl(link)) {
76
+ navigateToPath(link, true)
77
+ } else {
78
+ if (this.storybook) {
79
+ alert('This link will go to: ' + link)
80
+ } else {
81
+ this.$router.push({ path: link })
82
+ }
83
+ }
84
+ }
85
+ },
86
+
87
+ formatDate(date) {
88
+ return [
89
+ date.getFullYear(),
90
+ ('0' + date.getDate()).slice(-2),
91
+ ('0' + (date.getMonth() + 1)).slice(-2)
92
+ ].join('-')
93
+ }
94
+ }
95
+ }
96
+ </script>
97
+
98
+ <style lang="scss" scoped>
99
+ @import '../../../includes/scss/all';
100
+ </style>
101
+
102
+ <style>
103
+ .carousel {
104
+ position: relative;
105
+ padding-bottom: 7rem;
106
+ }
107
+
108
+ .carousel-inner {
109
+ overflow: visible;
110
+ }
111
+
112
+ .carousel-indicators {
113
+ padding-bottom: 3rem;
114
+ float: right;
115
+ right: 2% !important;
116
+ width: 20%;
117
+ justify-content: end;
118
+ margin-left: 80%;
119
+ margin-right: 0;
120
+ }
121
+
122
+ .carousel-indicators button {
123
+ width: 10px !important;
124
+ height: 10px !important;
125
+ border-radius: 50% !important;
126
+ background-color: black !important;
127
+ }
128
+
129
+ .carousel-indicators button:focus,
130
+ .carousel-indicators button:active {
131
+ outline: none !important;
132
+ box-shadow: none;
133
+
134
+ }
135
+
136
+ .carousel-caption {
137
+ color: black;
138
+ top: 100%;
139
+ left: 0;
140
+ right: 20%;
141
+ text-align: left;
142
+ text-decoration: underline;
143
+ }
144
+
145
+ .carousel-control-next,
146
+ .carousel-control-prev {
147
+ bottom: 7rem;
148
+ }
149
+
150
+ .carousel-control-prev:focus,
151
+ .carousel-control-prev:active,
152
+ .carousel-control-next:focus,
153
+ .carousel-control-next:active {
154
+ outline: none !important;
155
+ box-shadow: none;
156
+ }
157
+
158
+ .carousel-control-prev-icon,
159
+ .carousel-control-next-icon {
160
+ height: 50px !important;
161
+ width: 50px !important;
162
+ outline:none !important;
163
+ }
164
+
165
+ </style>
@@ -0,0 +1,75 @@
1
+ import HomepageHeader from './index.vue'
2
+ import { mockCarouselItems } from '../../../mock/carousel-items'
3
+
4
+ const fetchMenu = () =>
5
+ Promise.resolve([
6
+ {
7
+ title: 'Report an incident',
8
+ relative: '/report-incident'
9
+ },
10
+ {
11
+ title: 'Report a case of COVID-19',
12
+ relative: '/report-confirmed-positive-case-covid-19'
13
+ },
14
+ {
15
+ title: 'Make a claim',
16
+ relative: '/before-claim'
17
+ },
18
+ {
19
+ title: 'Apply for a licence',
20
+ relative: '/apply-for-licence'
21
+ },
22
+ {
23
+ title: 'Pay or renew your insurance',
24
+ relative: '/pay-or-renew-your-workcover-insurance-premium'
25
+ }
26
+ ])
27
+
28
+ const contentParser = () => {
29
+ return Promise.resolve({
30
+ results: [
31
+ {
32
+ title: 'Content title 1',
33
+ description: 'Content description 2'
34
+ }
35
+ ],
36
+ offset: 0,
37
+ numFound: 1000
38
+ })
39
+ }
40
+
41
+ export default {
42
+ title: 'Website_Redesign/HomepageHeader',
43
+ component: HomepageHeader,
44
+ argTypes: {
45
+ fetchMenu: {
46
+ control: 'function',
47
+ table: { disable: true }
48
+ },
49
+ contentParser: {
50
+ control: 'function',
51
+ table: { disable: true }
52
+ }
53
+ },
54
+ args: {
55
+ fetchMenu: fetchMenu,
56
+ slideList: mockCarouselItems,
57
+ isStorybook: true,
58
+ contentParser: contentParser
59
+ }
60
+ }
61
+
62
+ const DefaultHH = (args) => ({
63
+ components: { HomepageHeader },
64
+ setup() {
65
+ return { args };
66
+ },
67
+ mounted() {
68
+ setTimeout(() => {
69
+ this.$refs.hh.renderMenu()
70
+ })
71
+ },
72
+ template: '<homepage-header v-bind="args" ref="hh" />'
73
+ })
74
+
75
+ export const Default = DefaultHH.bind({})
@@ -0,0 +1,198 @@
1
+ <template>
2
+ <div class="homepage-header">
3
+ <div class="container">
4
+ <search
5
+ :page-limit="3"
6
+ :page-number="1"
7
+ :is-typeahead="true"
8
+ :content-parser="contentParser"
9
+ tabindex="0"
10
+ class="homepage-header__search"
11
+ />
12
+ <row class="wcl-hero-header__content-wrapper container">
13
+ <column class="wcl-hero-header__content-wrapper__content-col col-12 col-md-7 wcl-hero-header__content-wrapper__content-col--split wcl-rich-text--ltr">
14
+ <carousel-component
15
+ :carouselItems="this.slideList"
16
+ :storybook="this.isStorybook"
17
+ />
18
+ </column>
19
+ <column class="wcl-hero-header__side col-md-4 offset-md-1">
20
+ <cta-button
21
+ v-for="(link, i) in links"
22
+ :key="i"
23
+ class="iebtn"
24
+ :url="link.path"
25
+ type="dark"
26
+ :stretch="true"
27
+ >{{ link.text }}</cta-button
28
+ >
29
+ <cta-button
30
+ class="iebtn"
31
+ url="/choose-your-language"
32
+ type="dark"
33
+ :stretch="true"
34
+ :glyph="earthIcon"
35
+ :is-centred="false"
36
+ >Choose your language</cta-button
37
+ >
38
+ </column>
39
+ </row>
40
+ </div>
41
+ </div>
42
+ </template>
43
+ <script>
44
+ import Search from './../../SubComponents/Search/index.vue'
45
+ import CtaButton from './../../SubComponents/CtaButton/index.vue'
46
+ import earthIcon from './../../../assets/icons/earth.svg?url'
47
+ import CarouselComponent from './../../Containers/Carousel/index.vue'
48
+ import Row from './../../Containers/Row/index.vue'
49
+ import Column from './../../Containers/Column/index.vue'
50
+
51
+ export default {
52
+ name: 'HomepageHeader',
53
+ components: {
54
+ Search,
55
+ CtaButton,
56
+ CarouselComponent,
57
+ Row,
58
+ Column
59
+ },
60
+ props: {
61
+ contentParser: {
62
+ type: Function,
63
+ required: true,
64
+ },
65
+ fetchMenu: {
66
+ type: Function,
67
+ required: true,
68
+ },
69
+ slideList: {
70
+ type: Array,
71
+ required: true,
72
+ },
73
+ isStorybook: {
74
+ type: Boolean,
75
+ default: false
76
+ }
77
+ },
78
+ async mounted() {
79
+ await this.renderMenu()
80
+ },
81
+
82
+ data: () => ({
83
+ links: [],
84
+ earthIcon,
85
+ }),
86
+ methods: {
87
+ async renderMenu() {
88
+ const menu = await this.fetchMenu()
89
+ this.links = (Array.isArray(menu) ? menu : []).map((item) => {
90
+ return {
91
+ text: item.title,
92
+ path: item.relative || item.absolute,
93
+ }
94
+ })
95
+ },
96
+ },
97
+ }
98
+ </script>
99
+
100
+ <!-- styles from the heroheader are still used for consistency,
101
+ even though the component itself is no longer imported. -->
102
+
103
+ <style lang="scss" scoped>
104
+ @import '../../../includes/scss/all';
105
+ @import './../../Global/HeroHeader/styles.scss';
106
+
107
+ .homepage-header {
108
+ border-bottom: none !important;
109
+
110
+ :deep(.wysiwyg) {
111
+ h1 {
112
+ @media screen and (max-width: 390px) {
113
+ font-size: 32px;
114
+ line-height: 32px;
115
+ }
116
+
117
+ @media screen and (max-width: 767px) {
118
+ font-size: 36px;
119
+ line-height: 36px;
120
+ margin-bottom: 16px;
121
+ }
122
+ }
123
+ }
124
+
125
+ :deep(.wcl-hero-header__content-wrapper) {
126
+ @include fp('top', 75, 250);
127
+ margin-top: 0;
128
+
129
+ @media screen and (max-width: 540px) {
130
+ padding-right: 35px;
131
+ }
132
+
133
+ }
134
+
135
+ :deep(.wcl-hero-header__wrap) {
136
+ display: block;
137
+ align-items: normal;
138
+ }
139
+
140
+ :deep(.wcl-cta) {
141
+
142
+ margin-left: 0 !important;
143
+
144
+ &:last-of-type {
145
+ img {
146
+ position: absolute;
147
+ right: 16px;
148
+ top: 19px;
149
+ }
150
+ }
151
+ }
152
+
153
+ &__search {
154
+ // margin-top: 10px;
155
+ z-index: 1;
156
+ width: auto;
157
+
158
+ @include mq('xs') {
159
+ padding-right: 0;
160
+ }
161
+
162
+ :deep(.gsc-results-wrapper-visible) {
163
+ display: none !important;
164
+ }
165
+ }
166
+
167
+ @media all and (-ms-high-contrast: none) {
168
+ ::-ms-backdrop,
169
+ .iebtn {
170
+ bottom: 280px;
171
+ left: 650px;
172
+ }
173
+
174
+ /* IE11 */
175
+
176
+ @media screen\9, screen and (max-width: 1150px) {
177
+ .iebtn {
178
+ bottom: 330px;
179
+ left: 480px;
180
+ }
181
+ }
182
+
183
+ @media screen\9, screen and (max-width: 950px) {
184
+ .iebtn {
185
+ bottom: 350px;
186
+ left: 450px;
187
+ }
188
+ }
189
+
190
+ @media screen\9, screen and (max-width: 767px) {
191
+ .iebtn {
192
+ left: 2px;
193
+ top: 10px;
194
+ }
195
+ }
196
+ }
197
+ }
198
+ </style>
@@ -104,8 +104,14 @@ export default {
104
104
  // Some custom logic for gov caretaker logic
105
105
  if (process.env.CARETAKER && process.env.CARETAKER === 'true') {
106
106
  if (!isGovSite(card?.selectedCard?.linkHref)) {
107
- this.$store.commit('page/SET_CARETAKER_REF', 'subheader')
108
- this.$root.$emit('caretaker-open', card?.selectedCard?.linkHref)
107
+ // this.$store.commit('page/SET_CARETAKER_REF', 'subheader')
108
+ // this.$root.$emit('caretaker-open', card?.selectedCard?.linkHref)
109
+ if (this.$pageStore) {
110
+ this.$pageStore.caretaker.referrer = 'subheader'
111
+ }
112
+ if (this.$bus) {
113
+ this.$bus.$emit('caretaker-open', card?.selectedCard?.linkHref)
114
+ }
109
115
  } else {
110
116
  navigateToPath.call(
111
117
  this,