@worksafevictoria/wcl7.5 1.0.0 → 1.1.0-beta.2

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 (35) hide show
  1. package/.env +4 -2
  2. package/.eslintrc.cjs +1 -1
  3. package/.eslintrc.js +2 -1
  4. package/.husky/pre-commit +4 -0
  5. package/.storybook/main.js +2 -1
  6. package/.storybook/preview.js +10 -0
  7. package/README.md +14 -0
  8. package/babel.config.js +7 -6
  9. package/bin/deploy.sh +3 -3
  10. package/ci/build/build_validation.yml +11 -6
  11. package/ci/release/beta.yml +6 -5
  12. package/ci/release/master.yml +6 -5
  13. package/jest.config.js +3 -1
  14. package/package.json +14 -9
  15. package/public/.nojekyll +1 -0
  16. package/src/components/Global/Cookies/{index.storieshide.js → index.stories.js} +5 -16
  17. package/src/components/Global/Cookies/index.vue +122 -136
  18. package/src/components/Global/Cookies/styles.scss +10 -2
  19. package/src/components/Global/DirectoryFilters/SingleTaxonomy/index.vue +53 -47
  20. package/src/components/Global/GlobalNotice/index.stories.js +8 -0
  21. package/src/components/Global/GlobalNotice/index.vue +71 -137
  22. package/src/components/Global/HeroHeader/styles.scss +2 -1
  23. package/src/components/Paragraphs/BrowseContent/index.stories.js +39 -57
  24. package/src/components/SubComponents/FormInstance/index.vue +3 -1
  25. package/src/components/SubComponents/FormInstance/stories/mocks/checkbox.json +21 -0
  26. package/src/components/SubComponents/Search/GoogleREST/index.stories.js +50 -0
  27. package/src/components/SubComponents/Search/GoogleSearch/index.stories.js +23 -0
  28. package/src/components/SubComponents/Search/SearchListing/index.vue +69 -9
  29. package/src/components/SubComponents/Search/index.stories.js +19 -16
  30. package/src/components/SubComponents/Search/index.vue +563 -59
  31. package/src/components/SubComponents/VideoThumbnail/index.stories.js +9 -4
  32. package/src/components/SubComponents/VideoThumbnail/index.vue +93 -96
  33. package/vite.config.js +5 -1
  34. package/src/components/SubComponents/GoogleSearch/index.stories.js +0 -8
  35. package/src/components/SubComponents/GoogleSearch/index.vue +0 -405
@@ -20,22 +20,27 @@ export default {
20
20
  argTypes: {
21
21
  video: {
22
22
  control: 'object',
23
- defaultValue: mockData
24
23
  }
24
+ },
25
+ args: {
26
+ video: mockData
25
27
  }
26
28
  }
27
29
 
