@nuxt/ui 3.1.3 → 3.3.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/.nuxt/ui/avatar.ts +1 -1
- package/.nuxt/ui/button.ts +42 -42
- package/.nuxt/ui/card.ts +1 -1
- package/.nuxt/ui/carousel.ts +1 -1
- package/.nuxt/ui/command-palette.ts +3 -1
- package/.nuxt/ui/drawer.ts +1 -1
- package/.nuxt/ui/file-upload.ts +290 -0
- package/.nuxt/ui/index.ts +3 -0
- package/.nuxt/ui/input-menu.ts +24 -10
- package/.nuxt/ui/input-tags.ts +310 -0
- package/.nuxt/ui/kbd.ts +167 -3
- package/.nuxt/ui/modal.ts +1 -1
- package/.nuxt/ui/navigation-menu.ts +1 -1
- package/.nuxt/ui/select-menu.ts +11 -6
- package/.nuxt/ui/select.ts +11 -6
- package/.nuxt/ui/table.ts +11 -2
- package/.nuxt/ui/tabs.ts +4 -2
- package/.nuxt/ui/timeline.ts +321 -0
- package/.nuxt/ui/toast.ts +8 -15
- package/.nuxt/ui/toaster.ts +1 -1
- package/.nuxt/ui/tooltip.ts +1 -1
- package/cli/templates.mjs +11 -7
- package/dist/module.d.mts +15 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -3
- package/dist/runtime/components/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/Alert.vue +0 -1
- package/dist/runtime/components/Alert.vue.d.ts +2 -2
- package/dist/runtime/components/App.vue.d.ts +1 -1
- package/dist/runtime/components/Avatar.vue +10 -2
- package/dist/runtime/components/Avatar.vue.d.ts +3 -1
- package/dist/runtime/components/AvatarGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Badge.vue.d.ts +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/Button.vue +6 -6
- package/dist/runtime/components/Button.vue.d.ts +1 -5
- package/dist/runtime/components/ButtonGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +4 -1
- package/dist/runtime/components/Calendar.vue.d.ts +1 -1
- package/dist/runtime/components/Card.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.vue +19 -16
- package/dist/runtime/components/Carousel.vue.d.ts +1 -1
- package/dist/runtime/components/Checkbox.vue +1 -1
- package/dist/runtime/components/Checkbox.vue.d.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/Collapsible.vue.d.ts +1 -1
- package/dist/runtime/components/ColorPicker.vue +1 -2
- package/dist/runtime/components/ColorPicker.vue.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue +84 -16
- package/dist/runtime/components/CommandPalette.vue.d.ts +38 -9
- package/dist/runtime/components/Container.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +5 -21
- package/dist/runtime/components/Drawer.vue +4 -4
- package/dist/runtime/components/Drawer.vue.d.ts +6 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +12 -25
- package/dist/runtime/components/FileUpload.vue +242 -0
- package/dist/runtime/components/FileUpload.vue.d.ts +167 -0
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/Form.vue.d.ts +15 -13
- package/dist/runtime/components/FormField.vue +2 -2
- package/dist/runtime/components/FormField.vue.d.ts +4 -4
- package/dist/runtime/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/Input.vue +10 -7
- package/dist/runtime/components/Input.vue.d.ts +9 -9
- package/dist/runtime/components/InputMenu.vue +17 -10
- package/dist/runtime/components/InputMenu.vue.d.ts +19 -16
- package/dist/runtime/components/InputNumber.vue +3 -2
- package/dist/runtime/components/InputNumber.vue.d.ts +5 -5
- package/dist/runtime/components/InputTags.vue +161 -0
- package/dist/runtime/components/InputTags.vue.d.ts +185 -0
- package/dist/runtime/components/Kbd.vue +2 -1
- package/dist/runtime/components/Kbd.vue.d.ts +5 -1
- package/dist/runtime/components/Link.vue +6 -5
- package/dist/runtime/components/Link.vue.d.ts +1 -3
- package/dist/runtime/components/LinkBase.vue.d.ts +1 -1
- package/dist/runtime/components/Modal.vue +14 -13
- package/dist/runtime/components/Modal.vue.d.ts +16 -6
- package/dist/runtime/components/NavigationMenu.vue +19 -17
- package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
- package/dist/runtime/components/OverlayProvider.vue +2 -2
- package/dist/runtime/components/OverlayProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Pagination.vue +1 -1
- package/dist/runtime/components/Pagination.vue.d.ts +1 -2
- package/dist/runtime/components/PinInput.vue +4 -3
- package/dist/runtime/components/PinInput.vue.d.ts +22 -19
- package/dist/runtime/components/Popover.vue +2 -1
- package/dist/runtime/components/Popover.vue.d.ts +8 -2
- package/dist/runtime/components/Progress.vue +2 -1
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +3 -3
- package/dist/runtime/components/RadioGroup.vue.d.ts +5 -4
- package/dist/runtime/components/Select.vue +23 -4
- package/dist/runtime/components/Select.vue.d.ts +108 -2
- package/dist/runtime/components/SelectMenu.vue +33 -11
- package/dist/runtime/components/SelectMenu.vue.d.ts +106 -2
- package/dist/runtime/components/Separator.vue.d.ts +1 -1
- package/dist/runtime/components/Skeleton.vue.d.ts +1 -1
- package/dist/runtime/components/Slideover.vue +14 -13
- package/dist/runtime/components/Slideover.vue.d.ts +16 -6
- package/dist/runtime/components/Slider.vue.d.ts +5 -5
- package/dist/runtime/components/Stepper.vue.d.ts +1 -1
- package/dist/runtime/components/Switch.vue.d.ts +1 -1
- package/dist/runtime/components/Table.vue +90 -9
- package/dist/runtime/components/Table.vue.d.ts +30 -12
- package/dist/runtime/components/Tabs.vue +24 -4
- package/dist/runtime/components/Tabs.vue.d.ts +12 -4
- package/dist/runtime/components/Textarea.vue +10 -7
- package/dist/runtime/components/Textarea.vue.d.ts +14 -12
- package/dist/runtime/components/Timeline.vue +92 -0
- package/dist/runtime/components/Timeline.vue.d.ts +70 -0
- package/dist/runtime/components/Toast.vue +16 -9
- package/dist/runtime/components/Toast.vue.d.ts +14 -13
- package/dist/runtime/components/Toaster.vue.d.ts +1 -1
- package/dist/runtime/components/Tooltip.vue +2 -1
- package/dist/runtime/components/Tooltip.vue.d.ts +8 -2
- package/dist/runtime/components/Tree.vue +6 -4
- package/dist/runtime/components/Tree.vue.d.ts +2 -2
- package/dist/runtime/composables/defineLocale.d.ts +2 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +7 -5
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useComponentIcons.d.ts +1 -1
- package/dist/runtime/composables/useFileUpload.d.ts +19 -0
- package/dist/runtime/composables/useFileUpload.js +63 -0
- package/dist/runtime/composables/useFormField.d.ts +3 -6
- package/dist/runtime/composables/useFormField.js +5 -2
- package/dist/runtime/composables/useKbd.d.ts +1 -1
- package/dist/runtime/composables/useLocale.js +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +30 -2
- package/dist/runtime/composables/useOverlay.js +8 -7
- package/dist/runtime/composables/usePortal.d.ts +1 -1
- package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +1 -1
- package/dist/runtime/inertia/stubs.d.ts +1 -0
- package/dist/runtime/inertia/stubs.js +4 -2
- package/dist/runtime/locale/ar.js +4 -2
- package/dist/runtime/locale/az.js +3 -1
- package/dist/runtime/locale/bg.js +3 -1
- package/dist/runtime/locale/bn.js +3 -1
- package/dist/runtime/locale/ca.js +3 -1
- package/dist/runtime/locale/ckb.js +4 -2
- package/dist/runtime/locale/cs.js +3 -1
- package/dist/runtime/locale/da.js +3 -1
- package/dist/runtime/locale/de.js +3 -1
- package/dist/runtime/locale/el.js +3 -1
- package/dist/runtime/locale/en.js +3 -1
- package/dist/runtime/locale/es.js +3 -1
- package/dist/runtime/locale/et.js +3 -1
- package/dist/runtime/locale/fa_ir.js +3 -1
- package/dist/runtime/locale/fi.js +3 -1
- package/dist/runtime/locale/fr.js +3 -1
- package/dist/runtime/locale/he.js +3 -1
- package/dist/runtime/locale/hi.js +4 -2
- package/dist/runtime/locale/hu.js +3 -1
- package/dist/runtime/locale/hy.js +3 -1
- package/dist/runtime/locale/id.js +3 -1
- package/dist/runtime/locale/index.d.ts +1 -0
- package/dist/runtime/locale/index.js +1 -0
- package/dist/runtime/locale/it.js +3 -1
- package/dist/runtime/locale/ja.js +3 -1
- package/dist/runtime/locale/kk.js +3 -1
- package/dist/runtime/locale/km.js +4 -2
- package/dist/runtime/locale/ko.js +3 -1
- package/dist/runtime/locale/ky.js +3 -1
- package/dist/runtime/locale/lb.d.ts +3 -0
- package/dist/runtime/locale/lb.js +56 -0
- package/dist/runtime/locale/lt.js +3 -1
- package/dist/runtime/locale/mn.js +3 -1
- package/dist/runtime/locale/ms.js +3 -1
- package/dist/runtime/locale/nb_no.js +3 -1
- package/dist/runtime/locale/nl.js +3 -1
- package/dist/runtime/locale/pl.js +3 -1
- package/dist/runtime/locale/pt.js +3 -1
- package/dist/runtime/locale/pt_br.js +3 -1
- package/dist/runtime/locale/ro.js +3 -1
- package/dist/runtime/locale/ru.js +3 -1
- package/dist/runtime/locale/sk.js +3 -1
- package/dist/runtime/locale/sl.js +3 -1
- package/dist/runtime/locale/sv.js +3 -1
- package/dist/runtime/locale/th.js +3 -1
- package/dist/runtime/locale/tj.js +3 -1
- package/dist/runtime/locale/tr.js +3 -1
- package/dist/runtime/locale/ug_cn.js +3 -1
- package/dist/runtime/locale/uk.js +3 -1
- package/dist/runtime/locale/ur.js +3 -1
- package/dist/runtime/locale/uz.js +3 -1
- package/dist/runtime/locale/vi.js +3 -1
- package/dist/runtime/locale/zh_cn.js +3 -1
- package/dist/runtime/locale/zh_tw.js +3 -1
- package/dist/runtime/types/form.d.ts +11 -10
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/locale.d.ts +2 -0
- package/dist/runtime/types/utils.d.ts +3 -0
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +9 -0
- package/dist/runtime/vue/components/Icon.vue.d.ts +1 -1
- package/dist/runtime/vue/components/Link.vue.d.ts +1 -1
- package/dist/runtime/vue/stubs.d.ts +1 -0
- package/dist/runtime/vue/stubs.js +3 -1
- package/dist/shared/{ui.Bix4DSU4.mjs → ui.BkSj2DmF.mjs} +560 -55
- package/dist/unplugin.d.mts +2 -0
- package/dist/unplugin.mjs +6 -3
- package/dist/vite.mjs +1 -1
- package/package.json +37 -38
|
@@ -43,13 +43,14 @@ const props = defineProps({
|
|
|
43
43
|
id: { type: String, required: false },
|
|
44
44
|
name: { type: String, required: false },
|
|
45
45
|
formatOptions: { type: null, required: false },
|
|
46
|
-
disableWheelChange: { type: Boolean, required: false }
|
|
46
|
+
disableWheelChange: { type: Boolean, required: false },
|
|
47
|
+
invertWheelChange: { type: Boolean, required: false }
|
|
47
48
|
});
|
|
48
49
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
49
50
|
defineSlots();
|
|
50
51
|
const { t, code: codeLocale } = useLocale();
|
|
51
52
|
const appConfig = useAppConfig();
|
|
52
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange"), emits);
|
|
53
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange", "invertWheelChange"), emits);
|
|
53
54
|
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
54
55
|
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
55
56
|
const locale = computed(() => props.locale || codeLocale.value);
|
|
@@ -4,7 +4,7 @@ import theme from '#build/ui/input-number';
|
|
|
4
4
|
import type { ButtonProps } from '../types';
|
|
5
5
|
import type { ComponentConfig } from '../types/utils';
|
|
6
6
|
type InputNumber = ComponentConfig<typeof theme, AppConfig, 'inputNumber'>;
|
|
7
|
-
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'stepSnapping' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions' | 'disableWheelChange'> {
|
|
7
|
+
export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'stepSnapping' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions' | 'disableWheelChange' | 'invertWheelChange'> {
|
|
8
8
|
/**
|
|
9
9
|
* The element or component this component should render as.
|
|
10
10
|
* @defaultValue 'div'
|
|
@@ -59,9 +59,9 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|
|
59
59
|
ui?: InputNumber['slots'];
|
|
60
60
|
}
|
|
61
61
|
export interface InputNumberEmits {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
'update:modelValue': [payload: number];
|
|
63
|
+
'blur': [event: FocusEvent];
|
|
64
|
+
'change': [payload: Event];
|
|
65
65
|
}
|
|
66
66
|
export interface InputNumberSlots {
|
|
67
67
|
increment(props?: {}): any;
|
|
@@ -241,7 +241,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<InputNumbe
|
|
|
241
241
|
default?(_: {}): any;
|
|
242
242
|
};
|
|
243
243
|
}) | null>;
|
|
244
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
244
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
245
245
|
blur: (event: FocusEvent) => any;
|
|
246
246
|
change: (payload: Event) => any;
|
|
247
247
|
"update:modelValue": (payload: number) => any;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/input-tags";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, ref, onMounted, toRaw } from "vue";
|
|
7
|
+
import { TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { reactivePick } from "@vueuse/core";
|
|
9
|
+
import { useAppConfig } from "#imports";
|
|
10
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
11
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
12
|
+
import { useFormField } from "../composables/useFormField";
|
|
13
|
+
import { tv } from "../utils/tv";
|
|
14
|
+
import UIcon from "./Icon.vue";
|
|
15
|
+
import UAvatar from "./Avatar.vue";
|
|
16
|
+
defineOptions({ inheritAttrs: false });
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
as: { type: null, required: false },
|
|
19
|
+
placeholder: { type: String, required: false },
|
|
20
|
+
maxLength: { type: Number, required: false },
|
|
21
|
+
color: { type: null, required: false },
|
|
22
|
+
variant: { type: null, required: false },
|
|
23
|
+
size: { type: null, required: false },
|
|
24
|
+
autofocus: { type: Boolean, required: false },
|
|
25
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
26
|
+
deleteIcon: { type: String, required: false },
|
|
27
|
+
highlight: { type: Boolean, required: false },
|
|
28
|
+
class: { type: null, required: false },
|
|
29
|
+
ui: { type: null, required: false },
|
|
30
|
+
modelValue: { type: [Array, null], required: false },
|
|
31
|
+
defaultValue: { type: Array, required: false },
|
|
32
|
+
addOnPaste: { type: Boolean, required: false },
|
|
33
|
+
addOnTab: { type: Boolean, required: false },
|
|
34
|
+
addOnBlur: { type: Boolean, required: false },
|
|
35
|
+
duplicate: { type: Boolean, required: false },
|
|
36
|
+
disabled: { type: Boolean, required: false },
|
|
37
|
+
delimiter: { type: null, required: false },
|
|
38
|
+
max: { type: Number, required: false },
|
|
39
|
+
id: { type: String, required: false },
|
|
40
|
+
convertValue: { type: Function, required: false },
|
|
41
|
+
displayValue: { type: Function, required: false },
|
|
42
|
+
name: { type: String, required: false },
|
|
43
|
+
required: { type: Boolean, required: false },
|
|
44
|
+
icon: { type: String, required: false },
|
|
45
|
+
avatar: { type: Object, required: false },
|
|
46
|
+
leading: { type: Boolean, required: false },
|
|
47
|
+
leadingIcon: { type: String, required: false },
|
|
48
|
+
trailing: { type: Boolean, required: false },
|
|
49
|
+
trailingIcon: { type: String, required: false },
|
|
50
|
+
loading: { type: Boolean, required: false },
|
|
51
|
+
loadingIcon: { type: String, required: false }
|
|
52
|
+
});
|
|
53
|
+
const emits = defineEmits(["change", "blur", "focus", "update:modelValue", "invalid", "addTag", "removeTag"]);
|
|
54
|
+
const slots = defineSlots();
|
|
55
|
+
const appConfig = useAppConfig();
|
|
56
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "addOnPaste", "addOnTab", "addOnBlur", "duplicate", "delimiter", "max", "convertValue", "displayValue", "required"), emits);
|
|
57
|
+
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
58
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
59
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
|
|
60
|
+
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
61
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.inputTags || {} })({
|
|
62
|
+
color: color.value,
|
|
63
|
+
variant: props.variant,
|
|
64
|
+
size: inputSize?.value,
|
|
65
|
+
loading: props.loading,
|
|
66
|
+
highlight: highlight.value,
|
|
67
|
+
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
68
|
+
trailing: isTrailing.value || !!slots.trailing,
|
|
69
|
+
buttonGroup: orientation.value
|
|
70
|
+
}));
|
|
71
|
+
const inputRef = ref(null);
|
|
72
|
+
onMounted(() => {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
autoFocus();
|
|
75
|
+
}, props.autofocusDelay);
|
|
76
|
+
});
|
|
77
|
+
function autoFocus() {
|
|
78
|
+
if (props.autofocus) {
|
|
79
|
+
inputRef.value?.$el?.focus();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function onUpdate(value) {
|
|
83
|
+
if (toRaw(props.modelValue) === value) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const event = new Event("change", { target: { value } });
|
|
87
|
+
emits("change", event);
|
|
88
|
+
emitFormChange();
|
|
89
|
+
emitFormInput();
|
|
90
|
+
}
|
|
91
|
+
function onBlur(event) {
|
|
92
|
+
emits("blur", event);
|
|
93
|
+
emitFormBlur();
|
|
94
|
+
}
|
|
95
|
+
function onFocus(event) {
|
|
96
|
+
emits("focus", event);
|
|
97
|
+
emitFormFocus();
|
|
98
|
+
}
|
|
99
|
+
defineExpose({
|
|
100
|
+
inputRef
|
|
101
|
+
});
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<TagsInputRoot
|
|
106
|
+
:id="id"
|
|
107
|
+
v-slot="{ modelValue: tags }"
|
|
108
|
+
:model-value="modelValue"
|
|
109
|
+
:default-value="defaultValue"
|
|
110
|
+
:class="ui.root({ class: [ui.base({ class: props.ui?.base }), props.ui?.root, props.class] })"
|
|
111
|
+
v-bind="rootProps"
|
|
112
|
+
:name="name"
|
|
113
|
+
:disabled="disabled"
|
|
114
|
+
@update:model-value="onUpdate"
|
|
115
|
+
@blur="onBlur"
|
|
116
|
+
@focus="onFocus"
|
|
117
|
+
>
|
|
118
|
+
<TagsInputItem
|
|
119
|
+
v-for="(item, index) in tags"
|
|
120
|
+
:key="index"
|
|
121
|
+
:value="item"
|
|
122
|
+
:class="ui.item({ class: [props.ui?.item] })"
|
|
123
|
+
>
|
|
124
|
+
<TagsInputItemText :class="ui.itemText({ class: [props.ui?.itemText] })">
|
|
125
|
+
<slot v-if="!!slots['item-text']" name="item-text" :item="item" :index="index" />
|
|
126
|
+
</TagsInputItemText>
|
|
127
|
+
|
|
128
|
+
<TagsInputItemDelete
|
|
129
|
+
:class="ui.itemDelete({ class: [props.ui?.itemDelete] })"
|
|
130
|
+
:disabled="disabled"
|
|
131
|
+
>
|
|
132
|
+
<slot name="item-delete" :item="item" :index="index">
|
|
133
|
+
<UIcon :name="deleteIcon || appConfig.ui.icons.close" :class="ui.itemDeleteIcon({ class: [props.ui?.itemDeleteIcon] })" />
|
|
134
|
+
</slot>
|
|
135
|
+
</TagsInputItemDelete>
|
|
136
|
+
</TagsInputItem>
|
|
137
|
+
|
|
138
|
+
<TagsInputInput
|
|
139
|
+
ref="inputRef"
|
|
140
|
+
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
141
|
+
:placeholder="placeholder"
|
|
142
|
+
:max-length="maxLength"
|
|
143
|
+
:class="ui.input({ class: props.ui?.input })"
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<slot />
|
|
147
|
+
|
|
148
|
+
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
149
|
+
<slot name="leading">
|
|
150
|
+
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
151
|
+
<UAvatar v-else-if="!!avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
|
152
|
+
</slot>
|
|
153
|
+
</span>
|
|
154
|
+
|
|
155
|
+
<span v-if="isTrailing || !!slots.trailing" :class="ui.trailing({ class: props.ui?.trailing })">
|
|
156
|
+
<slot name="trailing">
|
|
157
|
+
<UIcon v-if="trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
|
158
|
+
</slot>
|
|
159
|
+
</span>
|
|
160
|
+
</TagsInputRoot>
|
|
161
|
+
</template>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import type { TagsInputRootProps, TagsInputRootEmits, AcceptableInputValue } from 'reka-ui';
|
|
3
|
+
import theme from '#build/ui/input-tags';
|
|
4
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
5
|
+
import type { ComponentConfig } from '../types/utils';
|
|
6
|
+
type InputTags = ComponentConfig<typeof theme, AppConfig, 'inputTags'>;
|
|
7
|
+
export type InputTagItem = AcceptableInputValue;
|
|
8
|
+
export interface InputTagsProps<T extends InputTagItem = InputTagItem> extends Pick<TagsInputRootProps<T>, 'modelValue' | 'defaultValue' | 'addOnPaste' | 'addOnTab' | 'addOnBlur' | 'duplicate' | 'disabled' | 'delimiter' | 'max' | 'id' | 'convertValue' | 'displayValue' | 'name' | 'required'>, UseComponentIconsProps {
|
|
9
|
+
/**
|
|
10
|
+
* The element or component this component should render as.
|
|
11
|
+
* @defaultValue 'div'
|
|
12
|
+
*/
|
|
13
|
+
as?: any;
|
|
14
|
+
/** The placeholder text when the input is empty. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** The maximum number of character allowed. */
|
|
17
|
+
maxLength?: number;
|
|
18
|
+
/**
|
|
19
|
+
* @defaultValue 'primary'
|
|
20
|
+
*/
|
|
21
|
+
color?: InputTags['variants']['color'];
|
|
22
|
+
/**
|
|
23
|
+
* @defaultValue 'outline'
|
|
24
|
+
*/
|
|
25
|
+
variant?: InputTags['variants']['variant'];
|
|
26
|
+
/**
|
|
27
|
+
* @defaultValue 'md'
|
|
28
|
+
*/
|
|
29
|
+
size?: InputTags['variants']['size'];
|
|
30
|
+
autofocus?: boolean;
|
|
31
|
+
autofocusDelay?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The icon displayed to delete a tag.
|
|
34
|
+
* @defaultValue appConfig.ui.icons.close
|
|
35
|
+
* @IconifyIcon
|
|
36
|
+
*/
|
|
37
|
+
deleteIcon?: string;
|
|
38
|
+
/** Highlight the ring color like a focus state. */
|
|
39
|
+
highlight?: boolean;
|
|
40
|
+
class?: any;
|
|
41
|
+
ui?: InputTags['slots'];
|
|
42
|
+
}
|
|
43
|
+
export interface InputTagsEmits<T extends InputTagItem> extends TagsInputRootEmits<T> {
|
|
44
|
+
change: [event: Event];
|
|
45
|
+
blur: [event: FocusEvent];
|
|
46
|
+
focus: [event: FocusEvent];
|
|
47
|
+
}
|
|
48
|
+
type SlotProps<T extends InputTagItem> = (props: {
|
|
49
|
+
item: T;
|
|
50
|
+
index: number;
|
|
51
|
+
}) => any;
|
|
52
|
+
export interface InputTagsSlots<T extends InputTagItem = InputTagItem> {
|
|
53
|
+
'leading'(props?: {}): any;
|
|
54
|
+
'default'(props?: {}): any;
|
|
55
|
+
'trailing'(props?: {}): any;
|
|
56
|
+
'item-text': SlotProps<T>;
|
|
57
|
+
'item-delete': SlotProps<T>;
|
|
58
|
+
}
|
|
59
|
+
declare const _default: <T extends InputTagItem>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
60
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
61
|
+
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
62
|
+
readonly onChange?: ((event: Event) => any) | undefined;
|
|
63
|
+
readonly onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
64
|
+
readonly onInvalid?: ((payload: T) => any) | undefined;
|
|
65
|
+
readonly "onUpdate:modelValue"?: ((payload: T[]) => any) | undefined;
|
|
66
|
+
readonly onAddTag?: ((payload: T) => any) | undefined;
|
|
67
|
+
readonly onRemoveTag?: ((payload: T) => any) | undefined;
|
|
68
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onInvalid" | "onUpdate:modelValue" | "onRemoveTag" | "onAddTag"> & InputTagsProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
69
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
70
|
+
inputRef: import("vue").Ref<({
|
|
71
|
+
$: import("vue").ComponentInternalInstance;
|
|
72
|
+
$data: {};
|
|
73
|
+
$props: {
|
|
74
|
+
readonly placeholder?: string | undefined;
|
|
75
|
+
readonly autoFocus?: boolean | undefined;
|
|
76
|
+
readonly maxLength?: number | undefined;
|
|
77
|
+
readonly asChild?: boolean | undefined;
|
|
78
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
79
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
80
|
+
$attrs: {
|
|
81
|
+
[x: string]: unknown;
|
|
82
|
+
};
|
|
83
|
+
$refs: {
|
|
84
|
+
[x: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
$slots: Readonly<{
|
|
87
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
90
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
91
|
+
$host: Element | null;
|
|
92
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
93
|
+
$el: any;
|
|
94
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
95
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
96
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
97
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
98
|
+
created?: (() => void) | (() => void)[];
|
|
99
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
100
|
+
mounted?: (() => void) | (() => void)[];
|
|
101
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
102
|
+
updated?: (() => void) | (() => void)[];
|
|
103
|
+
activated?: (() => void) | (() => void)[];
|
|
104
|
+
deactivated?: (() => void) | (() => void)[];
|
|
105
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
106
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
107
|
+
destroyed?: (() => void) | (() => void)[];
|
|
108
|
+
unmounted?: (() => void) | (() => void)[];
|
|
109
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
110
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
111
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
112
|
+
};
|
|
113
|
+
$forceUpdate: () => void;
|
|
114
|
+
$nextTick: typeof import("vue").nextTick;
|
|
115
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
116
|
+
} & Readonly<{
|
|
117
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
118
|
+
}> & Omit<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
119
|
+
$slots: {
|
|
120
|
+
default?(_: {}): any;
|
|
121
|
+
};
|
|
122
|
+
}) | null, ({
|
|
123
|
+
$: import("vue").ComponentInternalInstance;
|
|
124
|
+
$data: {};
|
|
125
|
+
$props: {
|
|
126
|
+
readonly placeholder?: string | undefined;
|
|
127
|
+
readonly autoFocus?: boolean | undefined;
|
|
128
|
+
readonly maxLength?: number | undefined;
|
|
129
|
+
readonly asChild?: boolean | undefined;
|
|
130
|
+
readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
|
|
131
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
132
|
+
$attrs: {
|
|
133
|
+
[x: string]: unknown;
|
|
134
|
+
};
|
|
135
|
+
$refs: {
|
|
136
|
+
[x: string]: unknown;
|
|
137
|
+
};
|
|
138
|
+
$slots: Readonly<{
|
|
139
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
$root: import("vue").ComponentPublicInstance | null;
|
|
142
|
+
$parent: import("vue").ComponentPublicInstance | null;
|
|
143
|
+
$host: Element | null;
|
|
144
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
145
|
+
$el: any;
|
|
146
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
147
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
148
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
|
|
149
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
150
|
+
created?: (() => void) | (() => void)[];
|
|
151
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
152
|
+
mounted?: (() => void) | (() => void)[];
|
|
153
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
154
|
+
updated?: (() => void) | (() => void)[];
|
|
155
|
+
activated?: (() => void) | (() => void)[];
|
|
156
|
+
deactivated?: (() => void) | (() => void)[];
|
|
157
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
158
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
159
|
+
destroyed?: (() => void) | (() => void)[];
|
|
160
|
+
unmounted?: (() => void) | (() => void)[];
|
|
161
|
+
renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
162
|
+
renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
|
|
163
|
+
errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
164
|
+
};
|
|
165
|
+
$forceUpdate: () => void;
|
|
166
|
+
$nextTick: typeof import("vue").nextTick;
|
|
167
|
+
$watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
|
|
168
|
+
} & Readonly<{
|
|
169
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
170
|
+
}> & Omit<Readonly<import("reka-ui").TagsInputInputProps> & Readonly<{}>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
|
|
171
|
+
$slots: {
|
|
172
|
+
default?(_: {}): any;
|
|
173
|
+
};
|
|
174
|
+
}) | null>;
|
|
175
|
+
}>): void;
|
|
176
|
+
attrs: any;
|
|
177
|
+
slots: InputTagsSlots<T>;
|
|
178
|
+
emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "invalid", payload: T) => void) & ((evt: "update:modelValue", payload: T[]) => void) & ((evt: "addTag", payload: T) => void) & ((evt: "removeTag", payload: T) => void);
|
|
179
|
+
}>) => import("vue").VNode & {
|
|
180
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
181
|
+
};
|
|
182
|
+
export default _default;
|
|
183
|
+
type __VLS_PrettifyLocal<T> = {
|
|
184
|
+
[K in keyof T as K]: T[K];
|
|
185
|
+
} & {};
|
|
@@ -11,6 +11,7 @@ import { tv } from "../utils/tv";
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
as: { type: null, required: false, default: "kbd" },
|
|
13
13
|
value: { type: null, required: false },
|
|
14
|
+
color: { type: null, required: false },
|
|
14
15
|
variant: { type: null, required: false },
|
|
15
16
|
size: { type: null, required: false },
|
|
16
17
|
class: { type: null, required: false }
|
|
@@ -22,7 +23,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.kbd || {} }))
|
|
|
22
23
|
</script>
|
|
23
24
|
|
|
24
25
|
<template>
|
|
25
|
-
<Primitive :as="as" :class="ui({
|
|
26
|
+
<Primitive :as="as" :class="ui({ class: props.class, color: props.color, variant: props.variant, size: props.size })">
|
|
26
27
|
<slot>
|
|
27
28
|
{{ getKbdKey(value) }}
|
|
28
29
|
</slot>
|
|
@@ -10,6 +10,10 @@ export interface KbdProps {
|
|
|
10
10
|
*/
|
|
11
11
|
as?: any;
|
|
12
12
|
value?: KbdKey | string;
|
|
13
|
+
/**
|
|
14
|
+
* @defaultValue 'neutral'
|
|
15
|
+
*/
|
|
16
|
+
color?: Kbd['variants']['color'];
|
|
13
17
|
/**
|
|
14
18
|
* @defaultValue 'outline'
|
|
15
19
|
*/
|
|
@@ -23,7 +27,7 @@ export interface KbdProps {
|
|
|
23
27
|
export interface KbdSlots {
|
|
24
28
|
default(props?: {}): any;
|
|
25
29
|
}
|
|
26
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<KbdProps,
|
|
30
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<KbdProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KbdProps> & Readonly<{}>, {
|
|
27
31
|
as: any;
|
|
28
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, KbdSlots>;
|
|
29
33
|
export default _default;
|
|
@@ -4,11 +4,12 @@ import theme from "#build/ui/link";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from "vue";
|
|
7
|
-
import { defu } from "defu";
|
|
8
7
|
import { isEqual } from "ohash/utils";
|
|
9
8
|
import { useForwardProps } from "reka-ui";
|
|
9
|
+
import { defu } from "defu";
|
|
10
10
|
import { reactiveOmit } from "@vueuse/core";
|
|
11
11
|
import { useRoute, useAppConfig } from "#imports";
|
|
12
|
+
import { mergeClasses } from "../utils";
|
|
12
13
|
import { tv } from "../utils/tv";
|
|
13
14
|
import { isPartiallyEqual } from "../utils/link";
|
|
14
15
|
import ULinkBase from "./LinkBase.vue";
|
|
@@ -21,7 +22,7 @@ const props = defineProps({
|
|
|
21
22
|
exact: { type: Boolean, required: false },
|
|
22
23
|
exactQuery: { type: [Boolean, String], required: false },
|
|
23
24
|
exactHash: { type: Boolean, required: false },
|
|
24
|
-
inactiveClass: { type: String, required: false
|
|
25
|
+
inactiveClass: { type: String, required: false },
|
|
25
26
|
custom: { type: Boolean, required: false },
|
|
26
27
|
raw: { type: Boolean, required: false },
|
|
27
28
|
class: { type: null, required: false },
|
|
@@ -35,7 +36,7 @@ const props = defineProps({
|
|
|
35
36
|
prefetch: { type: Boolean, required: false },
|
|
36
37
|
prefetchOn: { type: [String, Object], required: false },
|
|
37
38
|
noPrefetch: { type: Boolean, required: false },
|
|
38
|
-
activeClass: { type: String, required: false
|
|
39
|
+
activeClass: { type: String, required: false },
|
|
39
40
|
exactActiveClass: { type: String, required: false },
|
|
40
41
|
ariaCurrentValue: { type: String, required: false, default: "page" },
|
|
41
42
|
viewTransition: { type: Boolean, required: false },
|
|
@@ -50,8 +51,8 @@ const ui = computed(() => tv({
|
|
|
50
51
|
...defu({
|
|
51
52
|
variants: {
|
|
52
53
|
active: {
|
|
53
|
-
true: props.activeClass,
|
|
54
|
-
false: props.inactiveClass
|
|
54
|
+
true: mergeClasses(appConfig.ui?.link?.variants?.active?.true, props.activeClass),
|
|
55
|
+
false: mergeClasses(appConfig.ui?.link?.variants?.active?.false, props.inactiveClass)
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
}, appConfig.ui?.link || {})
|
|
@@ -77,13 +77,11 @@ export interface LinkSlots {
|
|
|
77
77
|
active: boolean;
|
|
78
78
|
}): any;
|
|
79
79
|
}
|
|
80
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkProps,
|
|
80
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkProps> & Readonly<{}>, {
|
|
81
81
|
type: "reset" | "submit" | "button";
|
|
82
82
|
as: any;
|
|
83
|
-
activeClass: string;
|
|
84
83
|
ariaCurrentValue: "page" | "step" | "location" | "date" | "time" | "true" | "false";
|
|
85
84
|
active: boolean;
|
|
86
|
-
inactiveClass: string;
|
|
87
85
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, LinkSlots>;
|
|
88
86
|
export default _default;
|
|
89
87
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -11,7 +11,7 @@ export interface LinkBaseProps {
|
|
|
11
11
|
active?: boolean;
|
|
12
12
|
isExternal?: boolean;
|
|
13
13
|
}
|
|
14
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkBaseProps,
|
|
14
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkBaseProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkBaseProps> & Readonly<{}>, {
|
|
15
15
|
type: string;
|
|
16
16
|
as: string;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
@@ -40,14 +40,14 @@ const contentEvents = computed(() => {
|
|
|
40
40
|
closeAutoFocus: (e) => e.preventDefault()
|
|
41
41
|
};
|
|
42
42
|
if (!props.dismissible) {
|
|
43
|
-
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"
|
|
43
|
+
const events = ["pointerDownOutside", "interactOutside", "escapeKeyDown"];
|
|
44
44
|
return events.reduce((acc, curr) => {
|
|
45
45
|
acc[curr] = (e) => {
|
|
46
46
|
e.preventDefault();
|
|
47
47
|
emits("close:prevent");
|
|
48
48
|
};
|
|
49
49
|
return acc;
|
|
50
|
-
},
|
|
50
|
+
}, defaultEvents);
|
|
51
51
|
}
|
|
52
52
|
return defaultEvents;
|
|
53
53
|
});
|
|
@@ -58,7 +58,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
58
58
|
</script>
|
|
59
59
|
|
|
60
60
|
<template>
|
|
61
|
-
<DialogRoot v-slot="{ open }" v-bind="rootProps">
|
|
61
|
+
<DialogRoot v-slot="{ open, close }" v-bind="rootProps">
|
|
62
62
|
<DialogTrigger v-if="!!slots.default" as-child :class="props.class">
|
|
63
63
|
<slot :open="open" />
|
|
64
64
|
</DialogTrigger>
|
|
@@ -81,9 +81,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
81
81
|
</DialogDescription>
|
|
82
82
|
</VisuallyHidden>
|
|
83
83
|
|
|
84
|
-
<slot name="content">
|
|
85
|
-
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
86
|
-
<slot name="header">
|
|
84
|
+
<slot name="content" :close="close">
|
|
85
|
+
<div v-if="!!slots.header || (title || !!slots.title) || (description || !!slots.description) || (props.close || !!slots.close)" :class="ui.header({ class: props.ui?.header })">
|
|
86
|
+
<slot name="header" :close="close">
|
|
87
87
|
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
|
88
88
|
<DialogTitle v-if="title || !!slots.title" :class="ui.title({ class: props.ui?.title })">
|
|
89
89
|
<slot name="title">
|
|
@@ -98,16 +98,17 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
98
98
|
</DialogDescription>
|
|
99
99
|
</div>
|
|
100
100
|
|
|
101
|
-
<
|
|
102
|
-
|
|
101
|
+
<slot name="actions" />
|
|
102
|
+
|
|
103
|
+
<DialogClose v-if="props.close || !!slots.close" as-child>
|
|
104
|
+
<slot name="close" :close="close" :ui="ui">
|
|
103
105
|
<UButton
|
|
104
|
-
v-if="close"
|
|
106
|
+
v-if="props.close"
|
|
105
107
|
:icon="closeIcon || appConfig.ui.icons.close"
|
|
106
|
-
size="md"
|
|
107
108
|
color="neutral"
|
|
108
109
|
variant="ghost"
|
|
109
110
|
:aria-label="t('modal.close')"
|
|
110
|
-
v-bind="typeof close === 'object' ? close : {}"
|
|
111
|
+
v-bind="typeof props.close === 'object' ? props.close : {}"
|
|
111
112
|
:class="ui.close({ class: props.ui?.close })"
|
|
112
113
|
/>
|
|
113
114
|
</slot>
|
|
@@ -116,11 +117,11 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.modal || {} }
|
|
|
116
117
|
</div>
|
|
117
118
|
|
|
118
119
|
<div v-if="!!slots.body" :class="ui.body({ class: props.ui?.body })">
|
|
119
|
-
<slot name="body" />
|
|
120
|
+
<slot name="body" :close="close" />
|
|
120
121
|
</div>
|
|
121
122
|
|
|
122
123
|
<div v-if="!!slots.footer" :class="ui.footer({ class: props.ui?.footer })">
|
|
123
|
-
<slot name="footer" />
|
|
124
|
+
<slot name="footer" :close="close" />
|
|
124
125
|
</div>
|
|
125
126
|
</slot>
|
|
126
127
|
</DialogContent>
|
|
@@ -58,19 +58,29 @@ export interface ModalSlots {
|
|
|
58
58
|
default(props: {
|
|
59
59
|
open: boolean;
|
|
60
60
|
}): any;
|
|
61
|
-
content(props
|
|
62
|
-
|
|
61
|
+
content(props: {
|
|
62
|
+
close: () => void;
|
|
63
|
+
}): any;
|
|
64
|
+
header(props: {
|
|
65
|
+
close: () => void;
|
|
66
|
+
}): any;
|
|
63
67
|
title(props?: {}): any;
|
|
64
68
|
description(props?: {}): any;
|
|
69
|
+
actions(props?: {}): any;
|
|
65
70
|
close(props: {
|
|
71
|
+
close: () => void;
|
|
66
72
|
ui: {
|
|
67
73
|
[K in keyof Required<Modal['slots']>]: (props?: Record<string, any>) => string;
|
|
68
74
|
};
|
|
69
75
|
}): any;
|
|
70
|
-
body(props
|
|
71
|
-
|
|
76
|
+
body(props: {
|
|
77
|
+
close: () => void;
|
|
78
|
+
}): any;
|
|
79
|
+
footer(props: {
|
|
80
|
+
close: () => void;
|
|
81
|
+
}): any;
|
|
72
82
|
}
|
|
73
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ModalProps,
|
|
83
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ModalProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
74
84
|
"update:open": (value: boolean) => any;
|
|
75
85
|
"after:leave": () => any;
|
|
76
86
|
"after:enter": () => any;
|
|
@@ -83,9 +93,9 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ModalProps
|
|
|
83
93
|
}>, {
|
|
84
94
|
close: boolean | Partial<ButtonProps>;
|
|
85
95
|
modal: boolean;
|
|
96
|
+
transition: boolean;
|
|
86
97
|
portal: boolean | string | HTMLElement;
|
|
87
98
|
overlay: boolean;
|
|
88
|
-
transition: boolean;
|
|
89
99
|
dismissible: boolean;
|
|
90
100
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ModalSlots>;
|
|
91
101
|
export default _default;
|