@usssa/component-library 1.0.0-alpha.118 → 1.0.0-alpha.119
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
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import URadioStd from './URadioStd.vue'
|
|
4
|
+
|
|
5
|
+
const emit = defineEmits(['onClick', 'onButtonClick'])
|
|
6
|
+
|
|
7
|
+
const model = defineModel()
|
|
8
|
+
|
|
4
9
|
const props = defineProps({
|
|
5
|
-
|
|
10
|
+
altText: {
|
|
6
11
|
type: String,
|
|
7
12
|
default: '',
|
|
8
13
|
},
|
|
9
|
-
|
|
14
|
+
dataTestId: {
|
|
10
15
|
type: String,
|
|
11
|
-
default: '',
|
|
16
|
+
default: 'radio-btn-std',
|
|
12
17
|
},
|
|
13
18
|
description: {
|
|
14
19
|
type: String,
|
|
15
20
|
default: '',
|
|
16
21
|
},
|
|
17
|
-
|
|
22
|
+
iconClass: {
|
|
18
23
|
type: String,
|
|
19
24
|
default: '',
|
|
20
25
|
},
|
|
26
|
+
iconColor: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'primary',
|
|
29
|
+
},
|
|
30
|
+
id: { String },
|
|
21
31
|
image: {
|
|
22
32
|
type: String,
|
|
23
33
|
default: '',
|
|
@@ -26,56 +36,56 @@ const props = defineProps({
|
|
|
26
36
|
type: String,
|
|
27
37
|
default: '',
|
|
28
38
|
},
|
|
29
|
-
|
|
39
|
+
label: {
|
|
30
40
|
type: String,
|
|
31
41
|
default: '',
|
|
32
42
|
},
|
|
33
|
-
|
|
43
|
+
value: {
|
|
34
44
|
type: String,
|
|
35
|
-
default: '
|
|
45
|
+
default: '',
|
|
36
46
|
},
|
|
37
|
-
|
|
38
|
-
id: { String },
|
|
39
47
|
})
|
|
40
48
|
|
|
41
|
-
const emit = defineEmits(['onClick', 'onButtonClick'])
|
|
42
|
-
const model = defineModel()
|
|
43
|
-
|
|
44
|
-
const handleChange = () => {
|
|
45
|
-
model.value = props.value
|
|
46
|
-
}
|
|
47
|
-
|
|
48
49
|
const activeClass = computed(() => {
|
|
49
50
|
if (model.value === props.value) {
|
|
50
51
|
return 'active'
|
|
51
52
|
}
|
|
52
53
|
return ''
|
|
53
54
|
})
|
|
55
|
+
|
|
56
|
+
const handleChange = () => {
|
|
57
|
+
model.value = props.value
|
|
58
|
+
}
|
|
54
59
|
</script>
|
|
55
60
|
|
|
56
61
|
<template>
|
|
57
|
-
<q-btn
|
|
62
|
+
<q-btn
|
|
63
|
+
:class="`u-radio-btn ${activeClass}`"
|
|
64
|
+
:dataTestId="dataTestId"
|
|
65
|
+
flat
|
|
66
|
+
@click="handleChange"
|
|
67
|
+
>
|
|
58
68
|
<div class="radio-btn-content flex items-center">
|
|
59
|
-
<URadioStd v-model="model" :
|
|
69
|
+
<URadioStd v-model="model" :aria-label="label" :id="id" :value="value" />
|
|
60
70
|
<div class="button-text">
|
|
61
71
|
<div class="text-caption-lg">{{ label }}</div>
|
|
62
72
|
<div class="description-text text-body-sm">{{ description }}</div>
|
|
63
73
|
</div>
|
|
64
74
|
|
|
65
75
|
<img
|
|
66
|
-
class="radio-btn-img"
|
|
67
76
|
v-if="image"
|
|
68
|
-
|
|
69
|
-
:src="image"
|
|
77
|
+
class="radio-btn-img"
|
|
70
78
|
:alt="altText"
|
|
71
79
|
:aria-label="imgAriaLabel"
|
|
80
|
+
size="1.5rem"
|
|
81
|
+
:src="image"
|
|
72
82
|
/>
|
|
73
83
|
<q-icon
|
|
74
84
|
v-if="iconClass"
|
|
85
|
+
:class="iconClass"
|
|
75
86
|
:aria-label="imgAriaLabel"
|
|
76
87
|
:color="iconColor"
|
|
77
88
|
size="1.5rem"
|
|
78
|
-
:class="iconClass"
|
|
79
89
|
/>
|
|
80
90
|
</div>
|
|
81
91
|
</q-btn>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { onMounted } from 'vue'
|
|
3
3
|
|
|
4
|
+
const radioValue = defineModel()
|
|
5
|
+
|
|
4
6
|
const props = defineProps({
|
|
5
|
-
label: {
|
|
6
|
-
type: String,
|
|
7
|
-
},
|
|
8
7
|
ariaLabel: {
|
|
9
8
|
type: String,
|
|
10
9
|
},
|
|
11
|
-
|
|
10
|
+
dataTestId: {
|
|
12
11
|
type: String,
|
|
12
|
+
default: 'radio-std',
|
|
13
13
|
},
|
|
14
14
|
disable: {
|
|
15
15
|
type: Boolean,
|
|
@@ -20,34 +20,41 @@ const props = defineProps({
|
|
|
20
20
|
default: 'u-radio',
|
|
21
21
|
required: true, // it is required for to match accessibility crieteria
|
|
22
22
|
},
|
|
23
|
+
label: {
|
|
24
|
+
type: String,
|
|
25
|
+
},
|
|
26
|
+
value: {
|
|
27
|
+
type: String,
|
|
28
|
+
},
|
|
23
29
|
})
|
|
24
30
|
onMounted(() => {
|
|
25
31
|
const radioElement = document.getElementById(props.id)
|
|
26
32
|
if (radioElement) {
|
|
27
33
|
const inputElement = radioElement.querySelector('input')
|
|
28
|
-
inputElement
|
|
34
|
+
if (inputElement) {
|
|
35
|
+
inputElement.id = props.id
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
})
|
|
31
|
-
|
|
32
|
-
const radioValue = defineModel()
|
|
33
39
|
</script>
|
|
34
40
|
|
|
35
41
|
<template>
|
|
36
|
-
<label class="hidden" :for="id"
|
|
42
|
+
<label v-if="label || ariaLabel" class="hidden" :for="id">{{
|
|
37
43
|
label || ariaLabel
|
|
38
44
|
}}</label>
|
|
39
45
|
<q-radio
|
|
40
46
|
v-model="radioValue"
|
|
41
47
|
class="u-radio"
|
|
42
|
-
:val="value"
|
|
43
48
|
color="primary"
|
|
44
|
-
|
|
49
|
+
:dataTestId="dataTestId"
|
|
45
50
|
dense
|
|
46
|
-
size="3rem"
|
|
47
51
|
:disable="disable"
|
|
48
52
|
:id="id"
|
|
53
|
+
keep-color
|
|
54
|
+
size="3rem"
|
|
55
|
+
:val="value"
|
|
49
56
|
>
|
|
50
|
-
<div class="text-center text-caption-lg radio-label"
|
|
57
|
+
<div v-if="label" class="text-center text-caption-lg radio-label">
|
|
51
58
|
{{ label }}
|
|
52
59
|
</div>
|
|
53
60
|
</q-radio>
|