28
- const Template = (args, { argTypes }) => ({
30
+ const Template = (args) => ({
29
31
  components: { VideoThumbnail, Container, Row, Column },
30
- props: Object.keys(argTypes),
32
+ setup () {
33
+ return { args }
34
+ },
31
35
  template: `
32
36
  <container>
33
37
  <row>
34
38
  <column md="5">
35
- <video-thumbnail v-bind="$props" />
39
+ <video-thumbnail v-bind="args" />
36
40
  </column>
37
41
  </row>
38
42
  </container>
39
43
  `
40
44
  })
45
+
41
46
  export const Default = Template.bind({})
@@ -15,45 +15,37 @@
15
15
  />
16
16
  </div>
17
17
  </a>
18
- <b-modal
19
- :id="`wcl-video-modal`"
20
- v-model="showModal"
21
- scrollable
22
- class="wcl-video-modal__modal"
23
- >
24
- <template #modal-header="{ close }">
25
- <div class="modal-header__wrap">
26
- <!-- Emulate built in modal header close button action -->
27
- <a
28
- href="#"
29
- class="close-button"
30
- :class="{ rtl: video.rtl }"
31
- @click.prevent="close()"
32
- >
33
- <icon-close :src="IconClose" alt="close icon" class="close-icon" />
34
- </a>
18
+ <!-- Modal -->
19
+ <div v-if="showModal" :id="wcl-video-modal" class="modal" tabindex="-1" aria-modal="true" role="dialog" style="display: block;">
20
+ <div class="modal-dialog modal-dialog-scrollable">
21
+ <div class="modal-content">
22
+ <div class="modal-header">
23
+ <button type="button" class="btn-close" @click="showModal = !showModal" aria-label="close"></button>
24
+ </div>
25
+ <div class="modal-body">
26
+ <div class="wcl-video-modal__video">
27
+ <video-media
28
+ :media-title="video.mediaTitle"
29
+ :media-description="video.mediaDescription"
30
+ :video-id="video.id"
31
+ :provider="video.provider"
32
+ :transcript="video.transcript"
33
+ :transcript-title="video.transcriptTitle"
34
+ :fix-width="video.fixWidth"
35
+ :rtl="video.rtl"
36
+ />
37
+ </div>
38
+ </div>
35
39
  </div>
36
- </template>
37
- <div class="wcl-video-modal__video">
38
- <video-media
39
- :media-title="video.mediaTitle"
40
- :media-description="video.mediaDescription"
41
- :video-id="video.id"
42
- :provider="video.provider"
43
- :transcript="video.transcript"
44
- :transcript-title="video.transcriptTitle"
45
- :fix-width="video.fixWidth"
46
- :rtl="video.rtl"
47
- />
48
40
  </div>
49
- </b-modal>
41
+ </div>
50
42
  </div>
51
43
  </template>
52
44
 
53
45
  <script>
54
46
  import VideoMedia from './../../Paragraphs/VideoPlayer/index.vue'
55
- import VideoPlay from './../../../assets/icons/video-play.svg'
56
- import IconClose from './../../../assets/icons/icon-close.svg'
47
+ import VideoPlay from './../../../assets/icons/video-play.svg?url'
48
+ import IconClose from './../../../assets/icons/icon-close.svg?url'
57
49
 
58
50
  export default {
59
51
  name: 'VideoThumbnail',
@@ -112,83 +104,88 @@ export default {
112
104
  <style lang="scss">
113
105
  @import '../../../includes/scss/all';
114
106
  // The modal styling
115
- #wcl-video-modal {
116
- .modal-dialog {
117
- max-width: 1110px;
118
- @media only screen and (max-width: 1150px) {
119
- margin: {
120
- left: 15px;
121
- right: 15px;
122
- top: 15px;
123
- }
124
- }
107
+ .modal {
108
+ background: rgba(0,0,0,0.5)
109
+ }
125
110
 
126
- .modal-content {
127
- position: relative;
128
- border-radius: 8px;
111
+ .modal-backdrop {
112
+ display: none;
113
+ }
114
+ .modal-dialog {
115
+ max-width: 1110px;
116
+ @media only screen and (max-width: 1150px) {
117
+ margin: {
118
+ left: 15px;
119
+ right: 15px;
120
+ top: 15px;
129
121
  }
122
+ }
130
123
 
131
- .modal-header {
132
- position: absolute;
133
- top: 0;
134
- height: 45px;
135
- background: $white;
136
- z-index: 1;
137
- width: 100%;
124
+ .modal-content {
125
+ position: relative;
126
+ border-radius: 8px;
127
+ }
138
128
 
139
- &__wrap {
140
- position: relative;
141
- width: 100%;
142
- a {
143
- position: absolute;
144
- right: 0;
145
- z-index: 1;
146
- &.rtl {
147
- right: auto;
148
- left: 0;
149
- }
150
- svg {
151
- fill: $black;
152
- }
129
+ .modal-header {
130
+ position: absolute;
131
+ top: 0;
132
+ height: 45px;
133
+ background: $white;
134
+ z-index: 1;
135
+ width: 100%;
136
+
137
+ &__wrap {
138
+ position: relative;
139
+ width: 100%;
140
+ a {
141
+ position: absolute;
142
+ right: 0;
143
+ z-index: 1;
144
+ &.rtl {
145
+ right: auto;
146
+ left: 0;
147
+ }
148
+ svg {
149
+ fill: $black;
153
150
  }
154
151
  }
155
152
  }
156
- .modal-body {
157
- padding: 32px;
158
- margin-top: 16px;
159
- .video-player {
160
- @include fp(min-height, 250, 588);
161
- }
153
+ }
154
+ .modal-body {
155
+ padding: 32px;
156
+ margin-top: 16px;
157
+ .video-player {
158
+ @include fp(min-height, 250, 588);
159
+ }
162
160
 
163
- .paragraph--video-media {
164
- margin: 0;
165
- .container {
166
- padding: 0;
167
- width: 100%;
168
- }
169
- h3 {
170
- margin: 0;
171
- font-style: normal;
172
- font-weight: bold;
173
- font-size: 28px;
174
- line-height: 32px;
175
- margin-bottom: 16px;
176
- display: inline-block;
177
- width: 98%;
178
- }
161
+ .paragraph--video-media {
162
+ margin: 0;
163
+ .container {
164
+ padding: 0;
165
+ width: 100%;
179
166
  }
180
- .section-group__block {
181
- max-width: 100%;
167
+ h3 {
168
+ margin: 0;
169
+ font-style: normal;
170
+ font-weight: bold;
171
+ font-size: 28px;
172
+ line-height: 32px;
173
+ margin-bottom: 16px;
174
+ display: inline-block;
175
+ width: 98%;
182
176
  }
183
177
  }
184
- .modal-header,
185
- .modal-footer {
186
- border: none;
187
- }
188
- .modal-footer {
189
- display: none;
178
+ .section-group__block {
179
+ max-width: 100%;
190
180
  }
191
181
  }
182
+ .modal-header,
183
+ .modal-footer {
184
+ border: none;
185
+ }
186
+ .modal-footer {
187
+ display: none;
188
+ }
192
189
  }
193
190
  </style>
194
191
  <style lang="scss" scoped>
package/vite.config.js CHANGED
@@ -14,6 +14,10 @@ export default defineConfig({
14
14
  }
15
15
  },
16
16
  define: {
17
- 'process.env.SOME_ENV': `"${process.env.SOME_ENV}"`
17
+ 'process.env.SHOW_COOKIE': `"${process.env.SHOW_COOKIE}"`,
18
+ 'process.env.CONTENT_API_URL': `"${process.env.CONTENT_API_URL}"`,
19
+ 'process.env.IS_STORYBOOK': `"${process.env.IS_STORYBOOK}"`,
20
+ 'process.env.CARETAKER': `"${process.env.CARETAKER}"`,
21
+ 'process.env.SHOW_GLOBAL_NOTICE': `"${process.env.SHOW_GLOBAL_NOTICE}"`
18
22
  }
19
23
  })
@@ -1,8 +0,0 @@
1
- import GoogleSearch from './index.vue'
2
-
3
- export default {
4
- title: 'SubComponents/GoogleSearch',
5
- component: GoogleSearch
6
- }
7
-
8
- export const Default = {}
@@ -1,405 +0,0 @@
1
- <template>
2
- <div class="wcl-search">
3
- <div class="gcse-search"></div>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- mounted() {
10
- // console.log('Component mounted')
11
- this.setupCustomeStyle()
12
-
13
- // Introduce a delay before setting up addEventListener
14
- setTimeout(() => {
15
- this.setupCustomAttr()
16
- this.handleSearchResultLinkTitle()
17
- }, 2000) // Adjust the delay time as needed
18
- },
19
-
20
- beforeDestroy() {
21
- // Remove event listeners before the component is destroyed
22
- const targetNode = document.querySelector('input[name="search"]')
23
- const buttonNode = document.querySelector('button.gsc-search-button')
24
-
25
- if (targetNode) {
26
- // Add keyup.enter event listener
27
- targetNode.removeEventListener('keyup', this.handleKeyUp)
28
- buttonNode.removeEventListener('click', this.handleKeyUp)
29
- }
30
- const paginationNodes = document.querySelectorAll('.gsc-cursor-page')
31
- paginationNodes.forEach((paginationNode) => {
32
- paginationNode.removeEventListener('click', this.handleSearchResultTitle)
33
- })
34
- },
35
-
36
- methods: {
37
- // Method to customize google search style
38
- setupCustomeStyle() {
39
- const script = document.createElement('script')
40
- script.async = true
41
- script.src = 'https://cse.google.com/cse.js?cx=53b1506aa03c64160'
42
- document.head.appendChild(script)
43
-
44
- // Create a new style element
45
- const style = document.createElement('style')
46
- style.id = 'searchStyle' // Assign an ID to the style element
47
- // The CSS we are going to inject
48
- const cssVar = 'table.gssb_c {display: none !important;}'
49
- // Inject the style element into the head
50
- document.head.appendChild(style)
51
- // Set the text content of the style element to the CSS text
52
- style.textContent = cssVar
53
- },
54
-
55
- // Method to add google search input attributes
56
- setupCustomAttr() {
57
- console.log('setupCustomInputAttr ...')
58
-
59
- const targetNode = document.querySelector('input[name="search"]')
60
- const buttonNode = document.querySelector('button.gsc-search-button')
61
-
62
- if (targetNode) {
63
- // Add keyup.enter event listener
64
- targetNode.addEventListener('keyup', this.handleKeyUp)
65
- buttonNode.addEventListener('click', this.handleKeyUp)
66
- }
67
-
68
- this.setupPaginationEvent()
69
- },
70
-
71
- setupPaginationEvent() {
72
- console.log('setupPaginationEvent ....')
73
- // Introduce a delay before setting up addEventListener on pagination
74
- setTimeout(() => {
75
- this.handleSearchResultLinkTitle()
76
- const paginationNodes = document.querySelectorAll('.gsc-cursor-page')
77
- console.log('paginationNodes length ..', paginationNodes.length)
78
-
79
- if (paginationNodes && paginationNodes.length > 0) {
80
- console.log('FOUND PAGINATION ....', paginationNodes)
81
-
82
- // Loop through each element and add a click event listener
83
- paginationNodes.forEach((paginationNode) => {
84
- // Check if the click event listener has already been added
85
- if (!paginationNode.clickEventListenerAdded) {
86
- // Add a click event listener
87
- paginationNode.addEventListener(
88
- 'click',
89
- this.handleSearchResultTitle
90
- )
91
- // Mark that the click event listener has been added
92
- paginationNode.clickEventListenerAdded = true
93
- console.log('Adding a click event listener')
94
- }
95
- })
96
- }
97
- }, 2000) // Adjust the delay time as needed
98
- },
99
-
100
- // Method to trim text after '|'
101
- handleSearchResultTitle() {
102
- //alert('handleSearchResultTitle ....')
103
- this.setupPaginationEvent()
104
- },
105
-
106
- handleSearchResultLinkTitle() {
107
- //alert('handleSearchResultLinkTitle ....')
108
- // Get all targetNodes with class "a.gs-title"
109
- var targetNodes = document.querySelectorAll('a.gs-title')
110
- console.log('search list title targetNodes :- ', targetNodes)
111
-
112
- // Loop through each element and hide the text after the "|"
113
- targetNodes.forEach(function(element) {
114
- // Get the text content
115
- var text = element.textContent || element.innerText
116
-
117
- // Find the index of the "|" symbol
118
- var pipeIndex = text.indexOf('|')
119
- console.log('text :- ', text)
120
- // If the "|" symbol is found, update the text content to display only the part before "|"
121
- if (pipeIndex !== -1) {
122
- element.textContent = text.substring(0, pipeIndex).trim()
123
- }
124
- })
125
- },
126
-
127
- handleKeyUp(event) {
128
- if (event.key === 'Enter' || event.type === 'click') {
129
- let keyword = event.key
130
- ? event.target.value
131
- : document.querySelector('input[name="search"]').value
132
-
133
- // console.log('Enter key pressed. Value:', keyword)
134
-
135
- // Check if the URL does not contain "/search"
136
- if (keyword && !window.location.href.includes('/search')) {
137
- let origin = window.location.origin
138
- let hash = window.location.hash
139
- let pathname = 'search'
140
- let URL = origin + '/' + pathname + hash
141
- // console.log('URL does not contains "/search" ...', URL)
142
- window.location.assign(URL)
143
- }
144
-
145
- this.setupPaginationEvent
146
- }
147
- }
148
- }
149
- }
150
- </script>
151
- <style lang="scss" scoped>
152
- @import '../../../includes/scss/all';
153
-
154
- .wcl-search {
155
- :deep(form.gsc-search-box) {
156
- position: relative;
157
- display: -ms-flexbox;
158
- display: flex;
159
- -ms-flex-wrap: wrap;
160
- flex-wrap: wrap;
161
- -ms-flex-align: stretch;
162
- align-items: stretch;
163
- width: 100%;
164
- }
165
- :deep(.gsib_a) {
166
- padding: 0 !important;
167
- height: 56px;
168
- }
169
- :deep(.gsib_b) {
170
- position: absolute;
171
- right: 5px;
172
- top: 15px;
173
- }
174
- :deep(.gcsc-more-maybe-branding-root) {
175
- display: none;
176
- }
177
- :deep(table.gsc-input) {
178
- position: relative;
179
- }
180
- :deep(td.gsc-input) {
181
- border: none;
182
- padding: 0;
183
- width: 100%;
184
- }
185
- :deep(.gsc-input-box) {
186
- border: none;
187
- }
188
- :deep(input.gsc-input) {
189
- border-radius: 8px 0px 0px 8px;
190
- border: 1px solid $gray !important;
191
- border-right: 0 !important;
192
- background: none !important;
193
- color: #495057;
194
- height: 56px !important;
195
- position: relative;
196
- -ms-flex: 1 1 auto;
197
- flex: 1 1 auto;
198
- padding: 0.375rem 0.75rem !important;
199
-
200
- @media screen and (max-width: 320px) {
201
- width: 220px;
202
- }
203
-
204
- &:focus {
205
- box-shadow: none;
206
- }
207
- }
208
- :deep(.gsc-search-button) {
209
- display: -ms-flexbox;
210
- display: flex;
211
- margin-left: 0px;
212
- height: 56px;
213
- margin-top: 0px;
214
- }
215
- :deep(button.gsc-search-button) {
216
- background: $orange;
217
- border: none;
218
- border-radius: 0px 8px 8px 0px;
219
- color: $black;
220
- display: flex;
221
- align-items: center;
222
- height: 56px !important;
223
- font-size: 16px;
224
- font-weight: 700;
225
- padding-right: 32px;
226
- padding-left: 32px;
227
-
228
- &:before {
229
- content: 'Search';
230
- }
231
- @media screen and (max-width: 767px) {
232
- margin-top: 6px;
233
- }
234
- @media screen and (max-width: 320px) {
235
- padding-right: 16px;
236
- padding-left: 16px;
237
- }
238
-
239
- svg {
240
- fill: black;
241
- height: 18px;
242
- width: 18px;
243
- margin-left: 10px;
244
- }
245
-
246
- :focus {
247
- box-shadow: 0px;
248
- }
249
- }
250
-
251
- :deep(.gsst_a .gscb_a) {
252
- color: #191919;
253
- }
254
- :deep(.gsc-result-info) {
255
- color: #191919;
256
- font-size: 16px;
257
- font-weight: 400;
258
- }
259
- :deep(.gsc-above-wrapper-area) {
260
- padding: 20px 0;
261
- border-bottom: none;
262
- }
263
- /* search list start */
264
- :deep(.gsc-url-top) {
265
- display: none;
266
- }
267
- :deep(.gsc-table-result) {
268
- line-height: 1.6;
269
- padding: 0 5px;
270
- font-size: 16px;
271
- font-weight: 400;
272
- width: 80%;
273
- b {
274
- color: #191919;
275
- font-size: 16px;
276
- font-weight: normal;
277
- }
278
- }
279
- :deep(.gsc-resultsRoot.gsc-tabData) {
280
- width: 100%;
281
- margin-left: auto;
282
- margin-right: auto;
283
- padding-left: 15px;
284
- padding-right: 15px;
285
-
286
- &:hover {
287
- border: none;
288
- }
289
- }
290
- :deep(.gs-bidi-start-align.gs-snippet) {
291
- color: #191919 !important;
292
- line-height: 24px;
293
- }
294
- :deep(.gsc-thumbnail-inside) {
295
- position: relative;
296
- padding: 0;
297
-
298
- &::after {
299
- content: ' ';
300
- position: absolute;
301
- height: 16px;
302
- width: 11px;
303
- top: 5px;
304
- right: 16px;
305
- background-repeat: no-repeat;
306
- background-image: url(../../../assets/icons/chev-right.svg);
307
- background-size: 100%;
308
- }
309
- div.gs-title {
310
- width: 90%;
311
- margin-bottom: 12px;
312
- overflow: visible;
313
- }
314
- a.gs-title {
315
- color: #191919 !important;
316
- font-weight: 700;
317
- line-height: 24px;
318
- font-size: 20px;
319
- border: 3px solid transparent;
320
- padding-left: 5px;
321
- padding-right: 5px;
322
- text-decoration: underline;
323
-
324
- &:hover {
325
- border: 3px solid #da47ff;
326
- color: #006bff !important;
327
- b {
328
- color: #006bff !important;
329
- }
330
- }
331
-
332
- b {
333
- color: #191919 !important;
334
- font-size: 20px;
335
- }
336
- }
337
- }
338
- :deep(.gsc-orderby-label) {
339
- font-size: 16px;
340
- font-weight: 700;
341
- color: #191919;
342
- }
343
- :deep(.gsc-selected-option-container) {
344
- background-color: white;
345
- border-radius: 10px;
346
- margin-top: 0px;
347
- padding-top: 6px;
348
- margin-right: 0;
349
- margin-left: 4px;
350
- padding-left: 20px;
351
- padding-bottom: 6px;
352
- height: 40px;
353
- .gsc-selected-option {
354
- font-size: 16px;
355
- font-weight: 400;
356
- line-height: 24px;
357
- margin-right: 20px;
358
- }
359
- }
360
- :deep(.gsc-control-cse .gsc-option-selector) {
361
- margin-top: 0;
362
- margin-right: 10px;
363
- }
364
- :deep(.gsc-expansionArea > .gsc-webResult.gsc-result) {
365
- border: 0;
366
- flex: 0 0 100%;
367
- max-width: 100%;
368
- padding: 0;
369
- &:first-child {
370
- border-top: 1px solid #bababa;
371
- }
372
- > div {
373
- border-bottom: 1px solid #bababa;
374
- padding: 32px 0;
375
- }
376
- }
377
-
378
- :deep(.gsc-results .gsc-cursor-box .gsc-cursor-current-page) {
379
- background-color: lightgrey;
380
- }
381
- :deep(.gsc-results .gsc-cursor-box .gsc-cursor-page) {
382
- border: 1px solid grey;
383
- color: #333333;
384
- padding: 10px 12px;
385
- border-radius: 5px;
386
- font-size: 16px;
387
- font-weight: 400;
388
- }
389
- :deep(.gsc-results .gsc-cursor-box) {
390
- margin-top: 50px;
391
- }
392
-
393
- /* search list end */
394
- @include mq('xs') {
395
- .not-extra-small-screen {
396
- display: none;
397
- }
398
- }
399
- }
400
- @media screen and (max-width: 767px) {
401
- :deep(.gssb_c) {
402
- width: 85% !important;
403
- }
404
- }
405
- </style>