@nuxt/ui 0.4.0 → 2.8.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/LICENSE.md +9 -0
- package/README.md +63 -50
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +1234 -0
- package/dist/module.d.ts +1234 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +407 -0
- package/dist/runtime/app.config.d.ts +1203 -0
- package/dist/runtime/app.config.mjs +1057 -0
- package/dist/runtime/components/data/Table.vue +251 -0
- package/dist/runtime/components/data/Table.vue.d.ts +215 -0
- package/dist/runtime/components/elements/Accordion.vue +138 -0
- package/dist/runtime/components/elements/Accordion.vue.d.ts +80 -0
- package/dist/runtime/components/elements/Alert.vue +120 -0
- package/dist/runtime/components/elements/Alert.vue.d.ts +107 -0
- package/dist/runtime/components/elements/Avatar.vue +149 -0
- package/dist/runtime/components/elements/Avatar.vue.d.ts +115 -0
- package/dist/runtime/components/elements/AvatarGroup.d.ts +37 -0
- package/dist/runtime/components/elements/AvatarGroup.mjs +53 -0
- package/dist/runtime/components/elements/Badge.vue +69 -0
- package/dist/runtime/components/elements/Badge.vue.d.ts +63 -0
- package/dist/runtime/components/elements/Button.vue +182 -0
- package/dist/runtime/components/elements/Button.vue.d.ts +187 -0
- package/dist/runtime/components/elements/ButtonGroup.d.ts +39 -0
- package/dist/runtime/components/elements/ButtonGroup.mjs +70 -0
- package/dist/runtime/components/elements/Dropdown.vue +172 -0
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +96 -0
- package/dist/runtime/components/elements/Icon.vue +15 -0
- package/dist/runtime/components/elements/Icon.vue.d.ts +12 -0
- package/dist/runtime/components/elements/Kbd.vue +55 -0
- package/dist/runtime/components/elements/Kbd.vue.d.ts +42 -0
- package/dist/runtime/components/elements/Link.vue +80 -0
- package/dist/runtime/components/elements/Link.vue.d.ts +9 -0
- package/dist/runtime/components/forms/Checkbox.vue +136 -0
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +129 -0
- package/dist/runtime/components/forms/Form.vue +186 -0
- package/dist/runtime/components/forms/Form.vue.d.ts +50 -0
- package/dist/runtime/components/forms/FormGroup.vue +97 -0
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +98 -0
- package/dist/runtime/components/forms/Input.vue +250 -0
- package/dist/runtime/components/forms/Input.vue.d.ts +214 -0
- package/dist/runtime/components/forms/Radio.vue +122 -0
- package/dist/runtime/components/forms/Radio.vue.d.ts +109 -0
- package/dist/runtime/components/forms/Range.vue +163 -0
- package/dist/runtime/components/forms/Range.vue.d.ts +119 -0
- package/dist/runtime/components/forms/Select.vue +307 -0
- package/dist/runtime/components/forms/Select.vue.d.ts +229 -0
- package/dist/runtime/components/forms/SelectMenu.vue +429 -0
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +330 -0
- package/dist/runtime/components/forms/Textarea.vue +184 -0
- package/dist/runtime/components/forms/Textarea.vue.d.ts +161 -0
- package/dist/runtime/components/forms/Toggle.vue +113 -0
- package/dist/runtime/components/forms/Toggle.vue.d.ts +83 -0
- package/dist/runtime/components/layout/Card.vue +58 -0
- package/dist/runtime/components/layout/Card.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Container.vue +43 -0
- package/dist/runtime/components/layout/Container.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Skeleton.vue +37 -0
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +22 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +304 -0
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +224 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +152 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +63 -0
- package/dist/runtime/components/navigation/Pagination.vue +197 -0
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +125 -0
- package/dist/runtime/components/navigation/Tabs.vue +138 -0
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +69 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue +79 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +37 -0
- package/dist/runtime/components/overlays/ContextMenu.vue +74 -0
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +54 -0
- package/dist/runtime/components/overlays/Modal.vue +113 -0
- package/dist/runtime/components/overlays/Modal.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Notification.vue +197 -0
- package/dist/runtime/components/overlays/Notification.vue.d.ts +126 -0
- package/dist/runtime/components/overlays/Notifications.vue +61 -0
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +41 -0
- package/dist/runtime/components/overlays/Popover.vue +139 -0
- package/dist/runtime/components/overlays/Popover.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Slideover.vue +103 -0
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +84 -0
- package/dist/runtime/components/overlays/Tooltip.vue +118 -0
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +82 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +13 -0
- package/dist/runtime/composables/defineShortcuts.mjs +108 -0
- package/dist/runtime/composables/useCopyToClipboard.d.ts +10 -0
- package/dist/runtime/composables/useCopyToClipboard.mjs +26 -0
- package/dist/runtime/composables/useFormGroup.d.ts +6 -0
- package/dist/runtime/composables/useFormGroup.mjs +30 -0
- package/dist/runtime/composables/usePopper.d.ts +232 -0
- package/dist/runtime/composables/usePopper.mjs +78 -0
- package/dist/runtime/composables/useShortcuts.d.ts +12 -0
- package/dist/runtime/composables/useShortcuts.mjs +24 -0
- package/dist/runtime/composables/useTimer.d.ts +8 -0
- package/dist/runtime/composables/useTimer.mjs +51 -0
- package/dist/runtime/composables/useToast.d.ts +18 -0
- package/dist/runtime/composables/useToast.mjs +22 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.mjs +46 -0
- package/dist/runtime/types/accordion.d.ts +9 -0
- package/dist/runtime/types/avatar.d.ts +9 -0
- package/dist/runtime/types/button.d.ts +23 -0
- package/dist/runtime/types/clipboard.d.ts +3 -0
- package/dist/runtime/types/command-palette.d.ts +26 -0
- package/dist/runtime/types/dropdown.d.ts +13 -0
- package/dist/runtime/types/form.d.ts +21 -0
- package/dist/runtime/types/index.d.ts +12 -0
- package/dist/runtime/types/link.d.ts +8 -0
- package/dist/runtime/types/notification.d.ts +22 -0
- package/dist/runtime/types/popper.d.ts +14 -0
- package/dist/runtime/types/tabs.d.ts +6 -0
- package/dist/runtime/types/vertical-navigation.d.ts +11 -0
- package/dist/runtime/ui.css +13 -0
- package/dist/runtime/utils/StateEmitter.d.ts +17 -0
- package/dist/runtime/utils/StateEmitter.mjs +21 -0
- package/dist/runtime/utils/index.d.ts +11 -0
- package/dist/runtime/utils/index.mjs +33 -0
- package/dist/types.d.mts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +57 -40
- package/LICENSE +0 -21
- package/dist/assets/styles.css +0 -14
- package/dist/components/NButton.vue +0 -19
- package/dist/components/NCard.vue +0 -5
- package/dist/components/NCheckbox.vue +0 -35
- package/dist/components/NDarkToggle.vue +0 -28
- package/dist/components/NDialog.vue +0 -59
- package/dist/components/NDropdown.vue +0 -31
- package/dist/components/NIcon.vue +0 -9
- package/dist/components/NLink.vue +0 -17
- package/dist/components/NRadio.vue +0 -40
- package/dist/components/NSwitch.vue +0 -37
- package/dist/components/NTextInput.vue +0 -34
- package/dist/components/NTip.vue +0 -16
- package/dist/components/NuxtContentLogo.vue +0 -7
- package/dist/components/NuxtExampleLayout.vue +0 -82
- package/dist/components/NuxtLogo.vue +0 -20
- package/dist/components/nuxt/NDarkToggle.vue +0 -28
- package/dist/nuxt.d.ts +0 -16
- package/dist/nuxt.mjs +0 -36
- package/dist/unocss.d.ts +0 -7
- package/dist/unocss.mjs +0 -117
- package/nuxt.cjs +0 -7
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
size: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
default: () => any;
|
|
7
|
+
validator(value: string): boolean;
|
|
8
|
+
};
|
|
9
|
+
color: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: () => any;
|
|
12
|
+
validator(value: string): boolean;
|
|
13
|
+
};
|
|
14
|
+
variant: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: () => any;
|
|
17
|
+
validator(value: string): boolean;
|
|
18
|
+
};
|
|
19
|
+
label: {
|
|
20
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
21
|
+
default: null;
|
|
22
|
+
};
|
|
23
|
+
ui: {
|
|
24
|
+
type: PropType<any>;
|
|
25
|
+
default: () => {};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
attrs: import("lodash").Omit<{
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
}, "class">;
|
|
31
|
+
badgeClass: import("vue").ComputedRef<string>;
|
|
32
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
+
size: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: () => any;
|
|
36
|
+
validator(value: string): boolean;
|
|
37
|
+
};
|
|
38
|
+
color: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: () => any;
|
|
41
|
+
validator(value: string): boolean;
|
|
42
|
+
};
|
|
43
|
+
variant: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: () => any;
|
|
46
|
+
validator(value: string): boolean;
|
|
47
|
+
};
|
|
48
|
+
label: {
|
|
49
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
50
|
+
default: null;
|
|
51
|
+
};
|
|
52
|
+
ui: {
|
|
53
|
+
type: PropType<any>;
|
|
54
|
+
default: () => {};
|
|
55
|
+
};
|
|
56
|
+
}>>, {
|
|
57
|
+
color: string;
|
|
58
|
+
ui: any;
|
|
59
|
+
label: string | number;
|
|
60
|
+
variant: string;
|
|
61
|
+
size: string;
|
|
62
|
+
}, {}>;
|
|
63
|
+
export default _default;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ULink :type="type" :disabled="disabled || loading" :class="buttonClass" v-bind="attrs">
|
|
3
|
+
<slot name="leading" :disabled="disabled" :loading="loading">
|
|
4
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="leadingIconClass" aria-hidden="true" />
|
|
5
|
+
</slot>
|
|
6
|
+
|
|
7
|
+
<slot>
|
|
8
|
+
<span v-if="label" :class="[truncate ? 'text-left break-all line-clamp-1' : '']">
|
|
9
|
+
{{ label }}
|
|
10
|
+
</span>
|
|
11
|
+
</slot>
|
|
12
|
+
|
|
13
|
+
<slot name="trailing" :disabled="disabled" :loading="loading">
|
|
14
|
+
<UIcon v-if="isTrailing && trailingIconName" :name="trailingIconName" :class="trailingIconClass" aria-hidden="true" />
|
|
15
|
+
</slot>
|
|
16
|
+
</ULink>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { computed, defineComponent } from "vue";
|
|
21
|
+
import { omit } from "lodash-es";
|
|
22
|
+
import { twMerge, twJoin } from "tailwind-merge";
|
|
23
|
+
import UIcon from "../elements/Icon.vue";
|
|
24
|
+
import ULink from "../elements/Link.vue";
|
|
25
|
+
import { defuTwMerge } from "../../utils";
|
|
26
|
+
import { useAppConfig } from "#imports";
|
|
27
|
+
import appConfig from "#build/app.config";
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
components: {
|
|
30
|
+
UIcon,
|
|
31
|
+
ULink
|
|
32
|
+
},
|
|
33
|
+
inheritAttrs: false,
|
|
34
|
+
props: {
|
|
35
|
+
type: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "button"
|
|
38
|
+
},
|
|
39
|
+
block: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
label: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: null
|
|
46
|
+
},
|
|
47
|
+
loading: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
padded: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
58
|
+
},
|
|
59
|
+
size: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: () => appConfig.ui.button.default.size,
|
|
62
|
+
validator(value) {
|
|
63
|
+
return Object.keys(appConfig.ui.button.size).includes(value);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
color: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: () => appConfig.ui.button.default.color,
|
|
69
|
+
validator(value) {
|
|
70
|
+
return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.button.color)].includes(value);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
variant: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: () => appConfig.ui.button.default.variant,
|
|
76
|
+
validator(value) {
|
|
77
|
+
return [
|
|
78
|
+
...Object.keys(appConfig.ui.button.variant),
|
|
79
|
+
...Object.values(appConfig.ui.button.color).flatMap((value2) => Object.keys(value2))
|
|
80
|
+
].includes(value);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
icon: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: null
|
|
86
|
+
},
|
|
87
|
+
loadingIcon: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: () => appConfig.ui.button.default.loadingIcon
|
|
90
|
+
},
|
|
91
|
+
leadingIcon: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: null
|
|
94
|
+
},
|
|
95
|
+
trailingIcon: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: null
|
|
98
|
+
},
|
|
99
|
+
trailing: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false
|
|
102
|
+
},
|
|
103
|
+
leading: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false
|
|
106
|
+
},
|
|
107
|
+
square: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
default: false
|
|
110
|
+
},
|
|
111
|
+
truncate: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false
|
|
114
|
+
},
|
|
115
|
+
ui: {
|
|
116
|
+
type: Object,
|
|
117
|
+
default: () => ({})
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
setup(props, { attrs, slots }) {
|
|
121
|
+
const appConfig2 = useAppConfig();
|
|
122
|
+
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.button));
|
|
123
|
+
const isLeading = computed(() => {
|
|
124
|
+
return props.icon && props.leading || props.icon && !props.trailing || props.loading && !props.trailing || props.leadingIcon;
|
|
125
|
+
});
|
|
126
|
+
const isTrailing = computed(() => {
|
|
127
|
+
return props.icon && props.trailing || props.loading && props.trailing || props.trailingIcon;
|
|
128
|
+
});
|
|
129
|
+
const isSquare = computed(() => props.square || !slots.default && !props.label);
|
|
130
|
+
const buttonClass = computed(() => {
|
|
131
|
+
const variant = ui.value.color?.[props.color]?.[props.variant] || ui.value.variant[props.variant];
|
|
132
|
+
return twMerge(twJoin(
|
|
133
|
+
ui.value.base,
|
|
134
|
+
ui.value.font,
|
|
135
|
+
ui.value.rounded,
|
|
136
|
+
ui.value.size[props.size],
|
|
137
|
+
ui.value.gap[props.size],
|
|
138
|
+
props.padded && ui.value[isSquare.value ? "square" : "padding"][props.size],
|
|
139
|
+
variant?.replaceAll("{color}", props.color),
|
|
140
|
+
props.block ? "w-full flex justify-center items-center" : "inline-flex items-center"
|
|
141
|
+
), attrs.class);
|
|
142
|
+
});
|
|
143
|
+
const leadingIconName = computed(() => {
|
|
144
|
+
if (props.loading) {
|
|
145
|
+
return props.loadingIcon;
|
|
146
|
+
}
|
|
147
|
+
return props.leadingIcon || props.icon;
|
|
148
|
+
});
|
|
149
|
+
const trailingIconName = computed(() => {
|
|
150
|
+
if (props.loading && !isLeading.value) {
|
|
151
|
+
return props.loadingIcon;
|
|
152
|
+
}
|
|
153
|
+
return props.trailingIcon || props.icon;
|
|
154
|
+
});
|
|
155
|
+
const leadingIconClass = computed(() => {
|
|
156
|
+
return twJoin(
|
|
157
|
+
ui.value.icon.base,
|
|
158
|
+
ui.value.icon.size[props.size],
|
|
159
|
+
props.loading && "animate-spin"
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
const trailingIconClass = computed(() => {
|
|
163
|
+
return twJoin(
|
|
164
|
+
ui.value.icon.base,
|
|
165
|
+
ui.value.icon.size[props.size],
|
|
166
|
+
props.loading && !isLeading.value && "animate-spin"
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
attrs: omit(attrs, ["class"]),
|
|
171
|
+
isLeading,
|
|
172
|
+
isTrailing,
|
|
173
|
+
isSquare,
|
|
174
|
+
buttonClass,
|
|
175
|
+
leadingIconName,
|
|
176
|
+
trailingIconName,
|
|
177
|
+
leadingIconClass,
|
|
178
|
+
trailingIconClass
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
</script>
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
type: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
block: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
label: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: null;
|
|
15
|
+
};
|
|
16
|
+
loading: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
disabled: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
padded: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: () => any;
|
|
31
|
+
validator(value: string): boolean;
|
|
32
|
+
};
|
|
33
|
+
color: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: () => any;
|
|
36
|
+
validator(value: string): boolean;
|
|
37
|
+
};
|
|
38
|
+
variant: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: () => any;
|
|
41
|
+
validator(value: string): boolean;
|
|
42
|
+
};
|
|
43
|
+
icon: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
default: null;
|
|
46
|
+
};
|
|
47
|
+
loadingIcon: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
default: () => any;
|
|
50
|
+
};
|
|
51
|
+
leadingIcon: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
default: null;
|
|
54
|
+
};
|
|
55
|
+
trailingIcon: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: null;
|
|
58
|
+
};
|
|
59
|
+
trailing: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
default: boolean;
|
|
62
|
+
};
|
|
63
|
+
leading: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
square: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
truncate: {
|
|
72
|
+
type: BooleanConstructor;
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
75
|
+
ui: {
|
|
76
|
+
type: PropType<any>;
|
|
77
|
+
default: () => {};
|
|
78
|
+
};
|
|
79
|
+
}, {
|
|
80
|
+
attrs: import("lodash").Omit<{
|
|
81
|
+
[x: string]: unknown;
|
|
82
|
+
}, "class">;
|
|
83
|
+
isLeading: import("vue").ComputedRef<string | true>;
|
|
84
|
+
isTrailing: import("vue").ComputedRef<string | true>;
|
|
85
|
+
isSquare: import("vue").ComputedRef<boolean>;
|
|
86
|
+
buttonClass: import("vue").ComputedRef<string>;
|
|
87
|
+
leadingIconName: import("vue").ComputedRef<string | undefined>;
|
|
88
|
+
trailingIconName: import("vue").ComputedRef<string | undefined>;
|
|
89
|
+
leadingIconClass: import("vue").ComputedRef<string>;
|
|
90
|
+
trailingIconClass: import("vue").ComputedRef<string>;
|
|
91
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
92
|
+
type: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: string;
|
|
95
|
+
};
|
|
96
|
+
block: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
label: {
|
|
101
|
+
type: StringConstructor;
|
|
102
|
+
default: null;
|
|
103
|
+
};
|
|
104
|
+
loading: {
|
|
105
|
+
type: BooleanConstructor;
|
|
106
|
+
default: boolean;
|
|
107
|
+
};
|
|
108
|
+
disabled: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
padded: {
|
|
113
|
+
type: BooleanConstructor;
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
116
|
+
size: {
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
default: () => any;
|
|
119
|
+
validator(value: string): boolean;
|
|
120
|
+
};
|
|
121
|
+
color: {
|
|
122
|
+
type: StringConstructor;
|
|
123
|
+
default: () => any;
|
|
124
|
+
validator(value: string): boolean;
|
|
125
|
+
};
|
|
126
|
+
variant: {
|
|
127
|
+
type: StringConstructor;
|
|
128
|
+
default: () => any;
|
|
129
|
+
validator(value: string): boolean;
|
|
130
|
+
};
|
|
131
|
+
icon: {
|
|
132
|
+
type: StringConstructor;
|
|
133
|
+
default: null;
|
|
134
|
+
};
|
|
135
|
+
loadingIcon: {
|
|
136
|
+
type: StringConstructor;
|
|
137
|
+
default: () => any;
|
|
138
|
+
};
|
|
139
|
+
leadingIcon: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
default: null;
|
|
142
|
+
};
|
|
143
|
+
trailingIcon: {
|
|
144
|
+
type: StringConstructor;
|
|
145
|
+
default: null;
|
|
146
|
+
};
|
|
147
|
+
trailing: {
|
|
148
|
+
type: BooleanConstructor;
|
|
149
|
+
default: boolean;
|
|
150
|
+
};
|
|
151
|
+
leading: {
|
|
152
|
+
type: BooleanConstructor;
|
|
153
|
+
default: boolean;
|
|
154
|
+
};
|
|
155
|
+
square: {
|
|
156
|
+
type: BooleanConstructor;
|
|
157
|
+
default: boolean;
|
|
158
|
+
};
|
|
159
|
+
truncate: {
|
|
160
|
+
type: BooleanConstructor;
|
|
161
|
+
default: boolean;
|
|
162
|
+
};
|
|
163
|
+
ui: {
|
|
164
|
+
type: PropType<any>;
|
|
165
|
+
default: () => {};
|
|
166
|
+
};
|
|
167
|
+
}>>, {
|
|
168
|
+
icon: string;
|
|
169
|
+
color: string;
|
|
170
|
+
ui: any;
|
|
171
|
+
label: string;
|
|
172
|
+
type: string;
|
|
173
|
+
loading: boolean;
|
|
174
|
+
disabled: boolean;
|
|
175
|
+
variant: string;
|
|
176
|
+
size: string;
|
|
177
|
+
block: boolean;
|
|
178
|
+
padded: boolean;
|
|
179
|
+
loadingIcon: string;
|
|
180
|
+
leadingIcon: string;
|
|
181
|
+
trailingIcon: string;
|
|
182
|
+
trailing: boolean;
|
|
183
|
+
leading: boolean;
|
|
184
|
+
square: boolean;
|
|
185
|
+
truncate: boolean;
|
|
186
|
+
}, {}>;
|
|
187
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
size: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: null;
|
|
6
|
+
validator(value: string): boolean;
|
|
7
|
+
};
|
|
8
|
+
orientation: {
|
|
9
|
+
type: PropType<"horizontal" | "vertical">;
|
|
10
|
+
default: string;
|
|
11
|
+
validator(value: string): boolean;
|
|
12
|
+
};
|
|
13
|
+
ui: {
|
|
14
|
+
type: PropType<any>;
|
|
15
|
+
default: () => {};
|
|
16
|
+
};
|
|
17
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
size: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: null;
|
|
23
|
+
validator(value: string): boolean;
|
|
24
|
+
};
|
|
25
|
+
orientation: {
|
|
26
|
+
type: PropType<"horizontal" | "vertical">;
|
|
27
|
+
default: string;
|
|
28
|
+
validator(value: string): boolean;
|
|
29
|
+
};
|
|
30
|
+
ui: {
|
|
31
|
+
type: PropType<any>;
|
|
32
|
+
default: () => {};
|
|
33
|
+
};
|
|
34
|
+
}>>, {
|
|
35
|
+
ui: any;
|
|
36
|
+
size: string;
|
|
37
|
+
orientation: "horizontal" | "vertical";
|
|
38
|
+
}, {}>;
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { h, cloneVNode, computed, defineComponent } from "vue";
|
|
2
|
+
import { omit } from "lodash-es";
|
|
3
|
+
import { twMerge, twJoin } from "tailwind-merge";
|
|
4
|
+
import { defuTwMerge, getSlotsChildren } from "../../utils/index.mjs";
|
|
5
|
+
import { useAppConfig } from "#imports";
|
|
6
|
+
import appConfig from "#build/app.config";
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: {
|
|
10
|
+
size: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: null,
|
|
13
|
+
validator(value) {
|
|
14
|
+
return Object.keys(appConfig.ui.button.size).includes(value);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
orientation: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "horizontal",
|
|
20
|
+
validator(value) {
|
|
21
|
+
return ["horizontal", "vertical"].includes(value);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
ui: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({})
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setup(props, { attrs, slots }) {
|
|
30
|
+
const appConfig2 = useAppConfig();
|
|
31
|
+
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.buttonGroup));
|
|
32
|
+
const children = computed(() => getSlotsChildren(slots));
|
|
33
|
+
const rounded = computed(() => {
|
|
34
|
+
const roundedMap = {
|
|
35
|
+
"rounded-none": { horizontal: { left: "rounded-s-none", right: "rounded-e-none" }, vertical: { top: "rounded-t-none", bottom: "rounded-b-none" } },
|
|
36
|
+
"rounded-sm": { horizontal: { left: "rounded-s-sm", right: "rounded-e-sm" }, vertical: { top: "rounded-t-sm", bottom: "rounded-b-sm" } },
|
|
37
|
+
rounded: { horizontal: { left: "rounded-s", right: "rounded-e" }, vertical: { top: "rounded-t", bottom: "rounded-b" } },
|
|
38
|
+
"rounded-md": { horizontal: { left: "rounded-s-md", right: "rounded-e-md" }, vertical: { top: "rounded-t-md", bottom: "rounded-b-md" } },
|
|
39
|
+
"rounded-lg": { horizontal: { left: "rounded-s-lg", right: "rounded-e-lg" }, vertical: { top: "rounded-t-lg", bottom: "rounded-b-lg" } },
|
|
40
|
+
"rounded-xl": { horizontal: { left: "rounded-s-xl", right: "rounded-e-xl" }, vertical: { top: "rounded-t-xl", bottom: "rounded-b-xl" } },
|
|
41
|
+
"rounded-2xl": { horizontal: { left: "rounded-s-2xl", right: "rounded-e-2xl" }, vertical: { top: "rounded-t-2xl", bottom: "rounded-b-2xl" } },
|
|
42
|
+
"rounded-3xl": { horizontal: { left: "rounded-s-3xl", right: "rounded-e-3xl" }, vertical: { top: "rounded-t-3xl", bottom: "rounded-b-3xl" } },
|
|
43
|
+
"rounded-full": { horizontal: { left: "rounded-s-full", right: "rounded-e-full" }, vertical: { top: "rounded-t-full", bottom: "rounded-b-full" } }
|
|
44
|
+
};
|
|
45
|
+
return roundedMap[ui.value.rounded][props.orientation];
|
|
46
|
+
});
|
|
47
|
+
const clones = computed(() => children.value.map((node, index) => {
|
|
48
|
+
const vProps = {};
|
|
49
|
+
if (props.orientation === "vertical") {
|
|
50
|
+
ui.value.wrapper = "flex flex-col -space-y-px";
|
|
51
|
+
} else {
|
|
52
|
+
ui.value.wrapper = "inline-flex -space-x-px";
|
|
53
|
+
}
|
|
54
|
+
if (props.size) {
|
|
55
|
+
vProps.size = props.size;
|
|
56
|
+
}
|
|
57
|
+
vProps.ui = node.props?.ui || {};
|
|
58
|
+
vProps.ui.rounded = "rounded-none";
|
|
59
|
+
vProps.ui.base = "!shadow-none";
|
|
60
|
+
if (index === 0) {
|
|
61
|
+
vProps.ui.rounded += ` ${rounded.value.left || rounded.value.top}`;
|
|
62
|
+
}
|
|
63
|
+
if (index === children.value.length - 1) {
|
|
64
|
+
vProps.ui.rounded += ` ${rounded.value.right || rounded.value.bottom}`;
|
|
65
|
+
}
|
|
66
|
+
return cloneVNode(node, vProps);
|
|
67
|
+
}));
|
|
68
|
+
return () => h("div", { class: twMerge(twJoin(ui.value.wrapper, ui.value.rounded, ui.value.shadow), attrs.class), ...omit(attrs, ["class"]) }, clones.value);
|
|
69
|
+
}
|
|
70
|
+
});
|