@worksafevictoria/wcl7.5 1.17.1 → 1.18.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 (65) hide show
  1. package/package.json +1 -1
  2. package/src/assets/icons/chevron-right-icon.svg +14 -0
  3. package/src/assets/icons/notepad.svg +93 -0
  4. package/src/assets/icons/question.svg +7 -0
  5. package/src/components/Common/CardGrid/index.vue +83 -74
  6. package/src/components/Common/CardGridItem/index.vue +31 -4
  7. package/src/components/Containers/Carousel/index.vue +24 -4
  8. package/src/components/Containers/SectionGroup/index.stories.js +28 -27
  9. package/src/components/Containers/SectionGroup/index.vue +5 -0
  10. package/src/components/Global/AppHeaderNew/index.vue +9 -1
  11. package/src/components/Global/AppHeaderNew/mobile.scss +4 -2
  12. package/src/components/Global/HeroHeader/index.vue +74 -57
  13. package/src/components/Paragraphs/Calculator/CardContainer/index.vue +69 -62
  14. package/src/components/Paragraphs/Calculator/CardContainer/styles.scss +72 -68
  15. package/src/components/Paragraphs/Calculator/index.vue +61 -44
  16. package/src/components/Paragraphs/RTWPlanner/CardContainer/index.vue +134 -0
  17. package/src/components/Paragraphs/RTWPlanner/Constants.js +433 -0
  18. package/src/components/Paragraphs/RTWPlanner/Footer/index.vue +32 -0
  19. package/src/components/Paragraphs/RTWPlanner/{NavBar → Header}/index.vue +20 -9
  20. package/src/components/Paragraphs/RTWPlanner/HomePage/index.vue +72 -0
  21. package/src/components/Paragraphs/RTWPlanner/Injuries/index.vue +231 -0
  22. package/src/components/Paragraphs/RTWPlanner/Planners/PlanTasks.vue +9 -8
  23. package/src/components/Paragraphs/RTWPlanner/Planners/PlannerNameModal.vue +97 -0
  24. package/src/components/Paragraphs/RTWPlanner/Planners/index.vue +367 -175
  25. package/src/components/Paragraphs/RTWPlanner/index.stories.js +82 -15
  26. package/src/components/Paragraphs/RTWPlanner/index.vue +109 -31
  27. package/src/components/Paragraphs/SelectableCards/Control/index.stories.js +32 -11
  28. package/src/components/Paragraphs/SelectableCards/cardbody.vue +9 -10
  29. package/src/components/Paragraphs/SelectableCards/cardtop.vue +23 -16
  30. package/src/components/Paragraphs/SelectableCards/index.stories.js +29 -8
  31. package/src/components/Paragraphs/SelectableCards/index.vue +124 -50
  32. package/src/components/Paragraphs/TextMedia/index.vue +4 -0
  33. package/src/components/SubComponents/Breadcrumb/index.vue +40 -7
  34. package/src/components/SubComponents/FormInstance/models/base-form-element.js +4 -3
  35. package/src/components/SubComponents/FormInstance/services/form-render-parser.js +51 -16
  36. package/src/components/SubComponents/FormInstance/services/logic-parser.js +122 -18
  37. package/src/components/SubComponents/FormInstance/services/registry-factory.js +52 -50
  38. package/src/components/SubComponents/FormInstance/stories/mocks/checkboxesother.json +1 -10
  39. package/src/components/SubComponents/FormInstance/stories/mocks/emailconfirm.json +1 -10
  40. package/src/components/SubComponents/FormInstance/stories/mocks/jahd.json +1 -5
  41. package/src/components/SubComponents/FormInstance/stories/mocks/quad.json +1 -5
  42. package/src/components/SubComponents/FormInstance/stories/mocks/radiosother.json +1 -9
  43. package/src/components/SubComponents/FormInstance/stories/mocks/sameas.json +1 -5
  44. package/src/components/SubComponents/FormInstance/stories/mocks/selectother.json +1 -10
  45. package/src/components/SubComponents/FormInstance/stories/mocks/styles.json +1 -5
  46. package/src/components/SubComponents/FormInstance/stories/mocks/table-select.json +1 -15
  47. package/src/components/SubComponents/FormInstance/stories/mocks/token.json +1 -5
  48. package/src/components/SubComponents/FormInstance/stories/mocks/twig.json +1 -13
  49. package/src/components/SubComponents/FormInstance/stories/mocks/wizard.json +1 -13
  50. package/src/components/SubComponents/FormInstance/tests/form-test-utils.js +3 -0
  51. package/src/components/SubComponents/FormInstance/tests/form.test.js +2 -1
  52. package/src/components/SubComponents/FormInstance/tests/radiosother.test.js +12 -11
  53. package/src/components/SubComponents/FormInstance/tests/rule-disabled.test.js +13 -45
  54. package/src/components/SubComponents/FormInstance/tests/rule-enabled-value.test.js +8 -24
  55. package/src/components/SubComponents/FormInstance/tests/rule-hidden.test.js +13 -45
  56. package/src/components/SubComponents/FormInstance/tests/rule-required-value.test.js +15 -55
  57. package/src/components/SubComponents/FormInstance/tests/rule-visible.test.js +0 -413
  58. package/src/components/SubComponents/FormInstance/tests/sameas.test.js +9 -25
  59. package/src/components/SubComponents/FormInstance/tests/twig.test.js +7 -5
  60. package/src/components/SubComponents/ResourceGroup/index.vue +1 -1
  61. package/src/includes/scss/vars/src/colors.module.scss +3 -0
  62. package/src/includes/scss/vars/src/colors.scss +3 -0
  63. package/src/index.js +6 -0
  64. package/src/mock/control-selectable-cards.js +68 -25
  65. package/src/components/Paragraphs/RTWPlanner/Home/index.vue +0 -83
