@worksafevictoria/wcl7.5 1.17.0 → 1.18.0-beta.1
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/assets/icons/chevron-right-icon.svg +14 -0
- package/src/assets/icons/notepad.svg +93 -0
- package/src/assets/icons/question.svg +7 -0
- package/src/components/Common/CardGrid/index.vue +83 -74
- package/src/components/Common/CardGridItem/index.vue +31 -4
- package/src/components/Containers/Carousel/index.vue +24 -4
- package/src/components/Containers/SectionGroup/index.stories.js +28 -27
- package/src/components/Containers/SectionGroup/index.vue +5 -0
- package/src/components/Global/AppHeaderNew/index.vue +9 -1
- package/src/components/Global/AppHeaderNew/mobile.scss +5 -2
- package/src/components/Global/AppHeaderNew/styles.scss +6 -5
- package/src/components/Global/HeroHeader/index.vue +74 -57
- package/src/components/Paragraphs/Calculator/CardContainer/index.vue +68 -60
- package/src/components/Paragraphs/Calculator/index.vue +24 -22
- package/src/components/Paragraphs/RTWPlanner/CardContainer/index.vue +133 -0
- package/src/components/Paragraphs/RTWPlanner/Constants.js +433 -0
- package/src/components/Paragraphs/RTWPlanner/Footer/index.vue +32 -0
- package/src/components/Paragraphs/RTWPlanner/{NavBar → Header}/index.vue +20 -9
- package/src/components/Paragraphs/RTWPlanner/HomePage/index.vue +72 -0
- package/src/components/Paragraphs/RTWPlanner/Injuries/index.vue +226 -0
- package/src/components/Paragraphs/RTWPlanner/Planners/PlanTasks.vue +9 -8
- package/src/components/Paragraphs/RTWPlanner/Planners/PlannerNameModal.vue +97 -0
- package/src/components/Paragraphs/RTWPlanner/Planners/index.vue +367 -175
- package/src/components/Paragraphs/RTWPlanner/index.stories.js +82 -15
- package/src/components/Paragraphs/RTWPlanner/index.vue +109 -31
- package/src/components/Paragraphs/SelectableCards/Control/index.stories.js +31 -11
- package/src/components/Paragraphs/SelectableCards/cardbody.vue +9 -10
- package/src/components/Paragraphs/SelectableCards/cardtop.vue +23 -16
- package/src/components/Paragraphs/SelectableCards/index.stories.js +29 -8
- package/src/components/Paragraphs/SelectableCards/index.vue +124 -50
- package/src/components/Paragraphs/TextMedia/index.vue +4 -0
- package/src/components/Paragraphs/VideoPlayer/index.vue +1 -1
- package/src/components/SubComponents/Breadcrumb/index.vue +40 -7
- package/src/components/SubComponents/FormInstance/models/base-form-element.js +4 -3
- package/src/components/SubComponents/FormInstance/services/form-render-parser.js +51 -16
- package/src/components/SubComponents/FormInstance/services/logic-parser.js +122 -18
- package/src/components/SubComponents/FormInstance/services/registry-factory.js +52 -50
- package/src/components/SubComponents/FormInstance/stories/mocks/checkboxesother.json +1 -10
- package/src/components/SubComponents/FormInstance/stories/mocks/emailconfirm.json +1 -10
- package/src/components/SubComponents/FormInstance/stories/mocks/jahd.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/quad.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/radiosother.json +1 -9
- package/src/components/SubComponents/FormInstance/stories/mocks/sameas.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/selectother.json +1 -10
- package/src/components/SubComponents/FormInstance/stories/mocks/styles.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/table-select.json +1 -15
- package/src/components/SubComponents/FormInstance/stories/mocks/token.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/twig.json +1 -13
- package/src/components/SubComponents/FormInstance/stories/mocks/wizard.json +1 -13
- package/src/components/SubComponents/FormInstance/tests/form-test-utils.js +3 -0
- package/src/components/SubComponents/FormInstance/tests/form.test.js +2 -1
- package/src/components/SubComponents/FormInstance/tests/radiosother.test.js +12 -11
- package/src/components/SubComponents/FormInstance/tests/rule-disabled.test.js +13 -45
- package/src/components/SubComponents/FormInstance/tests/rule-enabled-value.test.js +8 -24
- package/src/components/SubComponents/FormInstance/tests/rule-hidden.test.js +13 -45
- package/src/components/SubComponents/FormInstance/tests/rule-required-value.test.js +15 -55
- package/src/components/SubComponents/FormInstance/tests/rule-visible.test.js +0 -413
- package/src/components/SubComponents/FormInstance/tests/sameas.test.js +9 -25
- package/src/components/SubComponents/FormInstance/tests/twig.test.js +7 -5
- package/src/components/SubComponents/ResourceGroup/index.vue +1 -1
- package/src/includes/scss/vars/src/colors.module.scss +3 -0
- package/src/includes/scss/vars/src/colors.scss +3 -0
- package/src/index.js +6 -0
- package/src/mock/control-selectable-cards.js +68 -25
- package/src/components/Paragraphs/RTWPlanner/Home/index.vue +0 -83
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
:cards="cards"
|
|
8
8
|
class="ffh-card-container control-selectablecards"
|
|
9
9
|
:card-type="typeCard"
|
|
10
|
+
:button-role="'radio'"
|
|
10
11
|
:icon-is-bordered="iconIsBordered"
|
|
11
12
|
:card-text-align="cardItemTextAlign"
|
|
12
13
|
@selected="selectedCardChangeFocus"
|
|
@@ -87,18 +88,18 @@
|
|
|
87
88
|
</template>
|
|
88
89
|
|
|
89
90
|
<script>
|
|
90
|
-
import Container from
|
|
91
|
-
import Column from
|
|
92
|
-
import Row from
|
|
93
|
-
import CtaButton from
|
|
94
|
-
import SelectableCards from
|
|
95
|
-
import CaretDown from
|
|
96
|
-
import CaretUp from
|
|
97
|
-
import CaretRight from
|
|
98
|
-
import CaretLeft from
|
|
91
|
+
import Container from '../../../Containers/Container/index.vue'
|
|
92
|
+
import Column from '../../../Containers/Column/index.vue'
|
|
93
|
+
import Row from '../../../Containers/Row/index.vue'
|
|
94
|
+
import CtaButton from '../../../SubComponents/CtaButton/index.vue'
|
|
95
|
+
import SelectableCards from '../../SelectableCards/index.vue'
|
|
96
|
+
import CaretDown from '../../../../assets/icons/caret-down.svg?url'
|
|
97
|
+
import CaretUp from '../../../../assets/icons/caret-up.svg?url'
|
|
98
|
+
import CaretRight from '../../../../assets/icons/caret-right.svg?url'
|
|
99
|
+
import CaretLeft from '../../../../assets/icons/caret-left.svg?url'
|
|
99
100
|
|
|
100
101
|
export default {
|
|
101
|
-
name:
|
|
102
|
+
name: 'CardContainer',
|
|
102
103
|
components: {
|
|
103
104
|
Column,
|
|
104
105
|
Container,
|
|
@@ -131,6 +132,10 @@ export default {
|
|
|
131
132
|
type: Array,
|
|
132
133
|
default: () => [],
|
|
133
134
|
},
|
|
135
|
+
buttonRole: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: 'radio',
|
|
138
|
+
},
|
|
134
139
|
},
|
|
135
140
|
data() {
|
|
136
141
|
return {
|
|
@@ -138,108 +143,111 @@ export default {
|
|
|
138
143
|
CaretDown,
|
|
139
144
|
CaretRight,
|
|
140
145
|
CaretLeft,
|
|
141
|
-
typeCard:
|
|
142
|
-
cardItemTextAlign:
|
|
146
|
+
typeCard: 'control-selectcards',
|
|
147
|
+
cardItemTextAlign: 'center',
|
|
143
148
|
title: null,
|
|
144
149
|
cards: null,
|
|
145
150
|
cardUnit: null,
|
|
146
|
-
placeHolder:
|
|
151
|
+
placeHolder: '000',
|
|
147
152
|
inputValueDisplay: null,
|
|
148
153
|
minValue: 0.25,
|
|
149
154
|
maxValue: 500,
|
|
150
155
|
selectedCard: null,
|
|
151
156
|
selectedInput: null,
|
|
152
|
-
}
|
|
157
|
+
}
|
|
153
158
|
},
|
|
154
159
|
computed: {
|
|
155
160
|
isButtonDisabled() {
|
|
156
161
|
// Call the function to get its result, then check if either selectedCard is null or inputValueDisplay is null
|
|
157
|
-
return this.getValueWithoutUnits === null
|
|
162
|
+
return this.getValueWithoutUnits === null
|
|
158
163
|
},
|
|
159
164
|
getValueWithoutUnits() {
|
|
160
165
|
// Ensure that inputValueDisplay is not null before attempting to replace
|
|
161
166
|
if (this.inputValueDisplay !== null) {
|
|
162
167
|
// Remove units (e.g., 'kg' or 'meters') from the input value
|
|
163
|
-
const valueWithoutUnits = this.inputValueDisplay.replace(
|
|
168
|
+
const valueWithoutUnits = this.inputValueDisplay.replace(
|
|
169
|
+
/kg|meters/i,
|
|
170
|
+
'',
|
|
171
|
+
)
|
|
164
172
|
// Convert the remaining value to a numeric representation
|
|
165
|
-
const numericValue = parseFloat(valueWithoutUnits)
|
|
173
|
+
const numericValue = parseFloat(valueWithoutUnits)
|
|
166
174
|
// Check if numericValue is a valid number
|
|
167
175
|
if (!isNaN(numericValue)) {
|
|
168
176
|
// Use toFixed(2) to display the number with two decimal places
|
|
169
|
-
return parseFloat(numericValue.toFixed(2))
|
|
177
|
+
return parseFloat(numericValue.toFixed(2))
|
|
170
178
|
} else {
|
|
171
|
-
return null
|
|
179
|
+
return null
|
|
172
180
|
}
|
|
173
181
|
} else {
|
|
174
|
-
return null
|
|
182
|
+
return null
|
|
175
183
|
}
|
|
176
184
|
},
|
|
177
185
|
},
|
|
178
186
|
mounted() {
|
|
179
|
-
this.inputValueDisplay = null
|
|
187
|
+
this.inputValueDisplay = null
|
|
180
188
|
if (this.isWeight) {
|
|
181
|
-
this.title = this.titles.weight
|
|
182
|
-
this.cards = this.weights
|
|
183
|
-
this.cardUnit =
|
|
184
|
-
this.placeHolder = this.placeHolder + this.cardUnit
|
|
185
|
-
this.minValue = 0.25
|
|
186
|
-
this.maxValue = 500
|
|
189
|
+
this.title = this.titles.weight
|
|
190
|
+
this.cards = this.weights
|
|
191
|
+
this.cardUnit = ' kg'
|
|
192
|
+
this.placeHolder = this.placeHolder + this.cardUnit
|
|
193
|
+
this.minValue = 0.25
|
|
194
|
+
this.maxValue = 500
|
|
187
195
|
} else {
|
|
188
|
-
this.title = this.titles.height
|
|
189
|
-
this.cards = this.heights
|
|
190
|
-
this.cardUnit =
|
|
191
|
-
this.placeHolder = this.placeHolder + this.cardUnit
|
|
192
|
-
this.minValue = 2
|
|
193
|
-
this.maxValue = 250
|
|
196
|
+
this.title = this.titles.height
|
|
197
|
+
this.cards = this.heights
|
|
198
|
+
this.cardUnit = ' meters'
|
|
199
|
+
this.placeHolder = this.placeHolder + this.cardUnit
|
|
200
|
+
this.minValue = 2
|
|
201
|
+
this.maxValue = 250
|
|
194
202
|
}
|
|
195
203
|
},
|
|
196
204
|
methods: {
|
|
197
205
|
handlePrevScreen() {
|
|
198
|
-
this.$emit(
|
|
206
|
+
this.$emit('prevScreen')
|
|
199
207
|
},
|
|
200
208
|
handleNextScreen() {
|
|
201
209
|
// Only emit the 'nextScreen' event if the button is not disabled
|
|
202
210
|
if (!this.isButtonDisabled) {
|
|
203
|
-
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
211
|
+
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
204
212
|
|
|
205
|
-
this.inputValueDisplay = null
|
|
206
|
-
this.$emit(
|
|
213
|
+
this.inputValueDisplay = null
|
|
214
|
+
this.$emit('nextScreen', this.selectedInput)
|
|
207
215
|
}
|
|
208
216
|
},
|
|
209
217
|
selectedCardChangeFocus(card) {
|
|
210
218
|
// if statement added to overcome issue of lost values when function is called twice
|
|
211
219
|
if (card.value !== undefined) {
|
|
212
|
-
this.selectedCard = card
|
|
213
|
-
this.selectedInput = null
|
|
214
|
-
this.inputValueDisplay = card.value +
|
|
215
|
-
this.$nextTick(() => this.$refs.calNextBtn.$el.focus())
|
|
220
|
+
this.selectedCard = card
|
|
221
|
+
this.selectedInput = null
|
|
222
|
+
this.inputValueDisplay = card.value + ' ' + this.cardUnit
|
|
223
|
+
this.$nextTick(() => this.$refs.calNextBtn.$el.focus())
|
|
216
224
|
}
|
|
217
225
|
},
|
|
218
226
|
clearCard() {
|
|
219
|
-
this.selectedInput = null
|
|
227
|
+
this.selectedInput = null
|
|
220
228
|
|
|
221
|
-
this.selectedCard = null
|
|
222
|
-
this.$refs.cardDeck.clearCard()
|
|
229
|
+
this.selectedCard = null
|
|
230
|
+
this.$refs.cardDeck.clearCard()
|
|
223
231
|
},
|
|
224
232
|
incrementValue() {
|
|
225
233
|
if (this.selectedCard !== null) {
|
|
226
|
-
this.$refs.cardDeck.clearCard()
|
|
234
|
+
this.$refs.cardDeck.clearCard()
|
|
227
235
|
}
|
|
228
236
|
|
|
229
|
-
let newValue = Math.min(this.getValueWithoutUnits + 1, this.maxValue)
|
|
230
|
-
this.inputValueDisplay = newValue + this.cardUnit
|
|
237
|
+
let newValue = Math.min(this.getValueWithoutUnits + 1, this.maxValue)
|
|
238
|
+
this.inputValueDisplay = newValue + this.cardUnit
|
|
231
239
|
|
|
232
|
-
this.selectedInput = { value: newValue }
|
|
240
|
+
this.selectedInput = { value: newValue }
|
|
233
241
|
},
|
|
234
242
|
decrementValue() {
|
|
235
243
|
if (this.selectedCard !== null) {
|
|
236
|
-
this.$refs.cardDeck.clearCard()
|
|
244
|
+
this.$refs.cardDeck.clearCard()
|
|
237
245
|
}
|
|
238
246
|
|
|
239
|
-
let newValue = Math.max(this.getValueWithoutUnits - 1, this.minValue)
|
|
240
|
-
this.inputValueDisplay = newValue + this.cardUnit
|
|
247
|
+
let newValue = Math.max(this.getValueWithoutUnits - 1, this.minValue)
|
|
248
|
+
this.inputValueDisplay = newValue + this.cardUnit
|
|
241
249
|
|
|
242
|
-
this.selectedInput = { value: newValue }
|
|
250
|
+
this.selectedInput = { value: newValue }
|
|
243
251
|
},
|
|
244
252
|
// Validate the input value on blur
|
|
245
253
|
validateInput() {
|
|
@@ -250,28 +258,28 @@ export default {
|
|
|
250
258
|
this.getValueWithoutUnits <= this.maxValue
|
|
251
259
|
) {
|
|
252
260
|
// Value is within the range, update the input value
|
|
253
|
-
this.inputValueDisplay = this.getValueWithoutUnits + this.cardUnit
|
|
261
|
+
this.inputValueDisplay = this.getValueWithoutUnits + this.cardUnit
|
|
254
262
|
|
|
255
263
|
// alternate..
|
|
256
|
-
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
264
|
+
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
257
265
|
} else {
|
|
258
266
|
// Value is outside the range, leave the input blank
|
|
259
|
-
this.inputValueDisplay = null
|
|
267
|
+
this.inputValueDisplay = null
|
|
260
268
|
|
|
261
|
-
this.selectedInput = null
|
|
269
|
+
this.selectedInput = null
|
|
262
270
|
}
|
|
263
271
|
},
|
|
264
272
|
// Handle input focus
|
|
265
273
|
handleInputFocus() {
|
|
266
274
|
if (this.selectedCard !== null) {
|
|
267
|
-
this.$refs.cardDeck.clearCard()
|
|
275
|
+
this.$refs.cardDeck.clearCard()
|
|
268
276
|
}
|
|
269
277
|
},
|
|
270
278
|
},
|
|
271
|
-
}
|
|
279
|
+
}
|
|
272
280
|
</script>
|
|
273
281
|
|
|
274
282
|
<style lang="scss" scoped>
|
|
275
|
-
@import
|
|
276
|
-
@import
|
|
283
|
+
@import '../../../../includes/scss/all';
|
|
284
|
+
@import './styles';
|
|
277
285
|
</style>
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
:weights="weights || []"
|
|
26
26
|
@nextScreen="nextScreen"
|
|
27
27
|
/>
|
|
28
|
+
|
|
28
29
|
<card-container
|
|
29
30
|
v-show="screen === 2"
|
|
30
31
|
ref="heightCardContainer"
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
@nextScreen="nextScreen"
|
|
35
36
|
@prevScreen="prevScreen"
|
|
36
37
|
/>
|
|
38
|
+
|
|
37
39
|
<risk-level
|
|
38
40
|
v-show="screen === 3"
|
|
39
41
|
:risk-points="riskPoints"
|
|
@@ -70,41 +72,41 @@ export default {
|
|
|
70
72
|
CardContainer,
|
|
71
73
|
ProgressBar,
|
|
72
74
|
RiskLevel,
|
|
73
|
-
RichText
|
|
75
|
+
RichText,
|
|
74
76
|
},
|
|
75
77
|
props: {
|
|
76
78
|
items: {
|
|
77
79
|
type: Array,
|
|
78
|
-
default: () => []
|
|
80
|
+
default: () => [],
|
|
79
81
|
},
|
|
80
82
|
steeperStyle: {
|
|
81
83
|
type: Boolean,
|
|
82
|
-
default: true
|
|
84
|
+
default: true,
|
|
83
85
|
},
|
|
84
86
|
titles: {
|
|
85
87
|
type: Object,
|
|
86
|
-
default: () => {}
|
|
88
|
+
default: () => {},
|
|
87
89
|
},
|
|
88
90
|
weights: {
|
|
89
91
|
type: Array,
|
|
90
|
-
default: () => []
|
|
92
|
+
default: () => [],
|
|
91
93
|
},
|
|
92
94
|
heights: {
|
|
93
95
|
type: Array,
|
|
94
|
-
default: () => []
|
|
96
|
+
default: () => [],
|
|
95
97
|
},
|
|
96
98
|
ffhPage: {
|
|
97
99
|
type: Object,
|
|
98
|
-
default: () => {}
|
|
100
|
+
default: () => {},
|
|
99
101
|
},
|
|
100
102
|
heroHeader: {
|
|
101
103
|
type: Object,
|
|
102
|
-
default: () => {}
|
|
104
|
+
default: () => {},
|
|
103
105
|
},
|
|
104
106
|
riskResults: {
|
|
105
107
|
type: Array,
|
|
106
|
-
default: () => []
|
|
107
|
-
}
|
|
108
|
+
default: () => [],
|
|
109
|
+
},
|
|
108
110
|
},
|
|
109
111
|
data() {
|
|
110
112
|
return {
|
|
@@ -112,14 +114,14 @@ export default {
|
|
|
112
114
|
selectedWeight: null,
|
|
113
115
|
selectedHeight: null,
|
|
114
116
|
barItems: [],
|
|
115
|
-
g: 9.81
|
|
117
|
+
g: 9.81,
|
|
116
118
|
}
|
|
117
119
|
},
|
|
118
120
|
computed: {
|
|
119
121
|
updateBar() {
|
|
120
122
|
const data = this.barItems
|
|
121
123
|
const currentIndex = data.findIndex(
|
|
122
|
-
(item) => item.value === this.screen.toString()
|
|
124
|
+
(item) => item.value === this.screen.toString(),
|
|
123
125
|
)
|
|
124
126
|
|
|
125
127
|
if (data.length === this.screen) {
|
|
@@ -144,13 +146,13 @@ export default {
|
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
let speedImpactMS = Math.sqrt(
|
|
147
|
-
2 * Number(this.selectedHeight.value) * this.g
|
|
149
|
+
2 * Number(this.selectedHeight.value) * this.g,
|
|
148
150
|
).toFixed(2)
|
|
149
151
|
let speedImpactKmH = (
|
|
150
152
|
Math.sqrt(2 * Number(this.selectedHeight.value) * this.g) * 3.6
|
|
151
153
|
).toFixed(2)
|
|
152
154
|
let timeImpact = Math.sqrt(
|
|
153
|
-
(2 * Number(this.selectedHeight.value)) / this.g
|
|
155
|
+
(2 * Number(this.selectedHeight.value)) / this.g,
|
|
154
156
|
).toFixed(2)
|
|
155
157
|
let energyImpact = (
|
|
156
158
|
Number(this.selectedHeight.value) *
|
|
@@ -177,10 +179,10 @@ export default {
|
|
|
177
179
|
speedImpactMS: speedImpactMS,
|
|
178
180
|
speedImpactKmH: speedImpactKmH,
|
|
179
181
|
timeImpact: timeImpact,
|
|
180
|
-
energyImpact: energyImpact
|
|
181
|
-
}
|
|
182
|
+
energyImpact: energyImpact,
|
|
183
|
+
},
|
|
182
184
|
]
|
|
183
|
-
}
|
|
185
|
+
},
|
|
184
186
|
},
|
|
185
187
|
created() {
|
|
186
188
|
this.barItems = JSON.parse(JSON.stringify(this.items))
|
|
@@ -218,7 +220,7 @@ export default {
|
|
|
218
220
|
|
|
219
221
|
this.$nextTick(() => {
|
|
220
222
|
const cardElement = this.$refs.weightCardContainer.$el.querySelector(
|
|
221
|
-
'#selectable-cc-card-0'
|
|
223
|
+
'#selectable-cc-card-0',
|
|
222
224
|
)
|
|
223
225
|
if (cardElement !== null) {
|
|
224
226
|
cardElement.focus()
|
|
@@ -265,16 +267,16 @@ export default {
|
|
|
265
267
|
label: labelVar,
|
|
266
268
|
mass: massVar,
|
|
267
269
|
height: heightVar,
|
|
268
|
-
energy: energyVar
|
|
270
|
+
energy: energyVar,
|
|
269
271
|
}
|
|
270
272
|
// fire the event
|
|
271
273
|
this.$gtm.push({
|
|
272
274
|
event: 'custom.interaction.droppedobject.click',
|
|
273
|
-
...attrs
|
|
275
|
+
...attrs,
|
|
274
276
|
})
|
|
275
277
|
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
+
},
|
|
279
|
+
},
|
|
278
280
|
}
|
|
279
281
|
</script>
|
|
280
282
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import SelectableCards from './../../SelectableCards/index.vue'
|
|
4
|
+
import RichText from './../../RichText/index.vue'
|
|
5
|
+
import CtaButton from './../../../SubComponents/CtaButton/index.vue'
|
|
6
|
+
import CaretRight from './../../../../assets/icons/caret-right.svg?url'
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits(['nextScreen'])
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
titles: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: () => [],
|
|
14
|
+
},
|
|
15
|
+
cards: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => [],
|
|
18
|
+
},
|
|
19
|
+
iconIsBordered: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
buttonRole: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'none',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const selectedCard = ref(null)
|
|
30
|
+
const isButtonDisabled = ref(true)
|
|
31
|
+
|
|
32
|
+
function selectedCardChangeFocus(card) {
|
|
33
|
+
isButtonDisabled.value = false
|
|
34
|
+
selectedCard.value = card
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function selectedButtonRole(card) {
|
|
38
|
+
selectedCard.value = card
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function handleNextScreen() {
|
|
42
|
+
// Only emit the 'nextScreen' event if the button is not disabled
|
|
43
|
+
if (!isButtonDisabled.value && selectedCard.value) {
|
|
44
|
+
emit('nextScreen', selectedCard.value)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<selectable-cards
|
|
51
|
+
ref="cardDeck"
|
|
52
|
+
:button-role="buttonRole"
|
|
53
|
+
:columns="3"
|
|
54
|
+
:title="titles && titles.heading"
|
|
55
|
+
:sub-heading="titles && titles.subHeading"
|
|
56
|
+
:cards="cards"
|
|
57
|
+
:icon-is-bordered="iconIsBordered"
|
|
58
|
+
:card-type="'control-selectcards'"
|
|
59
|
+
class="rtw-card-container control-selectablecards"
|
|
60
|
+
@selected="selectedCardChangeFocus"
|
|
61
|
+
@selected-button-role="selectedButtonRole"
|
|
62
|
+
>
|
|
63
|
+
<template v-slot:cardGridFooter>
|
|
64
|
+
<container class="rtw-card-container__footer">
|
|
65
|
+
<row>
|
|
66
|
+
<column>
|
|
67
|
+
<cta-button
|
|
68
|
+
ref="calNextBtn"
|
|
69
|
+
:glyph="CaretRight"
|
|
70
|
+
class="rtw-card-container__footer--next-btn"
|
|
71
|
+
:disabled="isButtonDisabled"
|
|
72
|
+
@clicked="handleNextScreen"
|
|
73
|
+
>Next</cta-button
|
|
74
|
+
>
|
|
75
|
+
</column>
|
|
76
|
+
</row>
|
|
77
|
+
</container>
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<!-- provide modal content via scoped slots (purely presentational) -->
|
|
81
|
+
<template #modalTitle="{ card }">
|
|
82
|
+
<rich-text
|
|
83
|
+
class="wcl-injury-modal__card--title"
|
|
84
|
+
:tag="'h2'"
|
|
85
|
+
:tag-class="'card-title'"
|
|
86
|
+
:content="card?.name"
|
|
87
|
+
/>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<template #modalBody="{ card }">
|
|
91
|
+
<div class="wcl-injury-modal__card">
|
|
92
|
+
<rich-text
|
|
93
|
+
:tag="'h5'"
|
|
94
|
+
class="wcl-injury-modal__card--content"
|
|
95
|
+
:content="card?.value"
|
|
96
|
+
/>
|
|
97
|
+
<rich-text
|
|
98
|
+
class="wcl-injury-modal__card--description"
|
|
99
|
+
:content="card?.description"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
</selectable-cards>
|
|
104
|
+
</template>
|
|
105
|
+
<style lang="scss" scoped>
|
|
106
|
+
@import './../../../../includes//scss/all.scss';
|
|
107
|
+
|
|
108
|
+
.rtw-card-container {
|
|
109
|
+
&__footer {
|
|
110
|
+
&--next-btn {
|
|
111
|
+
float: right;
|
|
112
|
+
}
|
|
113
|
+
.wcl-cta.default:disabled {
|
|
114
|
+
background-color: $gray-alt;
|
|
115
|
+
color: grey;
|
|
116
|
+
cursor: not-allowed; /* Change cursor to not-allowed */
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.wcl-injury-modal {
|
|
121
|
+
&__card {
|
|
122
|
+
&--title {
|
|
123
|
+
font-weight: normal;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&--content {
|
|
127
|
+
color: #b5321d;
|
|
128
|
+
font-weight: normal;
|
|
129
|
+
margin: 15px 0;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|