@redseed/redseed-ui-vue3 6.5.4 → 6.6.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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, watch } from 'vue'
|
|
3
|
+
import Card from './Card.vue'
|
|
4
|
+
import CardHeader from './CardHeader.vue'
|
|
5
|
+
import FormFieldCheckbox from '../FormField/FormFieldCheckbox.vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
checked: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false,
|
|
11
|
+
},
|
|
12
|
+
disabled: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
16
|
+
strikethrough: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: false,
|
|
19
|
+
},
|
|
20
|
+
success: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits(['check', 'uncheck', 'change'])
|
|
27
|
+
|
|
28
|
+
const isChecked = ref(props.checked)
|
|
29
|
+
|
|
30
|
+
watch(() => props.checked, (val) => {
|
|
31
|
+
isChecked.value = val
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function toggleChecked() {
|
|
36
|
+
if (props.disabled) return
|
|
37
|
+
isChecked.value = !isChecked.value
|
|
38
|
+
emit('change', isChecked.value)
|
|
39
|
+
emit(isChecked.value ? 'check' : 'uncheck', isChecked.value)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function onTitleClick() {
|
|
43
|
+
if (props.disabled) return
|
|
44
|
+
toggleChecked()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function onFieldInput() {
|
|
48
|
+
emit('change', isChecked.value)
|
|
49
|
+
emit(isChecked.value ? 'check' : 'uncheck', isChecked.value)
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
<template>
|
|
53
|
+
<Card :class="[
|
|
54
|
+
'rsui-checkbox-card',
|
|
55
|
+
{ 'rsui-checkbox-card--success': success }
|
|
56
|
+
]"
|
|
57
|
+
:clickable="false"
|
|
58
|
+
:hoverable="false"
|
|
59
|
+
:disabled="disabled"
|
|
60
|
+
>
|
|
61
|
+
<template #header>
|
|
62
|
+
<CardHeader
|
|
63
|
+
:showAvatar="false"
|
|
64
|
+
:showBadge="false"
|
|
65
|
+
:showSubtitle="false"
|
|
66
|
+
:showActions="false"
|
|
67
|
+
:showMoreActions="false"
|
|
68
|
+
:showDivider="false"
|
|
69
|
+
:singleLine="false"
|
|
70
|
+
>
|
|
71
|
+
<div class="rsui-checkbox-card__title-row">
|
|
72
|
+
<div class="rsui-checkbox-card__field">
|
|
73
|
+
<FormFieldCheckbox v-model="isChecked" :disabled="disabled" @input="onFieldInput" />
|
|
74
|
+
</div>
|
|
75
|
+
<span :class="[
|
|
76
|
+
'rsui-checkbox-card__title-text',
|
|
77
|
+
{ 'rsui-checkbox-card__title-text--strikethrough': strikethrough }
|
|
78
|
+
]"
|
|
79
|
+
@click.stop.prevent="onTitleClick"
|
|
80
|
+
>
|
|
81
|
+
<slot name="title"></slot>
|
|
82
|
+
</span>
|
|
83
|
+
</div>
|
|
84
|
+
</CardHeader>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<slot></slot>
|
|
88
|
+
|
|
89
|
+
<template #meta v-if="$slots.meta">
|
|
90
|
+
<slot name="meta"></slot>
|
|
91
|
+
</template>
|
|
92
|
+
</Card>
|
|
93
|
+
</template>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ButtonCard from './ButtonCard.vue'
|
|
2
|
+
import CheckboxCard from './CheckboxCard.vue'
|
|
2
3
|
import Card from './Card.vue'
|
|
3
4
|
import CardHeader from './CardHeader.vue'
|
|
4
5
|
import CardResource from './CardResource.vue'
|
|
@@ -6,6 +7,7 @@ import RadioCard from './RadioCard.vue'
|
|
|
6
7
|
import MetricCard from './MetricCard.vue'
|
|
7
8
|
export {
|
|
8
9
|
ButtonCard,
|
|
10
|
+
CheckboxCard,
|
|
9
11
|
Card,
|
|
10
12
|
CardHeader,
|
|
11
13
|
CardResource,
|