@@ -0,0 +1,72 @@
1
+ <script setup>
2
+ import Container from './../../../Containers/Container/index.vue'
3
+ import TextMedia from './../../TextMedia/index.vue'
4
+
5
+ const props = defineProps({
6
+ textMedia: {
7
+ type: Object,
8
+ required: true,
9
+ },
10
+ selectInjuries: {
11
+ type: Object,
12
+ required: true,
13
+ },
14
+ })
15
+ </script>
16
+
17
+ <template>
18
+ <div>
19
+ <TextMedia
20
+ :media-type="'image'"
21
+ :title-text="textMedia.title"
22
+ :title-tag="textMedia.titleTag"
23
+ :content="textMedia.content"
24
+ :image="textMedia.image"
25
+ :rtl="textMedia.rtl"
26
+ />
27
+
28
+ <Container fluid class="my-4">
29
+ <h2>Select your injury</h2>
30
+
31
+ <div>
32
+ <TextMedia
33
+ :media-type="'icon'"
34
+ :title-text="selectInjuries.physical.title"
35
+ :content="selectInjuries.physical.content"
36
+ :glyph="selectInjuries.physical.image.url"
37
+ :icon-alt="selectInjuries.physical.image.alt"
38
+ :glyph-height="60"
39
+ :glyph-width="60"
40
+ />
41
+
42
+ <TextMedia
43
+ :media-type="'icon'"
44
+ :title-text="selectInjuries.mental.title"
45
+ :content="selectInjuries.mental.content"
46
+ :glyph="selectInjuries.mental.image.url"
47
+ :icon-alt="selectInjuries.mental.image.alt"
48
+ :glyph-height="60"
49
+ :glyph-width="60"
50
+ />
51
+
52
+ <TextMedia
53
+ :media-type="'icon'"
54
+ :title-text="selectInjuries.other.title"
55
+ :content="selectInjuries.other.content"
56
+ :glyph="selectInjuries.other.image.url"
57
+ :icon-alt="selectInjuries.other.image.alt"
58
+ :glyph-height="60"
59
+ :glyph-width="60"
60
+ />
61
+ </div>
62
+ </Container>
63
+ </div>
64
+ </template>
65
+
66
+ <style scoped>
67
+ .lightgrey-bg {
68
+ border-radius: 12px;
69
+ border: 4px solid #727272;
70
+ background: #f5f5f5;
71
+ }
72
+ </style>
@@ -0,0 +1,231 @@
1
+ <script setup>
2
+ import { ref, watch } from 'vue'
3
+ import HeroHeader from './../../../Global/HeroHeader/index.vue'
4
+ import CardContainer from './../CardContainer/index.vue'
5
+ import Breakout from './../../Breakout/index.vue'
6
+ import SectionGroup from './../../../Containers/SectionGroup/index.vue'
7
+ import CardGroup from './../../../SubComponents/CardGroup/index.vue'
8
+ import Breadcrumb from './../../../SubComponents/Breadcrumb/index.vue'
9
+ import RichText from './../../RichText/index.vue'
10
+ import SelectableCards from './../../SelectableCards/index.vue'
11
+ import PlannerNameModal from './../Planners/PlannerNameModal.vue'
12
+
13
+ const props = defineProps({
14
+ injuryPage: {
15
+ type: String,
16
+ default: null,
17
+ },
18
+ titles: {
19
+ type: Object,
20
+ default: () => {},
21
+ },
22
+ heroHeader: {
23
+ type: Object,
24
+ default: () => {},
25
+ },
26
+ cards: {
27
+ type: Array,
28
+ default: () => [],
29
+ },
30
+ breakout: {
31
+ type: Object,
32
+ default: () => {},
33
+ },
34
+ rtwCards: {
35
+ type: Array,
36
+ default: () => [],
37
+ },
38
+ contactCards: {
39
+ type: Array,
40
+ default: () => [],
41
+ },
42
+ breadcrumbItems: {
43
+ type: Array,
44
+ default: () => [],
45
+ },
46
+ showModalOnButtonRole: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ })
51
+
52
+ const screen = ref(1)
53
+ const selectedCard = ref(null)
54
+ const showModal = ref(false)
55
+
56
+ // local copy of breadcrumb items allowed to mutate
57
+ const breadcrumbItemsLocal = ref([...props.breadcrumbItems])
58
+
59
+ // keep local in sync with incoming props when we're on screen 1
60
+ watch(
61
+ () => props.breadcrumbItems,
62
+ (val) => {
63
+ if (screen.value === 1) {
64
+ breadcrumbItemsLocal.value = [...val]
65
+ }
66
+ },
67
+ { immediate: true },
68
+ )
69
+
70
+ function nextScreen(card) {
71
+ selectedCard.value = card
72
+ screen.value = 2
73
+
74
+ if (props.injuryPage === 'physicalInjury') {
75
+ breadcrumbItemsLocal.value = [
76
+ {
77
+ text: 'Physical Injury',
78
+ to: '/',
79
+ },
80
+ ]
81
+ }
82
+ }
83
+
84
+ function onCrumbClick({ index }) {
85
+ // clicking the first crumb → back to screen 1
86
+ if (index === 0) {
87
+ screen.value = 1
88
+ selectedCard.value = null
89
+ breadcrumbItemsLocal.value = [...props.breadcrumbItems]
90
+ }
91
+
92
+ // if you want the second crumb clickable to stay on screen 2,
93
+ // you can add logic for index === 1 here, or just leave it as no-op.
94
+ }
95
+
96
+ function nextScreenAgent(card) {
97
+ showModal.value = true
98
+ }
99
+ </script>
100
+
101
+ <template>
102
+ <div class="injuries-app">
103
+ <breadcrumb
104
+ :breadcrumb-items="breadcrumbItemsLocal"
105
+ :intercept-clicks="true"
106
+ @item-click="onCrumbClick"
107
+ />
108
+
109
+ <div v-if="injuryPage === 'physicalInjury' && screen === 1">
110
+ <hero-header
111
+ :image="null"
112
+ :show-mask="false"
113
+ :title="heroHeader.title"
114
+ :description="heroHeader.description"
115
+ :bg-color="null"
116
+ :show-social="false"
117
+ class="hero-header"
118
+ />
119
+ <breakout :title="breakout.title" :body="breakout.body" />
120
+
121
+ <card-container
122
+ ref="physicalCardContainer"
123
+ :titles="titles.physical"
124
+ :cards="cards"
125
+ :button-role="'modal-quest'"
126
+ :showModalOnButtonRole="showModalOnButtonRole"
127
+ @nextScreen="nextScreen"
128
+ />
129
+ </div>
130
+
131
+ <div
132
+ v-if="
133
+ injuryPage === 'mentalInjury' ||
134
+ injuryPage === 'otherInjury' ||
135
+ screen === 2
136
+ "
137
+ >
138
+ <section-group
139
+ v-if="selectedCard?.value || cards.content"
140
+ :background-variant="'lavendergray'"
141
+ class="injuries-app__injury"
142
+ >
143
+ <rich-text
144
+ :content="selectedCard?.value || cards.content"
145
+ :without-container="true"
146
+ />
147
+ </section-group>
148
+
149
+ <card-group
150
+ v-if="rtwCards.length > 0"
151
+ class="injuries-app__rtw-cards"
152
+ :title="titles.rtwCards?.heading"
153
+ :title-tag="'h3'"
154
+ :cards="rtwCards"
155
+ :loading="false"
156
+ :columns="3"
157
+ :show-load-more="false"
158
+ :background="'white'"
159
+ />
160
+
161
+ <selectable-cards
162
+ class="injuries-app__contact-info"
163
+ :title="titles.cardContactInformaton?.heading"
164
+ :button-role="'none'"
165
+ :columns-per-row="4"
166
+ :cards="contactCards"
167
+ :icon-is-bordered="false"
168
+ :card-type="'control-selectcards'"
169
+ :card-text-align="'center'"
170
+ :is-selectable="'false'"
171
+ ></selectable-cards>
172
+ </div>
173
+
174
+ <div v-if="injuryPage === 'selectAgent'">
175
+ <card-container
176
+ ref="selectAgentContainer"
177
+ :columns="4"
178
+ :title="titles.cardContactInformaton?.heading"
179
+ :cards="contactCards"
180
+ :button-role="'link'"
181
+ @nextScreen="nextScreenAgent"
182
+ />
183
+ </div>
184
+
185
+ <PlannerNameModal class="injuries-app__new-planner" v-model="showModal" />
186
+ </div>
187
+ </template>
188
+
189
+ <style lang="scss" scoped>
190
+ .injuries-app {
191
+ .wcl-hero-header {
192
+ border: none;
193
+ }
194
+
195
+ .wcl-breadcrumb {
196
+ margin: 50px 0 20px 0;
197
+ :deep(.breadcrumb) {
198
+ font-size: 12px;
199
+ }
200
+
201
+ &--ltr {
202
+ :deep(.breadcrumb-item:first-of-type::before) {
203
+ content: '<';
204
+ margin-right: 10px;
205
+ }
206
+ }
207
+ }
208
+
209
+ &__injury {
210
+ border-radius: 8px !important;
211
+ :deep(a.cta-button) {
212
+ display: none;
213
+ }
214
+ }
215
+
216
+ &__rtw-cards {
217
+ @media (min-width: 1024px) {
218
+ :deep(.section-group__heading) {
219
+ width: 75%;
220
+ }
221
+ }
222
+ }
223
+
224
+ &__contact-info {
225
+ :deep(.card-unit) {
226
+ padding: 0;
227
+ font-weight: bold;
228
+ }
229
+ }
230
+ }
231
+ </style>
@@ -56,8 +56,8 @@
56
56
  ? 'bg-success-subtle text-dark fw-bold active-done'
