@nuxt/ui 0.4.1 → 2.8.1
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 +185 -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 +56 -39
- package/LICENSE +0 -21
- package/dist/assets/styles.css +0 -14
- package/dist/components/NButton.vue +0 -22
- 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 -20
- 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 -127
- package/nuxt.cjs +0 -7
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<HMenu v-slot="{ open }" as="div" :class="wrapperClass" v-bind="attrs" @mouseleave="onMouseLeave">
|
|
3
|
+
<HMenuButton
|
|
4
|
+
ref="trigger"
|
|
5
|
+
as="div"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
class="inline-flex w-full"
|
|
8
|
+
role="button"
|
|
9
|
+
@mouseover="onMouseOver"
|
|
10
|
+
>
|
|
11
|
+
<slot :open="open" :disabled="disabled">
|
|
12
|
+
<button :disabled="disabled">
|
|
13
|
+
Open
|
|
14
|
+
</button>
|
|
15
|
+
</slot>
|
|
16
|
+
</HMenuButton>
|
|
17
|
+
|
|
18
|
+
<div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
|
|
19
|
+
<Transition appear v-bind="ui.transition">
|
|
20
|
+
<HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
|
|
21
|
+
<div v-for="(subItems, index) of items" :key="index" :class="ui.padding">
|
|
22
|
+
<HMenuItem v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ active, disabled: itemDisabled }" :disabled="item.disabled">
|
|
23
|
+
<ULink
|
|
24
|
+
v-bind="omit(item, ['label', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'click'])"
|
|
25
|
+
:class="[ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled]"
|
|
26
|
+
@click="item.click"
|
|
27
|
+
>
|
|
28
|
+
<slot :name="item.slot || 'item'" :item="item">
|
|
29
|
+
<UIcon v-if="item.icon" :name="item.icon" :class="[ui.item.icon.base, active ? ui.item.icon.active : ui.item.icon.inactive, item.iconClass]" />
|
|
30
|
+
<UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
|
|
31
|
+
|
|
32
|
+
<span class="truncate">{{ item.label }}</span>
|
|
33
|
+
|
|
34
|
+
<span v-if="item.shortcuts?.length" :class="ui.item.shortcuts">
|
|
35
|
+
<UKbd v-for="shortcut of item.shortcuts" :key="shortcut">{{ shortcut }}</UKbd>
|
|
36
|
+
</span>
|
|
37
|
+
</slot>
|
|
38
|
+
</ULink>
|
|
39
|
+
</HMenuItem>
|
|
40
|
+
</div>
|
|
41
|
+
</HMenuItems>
|
|
42
|
+
</Transition>
|
|
43
|
+
</div>
|
|
44
|
+
</HMenu>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { defineComponent, ref, computed, onMounted } from "vue";
|
|
49
|
+
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem } from "@headlessui/vue";
|
|
50
|
+
import { defu } from "defu";
|
|
51
|
+
import { omit } from "lodash-es";
|
|
52
|
+
import { twMerge } from "tailwind-merge";
|
|
53
|
+
import UIcon from "../elements/Icon.vue";
|
|
54
|
+
import UAvatar from "../elements/Avatar.vue";
|
|
55
|
+
import UKbd from "../elements/Kbd.vue";
|
|
56
|
+
import ULink from "../elements/Link.vue";
|
|
57
|
+
import { usePopper } from "../../composables/usePopper";
|
|
58
|
+
import { defuTwMerge } from "../../utils";
|
|
59
|
+
import { useAppConfig } from "#imports";
|
|
60
|
+
export default defineComponent({
|
|
61
|
+
components: {
|
|
62
|
+
HMenu,
|
|
63
|
+
HMenuButton,
|
|
64
|
+
HMenuItems,
|
|
65
|
+
HMenuItem,
|
|
66
|
+
UIcon,
|
|
67
|
+
UAvatar,
|
|
68
|
+
UKbd,
|
|
69
|
+
ULink
|
|
70
|
+
},
|
|
71
|
+
inheritAttrs: false,
|
|
72
|
+
props: {
|
|
73
|
+
items: {
|
|
74
|
+
type: Array,
|
|
75
|
+
default: () => []
|
|
76
|
+
},
|
|
77
|
+
mode: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "click",
|
|
80
|
+
validator: (value) => ["click", "hover"].includes(value)
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false
|
|
85
|
+
},
|
|
86
|
+
popper: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: () => ({})
|
|
89
|
+
},
|
|
90
|
+
openDelay: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 0
|
|
93
|
+
},
|
|
94
|
+
closeDelay: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 0
|
|
97
|
+
},
|
|
98
|
+
ui: {
|
|
99
|
+
type: Object,
|
|
100
|
+
default: () => ({})
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
setup(props, { attrs }) {
|
|
104
|
+
const appConfig2 = useAppConfig();
|
|
105
|
+
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.dropdown));
|
|
106
|
+
const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
|
|
107
|
+
const [trigger, container] = usePopper(popper.value);
|
|
108
|
+
const menuApi = ref(null);
|
|
109
|
+
let openTimeout = null;
|
|
110
|
+
let closeTimeout = null;
|
|
111
|
+
onMounted(() => {
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
const menuProvides = trigger.value?.$.provides;
|
|
114
|
+
if (!menuProvides) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const menuProvidesSymbols = Object.getOwnPropertySymbols(menuProvides);
|
|
118
|
+
menuApi.value = menuProvidesSymbols.length && menuProvides[menuProvidesSymbols[0]];
|
|
119
|
+
}, 200);
|
|
120
|
+
});
|
|
121
|
+
const containerStyle = computed(() => {
|
|
122
|
+
const offsetDistance = props.popper?.offsetDistance || ui.value.popper?.offsetDistance || 8;
|
|
123
|
+
return props.mode === "hover" ? { paddingTop: `${offsetDistance}px`, paddingBottom: `${offsetDistance}px` } : {};
|
|
124
|
+
});
|
|
125
|
+
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
126
|
+
function onMouseOver() {
|
|
127
|
+
if (props.mode !== "hover" || !menuApi.value) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (closeTimeout) {
|
|
131
|
+
clearTimeout(closeTimeout);
|
|
132
|
+
closeTimeout = null;
|
|
133
|
+
}
|
|
134
|
+
if (menuApi.value.menuState === 0) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
openTimeout = openTimeout || setTimeout(() => {
|
|
138
|
+
menuApi.value.openMenu && menuApi.value.openMenu();
|
|
139
|
+
openTimeout = null;
|
|
140
|
+
}, props.openDelay);
|
|
141
|
+
}
|
|
142
|
+
function onMouseLeave() {
|
|
143
|
+
if (props.mode !== "hover" || !menuApi.value) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (openTimeout) {
|
|
147
|
+
clearTimeout(openTimeout);
|
|
148
|
+
openTimeout = null;
|
|
149
|
+
}
|
|
150
|
+
if (menuApi.value.menuState === 1) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
closeTimeout = closeTimeout || setTimeout(() => {
|
|
154
|
+
menuApi.value.closeMenu && menuApi.value.closeMenu();
|
|
155
|
+
closeTimeout = null;
|
|
156
|
+
}, props.closeDelay);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
attrs: omit(attrs, ["class"]),
|
|
160
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
161
|
+
ui,
|
|
162
|
+
trigger,
|
|
163
|
+
container,
|
|
164
|
+
containerStyle,
|
|
165
|
+
wrapperClass,
|
|
166
|
+
onMouseOver,
|
|
167
|
+
onMouseLeave,
|
|
168
|
+
omit
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { DropdownItem } from '../../types/dropdown';
|
|
4
|
+
import type { PopperOptions } from '../../types/popper';
|
|
5
|
+
declare const _default: import("vue").DefineComponent<{
|
|
6
|
+
items: {
|
|
7
|
+
type: PropType<DropdownItem[][]>;
|
|
8
|
+
default: () => never[];
|
|
9
|
+
};
|
|
10
|
+
mode: {
|
|
11
|
+
type: PropType<"click" | "hover">;
|
|
12
|
+
default: string;
|
|
13
|
+
validator: (value: string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
disabled: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
popper: {
|
|
20
|
+
type: PropType<PopperOptions>;
|
|
21
|
+
default: () => {};
|
|
22
|
+
};
|
|
23
|
+
openDelay: {
|
|
24
|
+
type: NumberConstructor;
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
27
|
+
closeDelay: {
|
|
28
|
+
type: NumberConstructor;
|
|
29
|
+
default: number;
|
|
30
|
+
};
|
|
31
|
+
ui: {
|
|
32
|
+
type: PropType<any>;
|
|
33
|
+
default: () => {};
|
|
34
|
+
};
|
|
35
|
+
}, {
|
|
36
|
+
attrs: import("lodash").Omit<{
|
|
37
|
+
[x: string]: unknown;
|
|
38
|
+
}, "class">;
|
|
39
|
+
ui: import("vue").ComputedRef<any>;
|
|
40
|
+
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
41
|
+
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
42
|
+
containerStyle: import("vue").ComputedRef<{
|
|
43
|
+
paddingTop: string;
|
|
44
|
+
paddingBottom: string;
|
|
45
|
+
} | {
|
|
46
|
+
paddingTop?: undefined;
|
|
47
|
+
paddingBottom?: undefined;
|
|
48
|
+
}>;
|
|
49
|
+
wrapperClass: import("vue").ComputedRef<string>;
|
|
50
|
+
onMouseOver: () => void;
|
|
51
|
+
onMouseLeave: () => void;
|
|
52
|
+
omit: {
|
|
53
|
+
<T extends object, K extends import("lodash").PropertyName[]>(object: T | null | undefined, ...paths: K): Pick<T, Exclude<keyof T, K[number]>>;
|
|
54
|
+
<T_1 extends object, K_1 extends keyof T_1>(object: T_1 | null | undefined, ...paths: import("lodash").Many<K_1>[]): import("lodash").Omit<T_1, K_1>;
|
|
55
|
+
<T_2 extends object>(object: T_2 | null | undefined, ...paths: import("lodash").Many<import("lodash").PropertyName>[]): Partial<T_2>;
|
|
56
|
+
};
|
|
57
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
58
|
+
items: {
|
|
59
|
+
type: PropType<DropdownItem[][]>;
|
|
60
|
+
default: () => never[];
|
|
61
|
+
};
|
|
62
|
+
mode: {
|
|
63
|
+
type: PropType<"click" | "hover">;
|
|
64
|
+
default: string;
|
|
65
|
+
validator: (value: string) => boolean;
|
|
66
|
+
};
|
|
67
|
+
disabled: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
popper: {
|
|
72
|
+
type: PropType<PopperOptions>;
|
|
73
|
+
default: () => {};
|
|
74
|
+
};
|
|
75
|
+
openDelay: {
|
|
76
|
+
type: NumberConstructor;
|
|
77
|
+
default: number;
|
|
78
|
+
};
|
|
79
|
+
closeDelay: {
|
|
80
|
+
type: NumberConstructor;
|
|
81
|
+
default: number;
|
|
82
|
+
};
|
|
83
|
+
ui: {
|
|
84
|
+
type: PropType<any>;
|
|
85
|
+
default: () => {};
|
|
86
|
+
};
|
|
87
|
+
}>>, {
|
|
88
|
+
ui: any;
|
|
89
|
+
popper: PopperOptions;
|
|
90
|
+
disabled: boolean;
|
|
91
|
+
items: DropdownItem[][];
|
|
92
|
+
mode: "click" | "hover";
|
|
93
|
+
openDelay: number;
|
|
94
|
+
closeDelay: number;
|
|
95
|
+
}, {}>;
|
|
96
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
name: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
name: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
}>>, {}, {}>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<kbd :class="kbdClass" v-bind="attrs">
|
|
3
|
+
<slot>{{ value }}</slot>
|
|
4
|
+
</kbd>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { defineComponent, computed } from "vue";
|
|
9
|
+
import { omit } from "lodash-es";
|
|
10
|
+
import { twMerge, twJoin } from "tailwind-merge";
|
|
11
|
+
import { defuTwMerge } from "../../utils";
|
|
12
|
+
import { useAppConfig } from "#imports";
|
|
13
|
+
import appConfig from "#build/app.config";
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
inheritAttrs: false,
|
|
16
|
+
props: {
|
|
17
|
+
value: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: () => appConfig.ui.kbd.default.size,
|
|
24
|
+
validator(value) {
|
|
25
|
+
return Object.keys(appConfig.ui.kbd.size).includes(value);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
ui: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: () => ({})
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
setup(props, { attrs }) {
|
|
34
|
+
const appConfig2 = useAppConfig();
|
|
35
|
+
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.kbd));
|
|
36
|
+
const kbdClass = computed(() => {
|
|
37
|
+
return twMerge(twJoin(
|
|
38
|
+
ui.value.base,
|
|
39
|
+
ui.value.size[props.size],
|
|
40
|
+
ui.value.padding,
|
|
41
|
+
ui.value.rounded,
|
|
42
|
+
ui.value.font,
|
|
43
|
+
ui.value.background,
|
|
44
|
+
ui.value.ring
|
|
45
|
+
), attrs.class);
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
attrs: omit(attrs, ["class"]),
|
|
49
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
50
|
+
ui,
|
|
51
|
+
kbdClass
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
value: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
default: null;
|
|
7
|
+
};
|
|
8
|
+
size: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: () => any;
|
|
11
|
+
validator(value: string): boolean;
|
|
12
|
+
};
|
|
13
|
+
ui: {
|
|
14
|
+
type: PropType<any>;
|
|
15
|
+
default: () => {};
|
|
16
|
+
};
|
|
17
|
+
}, {
|
|
18
|
+
attrs: import("lodash").Omit<{
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
}, "class">;
|
|
21
|
+
ui: import("vue").ComputedRef<any>;
|
|
22
|
+
kbdClass: import("vue").ComputedRef<string>;
|
|
23
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
value: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
default: null;
|
|
27
|
+
};
|
|
28
|
+
size: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: () => any;
|
|
31
|
+
validator(value: string): boolean;
|
|
32
|
+
};
|
|
33
|
+
ui: {
|
|
34
|
+
type: PropType<any>;
|
|
35
|
+
default: () => {};
|
|
36
|
+
};
|
|
37
|
+
}>>, {
|
|
38
|
+
ui: any;
|
|
39
|
+
value: string;
|
|
40
|
+
size: string;
|
|
41
|
+
}, {}>;
|
|
42
|
+
export default _default;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button v-if="!to" :type="type" :disabled="disabled" v-bind="$attrs" :class="inactiveClass">
|
|
3
|
+
<slot />
|
|
4
|
+
</button>
|
|
5
|
+
<NuxtLink
|
|
6
|
+
v-else
|
|
7
|
+
v-slot="{ route, href, target, rel, navigate, isActive, isExactActive, isExternal }"
|
|
8
|
+
v-bind="$props"
|
|
9
|
+
custom
|
|
10
|
+
>
|
|
11
|
+
<a
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
:href="!disabled ? href : undefined"
|
|
14
|
+
:aria-disabled="disabled ? 'true' : undefined"
|
|
15
|
+
:role="disabled ? 'link' : undefined"
|
|
16
|
+
:rel="rel"
|
|
17
|
+
:target="target"
|
|
18
|
+
:class="resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
19
|
+
@click="(e) => !isExternal && navigate(e)"
|
|
20
|
+
>
|
|
21
|
+
<slot v-bind="{ isActive: exact ? isExactActive : isActive }" />
|
|
22
|
+
</a>
|
|
23
|
+
</NuxtLink>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import { isEqual } from "lodash-es";
|
|
28
|
+
import { defineComponent } from "vue";
|
|
29
|
+
import { NuxtLink } from "#components";
|
|
30
|
+
export default defineComponent({
|
|
31
|
+
inheritAttrs: false,
|
|
32
|
+
props: {
|
|
33
|
+
...NuxtLink.props,
|
|
34
|
+
type: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
disabled: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
42
|
+
exact: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
exactQuery: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
exactHash: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
inactiveClass: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: void 0
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
setup(props) {
|
|
60
|
+
function resolveLinkClass(route, $route, { isActive, isExactActive }) {
|
|
61
|
+
if (props.exactQuery && !isEqual(route.query, $route.query)) {
|
|
62
|
+
return props.inactiveClass;
|
|
63
|
+
}
|
|
64
|
+
if (props.exactHash && route.hash !== $route.hash) {
|
|
65
|
+
return props.inactiveClass;
|
|
66
|
+
}
|
|
67
|
+
if (props.exact && isExactActive) {
|
|
68
|
+
return props.activeClass;
|
|
69
|
+
}
|
|
70
|
+
if (!props.exact && isActive) {
|
|
71
|
+
return props.activeClass;
|
|
72
|
+
}
|
|
73
|
+
return props.inactiveClass;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
resolveLinkClass
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<any, {
|
|
2
|
+
resolveLinkClass: (route: any, $route: any, { isActive, isExactActive }: {
|
|
3
|
+
isActive: boolean;
|
|
4
|
+
isExactActive: boolean;
|
|
5
|
+
}) => any;
|
|
6
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<any>, {} | {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}, {}>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="wrapperClass">
|
|
3
|
+
<div class="flex items-center h-5">
|
|
4
|
+
<input
|
|
5
|
+
:id="name"
|
|
6
|
+
v-model="toggle"
|
|
7
|
+
:name="name"
|
|
8
|
+
:required="required"
|
|
9
|
+
:value="value"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:checked="checked"
|
|
12
|
+
:indeterminate="indeterminate"
|
|
13
|
+
type="checkbox"
|
|
14
|
+
class="form-checkbox"
|
|
15
|
+
:class="inputClass"
|
|
16
|
+
v-bind="attrs"
|
|
17
|
+
@change="onChange"
|
|
18
|
+
>
|
|
19
|
+
</div>
|
|
20
|
+
<div v-if="label || $slots.label" class="ms-3 text-sm">
|
|
21
|
+
<label :for="name" :class="ui.label">
|
|
22
|
+
<slot name="label">{{ label }}</slot>
|
|
23
|
+
<span v-if="required" :class="ui.required">*</span>
|
|
24
|
+
</label>
|
|
25
|
+
<p v-if="help" :class="ui.help">
|
|
26
|
+
{{ help }}
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import { computed, defineComponent } from "vue";
|
|
34
|
+
import { omit } from "lodash-es";
|
|
35
|
+
import { twMerge, twJoin } from "tailwind-merge";
|
|
36
|
+
import { defuTwMerge } from "../../utils";
|
|
37
|
+
import { useFormGroup } from "../../composables/useFormGroup";
|
|
38
|
+
import { useAppConfig } from "#imports";
|
|
39
|
+
import appConfig from "#build/app.config";
|
|
40
|
+
export default defineComponent({
|
|
41
|
+
inheritAttrs: false,
|
|
42
|
+
props: {
|
|
43
|
+
value: {
|
|
44
|
+
type: [String, Number, Boolean, Object],
|
|
45
|
+
default: null
|
|
46
|
+
},
|
|
47
|
+
modelValue: {
|
|
48
|
+
type: [Boolean, Array],
|
|
49
|
+
default: null
|
|
50
|
+
},
|
|
51
|
+
name: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
checked: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
indeterminate: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
help: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: null
|
|
70
|
+
},
|
|
71
|
+
label: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: null
|
|
74
|
+
},
|
|
75
|
+
required: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
color: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: () => appConfig.ui.checkbox.default.color,
|
|
82
|
+
validator(value) {
|
|
83
|
+
return appConfig.ui.colors.includes(value);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
inputClass: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: ""
|
|
89
|
+
},
|
|
90
|
+
ui: {
|
|
91
|
+
type: Object,
|
|
92
|
+
default: () => ({})
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
emits: ["update:modelValue", "change"],
|
|
96
|
+
setup(props, { emit, attrs }) {
|
|
97
|
+
const appConfig2 = useAppConfig();
|
|
98
|
+
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.checkbox));
|
|
99
|
+
const { emitFormChange, formGroup } = useFormGroup();
|
|
100
|
+
const color = computed(() => formGroup?.error?.value ? "red" : props.color);
|
|
101
|
+
const toggle = computed({
|
|
102
|
+
get() {
|
|
103
|
+
return props.modelValue;
|
|
104
|
+
},
|
|
105
|
+
set(value) {
|
|
106
|
+
emit("update:modelValue", value);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const onChange = (event) => {
|
|
110
|
+
emit("change", event);
|
|
111
|
+
emitFormChange();
|
|
112
|
+
};
|
|
113
|
+
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
114
|
+
const inputClass = computed(() => {
|
|
115
|
+
return twMerge(twJoin(
|
|
116
|
+
ui.value.base,
|
|
117
|
+
ui.value.rounded,
|
|
118
|
+
ui.value.background,
|
|
119
|
+
ui.value.border,
|
|
120
|
+
ui.value.ring.replaceAll("{color}", color.value),
|
|
121
|
+
ui.value.color.replaceAll("{color}", color.value)
|
|
122
|
+
), props.inputClass);
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
attrs: omit(attrs, ["class"]),
|
|
126
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
127
|
+
ui,
|
|
128
|
+
toggle,
|
|
129
|
+
wrapperClass,
|
|
130
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
131
|
+
inputClass,
|
|
132
|
+
onChange
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
</script>
|