@worksafevictoria/wcl7.5 1.1.0 → 1.1.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.
@@ -12,7 +12,8 @@ const config = {
12
12
  options: {}
13
13
  },
14
14
  docs: {
15
- autodocs: 'tag'
15
+ autodocs: 'tag',
16
+ defaultName: 'Documentation'
16
17
  }
17
18
  }
18
19
  export default config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worksafevictoria/wcl7.5",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,7 @@
17
17
  >
18
18
  <search
19
19
  ref="searchInputBox"
20
+ :google-search-flag="googleSearchFlag"
20
21
  :initial-search-query="searchQuery"
21
22
  :page-limit="pageLimit"
22
23
  :page-number="pageNumber"
@@ -31,7 +32,7 @@
31
32
  </template>
32
33
 
33
34
  <script>
34
- import Close from '../../../../assets/icons/close.svg'
35
+ import Close from '../../../../assets/icons/close.svg?url'
35
36
  import Search from '../../../SubComponents/Search/index.vue'
36
37
 
37
38
  export default {
@@ -45,6 +46,10 @@ export default {
45
46
  contentParser: {
46
47
  type: Function,
47
48
  required: true
49
+ },
50
+ googleSearchFlag: {
51
+ type: String,
52
+ default: 'googlerest'
48
53
  }
49
54
  },
50
55
  data() {
@@ -18,45 +18,42 @@ const contentParser = () => {
18
18
  export default {
19
19
  title: 'Global/AppHeader',
20
20
  component: AppHeader,
21
+ tags: ['autodocs'],
21
22
  data() {
22
23
  return {
23
24
  appHeaderData
24
25
  }
25
26
  },
26
27
  argTypes: {
27
- headerMenu: {
28
- control: 'object',
29
- defaultValue: appHeaderData
30
- },
31
28
  contentParser: {
32
- control: 'function',
33
- defaultValue: contentParser,
34
29
  table: { disable: true }
35
- },
36
- isWorkWell: {
37
- control: 'boolean',
38
- defaultValue: false
39
- },
40
- authenticated: {
41
- control: 'boolean',
42
- defaultValue: false
43
30
  }
31
+ },
32
+ args: {
33
+ headerMenu: appHeaderData,
34
+ contentParser: contentParser,
35
+ isWorkWell: false,
36
+ authenticated: false,
37
+ mainContent: 'Some dummy main content required for this example',
38
+ footerContent: 'Some dummy footer content required for this example'
44
39
  }
45
40
  }
46
41
 
47
- const DefaultContent = (args, { argTypes }) => ({
42
+ const DefaultContent = (args) => ({
48
43
  components: { AppHeader },
49
- props: Object.keys(argTypes),
44
+ setup() {
45
+ return { args }
46
+ },
50
47
  template: `
51
48
  <div>
52
49
  <app-header
53
- v-bind="$props"
50
+ v-bind="args"
54
51
  />
55
52
  <main>
56
53
  <div class="container">
57
54
  <div class="row">
58
55
  <div class="col">
59
- {{$props.mainContent}}
56
+ {{args.mainContent}}
60
57
  </div>
61
58
  </div>
62
59
  </div>
@@ -65,7 +62,7 @@ const DefaultContent = (args, { argTypes }) => ({
65
62
  <div class="container">
66
63
  <div class="row">
67
64
  <div class="col">
68
- {{$props.footerContent}}
65
+ {{args.footerContent}}
69
66
  </div>
70
67
  </div>
71
68
  </div>
@@ -75,8 +72,3 @@ const DefaultContent = (args, { argTypes }) => ({
75
72
  })
76
73
 
77
74
  export const Default = DefaultContent.bind({})
78
-
79
- Default.args = {
80
- mainContent: 'Some dummy main content required for this example',
81
- footerContent: 'Some dummy footer content required for this example'
82
- }
@@ -416,14 +416,14 @@
416
416
 
417
417
  <script>
418
418
  import ModalSearch from './ModalSearch/index.vue'
419
- import Close from './../../../assets/icons/close.svg'
420
- import WorkSafeLogo from './../../../assets/icons/AppFooter/worksafe-footer-logo.svg'
421
- import WorkWellLogo from './../../../assets/icons/AppFooter/logo-workwell-reversed.svg'
422
- import CaretRight from './../../../assets/icons/caret-right.svg'
423
- import CaretDown from './../../../assets/icons/caret-down.svg'
424
- import SearchIcon from './../../../assets/icons/AppHeader/search-32px.svg'
425
- import CaretLeft from './../../../assets/icons/caret-left.svg'
426
- import MenuIcon from './../../../assets/icons/AppHeader/menu-32px.svg'
419
+ import Close from './../../../assets/icons/close.svg?component'
420
+ import WorkSafeLogo from './../../../assets/icons/AppFooter/worksafe-footer-logo.svg?url'
421
+ import WorkWellLogo from './../../../assets/icons/AppFooter/logo-workwell-reversed.svg?url'
422
+ import CaretRight from './../../../assets/icons/caret-right.svg?component'
423
+ import CaretDown from './../../../assets/icons/caret-down.svg?component'
424
+ import SearchIcon from './../../../assets/icons/AppHeader/search-32px.svg?component'
425
+ import CaretLeft from './../../../assets/icons/caret-left.svg?component'
426
+ import MenuIcon from './../../../assets/icons/AppHeader/menu-32px.svg?component'
427
427
 
428
428
  export default {
429
429
  components: {
@@ -527,6 +527,7 @@ export default {
527
527
  this.windowWidth = window.innerWidth
528
528
  },
529
529
  firstLevelClick(item, ref) {
530
+ console.log('in first level click')
530
531
  // Reset screen to fix whitespace
531
532
  if (window && window.scrollTo && this.screen === 'desktop') {
532
533
  window.scrollTo(0, 0)
@@ -1,8 +1,10 @@
1
1
  <template>
2
- <h1>Form Instance</h1>
2
+ <div>
3
+ <h1>Form Instance</h1>
3
4
  <p>
4
5
  The .vue and .stories.js files for SubComponents/FormInstance (displayed in Storybook under Form) must be copied from current Storybook 6 branch when time to upgrade them. They are causing errors preventing Storybook from being rendered and therefore tested.
5
6
  </p>
7
+ </div>
6
8
  </template>
7
9
 
8
10
  <script>
@@ -0,0 +1,50 @@
1
+ import Search from './../index.vue'
2
+
3
+ const contentParser = () => {
4
+ return Promise.resolve({
5
+ results: [
6
+ {
7
+ title: 'Content title 1',
8
+ description: 'Content description 2'
9
+ }
10
+ ],
11
+ offset: 0,
12
+ numFound: 1000
13
+ })
14
+ }
15
+
16
+ export default {
17
+ title: 'SubComponents/Search',
18
+ component: { Search },
19
+ tags: ['autodocs'],
20
+ argTypes: {
21
+ contentParser: {
22
+ table: { disable: true }
23
+ },
24
+ googleSearchFlag: {
25
+ table: { disable: true }
26
+ }
27
+ },
28
+ args: {
29
+ pageLimit: 10,
30
+ contentParser: contentParser,
31
+ isTypeahead: false,
32
+ initialSearchQuery: 'Mental Health',
33
+ googleSearchFlag: 'googlerest',
34
+ visibleSearchList: true
35
+ },
36
+
37
+ }
38
+
39
+ const DefaultSearch = (args) => ({
40
+ components: { Search },
41
+ setup () {
42
+ return { args }
43
+ },
44
+ template: `<search
45
+ v-bind="args"
46
+ :search-type="googleSearchFlag"
47
+ ref="googlerest" />`
48
+ })
49
+
50
+ export const GoogleREST = DefaultSearch.bind({})
@@ -0,0 +1,23 @@
1
+ import Search from './../index.vue'
2
+
3
+ export default {
4
+ title: 'SubComponents/Search',
5
+ component: { Search },
6
+ tags: ['autodocs'],
7
+ args: {
8
+ googleSearchFlag: 'google'
9
+ }
10
+ }
11
+
12
+ const DefaultSearch = (args) => ({
13
+ components: { Search },
14
+ setup () {
15
+ return { args }
16
+ },
17
+ template: `<search
18
+ v-bind="args"
19
+ :google-search-flag="googleSearchFlag"
20
+ ref="googlerest" />`
21
+ })
22
+
23
+ export const GoogleSearch = DefaultSearch.bind({})
@@ -1,22 +1,32 @@
1
1
  <template>
2
2
  <div class="app-search-result">
3
- <div v-if="isLoading" class="app-search-result__loader" ></div>
3
+ <div v-if="isLoading" class="app-search-result__loader"></div>
4
4
  <p
5
5
  v-if="!(isTypeahead && numFound > 0) && !isLoading"
6
6
  class="app-search-result__found"
7
7
  >
8
- <span>{{ numFound }} results found for {{ query }}</span>
8
+ <span
9
+ >{{ numFound }} results found for
10
+ {{ !suggestion ? query : suggestion }}</span
11
+ >
12
+ </p>
13
+ <p
14
+ v-if="results && results.length > 0 && suggestion"
15
+ class="app-search-result__suggestion"
16
+ >
17
+ Showing results for <span class="suggestion">{{ suggestion }}</span>
9
18
  </p>
10
19
  <card-grid
11
20
  v-if="results && results.length > 0 && !isLoading"
12
21
  :force-lg-columns-per-row="1"
13
22
  :force-md-columns-per-row="1"
14
23
  :cards="results"
15
- :is-selectable="true"
24
+ :is-selectable="false"
16
25
  :size="'full'"
17
26
  :row-spacing="'none'"
18
27
  :no-padding-top="true"
19
28
  @selected="onSelectResult"
29
+ @selected-title="onSelectCardTitle"
20
30
  >
21
31
  <template v-slot:cardItem="{ card }">
22
32
  <card-grid-item
@@ -29,7 +39,7 @@
29
39
  :description="
30
40
  !isTypeahead && card.description
31
41
  ? truncate(card.description, 144)
32
- : ''
42
+ : card.htmlSnippet || ''
33
43
  "
34
44
  :strip-description-html="true"
35
45
  :taxonomies="{
@@ -37,6 +47,7 @@
37
47
  topic: card.topic,
38
48
  language: card.language
39
49
  }"
50
+ :is-card-title-selectable="isCardTitleSelectable"
40
51
  />
41
52
  </template>
42
53
  <template
@@ -58,7 +69,6 @@
58
69
  :aria-label="'search result pagination'"
59
70
  :rows="pageLimit"
60
71
  :offset="offset"
61
- :max-pages="4"
62
72
  :total="numFound"
63
73
  :align="'start'"
64
74
  @prev="(pg) => $emit('pageChanged', pg.currentPage)"
@@ -113,6 +123,14 @@ export default {
113
123
  isLoading: {
114
124
  type: Boolean,
115
125
  required: false
126
+ },
127
+ suggestion: {
128
+ type: String,
129
+ default: null
130
+ },
131
+ isCardTitleSelectable: {
132
+ type: Boolean,
133
+ default: false
116
134
  }
117
135
  },
118
136
  methods: {
@@ -125,6 +143,18 @@ export default {
125
143
  }
126
144
  return value
127
145
  },
146
+ onSelectCardTitle(card) {
147
+ navigateToPath.call(
148
+ this,
149
+ card?.selectedCard?.link,
150
+ card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
151
+ )
152
+ this.$nextTick(() => this.$emit('selected-title'))
153
+
154
+ if (this.$gtm) {
155
+ this.fireGTM(card)
156
+ }
157
+ },
128
158
  onSelectResult(card) {
129
159
  navigateToPath.call(
130
160
  this,
@@ -132,6 +162,12 @@ export default {
132
162
  card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
133
163
  )
134
164
  this.$nextTick(() => this.$emit('selected'))
165
+
166
+ if (this.$gtm) {
167
+ this.fireGTM(card)
168
+ }
169
+ },
170
+ fireGTM(card) {
135
171
  let attrs = {
136
172
  location:
137
173
  this.$route?.path === '/'
@@ -149,9 +185,7 @@ export default {
149
185
  topic: card?.selectedCard?.topic,
150
186
  language: card?.selectedCard?.language
151
187
  }
152
- if (this.$gtm) {
153
- this.$gtm.push({ event: 'custom.search.site.result', ...attrs })
154
- }
188
+ this.$gtm.push({ event: 'custom.search.site.result', ...attrs })
155
189
  },
156
190
  showMoreResults() {
157
191
  if (this.$nuxt) {
@@ -165,8 +199,13 @@ export default {
165
199
  <style lang="scss" scoped>
166
200
  @import '../../../../includes/scss/all';
167
201
  .app-search-result {
168
- &__found {
202
+ &__found,
203
+ &__suggestion {
169
204
  margin: 40px 16px;
205
+ .suggestion {
206
+ font-weight: bold;
207
+ color: #006bff;
208
+ }
170
209
  }
171
210
 
172
211
  :deep(.card-grid-item__card) {
@@ -214,4 +253,25 @@ export default {
214
253
  }
215
254
  }
216
255
  }
256
+
257
+ .wcl-search__google {
258
+ .app-search-result {
259
+ :deep(.card-grid-item__card) {
260
+ border-radius: 0 !important;
261
+ border-bottom: solid $gray-alt 1px;
262
+ &:hover {
263
+ background-color: transparent !important;
264
+ }
265
+ }
266
+ :deep(.card-title) {
267
+ text-decoration: underline;
268
+ border: 3px solid transparent;
269
+ width: auto;
270
+ &:hover {
271
+ border: 3px solid #da47ff;
272
+ color: #006bff !important;
273
+ }
274
+ }
275
+ }
276
+ }
217
277
  </style>
@@ -15,29 +15,32 @@ const contentParser = () => {
15
15
 
16
16
  export default {
17
17
  title: 'SubComponents/Search',
18
- component: Search,
18
+ component: { Search },
19
+ tags: ['autodocs'],
19
20
  argTypes: {
20
- pageLimit: {
21
- control: 'number'
22
- },
23
21
  contentParser: {
24
- control: 'function',
25
22
  table: { disable: true }
26
- },
27
- isTypeahead: {
28
- control: 'boolean'
29
- },
30
- initialSearchQuery: {
31
- control: 'text'
32
23
  }
33
- }
34
- }
35
-
36
- export const Default = {
24
+ },
37
25
  args: {
38
26
  pageLimit: 5,
39
27
  contentParser: contentParser,
40
28
  isTypeahead: false,
41
- initialSearchQuery: 'Metal'
29
+ initialSearchQuery: 'Metal',
30
+ googleSearchFlag: 'solar',
31
+ visibleSearchList: true
42
32
  }
43
33
  }
34
+
35
+ const DefaultSearch = (args) => ({
36
+ components: { Search },
37
+ setup () {
38
+ return { args }
39
+ },
40
+ template: `<search
41
+ v-bind="args"
42
+ ref="solrsearch" />`
43
+ })
44
+
45
+ export const Default = DefaultSearch.bind({})
46
+