57
57
  : 'bg-success-subtle text-dark fw-bold'
58
58
  : activeContent.id === content.id
59
- ? 'active'
60
- : 'bg-light text-muted'
59
+ ? 'active'
60
+ : 'bg-light text-muted'
61
61
  "
62
62
  @click="setActiveContent(task, content)"
63
63
  >
@@ -90,26 +90,26 @@
90
90
 
91
91
  <script setup>
92
92
  import { ref } from 'vue'
93
- import { CtaButton, Row, Column, Container } from '@worksafevictoria/wcl7.5'
94
- import TickCircleIcon from './icons/TickCircleIcon.vue'
93
+ // import { CtaButton, Row, Column, Container }
94
+ import TickCircleIcon from './../icons/TickCircleIcon.vue'
95
95
 
96
96
  const props = defineProps({
97
97
  activePlanner: { type: Object, required: true },
98
- tasks: { type: Array, required: true }
98
+ tasks: { type: Array, required: true },
99
99
  })
100
100
 
101
101
  const emit = defineEmits(['updatePlanner'])
102
102
  const tasks = ref([])
103
103
  const activeTask = ref(props.tasks[0] || { id: '', title: '', content: [] })
104
104
  const activeContent = ref(
105
- props.tasks[0]?.content[0] || { btnText: '', html: '' }
105
+ props.tasks[0]?.content[0] || { btnText: '', html: '' },
106
106
  )
