@globalbrain/sefirot 2.44.0 → 2.45.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { type IconifyIcon } from '@iconify/vue/dist/offline'
|
|
3
3
|
import IconCheck from '@iconify-icons/ph/check-bold'
|
|
4
|
+
import IconMinus from '@iconify-icons/ph/minus-bold'
|
|
4
5
|
import { computed } from 'vue'
|
|
5
6
|
import { type Validatable } from '../composables/Validation'
|
|
6
7
|
import SIcon from './SIcon.vue'
|
|
@@ -20,8 +21,8 @@ const props = withDefaults(defineProps<{
|
|
|
20
21
|
checkColor?: Color
|
|
21
22
|
text?: string
|
|
22
23
|
disabled?: boolean
|
|
23
|
-
value?: boolean
|
|
24
|
-
modelValue?: boolean
|
|
24
|
+
value?: boolean | 'indeterminate'
|
|
25
|
+
modelValue?: boolean | 'indeterminate'
|
|
25
26
|
validation?: Validatable
|
|
26
27
|
hideError?: boolean
|
|
27
28
|
}>(), {
|
|
@@ -39,10 +40,14 @@ const classes = computed(() => [
|
|
|
39
40
|
{ disabled: props.disabled }
|
|
40
41
|
])
|
|
41
42
|
|
|
43
|
+
const isIndeterminate = computed(() => {
|
|
44
|
+
return props.modelValue === 'indeterminate' || props.value === 'indeterminate'
|
|
45
|
+
})
|
|
46
|
+
|
|
42
47
|
const _value = computed(() => {
|
|
43
48
|
return props.modelValue !== undefined
|
|
44
|
-
? props.modelValue
|
|
45
|
-
: props.value !== undefined ? props.value : false
|
|
49
|
+
? props.modelValue === true
|
|
50
|
+
: props.value !== undefined ? props.value === true : false
|
|
46
51
|
})
|
|
47
52
|
|
|
48
53
|
function onClick() {
|
|
@@ -69,14 +74,17 @@ function onClick() {
|
|
|
69
74
|
<div class="container">
|
|
70
75
|
<div
|
|
71
76
|
class="input"
|
|
72
|
-
:class="{ on: _value }"
|
|
77
|
+
:class="{ on: _value || isIndeterminate }"
|
|
73
78
|
role="button"
|
|
74
79
|
@click="onClick"
|
|
75
80
|
:aria-disabled="disabled"
|
|
76
81
|
>
|
|
77
82
|
<div class="box">
|
|
78
83
|
<div class="check">
|
|
79
|
-
<SIcon
|
|
84
|
+
<SIcon
|
|
85
|
+
:icon="isIndeterminate ? IconMinus : IconCheck"
|
|
86
|
+
class="check-icon"
|
|
87
|
+
/>
|
|
80
88
|
</div>
|
|
81
89
|
</div>
|
|
82
90
|
|