sprintify-ui 0.0.125 → 0.0.127
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.
|
@@ -2,10 +2,10 @@ import { Locales } from '@/types';
|
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
modelValue: {
|
|
5
|
-
default:
|
|
5
|
+
default: null;
|
|
6
6
|
type: PropType<{
|
|
7
7
|
[locale: string]: string | number | boolean;
|
|
8
|
-
} | null
|
|
8
|
+
} | null>;
|
|
9
9
|
};
|
|
10
10
|
locales: {
|
|
11
11
|
default: undefined;
|
|
@@ -41,10 +41,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
41
41
|
};
|
|
42
42
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
43
|
modelValue: {
|
|
44
|
-
default:
|
|
44
|
+
default: null;
|
|
45
45
|
type: PropType<{
|
|
46
46
|
[locale: string]: string | number | boolean;
|
|
47
|
-
} | null
|
|
47
|
+
} | null>;
|
|
48
48
|
};
|
|
49
49
|
locales: {
|
|
50
50
|
default: undefined;
|
|
@@ -87,7 +87,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
87
|
defaultValue: string | number | boolean;
|
|
88
88
|
modelValue: {
|
|
89
89
|
[locale: string]: string | number | boolean;
|
|
90
|
-
} | null
|
|
90
|
+
} | null;
|
|
91
91
|
hasError: boolean;
|
|
92
92
|
component: "BaseInput" | "BaseTextarea";
|
|
93
93
|
locales: Locales;
|
|
@@ -2,7 +2,7 @@ import { PropType } from 'vue';
|
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
3
|
modelValue: {
|
|
4
4
|
default: boolean;
|
|
5
|
-
type: PropType<boolean | null | undefined>;
|
|
5
|
+
type: PropType<string | number | boolean | null | undefined>;
|
|
6
6
|
};
|
|
7
7
|
name: {
|
|
8
8
|
default: undefined;
|
|
@@ -27,7 +27,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
27
27
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
28
|
modelValue: {
|
|
29
29
|
default: boolean;
|
|
30
|
-
type: PropType<boolean | null | undefined>;
|
|
30
|
+
type: PropType<string | number | boolean | null | undefined>;
|
|
31
31
|
};
|
|
32
32
|
name: {
|
|
33
33
|
default: undefined;
|
|
@@ -56,7 +56,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
56
56
|
name: string;
|
|
57
57
|
color: "dark" | "light" | "danger" | "success" | "warning" | "info" | "primary";
|
|
58
58
|
size: "base" | "xs" | "sm" | "lg" | "xl";
|
|
59
|
-
modelValue: boolean | null | undefined;
|
|
59
|
+
modelValue: string | number | boolean | null | undefined;
|
|
60
60
|
hasError: boolean;
|
|
61
61
|
}>, {
|
|
62
62
|
default: (_: {}) => any;
|
package/package.json
CHANGED
|
@@ -55,8 +55,8 @@ type Value = { [locale: string]: string | number | boolean };
|
|
|
55
55
|
|
|
56
56
|
const props = defineProps({
|
|
57
57
|
modelValue: {
|
|
58
|
-
default:
|
|
59
|
-
type: [Object, null
|
|
58
|
+
default: null,
|
|
59
|
+
type: [Object, null] as PropType<Value | null>,
|
|
60
60
|
},
|
|
61
61
|
locales: {
|
|
62
62
|
default: undefined,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<SwitchGroup>
|
|
3
3
|
<div class="inline-flex items-center space-x-3">
|
|
4
4
|
<Switch
|
|
5
|
-
:model-value="
|
|
5
|
+
:model-value="normalizedModelValue"
|
|
6
6
|
:class="[
|
|
7
7
|
modelValue ? bg : 'bg-slate-200',
|
|
8
8
|
'relative inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-offset-2 ',
|
|
@@ -34,12 +34,15 @@
|
|
|
34
34
|
<script lang="ts" setup>
|
|
35
35
|
import { useField } from '@/composables/field';
|
|
36
36
|
import { Switch, SwitchGroup, SwitchLabel } from '@headlessui/vue';
|
|
37
|
+
import { isNumber, isString } from 'lodash';
|
|
37
38
|
import { PropType } from 'vue';
|
|
38
39
|
|
|
39
40
|
const props = defineProps({
|
|
40
41
|
modelValue: {
|
|
41
42
|
default: false,
|
|
42
|
-
type: [Boolean, null, undefined] as PropType<
|
|
43
|
+
type: [Boolean, String, Number, null, undefined] as PropType<
|
|
44
|
+
boolean | string | number | null | undefined
|
|
45
|
+
>,
|
|
43
46
|
},
|
|
44
47
|
name: {
|
|
45
48
|
default: undefined,
|
|
@@ -74,6 +77,16 @@ const { emitUpdate } = useField({
|
|
|
74
77
|
emit: emit,
|
|
75
78
|
});
|
|
76
79
|
|
|
80
|
+
const normalizedModelValue = computed((): boolean => {
|
|
81
|
+
if (isString(props.modelValue)) {
|
|
82
|
+
return props.modelValue === 'true' || props.modelValue === '1';
|
|
83
|
+
}
|
|
84
|
+
if (isNumber(props.modelValue)) {
|
|
85
|
+
return props.modelValue === 1;
|
|
86
|
+
}
|
|
87
|
+
return props.modelValue ?? false;
|
|
88
|
+
});
|
|
89
|
+
|
|
77
90
|
const bg = computed(() => {
|
|
78
91
|
if (props.color == 'primary') {
|
|
79
92
|
return 'bg-primary-500';
|