@redseed/redseed-ui-vue3 8.55.0 → 8.57.0
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
|
@@ -6,6 +6,7 @@ import ButtonTertiary from './ButtonTertiary.vue'
|
|
|
6
6
|
import ButtonTertiaryFull from './ButtonTertiaryFull.vue'
|
|
7
7
|
import ButtonDanger from './ButtonDanger.vue'
|
|
8
8
|
import ButtonDangerFull from './ButtonDangerFull.vue'
|
|
9
|
+
import ButtonAI from './ButtonAI.vue'
|
|
9
10
|
import ButtonSlot from './ButtonSlot.vue'
|
|
10
11
|
|
|
11
12
|
export {
|
|
@@ -17,5 +18,6 @@ export {
|
|
|
17
18
|
ButtonTertiaryFull,
|
|
18
19
|
ButtonDanger,
|
|
19
20
|
ButtonDangerFull,
|
|
21
|
+
ButtonAI,
|
|
20
22
|
ButtonSlot,
|
|
21
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, useAttrs } from 'vue'
|
|
2
|
+
import { computed, useAttrs, useSlots } from 'vue'
|
|
3
3
|
import FormFieldSlot from './FormFieldSlot.vue'
|
|
4
4
|
import { useFormFieldA11y } from '../../composables/useFormFieldA11y.js'
|
|
5
5
|
|
|
@@ -18,6 +18,10 @@ const props = defineProps({
|
|
|
18
18
|
type: Boolean,
|
|
19
19
|
default: false,
|
|
20
20
|
},
|
|
21
|
+
likert: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
21
25
|
})
|
|
22
26
|
|
|
23
27
|
const emit = defineEmits(['input'])
|
|
@@ -32,6 +36,27 @@ function setValue(value) {
|
|
|
32
36
|
emit('input', value)
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
// Each anchor rides inside the scale point it labels, so the pair travels as one flex
|
|
40
|
+
// child and justify-between can spread the row without prising the anchor off its end.
|
|
41
|
+
const slots = useSlots()
|
|
42
|
+
|
|
43
|
+
function showAnchorStartAt(index) {
|
|
44
|
+
return props.likert && index === 0 && Boolean(slots['anchor-start'])
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function showAnchorEndAt(index) {
|
|
48
|
+
return props.likert && index === props.options.length - 1 && Boolean(slots['anchor-end'])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// likert lays the scale out as a single row between two anchors, so it overrides stacked
|
|
52
|
+
const itemsClass = computed(() => [
|
|
53
|
+
'rsui-form-field-radio-group__items',
|
|
54
|
+
{
|
|
55
|
+
'rsui-form-field-radio-group__items--stacked': props.stacked && !props.likert,
|
|
56
|
+
'rsui-form-field-radio-group__items--likert': props.likert,
|
|
57
|
+
},
|
|
58
|
+
])
|
|
59
|
+
|
|
35
60
|
</script>
|
|
36
61
|
<template>
|
|
37
62
|
<FormFieldSlot
|
|
@@ -47,7 +72,7 @@ function setValue(value) {
|
|
|
47
72
|
<slot name="label"></slot>
|
|
48
73
|
</span>
|
|
49
74
|
</template>
|
|
50
|
-
<div :class="
|
|
75
|
+
<div :class="itemsClass"
|
|
51
76
|
role="radiogroup"
|
|
52
77
|
:aria-labelledby="$slots.label ? `${effectiveId}-label` : undefined"
|
|
53
78
|
:aria-describedby="ariaDescribedby"
|
|
@@ -58,6 +83,10 @@ function setValue(value) {
|
|
|
58
83
|
:key="option.value"
|
|
59
84
|
:class="['rsui-form-field-radio-group__item', {'rsui-form-field-radio-group__item--disabled': option.disabled}]"
|
|
60
85
|
>
|
|
86
|
+
<span v-if="showAnchorStartAt(index)" class="rsui-form-field-radio-group__anchor">
|
|
87
|
+
<slot name="anchor-start"></slot>
|
|
88
|
+
</span>
|
|
89
|
+
|
|
61
90
|
<div class="rsui-form-field-radio-group__control" v-if="model !== option.value" aria-hidden="true"></div>
|
|
62
91
|
<div class="rsui-form-field-radio-group__control rsui-form-field-radio-group__control--active"
|
|
63
92
|
v-if="model == option.value" aria-hidden="true">
|
|
@@ -79,6 +108,10 @@ function setValue(value) {
|
|
|
79
108
|
>
|
|
80
109
|
{{ option.label }}
|
|
81
110
|
</label>
|
|
111
|
+
|
|
112
|
+
<span v-if="showAnchorEndAt(index)" class="rsui-form-field-radio-group__anchor">
|
|
113
|
+
<slot name="anchor-end"></slot>
|
|
114
|
+
</span>
|
|
82
115
|
</div>
|
|
83
116
|
</div>
|
|
84
117
|
<template #help v-if="$slots.help">
|