107
107
 
108
108
  const toggleTask = (taskId, contentId) => {
109
109
  const key = `${taskId}_${contentId}`
110
110
  const updatedPlanner = {
111
111
  ...props.activePlanner,
112
- tasksCompleted: [...props.activePlanner.tasksCompleted]
112
+ tasksCompleted: [...props.activePlanner.tasksCompleted],
113
113
  }
114
114
  const index = updatedPlanner.tasksCompleted.indexOf(key)
115
115
  if (index === -1) {
@@ -153,7 +153,8 @@ const getNextTask = () => {
153
153
  </script>
154
154
 
155
155
  <style lang="scss" scoped>
156
- @import '@worksafevictoria/wcl7.5/src/includes/scss/all.scss';
156
+ @import './../../../../includes/scss/all.scss';
157
+
157
158
  .active {
158
159
  color: black !important;
159
160
  background-color: $yellow !important;
@@ -0,0 +1,97 @@
1
+ <script setup>
2
+ import { computed } from 'vue'
3
+ import { BModal, BFormInput } from 'bootstrap-vue-next'
4
+ import CtaButton from './../../../SubComponents/CtaButton/index.vue'
5
+
6
+ // props from parent
7
+ const props = defineProps({
8
+ modelValue: {
9
+ type: Boolean,
10
+ default: false, // used by v-model on PlannerNameModal
11
+ },
12
+ value: {
13
+ type: String,
14
+ default: '', // used by v-model:value on PlannerNameModal
15
+ },
16
+ })
17
+
18
+ const emit = defineEmits([
19
+ 'update:modelValue', // for v-model (show/hide)
20
+ 'update:value', // for v-model:value (input text)
21
+ 'onsubmit', // custom event to send value to parent
22
+ ])
23
+
24
+ // proxy for v-model on <b-modal>
25
+ const show = computed({
26
+ get: () => props.modelValue,
27
+ set: (val) => emit('update:modelValue', val),
28
+ })
29
+
30
+ // proxy for v-model on input (goes to parent)
31
+ const inputValue = computed({
32
+ get: () => props.value,
33
+ set: (val) => emit('update:value', val),
34
+ })
35
+
36
+ function handleSubmit() {
37
+ const trimmed = inputValue.value.trim()
38
+ console.log('handle Submit', trimmed)
39
+
40
+ if (!trimmed) return
41
+
42
+ // emit value to parent
43
+ emit('onsubmit', trimmed)
44
+
45
+ // close modal
46
+ emit('update:modelValue', false)
47
+
48
+ // optional: clear input in parent
49
+ emit('update:value', '')
50
+ }
51
+ </script>
52
+
53
+ <template>
54
+ <b-modal
55
+ v-model="show"
56
+ aria-labelledby="injuries-app__modal"
57
+ no-close-on-backdrop
58
+ centered
59
+ no-footer
60
+ size="lg"
61
+ >
62
+ <template #default="{ close }">
63
+ <div class="p-3">
64
+ <h3 class="fw-bold mb-3 modal-title__new-planner">Name your planner</h3>
65
+ <p class="mb-4 modal-description__new-planner">
66
+ Give your planner a name so you can easily find it and pick up where
67
+ you left off.
68
+ </p>
69
+
70
+ <label for="modal2CB" class="fw-bold mb-2">
71
+ Injured workers first name
72
+ </label>
73
+
74
+ <BFormInput
75
+ id="modal2CB"
76
+ name="modal2CB"
77
+ placeholder=""
78
+ v-model="inputValue"
79
+ class="mb-4 input__new-planner"
80
+ @keyup.enter="handleSubmit"
81
+ />
82
+
83
+ <CtaButton ref="calNextBtn" @click="handleSubmit">Next</CtaButton>
84
+ </div>
85
+ </template>
86
+ </b-modal>
87
+ </template>
88
+
89
+ <style lang="scss" scoped>
90
+ :deep(.modal-description__new-planner) {
91
+ width: 65%;
92
+ }
93
+
94
+ :deep(.input__new-planner) {
95
+ width: 60%;
96
+ }
97
+ </style>