windly-ui 1.0.2 → 1.0.4
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/{ui-library/dist → dist}/module.json +2 -2
- package/dist/module.mjs +33 -0
- package/dist/runtime/components/Accordion.d.vue.ts +39 -0
- package/dist/runtime/components/Accordion.vue +96 -0
- package/dist/runtime/components/Accordion.vue.d.ts +39 -0
- package/dist/runtime/components/Alert.d.vue.ts +83 -0
- package/dist/runtime/components/Alert.vue +78 -0
- package/dist/runtime/components/Alert.vue.d.ts +83 -0
- package/dist/runtime/components/Avatar.d.vue.ts +141 -0
- package/dist/runtime/components/Avatar.vue +72 -0
- package/dist/runtime/components/Avatar.vue.d.ts +141 -0
- package/dist/runtime/components/Badge.d.vue.ts +133 -0
- package/dist/runtime/components/Badge.vue +99 -0
- package/dist/runtime/components/Badge.vue.d.ts +133 -0
- package/dist/runtime/components/Breadcrumbs.d.vue.ts +83 -0
- package/dist/runtime/components/Breadcrumbs.vue +116 -0
- package/dist/runtime/components/Breadcrumbs.vue.d.ts +83 -0
- package/dist/runtime/components/Button.d.vue.ts +208 -0
- package/dist/runtime/components/Button.vue +126 -0
- package/dist/runtime/components/Button.vue.d.ts +208 -0
- package/dist/runtime/components/Card.d.vue.ts +83 -0
- package/dist/runtime/components/Card.vue +71 -0
- package/dist/runtime/components/Card.vue.d.ts +83 -0
- package/dist/runtime/components/Checkbox.d.vue.ts +190 -0
- package/dist/runtime/components/Checkbox.vue +125 -0
- package/dist/runtime/components/Checkbox.vue.d.ts +190 -0
- package/dist/runtime/components/CodeBlock.d.vue.ts +16 -0
- package/dist/runtime/components/CodeBlock.vue +75 -0
- package/dist/runtime/components/CodeBlock.vue.d.ts +16 -0
- package/dist/runtime/components/ColorPicker.d.vue.ts +91 -0
- package/dist/runtime/components/ColorPicker.vue +244 -0
- package/dist/runtime/components/ColorPicker.vue.d.ts +91 -0
- package/dist/runtime/components/Date.d.vue.ts +137 -0
- package/dist/runtime/components/Date.vue +201 -0
- package/dist/runtime/components/Date.vue.d.ts +137 -0
- package/dist/runtime/components/Dialog.d.vue.ts +63 -0
- package/dist/runtime/components/Dialog.vue +85 -0
- package/dist/runtime/components/Dialog.vue.d.ts +63 -0
- package/dist/runtime/components/Divider.d.vue.ts +51 -0
- package/dist/runtime/components/Divider.vue +52 -0
- package/dist/runtime/components/Divider.vue.d.ts +51 -0
- package/dist/runtime/components/Drawer.d.vue.ts +30 -0
- package/dist/runtime/components/Drawer.vue +43 -0
- package/dist/runtime/components/Drawer.vue.d.ts +30 -0
- package/dist/runtime/components/Dropdown.d.vue.ts +34 -0
- package/dist/runtime/components/Dropdown.vue +127 -0
- package/dist/runtime/components/Dropdown.vue.d.ts +34 -0
- package/dist/runtime/components/FileUploader.d.vue.ts +65 -0
- package/dist/runtime/components/FileUploader.vue +358 -0
- package/dist/runtime/components/FileUploader.vue.d.ts +65 -0
- package/dist/runtime/components/Icon.d.vue.ts +41 -0
- package/dist/runtime/components/Icon.vue +66 -0
- package/dist/runtime/components/Icon.vue.d.ts +41 -0
- package/dist/runtime/components/Image.d.vue.ts +77 -0
- package/dist/runtime/components/Image.vue +61 -0
- package/dist/runtime/components/Image.vue.d.ts +77 -0
- package/dist/runtime/components/Input.d.vue.ts +68 -0
- package/dist/runtime/components/Input.vue +241 -0
- package/dist/runtime/components/Input.vue.d.ts +68 -0
- package/dist/runtime/components/Radio.d.vue.ts +41 -0
- package/dist/runtime/components/Radio.vue +222 -0
- package/dist/runtime/components/Radio.vue.d.ts +41 -0
- package/dist/runtime/components/ScrollArea.d.vue.ts +79 -0
- package/dist/runtime/components/ScrollArea.vue +36 -0
- package/dist/runtime/components/ScrollArea.vue.d.ts +79 -0
- package/dist/runtime/components/Select.d.vue.ts +51 -0
- package/dist/runtime/components/Select.vue +271 -0
- package/dist/runtime/components/Select.vue.d.ts +51 -0
- package/dist/runtime/components/Stepper.d.vue.ts +46 -0
- package/dist/runtime/components/Stepper.vue +218 -0
- package/dist/runtime/components/Stepper.vue.d.ts +46 -0
- package/dist/runtime/components/TabPanel.d.vue.ts +17 -0
- package/dist/runtime/components/TabPanel.vue +21 -0
- package/dist/runtime/components/TabPanel.vue.d.ts +17 -0
- package/dist/runtime/components/Table.d.vue.ts +40 -0
- package/dist/runtime/components/Table.vue +92 -0
- package/dist/runtime/components/Table.vue.d.ts +40 -0
- package/dist/runtime/components/Tabs.d.vue.ts +20 -0
- package/dist/runtime/components/Tabs.vue +62 -0
- package/dist/runtime/components/Tabs.vue.d.ts +20 -0
- package/dist/runtime/components/Textarea.d.vue.ts +208 -0
- package/dist/runtime/components/Textarea.vue +185 -0
- package/dist/runtime/components/Textarea.vue.d.ts +208 -0
- package/dist/runtime/components/Toggle.d.vue.ts +36 -0
- package/dist/runtime/components/Toggle.vue +173 -0
- package/dist/runtime/components/Toggle.vue.d.ts +36 -0
- package/dist/runtime/components/Tooltip.d.vue.ts +63 -0
- package/dist/runtime/components/Tooltip.vue +144 -0
- package/dist/runtime/components/Tooltip.vue.d.ts +63 -0
- package/dist/runtime/components/uiProps.d.ts +38 -0
- package/dist/runtime/components/uiProps.js +11 -0
- package/dist/runtime/components/useUiClasses.d.ts +43 -0
- package/dist/runtime/components/useUiClasses.js +124 -0
- package/dist/runtime/composables/plugin.d.ts +2 -0
- package/dist/runtime/composables/plugin.js +3 -0
- package/dist/runtime/tailwind-color.d.ts +2 -0
- package/dist/runtime/tailwind-color.js +5859 -0
- package/package.json +12 -46
- package/LICENSE +0 -21
- package/README.md +0 -232
- package/ui-library/dist/module.mjs +0 -22
- /package/{ui-library/dist → dist}/module.d.mts +0 -0
- /package/{ui-library/dist → dist}/types.d.mts +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({
|
|
3
|
+
inheritAttrs: false
|
|
4
|
+
});
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
flat: { type: Boolean, default: false },
|
|
8
|
+
square: { type: Boolean, default: false },
|
|
9
|
+
dense: { type: Boolean, default: false },
|
|
10
|
+
bordered: { type: Boolean, default: true },
|
|
11
|
+
color: { type: String, default: "white" },
|
|
12
|
+
borderColor: { type: String, default: "gray-200" },
|
|
13
|
+
width: { type: String, default: "100%" }
|
|
14
|
+
});
|
|
15
|
+
const isHex = (val) => val.startsWith("#");
|
|
16
|
+
const cardStyle = computed(() => {
|
|
17
|
+
const style = {
|
|
18
|
+
width: props.width,
|
|
19
|
+
maxWidth: "80vw"
|
|
20
|
+
};
|
|
21
|
+
if (isHex(props.color)) {
|
|
22
|
+
style.backgroundColor = props.color;
|
|
23
|
+
}
|
|
24
|
+
if (props.bordered && isHex(props.borderColor)) {
|
|
25
|
+
style.borderColor = props.borderColor;
|
|
26
|
+
}
|
|
27
|
+
return style;
|
|
28
|
+
});
|
|
29
|
+
const cardClass = computed(() => [
|
|
30
|
+
"transition-shadow duration-300",
|
|
31
|
+
props.flat ? "shadow-none" : "shadow-md",
|
|
32
|
+
props.square ? "rounded-none" : "rounded-md",
|
|
33
|
+
props.bordered ? "border" : "",
|
|
34
|
+
!isHex(props.borderColor) && props.bordered ? `border-${props.borderColor}` : "",
|
|
35
|
+
!isHex(props.color) ? `bg-${props.color}` : ""
|
|
36
|
+
]);
|
|
37
|
+
const sectionPadding = computed(
|
|
38
|
+
() => props.dense ? "p-0" : "p-4"
|
|
39
|
+
);
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div
|
|
44
|
+
:class="cardClass"
|
|
45
|
+
:style="cardStyle"
|
|
46
|
+
v-bind="$attrs"
|
|
47
|
+
>
|
|
48
|
+
<!-- Header -->
|
|
49
|
+
<div
|
|
50
|
+
v-if="$slots.header"
|
|
51
|
+
:class="sectionPadding"
|
|
52
|
+
class="border-b border-gray-200"
|
|
53
|
+
>
|
|
54
|
+
<slot name="header" />
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<!-- Content -->
|
|
58
|
+
<div :class="sectionPadding">
|
|
59
|
+
<slot />
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<!-- Footer -->
|
|
63
|
+
<div
|
|
64
|
+
v-if="$slots.footer"
|
|
65
|
+
:class="sectionPadding"
|
|
66
|
+
class="border-t border-gray-200"
|
|
67
|
+
>
|
|
68
|
+
<slot name="footer" />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
header?: (props: typeof __VLS_1) => any;
|
|
4
|
+
} & {
|
|
5
|
+
default?: (props: typeof __VLS_3) => any;
|
|
6
|
+
} & {
|
|
7
|
+
footer?: (props: typeof __VLS_5) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
flat: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
square: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
dense: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
bordered: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
color: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
borderColor: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
width: {
|
|
35
|
+
type: StringConstructor;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
39
|
+
flat: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
square: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
dense: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
51
|
+
bordered: {
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
color: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
borderColor: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
width: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
}>> & Readonly<{}>, {
|
|
68
|
+
dense: boolean;
|
|
69
|
+
color: string;
|
|
70
|
+
borderColor: string;
|
|
71
|
+
flat: boolean;
|
|
72
|
+
square: boolean;
|
|
73
|
+
bordered: boolean;
|
|
74
|
+
width: string;
|
|
75
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
76
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
77
|
+
declare const _default: typeof __VLS_export;
|
|
78
|
+
export default _default;
|
|
79
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
80
|
+
new (): {
|
|
81
|
+
$slots: S;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
contentClass: {
|
|
3
|
+
readonly type: StringConstructor;
|
|
4
|
+
readonly default: "";
|
|
5
|
+
};
|
|
6
|
+
contentStyle: {
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly default: "";
|
|
9
|
+
};
|
|
10
|
+
textColor: {
|
|
11
|
+
readonly type: StringConstructor;
|
|
12
|
+
readonly default: "";
|
|
13
|
+
};
|
|
14
|
+
disable: {
|
|
15
|
+
readonly type: BooleanConstructor;
|
|
16
|
+
readonly default: false;
|
|
17
|
+
};
|
|
18
|
+
loading: {
|
|
19
|
+
readonly type: BooleanConstructor;
|
|
20
|
+
readonly default: false;
|
|
21
|
+
};
|
|
22
|
+
color: {
|
|
23
|
+
readonly type: StringConstructor;
|
|
24
|
+
readonly default: "blue-900";
|
|
25
|
+
};
|
|
26
|
+
rounded: {
|
|
27
|
+
readonly type: StringConstructor;
|
|
28
|
+
readonly default: "md";
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
readonly type: StringConstructor;
|
|
32
|
+
readonly default: "md";
|
|
33
|
+
};
|
|
34
|
+
iconSize: {
|
|
35
|
+
readonly type: StringConstructor;
|
|
36
|
+
readonly default: "lg";
|
|
37
|
+
};
|
|
38
|
+
modelValue: {
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
name: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: null;
|
|
44
|
+
};
|
|
45
|
+
label: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
default: null;
|
|
48
|
+
};
|
|
49
|
+
trueValue: {
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
falseValue: {
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
intermediateValue: {
|
|
56
|
+
default: null;
|
|
57
|
+
};
|
|
58
|
+
checkedIcon: {
|
|
59
|
+
type: StringConstructor;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
uncheckedIcon: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
default: null;
|
|
65
|
+
};
|
|
66
|
+
intermediateIcon: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
default: string;
|
|
69
|
+
};
|
|
70
|
+
checkedColor: {
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
default: string;
|
|
73
|
+
};
|
|
74
|
+
uncheckedColor: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
dense: {
|
|
79
|
+
type: BooleanConstructor;
|
|
80
|
+
default: boolean;
|
|
81
|
+
};
|
|
82
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
83
|
+
"update:modelValue": (value: any) => any;
|
|
84
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
85
|
+
contentClass: {
|
|
86
|
+
readonly type: StringConstructor;
|
|
87
|
+
readonly default: "";
|
|
88
|
+
};
|
|
89
|
+
contentStyle: {
|
|
90
|
+
readonly type: StringConstructor;
|
|
91
|
+
readonly default: "";
|
|
92
|
+
};
|
|
93
|
+
textColor: {
|
|
94
|
+
readonly type: StringConstructor;
|
|
95
|
+
readonly default: "";
|
|
96
|
+
};
|
|
97
|
+
disable: {
|
|
98
|
+
readonly type: BooleanConstructor;
|
|
99
|
+
readonly default: false;
|
|
100
|
+
};
|
|
101
|
+
loading: {
|
|
102
|
+
readonly type: BooleanConstructor;
|
|
103
|
+
readonly default: false;
|
|
104
|
+
};
|
|
105
|
+
color: {
|
|
106
|
+
readonly type: StringConstructor;
|
|
107
|
+
readonly default: "blue-900";
|
|
108
|
+
};
|
|
109
|
+
rounded: {
|
|
110
|
+
readonly type: StringConstructor;
|
|
111
|
+
readonly default: "md";
|
|
112
|
+
};
|
|
113
|
+
size: {
|
|
114
|
+
readonly type: StringConstructor;
|
|
115
|
+
readonly default: "md";
|
|
116
|
+
};
|
|
117
|
+
iconSize: {
|
|
118
|
+
readonly type: StringConstructor;
|
|
119
|
+
readonly default: "lg";
|
|
120
|
+
};
|
|
121
|
+
modelValue: {
|
|
122
|
+
required: true;
|
|
123
|
+
};
|
|
124
|
+
name: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: null;
|
|
127
|
+
};
|
|
128
|
+
label: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
default: null;
|
|
131
|
+
};
|
|
132
|
+
trueValue: {
|
|
133
|
+
default: boolean;
|
|
134
|
+
};
|
|
135
|
+
falseValue: {
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
138
|
+
intermediateValue: {
|
|
139
|
+
default: null;
|
|
140
|
+
};
|
|
141
|
+
checkedIcon: {
|
|
142
|
+
type: StringConstructor;
|
|
143
|
+
default: string;
|
|
144
|
+
};
|
|
145
|
+
uncheckedIcon: {
|
|
146
|
+
type: StringConstructor;
|
|
147
|
+
default: null;
|
|
148
|
+
};
|
|
149
|
+
intermediateIcon: {
|
|
150
|
+
type: StringConstructor;
|
|
151
|
+
default: string;
|
|
152
|
+
};
|
|
153
|
+
checkedColor: {
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
default: string;
|
|
156
|
+
};
|
|
157
|
+
uncheckedColor: {
|
|
158
|
+
type: StringConstructor;
|
|
159
|
+
default: string;
|
|
160
|
+
};
|
|
161
|
+
dense: {
|
|
162
|
+
type: BooleanConstructor;
|
|
163
|
+
default: boolean;
|
|
164
|
+
};
|
|
165
|
+
}>> & Readonly<{
|
|
166
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
167
|
+
}>, {
|
|
168
|
+
dense: boolean;
|
|
169
|
+
label: string;
|
|
170
|
+
name: string;
|
|
171
|
+
contentClass: string;
|
|
172
|
+
contentStyle: string;
|
|
173
|
+
textColor: string;
|
|
174
|
+
disable: boolean;
|
|
175
|
+
loading: boolean;
|
|
176
|
+
color: string;
|
|
177
|
+
rounded: string;
|
|
178
|
+
size: string;
|
|
179
|
+
iconSize: string;
|
|
180
|
+
trueValue: boolean;
|
|
181
|
+
falseValue: boolean;
|
|
182
|
+
intermediateValue: null;
|
|
183
|
+
checkedIcon: string;
|
|
184
|
+
uncheckedIcon: string;
|
|
185
|
+
intermediateIcon: string;
|
|
186
|
+
checkedColor: string;
|
|
187
|
+
uncheckedColor: string;
|
|
188
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
189
|
+
declare const _default: typeof __VLS_export;
|
|
190
|
+
export default _default;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({ inheritAttrs: false });
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useUiClasses } from "./useUiClasses";
|
|
5
|
+
import { uiProps } from "./uiProps";
|
|
6
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
modelValue: { required: true },
|
|
9
|
+
name: { type: String, default: null },
|
|
10
|
+
label: { type: String, default: null },
|
|
11
|
+
trueValue: { default: true },
|
|
12
|
+
falseValue: { default: false },
|
|
13
|
+
intermediateValue: { default: null },
|
|
14
|
+
checkedIcon: { type: String, default: "check" },
|
|
15
|
+
uncheckedIcon: { type: String, default: null },
|
|
16
|
+
intermediateIcon: { type: String, default: "remove" },
|
|
17
|
+
checkedColor: { type: String, default: "" },
|
|
18
|
+
uncheckedColor: { type: String, default: "gray-400" },
|
|
19
|
+
dense: { type: Boolean, default: false },
|
|
20
|
+
...uiProps
|
|
21
|
+
});
|
|
22
|
+
const {
|
|
23
|
+
disable,
|
|
24
|
+
color,
|
|
25
|
+
size,
|
|
26
|
+
rounded,
|
|
27
|
+
roundedClass
|
|
28
|
+
} = useUiClasses(props);
|
|
29
|
+
const isChecked = computed(
|
|
30
|
+
() => props.modelValue === props.trueValue
|
|
31
|
+
);
|
|
32
|
+
const isIntermediate = computed(
|
|
33
|
+
() => props.modelValue === props.intermediateValue
|
|
34
|
+
);
|
|
35
|
+
const boxSizeClass = computed(() => {
|
|
36
|
+
const map = {
|
|
37
|
+
sm: "w-4 h-4",
|
|
38
|
+
md: "w-5 h-5",
|
|
39
|
+
lg: "w-6 h-6"
|
|
40
|
+
};
|
|
41
|
+
return map[size.value];
|
|
42
|
+
});
|
|
43
|
+
const labelSizeClass = computed(() => {
|
|
44
|
+
const map = {
|
|
45
|
+
sm: "text-sm",
|
|
46
|
+
md: "text-base",
|
|
47
|
+
lg: "text-xl"
|
|
48
|
+
};
|
|
49
|
+
return map[size.value];
|
|
50
|
+
});
|
|
51
|
+
const boxColorClass = computed(() => {
|
|
52
|
+
if (isChecked.value) {
|
|
53
|
+
return `bg-${props.checkedColor || color.value} border-${props.checkedColor || color.value}`;
|
|
54
|
+
}
|
|
55
|
+
if (isIntermediate.value) {
|
|
56
|
+
return `bg-${color.value} border-${color.value}`;
|
|
57
|
+
}
|
|
58
|
+
return `bg-transparent border-${props.uncheckedColor}`;
|
|
59
|
+
});
|
|
60
|
+
const containerClass = computed(
|
|
61
|
+
() => `
|
|
62
|
+
inline-flex items-center gap-2
|
|
63
|
+
${disable.value ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
64
|
+
`
|
|
65
|
+
);
|
|
66
|
+
function toggle() {
|
|
67
|
+
if (disable.value) return;
|
|
68
|
+
if (isChecked.value || isIntermediate.value) {
|
|
69
|
+
emit("update:modelValue", props.falseValue);
|
|
70
|
+
} else {
|
|
71
|
+
emit("update:modelValue", props.trueValue);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<label
|
|
78
|
+
:class="containerClass"
|
|
79
|
+
role="checkbox"
|
|
80
|
+
:aria-checked="isIntermediate ? 'mixed' : isChecked"
|
|
81
|
+
>
|
|
82
|
+
<input
|
|
83
|
+
type="checkbox"
|
|
84
|
+
class="hidden"
|
|
85
|
+
:name="name"
|
|
86
|
+
:disabled="disable"
|
|
87
|
+
@change="toggle"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<span
|
|
91
|
+
:class="[
|
|
92
|
+
'flex items-center justify-center border transition-all duration-200 p-2',
|
|
93
|
+
boxSizeClass,
|
|
94
|
+
roundedClass[rounded],
|
|
95
|
+
boxColorClass
|
|
96
|
+
]"
|
|
97
|
+
@click.prevent="toggle"
|
|
98
|
+
>
|
|
99
|
+
<i
|
|
100
|
+
v-if="isChecked && checkedIcon"
|
|
101
|
+
:class="labelSizeClass"
|
|
102
|
+
class="material-icons text-white"
|
|
103
|
+
>
|
|
104
|
+
{{ checkedIcon }}
|
|
105
|
+
</i>
|
|
106
|
+
<i
|
|
107
|
+
v-else-if="isIntermediate && intermediateIcon"
|
|
108
|
+
:class="labelSizeClass"
|
|
109
|
+
class="material-icons text-white"
|
|
110
|
+
>
|
|
111
|
+
{{ intermediateIcon }}
|
|
112
|
+
</i>
|
|
113
|
+
<i
|
|
114
|
+
v-else-if="uncheckedIcon"
|
|
115
|
+
:class="labelSizeClass"
|
|
116
|
+
class="material-icons text-gray-400"
|
|
117
|
+
>
|
|
118
|
+
{{ uncheckedIcon }}
|
|
119
|
+
</i>
|
|
120
|
+
</span>
|
|
121
|
+
<span v-if="label" class="select-none" :class="labelSizeClass">
|
|
122
|
+
{{ label }}
|
|
123
|
+
</span>
|
|
124
|
+
</label>
|
|
125
|
+
</template>
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
contentClass: {
|
|
3
|
+
readonly type: StringConstructor;
|
|
4
|
+
readonly default: "";
|
|
5
|
+
};
|
|
6
|
+
contentStyle: {
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly default: "";
|
|
9
|
+
};
|
|
10
|
+
textColor: {
|
|
11
|
+
readonly type: StringConstructor;
|
|
12
|
+
readonly default: "";
|
|
13
|
+
};
|
|
14
|
+
disable: {
|
|
15
|
+
readonly type: BooleanConstructor;
|
|
16
|
+
readonly default: false;
|
|
17
|
+
};
|
|
18
|
+
loading: {
|
|
19
|
+
readonly type: BooleanConstructor;
|
|
20
|
+
readonly default: false;
|
|
21
|
+
};
|
|
22
|
+
color: {
|
|
23
|
+
readonly type: StringConstructor;
|
|
24
|
+
readonly default: "blue-900";
|
|
25
|
+
};
|
|
26
|
+
rounded: {
|
|
27
|
+
readonly type: StringConstructor;
|
|
28
|
+
readonly default: "md";
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
readonly type: StringConstructor;
|
|
32
|
+
readonly default: "md";
|
|
33
|
+
};
|
|
34
|
+
iconSize: {
|
|
35
|
+
readonly type: StringConstructor;
|
|
36
|
+
readonly default: "lg";
|
|
37
|
+
};
|
|
38
|
+
modelValue: {
|
|
39
|
+
required: true;
|
|
40
|
+
};
|
|
41
|
+
name: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: null;
|
|
44
|
+
};
|
|
45
|
+
label: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
default: null;
|
|
48
|
+
};
|
|
49
|
+
trueValue: {
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
falseValue: {
|
|
53
|
+
default: boolean;
|
|
54
|
+
};
|
|
55
|
+
intermediateValue: {
|
|
56
|
+
default: null;
|
|
57
|
+
};
|
|
58
|
+
checkedIcon: {
|
|
59
|
+
type: StringConstructor;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
uncheckedIcon: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
default: null;
|
|
65
|
+
};
|
|
66
|
+
intermediateIcon: {
|
|
67
|
+
type: StringConstructor;
|
|
68
|
+
default: string;
|
|
69
|
+
};
|
|
70
|
+
checkedColor: {
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
default: string;
|
|
73
|
+
};
|
|
74
|
+
uncheckedColor: {
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
dense: {
|
|
79
|
+
type: BooleanConstructor;
|
|
80
|
+
default: boolean;
|
|
81
|
+
};
|
|
82
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
83
|
+
"update:modelValue": (value: any) => any;
|
|
84
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
85
|
+
contentClass: {
|
|
86
|
+
readonly type: StringConstructor;
|
|
87
|
+
readonly default: "";
|
|
88
|
+
};
|
|
89
|
+
contentStyle: {
|
|
90
|
+
readonly type: StringConstructor;
|
|
91
|
+
readonly default: "";
|
|
92
|
+
};
|
|
93
|
+
textColor: {
|
|
94
|
+
readonly type: StringConstructor;
|
|
95
|
+
readonly default: "";
|
|
96
|
+
};
|
|
97
|
+
disable: {
|
|
98
|
+
readonly type: BooleanConstructor;
|
|
99
|
+
readonly default: false;
|
|
100
|
+
};
|
|
101
|
+
loading: {
|
|
102
|
+
readonly type: BooleanConstructor;
|
|
103
|
+
readonly default: false;
|
|
104
|
+
};
|
|
105
|
+
color: {
|
|
106
|
+
readonly type: StringConstructor;
|
|
107
|
+
readonly default: "blue-900";
|
|
108
|
+
};
|
|
109
|
+
rounded: {
|
|
110
|
+
readonly type: StringConstructor;
|
|
111
|
+
readonly default: "md";
|
|
112
|
+
};
|
|
113
|
+
size: {
|
|
114
|
+
readonly type: StringConstructor;
|
|
115
|
+
readonly default: "md";
|
|
116
|
+
};
|
|
117
|
+
iconSize: {
|
|
118
|
+
readonly type: StringConstructor;
|
|
119
|
+
readonly default: "lg";
|
|
120
|
+
};
|
|
121
|
+
modelValue: {
|
|
122
|
+
required: true;
|
|
123
|
+
};
|
|
124
|
+
name: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: null;
|
|
127
|
+
};
|
|
128
|
+
label: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
default: null;
|
|
131
|
+
};
|
|
132
|
+
trueValue: {
|
|
133
|
+
default: boolean;
|
|
134
|
+
};
|
|
135
|
+
falseValue: {
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
138
|
+
intermediateValue: {
|
|
139
|
+
default: null;
|
|
140
|
+
};
|
|
141
|
+
checkedIcon: {
|
|
142
|
+
type: StringConstructor;
|
|
143
|
+
default: string;
|
|
144
|
+
};
|
|
145
|
+
uncheckedIcon: {
|
|
146
|
+
type: StringConstructor;
|
|
147
|
+
default: null;
|
|
148
|
+
};
|
|
149
|
+
intermediateIcon: {
|
|
150
|
+
type: StringConstructor;
|
|
151
|
+
default: string;
|
|
152
|
+
};
|
|
153
|
+
checkedColor: {
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
default: string;
|
|
156
|
+
};
|
|
157
|
+
uncheckedColor: {
|
|
158
|
+
type: StringConstructor;
|
|
159
|
+
default: string;
|
|
160
|
+
};
|
|
161
|
+
dense: {
|
|
162
|
+
type: BooleanConstructor;
|
|
163
|
+
default: boolean;
|
|
164
|
+
};
|
|
165
|
+
}>> & Readonly<{
|
|
166
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
167
|
+
}>, {
|
|
168
|
+
dense: boolean;
|
|
169
|
+
label: string;
|
|
170
|
+
name: string;
|
|
171
|
+
contentClass: string;
|
|
172
|
+
contentStyle: string;
|
|
173
|
+
textColor: string;
|
|
174
|
+
disable: boolean;
|
|
175
|
+
loading: boolean;
|
|
176
|
+
color: string;
|
|
177
|
+
rounded: string;
|
|
178
|
+
size: string;
|
|
179
|
+
iconSize: string;
|
|
180
|
+
trueValue: boolean;
|
|
181
|
+
falseValue: boolean;
|
|
182
|
+
intermediateValue: null;
|
|
183
|
+
checkedIcon: string;
|
|
184
|
+
uncheckedIcon: string;
|
|
185
|
+
intermediateIcon: string;
|
|
186
|
+
checkedColor: string;
|
|
187
|
+
uncheckedColor: string;
|
|
188
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
189
|
+
declare const _default: typeof __VLS_export;
|
|
190
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_20: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_20) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|