@eturnity/eturnity_reusable_components 7.51.3 → 7.51.5
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 +2 -3
- package/src/assets/gifs/spinner.gif +0 -0
- package/src/assets/svgIcons/checkmark.svg +3 -0
- package/src/assets/svgIcons/collapse_all.svg +4 -0
- package/src/assets/svgIcons/expand_all.svg +4 -0
- package/src/assets/svgIcons/export_document.svg +3 -0
- package/src/assets/svgIcons/hybrid.svg +4 -0
- package/src/assets/svgIcons/module.svg +3 -0
- package/src/assets/svgIcons/move_down.svg +3 -0
- package/src/assets/svgIcons/move_up.svg +3 -0
- package/src/assets/svgIcons/optimizer.svg +6 -0
- package/src/assets/svgIcons/string_design.svg +5 -0
- package/src/assets/svgIcons/string_directions.svg +10 -0
- package/src/components/banner/notificationBanner/index.vue +131 -0
- package/src/components/buttons/buttonIcon/index.vue +4 -2
- package/src/components/buttons/mainButton/index.vue +16 -2
- package/src/components/icon/Icons.stories.js +9 -19
- package/src/components/icon/icon.spec.js +66 -0
- package/src/components/icon/iconCollection.vue +4 -3
- package/src/components/icon/index.vue +14 -3
- package/src/components/infoText/index.vue +38 -11
- package/src/components/inputs/checkbox/index.vue +19 -8
- package/src/components/inputs/inputNumber/index.vue +203 -13
- package/src/components/inputs/inputText/index.vue +23 -2
- package/src/components/inputs/radioButton/index.vue +27 -6
- package/src/components/inputs/select/index.vue +69 -25
- package/src/components/inputs/select/option/index.vue +11 -2
- package/src/components/markerItem/index.vue +8 -1
- package/src/components/spinner/index.vue +11 -0
- package/src/components/spinnerGif/index.vue +98 -0
- package/src/components/stringDesign/DropdownMenu/index.vue +981 -0
@@ -13,7 +13,11 @@
|
|
13
13
|
</LabelSlotWrapper>
|
14
14
|
|
15
15
|
<LabelWrapper v-if="labelText">
|
16
|
-
<LabelText
|
16
|
+
<LabelText
|
17
|
+
:data-id="labelDataId"
|
18
|
+
:label-font-color="labelFontColor"
|
19
|
+
:label-font-weight="labelFontWeight"
|
20
|
+
>
|
17
21
|
{{ labelText }}
|
18
22
|
</LabelText>
|
19
23
|
|
@@ -28,11 +32,16 @@
|
|
28
32
|
v-bind="$attrs"
|
29
33
|
ref="inputField1"
|
30
34
|
:align-items="alignItems"
|
31
|
-
:background-color="
|
32
|
-
|
35
|
+
:background-color="
|
36
|
+
colorMode === 'transparent' ? 'transparent' : backgroundColor
|
37
|
+
"
|
38
|
+
:border-color="
|
39
|
+
colorMode === 'transparent' && !borderColor ? 'white' : borderColor
|
40
|
+
"
|
41
|
+
:color-mode="colorMode"
|
33
42
|
:data-id="inputDataId"
|
34
43
|
:disabled="disabled"
|
35
|
-
:font-color="fontColor"
|
44
|
+
:font-color="colorMode === 'transparent' ? 'white' : fontColor"
|
36
45
|
:font-size="fontSize"
|
37
46
|
:has-label-slot="hasLabelSlot"
|
38
47
|
:has-slot="hasSlot"
|
@@ -44,6 +53,7 @@
|
|
44
53
|
:min-width="minWidth"
|
45
54
|
:no-border="noBorder"
|
46
55
|
:placeholder="displayedPlaceholder"
|
56
|
+
:show-arrow-controls="showArrowControls"
|
47
57
|
:show-linear-unit-name="showLinearUnitName"
|
48
58
|
:slot-size="slotSize"
|
49
59
|
:text-align="textAlign"
|
@@ -51,6 +61,8 @@
|
|
51
61
|
@blur="onInputBlur($event)"
|
52
62
|
@focus="focusInput()"
|
53
63
|
@input="onInput($event)"
|
64
|
+
@keydown.down="decrementValue"
|
65
|
+
@keydown.up="incrementValue"
|
54
66
|
@keyup.enter="onEnterPress"
|
55
67
|
/>
|
56
68
|
<SlotContainer v-if="hasSlot" :is-error="isError" :slot-size="slotSize">
|
@@ -79,7 +91,7 @@
|
|
79
91
|
@input-change="$emit('select-change', $event)"
|
80
92
|
>
|
81
93
|
<template #selector>
|
82
|
-
<SelectText>{{ getSelectValue }}</SelectText>
|
94
|
+
<SelectText>{{ getSelectValue() }}</SelectText>
|
83
95
|
</template>
|
84
96
|
<template #dropdown>
|
85
97
|
<RCOption
|
@@ -92,6 +104,31 @@
|
|
92
104
|
</template>
|
93
105
|
</RCSelect>
|
94
106
|
</SelectWrapper>
|
107
|
+
|
108
|
+
<ArrowControls
|
109
|
+
v-if="!disabled && showArrowControls"
|
110
|
+
:color-mode="colorMode"
|
111
|
+
>
|
112
|
+
<ArrowButton @click="incrementValue">
|
113
|
+
<Icon
|
114
|
+
:color="colorMode === 'transparent' ? 'white' : undefined"
|
115
|
+
name="arrow_up"
|
116
|
+
size="8px"
|
117
|
+
/>
|
118
|
+
</ArrowButton>
|
119
|
+
<ArrowDivider :color-mode="colorMode" />
|
120
|
+
<ArrowButton
|
121
|
+
:is-disabled="textInput <= minNumber"
|
122
|
+
@click="decrementValue"
|
123
|
+
>
|
124
|
+
<Icon
|
125
|
+
:color="colorMode === 'transparent' ? 'white' : undefined"
|
126
|
+
:disabled="textInput <= minNumber"
|
127
|
+
name="arrow_down"
|
128
|
+
size="8px"
|
129
|
+
/>
|
130
|
+
</ArrowButton>
|
131
|
+
</ArrowControls>
|
95
132
|
</InputWrapper>
|
96
133
|
<ErrorMessage v-if="isError">{{ errorMessage }}</ErrorMessage>
|
97
134
|
</Container>
|
@@ -123,6 +160,7 @@
|
|
123
160
|
// labelInfoAlign="left"
|
124
161
|
// :minNumber="0"
|
125
162
|
// fontColor="blue"
|
163
|
+
// colorMode="transparent" // Makes background transparent, border white, and font white
|
126
164
|
// >
|
127
165
|
//<template name=label><img>....</template>
|
128
166
|
//</inputNumber>
|
@@ -156,8 +194,11 @@
|
|
156
194
|
isInteractive: Boolean,
|
157
195
|
alignItems: String,
|
158
196
|
labelFontColor: String,
|
197
|
+
labelFontWeight: String,
|
159
198
|
borderColor: String,
|
160
199
|
showLinearUnitName: Boolean,
|
200
|
+
colorMode: String,
|
201
|
+
showArrowControls: Boolean,
|
161
202
|
}
|
162
203
|
|
163
204
|
const Container = styled('div', inputProps)`
|
@@ -181,9 +222,20 @@
|
|
181
222
|
: '1px solid ' + props.theme.colors.grey4};
|
182
223
|
height: ${(props) => props.inputHeight};
|
183
224
|
max-height: ${(props) => props.inputHeight};
|
184
|
-
padding:
|
185
|
-
|
186
|
-
|
225
|
+
padding: ${({ colorMode }) =>
|
226
|
+
colorMode === 'transparent' ? '10px 15px' : '0 10px'};
|
227
|
+
padding-right: ${({
|
228
|
+
slotSize,
|
229
|
+
isError,
|
230
|
+
showLinearUnitName,
|
231
|
+
colorMode,
|
232
|
+
showArrowControls,
|
233
|
+
}) =>
|
234
|
+
showArrowControls
|
235
|
+
? '40px'
|
236
|
+
: colorMode === 'transparent'
|
237
|
+
? '0'
|
238
|
+
: slotSize
|
187
239
|
? isError && !showLinearUnitName
|
188
240
|
? 'calc(' + slotSize + ' + 24px)'
|
189
241
|
: 'calc(' + slotSize + ' + 10px)'
|
@@ -201,20 +253,26 @@
|
|
201
253
|
props.isError
|
202
254
|
? props.theme.colors.grey6
|
203
255
|
: props.isDisabled
|
204
|
-
? props.
|
256
|
+
? props.colorMode === 'transparent'
|
257
|
+
? props.theme.colors.white
|
258
|
+
: props.theme.colors.grey2
|
205
259
|
: props.fontColor
|
206
260
|
? props.fontColor + ' !important'
|
207
261
|
: props.theme.colors.black};
|
208
262
|
background-color: ${(props) =>
|
209
|
-
props.
|
263
|
+
props.isDisabled
|
264
|
+
? props.colorMode === 'transparent'
|
265
|
+
? 'transparent'
|
266
|
+
: props.theme.colors.disabled
|
267
|
+
: props.backgroundColor
|
210
268
|
? props.backgroundColor + ' !important'
|
211
269
|
: props.theme.colors.white};
|
212
270
|
width: ${(props) =>
|
213
271
|
props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
|
214
272
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
215
|
-
background-color: ${(props) =>
|
216
|
-
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
217
273
|
box-sizing: border-box;
|
274
|
+
opacity: ${(props) =>
|
275
|
+
props.isDisabled && props.colorMode === 'transparent' ? '0.4' : '1'};
|
218
276
|
|
219
277
|
&::placeholder {
|
220
278
|
color: ${(props) => props.theme.colors.grey2};
|
@@ -225,6 +283,55 @@
|
|
225
283
|
}
|
226
284
|
`
|
227
285
|
|
286
|
+
const ArrowControlsProps = {
|
287
|
+
colorMode: String,
|
288
|
+
}
|
289
|
+
const ArrowControls = styled('div', ArrowControlsProps)`
|
290
|
+
position: absolute;
|
291
|
+
right: 0;
|
292
|
+
top: 0;
|
293
|
+
bottom: 0;
|
294
|
+
display: grid;
|
295
|
+
grid-template-rows: 1fr auto 1fr;
|
296
|
+
align-items: center;
|
297
|
+
justify-items: center;
|
298
|
+
cursor: pointer;
|
299
|
+
width: 30px;
|
300
|
+
background-color: ${(props) =>
|
301
|
+
props.colorMode === 'transparent'
|
302
|
+
? 'transparent'
|
303
|
+
: props.theme.colors.white};
|
304
|
+
border-left: 1px solid
|
305
|
+
${(props) =>
|
306
|
+
props.colorMode === 'transparent'
|
307
|
+
? props.theme.colors.white
|
308
|
+
: props.theme.colors.black};
|
309
|
+
`
|
310
|
+
|
311
|
+
const ArrowButtonProps = {
|
312
|
+
isDisabled: Boolean,
|
313
|
+
}
|
314
|
+
const ArrowButton = styled('button', ArrowButtonProps)`
|
315
|
+
background: transparent;
|
316
|
+
opacity: ${(props) => (props.isDisabled ? '0.2' : '1')};
|
317
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
318
|
+
display: flex;
|
319
|
+
align-items: center;
|
320
|
+
justify-content: center;
|
321
|
+
padding: 0;
|
322
|
+
width: 100%;
|
323
|
+
height: 100%;
|
324
|
+
`
|
325
|
+
|
326
|
+
const ArrowDivider = styled('div', ArrowControlsProps)`
|
327
|
+
width: 100%;
|
328
|
+
height: 1px;
|
329
|
+
background-color: ${(props) =>
|
330
|
+
props.colorMode === 'transparent'
|
331
|
+
? props.theme.colors.white
|
332
|
+
: props.theme.colors.black};
|
333
|
+
`
|
334
|
+
|
228
335
|
const InputWrapper = styled.span`
|
229
336
|
position: relative;
|
230
337
|
`
|
@@ -307,7 +414,7 @@
|
|
307
414
|
props.theme.colors[props.labelFontColor]
|
308
415
|
? props.theme.colors[props.labelFontColor]
|
309
416
|
: props.labelFontColor};
|
310
|
-
font-weight:
|
417
|
+
font-weight: ${(props) => props.labelFontWeight};
|
311
418
|
`
|
312
419
|
|
313
420
|
const IconAttrs = { size: String, marginRight: Number }
|
@@ -359,140 +466,184 @@
|
|
359
466
|
SelectWrapper,
|
360
467
|
SelectText,
|
361
468
|
Divider,
|
469
|
+
ArrowControls,
|
470
|
+
ArrowButton,
|
471
|
+
ArrowDivider,
|
362
472
|
},
|
363
473
|
inheritAttrs: false,
|
364
474
|
props: {
|
365
475
|
placeholder: {
|
476
|
+
type: String,
|
366
477
|
required: false,
|
367
478
|
default: '',
|
368
479
|
},
|
369
480
|
isError: {
|
481
|
+
type: Boolean,
|
370
482
|
required: false,
|
371
483
|
default: false,
|
372
484
|
},
|
373
485
|
inputWidth: {
|
486
|
+
type: String,
|
374
487
|
required: false,
|
375
488
|
default: null,
|
376
489
|
},
|
377
490
|
minWidth: {
|
491
|
+
type: String,
|
378
492
|
required: false,
|
379
493
|
default: null,
|
380
494
|
},
|
381
495
|
inputHeight: {
|
496
|
+
type: String,
|
382
497
|
required: false,
|
383
498
|
default: '40px',
|
384
499
|
},
|
385
500
|
value: {
|
501
|
+
type: [String, Number],
|
386
502
|
required: true,
|
387
503
|
default: null,
|
388
504
|
},
|
389
505
|
clearInput: {
|
506
|
+
type: Boolean,
|
390
507
|
required: false,
|
391
508
|
default: false,
|
392
509
|
},
|
393
510
|
alignItems: {
|
511
|
+
type: String,
|
394
512
|
required: false,
|
395
513
|
default: 'vertical',
|
396
514
|
},
|
397
515
|
errorMessage: {
|
516
|
+
type: String,
|
398
517
|
required: false,
|
399
518
|
default: 'Please insert a correct number',
|
400
519
|
},
|
401
520
|
numberPrecision: {
|
521
|
+
type: Number,
|
402
522
|
required: false,
|
403
523
|
default: 0,
|
404
524
|
},
|
405
525
|
minDecimals: {
|
526
|
+
type: Number,
|
406
527
|
required: false,
|
407
528
|
default: 0,
|
408
529
|
},
|
409
530
|
unitName: {
|
531
|
+
type: String,
|
410
532
|
required: false,
|
411
533
|
default: '',
|
412
534
|
},
|
413
535
|
showLinearUnitName: {
|
536
|
+
type: Boolean,
|
414
537
|
required: false,
|
415
538
|
default: false,
|
416
539
|
},
|
417
540
|
disabled: {
|
541
|
+
type: Boolean,
|
418
542
|
required: false,
|
419
543
|
default: false,
|
420
544
|
},
|
421
545
|
noBorder: {
|
546
|
+
type: Boolean,
|
422
547
|
required: false,
|
423
548
|
default: false,
|
424
549
|
},
|
425
550
|
borderColor: {
|
551
|
+
type: String,
|
426
552
|
required: false,
|
553
|
+
default: null,
|
427
554
|
},
|
428
555
|
textAlign: {
|
556
|
+
type: String,
|
429
557
|
required: false,
|
430
558
|
default: 'left',
|
431
559
|
},
|
432
560
|
fontSize: {
|
561
|
+
type: String,
|
433
562
|
required: false,
|
434
563
|
default: '13px',
|
435
564
|
},
|
436
565
|
isInteractive: {
|
566
|
+
type: Boolean,
|
437
567
|
required: false,
|
438
568
|
default: false,
|
439
569
|
},
|
440
570
|
interactionStep: {
|
571
|
+
type: Number,
|
441
572
|
required: false,
|
442
573
|
default: 1,
|
443
574
|
},
|
444
575
|
labelText: {
|
576
|
+
type: String,
|
445
577
|
required: false,
|
446
578
|
default: null,
|
447
579
|
},
|
448
580
|
labelInfoText: {
|
581
|
+
type: String,
|
449
582
|
required: false,
|
450
583
|
default: null,
|
451
584
|
},
|
452
585
|
labelInfoAlign: {
|
586
|
+
type: String,
|
453
587
|
required: false,
|
454
588
|
default: 'left',
|
455
589
|
},
|
456
590
|
defaultNumber: {
|
591
|
+
type: Number,
|
457
592
|
required: false,
|
458
593
|
default: null,
|
459
594
|
},
|
460
595
|
minNumber: {
|
596
|
+
type: Number,
|
461
597
|
required: false,
|
462
598
|
default: null,
|
463
599
|
},
|
464
600
|
fontColor: {
|
601
|
+
type: String,
|
465
602
|
required: false,
|
466
603
|
default: null,
|
467
604
|
},
|
468
605
|
backgroundColor: {
|
606
|
+
type: String,
|
469
607
|
required: false,
|
470
608
|
default: null,
|
471
609
|
},
|
472
610
|
numberToStringEnabled: {
|
611
|
+
type: Boolean,
|
473
612
|
required: false,
|
474
613
|
default: true,
|
475
614
|
},
|
476
615
|
allowNegative: {
|
616
|
+
type: Boolean,
|
477
617
|
required: false,
|
478
618
|
default: true,
|
479
619
|
},
|
480
620
|
slotSize: {
|
621
|
+
type: String,
|
481
622
|
required: false,
|
623
|
+
default: null,
|
482
624
|
},
|
483
625
|
labelFontColor: {
|
626
|
+
type: String,
|
484
627
|
required: false,
|
485
628
|
default: 'eturnityGrey',
|
486
629
|
},
|
630
|
+
labelFontWeight: {
|
631
|
+
type: String,
|
632
|
+
required: false,
|
633
|
+
default: '700',
|
634
|
+
},
|
487
635
|
focus: {
|
636
|
+
type: Boolean,
|
488
637
|
required: false,
|
489
638
|
default: false,
|
490
639
|
},
|
491
640
|
labelDataId: {
|
641
|
+
type: String,
|
492
642
|
required: false,
|
493
643
|
default: '',
|
494
644
|
},
|
495
645
|
inputDataId: {
|
646
|
+
type: String,
|
496
647
|
required: false,
|
497
648
|
default: '',
|
498
649
|
},
|
@@ -516,6 +667,14 @@
|
|
516
667
|
type: Boolean,
|
517
668
|
default: false,
|
518
669
|
},
|
670
|
+
colorMode: {
|
671
|
+
type: String,
|
672
|
+
default: '',
|
673
|
+
},
|
674
|
+
showArrowControls: {
|
675
|
+
type: Boolean,
|
676
|
+
default: false,
|
677
|
+
},
|
519
678
|
},
|
520
679
|
data() {
|
521
680
|
return {
|
@@ -585,6 +744,36 @@
|
|
585
744
|
}
|
586
745
|
},
|
587
746
|
methods: {
|
747
|
+
incrementValue() {
|
748
|
+
const currentValue = Math.max(
|
749
|
+
parseFloat(this.textInput || 0),
|
750
|
+
this.minNumber || 0
|
751
|
+
)
|
752
|
+
const newValue = currentValue + this.interactionStep
|
753
|
+
this.textInput = numberToString({
|
754
|
+
value: newValue,
|
755
|
+
numberPrecision: this.numberPrecision,
|
756
|
+
minDecimals: this.minDecimals,
|
757
|
+
})
|
758
|
+
this.$emit('on-input', newValue)
|
759
|
+
this.$emit('input-change', newValue)
|
760
|
+
},
|
761
|
+
decrementValue() {
|
762
|
+
const currentValue = Math.max(
|
763
|
+
parseFloat(this.textInput || 0),
|
764
|
+
this.minNumber || 0
|
765
|
+
)
|
766
|
+
const newValue = currentValue - this.interactionStep
|
767
|
+
if (this.allowNegative || newValue >= 0) {
|
768
|
+
this.textInput = numberToString({
|
769
|
+
value: newValue,
|
770
|
+
numberPrecision: this.numberPrecision,
|
771
|
+
minDecimals: this.minDecimals,
|
772
|
+
})
|
773
|
+
this.$emit('on-input', newValue)
|
774
|
+
this.$emit('input-change', newValue)
|
775
|
+
}
|
776
|
+
},
|
588
777
|
onEnterPress() {
|
589
778
|
this.$emit('on-enter-click')
|
590
779
|
this.$refs.inputField1.$el.blur()
|
@@ -680,6 +869,7 @@
|
|
680
869
|
this.$emit('on-input', evaluatedVal)
|
681
870
|
}
|
682
871
|
}
|
872
|
+
this.textInput = evaluatedVal
|
683
873
|
},
|
684
874
|
onInputBlur(e) {
|
685
875
|
this.isFocused = false
|
@@ -31,8 +31,10 @@
|
|
31
31
|
<InputContainer
|
32
32
|
ref="inputElement"
|
33
33
|
:background-color="backgroundColor"
|
34
|
+
:border-color="borderColor"
|
34
35
|
:data-id="inputDataId"
|
35
36
|
data-test-id="input"
|
37
|
+
:default-padding="defaultPadding"
|
36
38
|
:disabled="disabled"
|
37
39
|
:disabled-background-color="disabledBackgroundColor"
|
38
40
|
:font-color="fontColor"
|
@@ -64,6 +66,13 @@
|
|
64
66
|
<IconWrapper v-if="hasError" data-test-id="error_wrapper" size="16px">
|
65
67
|
<Icon cursor="default" name="warning" size="16px" />
|
66
68
|
</IconWrapper>
|
69
|
+
<IconWrapper
|
70
|
+
v-if="iconName && !hasError && inputType !== 'password'"
|
71
|
+
:default-padding="defaultPadding"
|
72
|
+
size="16px"
|
73
|
+
>
|
74
|
+
<Icon color="white" cursor="default" :name="iconName" size="16px" />
|
75
|
+
</IconWrapper>
|
67
76
|
</IconContainer>
|
68
77
|
<ErrorMessage
|
69
78
|
v-if="hasError && hasErrorMessage"
|
@@ -131,6 +140,7 @@
|
|
131
140
|
borderColor: String,
|
132
141
|
inputHeight: String,
|
133
142
|
disabledBackgroundColor: String,
|
143
|
+
defaultPadding: Boolean,
|
134
144
|
}
|
135
145
|
const InputContainer = styled('input', inputProps)`
|
136
146
|
border: ${(props) =>
|
@@ -148,6 +158,8 @@
|
|
148
158
|
? '11px 25px 11px 10px'
|
149
159
|
: props.inputType === 'password'
|
150
160
|
? '11px 25px 11px 10px'
|
161
|
+
: props.defaultPadding
|
162
|
+
? '10px 35px 10px 15px'
|
151
163
|
: '11px 5px 11px 10px'};
|
152
164
|
border-radius: 4px;
|
153
165
|
position: relative;
|
@@ -194,13 +206,13 @@
|
|
194
206
|
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
195
207
|
`
|
196
208
|
|
197
|
-
const IconAttrs = { size: String }
|
209
|
+
const IconAttrs = { size: String, defaultPadding: Boolean }
|
198
210
|
const IconWrapper = styled('div', IconAttrs)`
|
199
211
|
position: absolute;
|
200
212
|
top: 0;
|
201
213
|
bottom: 0;
|
202
214
|
margin: auto;
|
203
|
-
right: 5px;
|
215
|
+
right: ${(props) => (props.defaultPadding ? '15px' : '5px')};
|
204
216
|
height: ${(props) => (props.size ? props.size : 'auto')};
|
205
217
|
`
|
206
218
|
|
@@ -364,6 +376,15 @@
|
|
364
376
|
default: '',
|
365
377
|
type: String,
|
366
378
|
},
|
379
|
+
iconName: {
|
380
|
+
required: false,
|
381
|
+
default: null,
|
382
|
+
type: String,
|
383
|
+
},
|
384
|
+
defaultPadding: {
|
385
|
+
required: false,
|
386
|
+
default: false,
|
387
|
+
},
|
367
388
|
},
|
368
389
|
data() {
|
369
390
|
return {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<ComponentWrapper :layout="layout">
|
2
|
+
<ComponentWrapper :color-mode="colorMode" :layout="layout">
|
3
3
|
<RadioWrapper
|
4
4
|
v-for="(item, index) in options"
|
5
5
|
:key="item.value"
|
@@ -7,7 +7,9 @@
|
|
7
7
|
>
|
8
8
|
<LabelContainer
|
9
9
|
:checkmark-color="checkmarkColor"
|
10
|
+
:color-mode="colorMode"
|
10
11
|
:has-label="!!item.label"
|
12
|
+
:has-slots="!!$slots[`input-${item.value}`]"
|
11
13
|
:is-checked="selectedOption === item.value"
|
12
14
|
:is-disabled="item.disabled"
|
13
15
|
:size="size"
|
@@ -25,6 +27,7 @@
|
|
25
27
|
<span class="checkmark"></span>
|
26
28
|
<LabelText
|
27
29
|
v-if="item.label"
|
30
|
+
:color-mode="colorMode"
|
28
31
|
:data-test-id="'radioLabel_' + item.value"
|
29
32
|
:is-disabled="item.disabled"
|
30
33
|
>
|
@@ -36,6 +39,7 @@
|
|
36
39
|
size="16px"
|
37
40
|
:text="item.infoText"
|
38
41
|
/>
|
42
|
+
<slot :name="`input-${item.value}`"></slot>
|
39
43
|
</LabelContainer>
|
40
44
|
<ImageContainer v-if="item.img">
|
41
45
|
<RadioImage
|
@@ -95,12 +99,14 @@
|
|
95
99
|
|
96
100
|
const wrapperProps = {
|
97
101
|
layout: String,
|
102
|
+
colorMode: String,
|
98
103
|
}
|
99
104
|
const ComponentWrapper = styled('div', wrapperProps)`
|
100
105
|
display: flex;
|
101
106
|
flex-direction: ${(props) =>
|
102
107
|
props.layout === 'vertical' ? 'column' : 'row'};
|
103
|
-
grid-gap:
|
108
|
+
grid-gap: ${(props) =>
|
109
|
+
props.colorMode === 'transparent' ? '16px 5px' : '10px 5px'};
|
104
110
|
flex-wrap: wrap;
|
105
111
|
`
|
106
112
|
|
@@ -123,14 +129,20 @@
|
|
123
129
|
isChecked: Boolean,
|
124
130
|
checkmarkColor: String,
|
125
131
|
hasLabel: Boolean,
|
132
|
+
colorMode: String,
|
133
|
+
hasSlots: Boolean,
|
126
134
|
}
|
127
135
|
const LabelContainer = styled('label', containerProps)`
|
128
136
|
display: grid;
|
129
137
|
grid-template-columns: auto 1fr auto;
|
130
|
-
grid-gap: ${(props) => (props.hasLabel ? '15px' : 0)};
|
138
|
+
grid-gap: ${(props) => (props.hasLabel || props.hasSlots ? '15px' : 0)};
|
131
139
|
align-items: center;
|
132
140
|
color: ${(props) =>
|
133
|
-
props.isDisabled
|
141
|
+
props.isDisabled
|
142
|
+
? props.theme.colors.grey2
|
143
|
+
: props.colorMode === 'transparent'
|
144
|
+
? props.theme.colors.white
|
145
|
+
: props.theme.colors.black};
|
134
146
|
position: relative;
|
135
147
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
136
148
|
font-size: ${(props) =>
|
@@ -187,10 +199,14 @@
|
|
187
199
|
}
|
188
200
|
`
|
189
201
|
|
190
|
-
const textAttrs = { isDisabled: Boolean }
|
202
|
+
const textAttrs = { isDisabled: Boolean, colorMode: String }
|
191
203
|
const LabelText = styled('div', textAttrs)`
|
192
204
|
color: ${(props) =>
|
193
|
-
props.isDisabled
|
205
|
+
props.isDisabled
|
206
|
+
? props.theme.colors.grey2
|
207
|
+
: props.colorMode === 'transparent'
|
208
|
+
? props.theme.colors.white
|
209
|
+
: props.theme.colors.black};
|
194
210
|
`
|
195
211
|
|
196
212
|
const RadioImage = styled.img`
|
@@ -280,6 +296,11 @@
|
|
280
296
|
required: false,
|
281
297
|
type: String,
|
282
298
|
},
|
299
|
+
colorMode: {
|
300
|
+
default: '',
|
301
|
+
required: false,
|
302
|
+
type: String,
|
303
|
+
},
|
283
304
|
},
|
284
305
|
emits: ['on-radio-change'],
|
285
306
|
data() {
|