@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
|
@@ -10,23 +10,36 @@ declare module '@tanstack/table-core' {
|
|
|
10
10
|
th?: string | ((cell: Header<TData, TValue>) => string);
|
|
11
11
|
td?: string | ((cell: Cell<TData, TValue>) => string);
|
|
12
12
|
};
|
|
13
|
+
style?: {
|
|
14
|
+
th?: string | Record<string, string> | ((cell: Header<TData, TValue>) => string | Record<string, string>);
|
|
15
|
+
td?: string | Record<string, string> | ((cell: Cell<TData, TValue>) => string | Record<string, string>);
|
|
16
|
+
};
|
|
17
|
+
colspan?: {
|
|
18
|
+
td?: string | ((cell: Cell<TData, TValue>) => string);
|
|
19
|
+
};
|
|
20
|
+
rowspan?: {
|
|
21
|
+
td?: string | ((cell: Cell<TData, TValue>) => string);
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
interface TableMeta<TData> {
|
|
15
25
|
class?: {
|
|
16
26
|
tr?: string | ((row: Row<TData>) => string);
|
|
17
27
|
};
|
|
28
|
+
style?: {
|
|
29
|
+
tr?: string | Record<string, string> | ((row: Row<TData>) => string | Record<string, string>);
|
|
30
|
+
};
|
|
18
31
|
}
|
|
19
32
|
}
|
|
20
33
|
type Table = ComponentConfig<typeof theme, AppConfig, 'table'>;
|
|
21
34
|
export type TableRow<T> = Row<T>;
|
|
22
35
|
export type TableData = RowData;
|
|
23
36
|
export type TableColumn<T extends TableData, D = unknown> = ColumnDef<T, D>;
|
|
24
|
-
export interface TableOptions<T extends TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
37
|
+
export interface TableOptions<T extends TableData = TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
25
38
|
state?: CoreOptions<T>['state'];
|
|
26
39
|
onStateChange?: CoreOptions<T>['onStateChange'];
|
|
27
40
|
renderFallbackValue?: CoreOptions<T>['renderFallbackValue'];
|
|
28
41
|
}
|
|
29
|
-
export interface TableProps<T extends TableData> extends TableOptions<T> {
|
|
42
|
+
export interface TableProps<T extends TableData = TableData> extends TableOptions<T> {
|
|
30
43
|
/**
|
|
31
44
|
* The element or component this component should render as.
|
|
32
45
|
* @defaultValue 'div'
|
|
@@ -42,10 +55,10 @@ export interface TableProps<T extends TableData> extends TableOptions<T> {
|
|
|
42
55
|
*/
|
|
43
56
|
empty?: string;
|
|
44
57
|
/**
|
|
45
|
-
* Whether the table should have a sticky header.
|
|
58
|
+
* Whether the table should have a sticky header or footer. True for both, 'header' for header only, 'footer' for footer only.
|
|
46
59
|
* @defaultValue false
|
|
47
60
|
*/
|
|
48
|
-
sticky?: boolean;
|
|
61
|
+
sticky?: boolean | 'header' | 'footer';
|
|
49
62
|
/** Whether the table should be in loading state. */
|
|
50
63
|
loading?: boolean;
|
|
51
64
|
/**
|
|
@@ -124,19 +137,24 @@ export interface TableProps<T extends TableData> extends TableOptions<T> {
|
|
|
124
137
|
*/
|
|
125
138
|
facetedOptions?: FacetedOptions<T>;
|
|
126
139
|
onSelect?: (row: TableRow<T>, e?: Event) => void;
|
|
140
|
+
onHover?: (e: Event, row: TableRow<T> | null) => void;
|
|
141
|
+
onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
|
|
127
142
|
class?: any;
|
|
128
143
|
ui?: Table['slots'];
|
|
129
144
|
}
|
|
130
145
|
type DynamicHeaderSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-header`, (props: HeaderContext<T, unknown>) => any>;
|
|
146
|
+
type DynamicFooterSlots<T, K = keyof T> = Record<string, (props: HeaderContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-footer`, (props: HeaderContext<T, unknown>) => any>;
|
|
131
147
|
type DynamicCellSlots<T, K = keyof T> = Record<string, (props: CellContext<T, unknown>) => any> & Record<`${K extends string ? K : never}-cell`, (props: CellContext<T, unknown>) => any>;
|
|
132
|
-
export type TableSlots<T> = {
|
|
133
|
-
expanded: (props: {
|
|
148
|
+
export type TableSlots<T extends TableData = TableData> = {
|
|
149
|
+
'expanded': (props: {
|
|
134
150
|
row: Row<T>;
|
|
135
151
|
}) => any;
|
|
136
|
-
empty: (props?: {}) => any;
|
|
137
|
-
loading: (props?: {}) => any;
|
|
138
|
-
caption: (props?: {}) => any;
|
|
139
|
-
|
|
152
|
+
'empty': (props?: {}) => any;
|
|
153
|
+
'loading': (props?: {}) => any;
|
|
154
|
+
'caption': (props?: {}) => any;
|
|
155
|
+
'body-top': (props?: {}) => any;
|
|
156
|
+
'body-bottom': (props?: {}) => any;
|
|
157
|
+
} & DynamicHeaderSlots<T> & DynamicFooterSlots<T> & DynamicCellSlots<T>;
|
|
140
158
|
declare const _default: <T extends TableData>(__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<{
|
|
141
159
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
142
160
|
readonly "onUpdate:globalFilter"?: ((value: string) => any) | undefined;
|
|
@@ -168,7 +186,7 @@ declare const _default: <T extends TableData>(__VLS_props: NonNullable<Awaited<t
|
|
|
168
186
|
pagination?: PaginationState;
|
|
169
187
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
170
188
|
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
171
|
-
tableRef: Ref<HTMLTableElement |
|
|
189
|
+
tableRef: Ref<HTMLTableElement | null, HTMLTableElement | null>;
|
|
172
190
|
tableApi: import("@tanstack/table-core").Table<T>;
|
|
173
191
|
}>): void;
|
|
174
192
|
attrs: any;
|
|
@@ -179,5 +197,5 @@ declare const _default: <T extends TableData>(__VLS_props: NonNullable<Awaited<t
|
|
|
179
197
|
};
|
|
180
198
|
export default _default;
|
|
181
199
|
type __VLS_PrettifyLocal<T> = {
|
|
182
|
-
[K in keyof T]: T[K];
|
|
200
|
+
[K in keyof T as K]: T[K];
|
|
183
201
|
} & {};
|
|
@@ -3,7 +3,7 @@ import theme from "#build/ui/tabs";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed } from "vue";
|
|
6
|
+
import { ref, computed } from "vue";
|
|
7
7
|
import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
@@ -37,6 +37,10 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tabs || {} })
|
|
|
37
37
|
size: props.size,
|
|
38
38
|
orientation: props.orientation
|
|
39
39
|
}));
|
|
40
|
+
const triggersRef = ref([]);
|
|
41
|
+
defineExpose({
|
|
42
|
+
triggersRef
|
|
43
|
+
});
|
|
40
44
|
</script>
|
|
41
45
|
|
|
42
46
|
<template>
|
|
@@ -46,17 +50,33 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tabs || {} })
|
|
|
46
50
|
|
|
47
51
|
<slot name="list-leading" />
|
|
48
52
|
|
|
49
|
-
<TabsTrigger
|
|
53
|
+
<TabsTrigger
|
|
54
|
+
v-for="(item, index) of items"
|
|
55
|
+
:key="index"
|
|
56
|
+
:ref="(el) => triggersRef[index] = el"
|
|
57
|
+
:value="item.value || String(index)"
|
|
58
|
+
:disabled="item.disabled"
|
|
59
|
+
:class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger] })"
|
|
60
|
+
>
|
|
50
61
|
<slot name="leading" :item="item" :index="index">
|
|
51
62
|
<UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item.ui?.leadingIcon] })" />
|
|
52
|
-
<UAvatar v-else-if="item.avatar" :size="props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="item.avatar" :class="ui.leadingAvatar({ class: [props.ui?.leadingAvatar, item.ui?.leadingAvatar] })" />
|
|
63
|
+
<UAvatar v-else-if="item.avatar" :size="item.ui?.leadingAvatarSize || props.ui?.leadingAvatarSize || ui.leadingAvatarSize()" v-bind="item.avatar" :class="ui.leadingAvatar({ class: [props.ui?.leadingAvatar, item.ui?.leadingAvatar] })" />
|
|
53
64
|
</slot>
|
|
54
65
|
|
|
55
66
|
<span v-if="get(item, props.labelKey) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })">
|
|
56
67
|
<slot :item="item" :index="index">{{ get(item, props.labelKey) }}</slot>
|
|
57
68
|
</span>
|
|
58
69
|
|
|
59
|
-
<slot name="trailing" :item="item" :index="index"
|
|
70
|
+
<slot name="trailing" :item="item" :index="index">
|
|
71
|
+
<UBadge
|
|
72
|
+
v-if="item.badge !== void 0"
|
|
73
|
+
color="neutral"
|
|
74
|
+
variant="outline"
|
|
75
|
+
:size="item.ui?.trailingBadgeSize || props.ui?.trailingBadgeSize || ui.trailingBadgeSize()"
|
|
76
|
+
v-bind="typeof item.badge === 'string' || typeof item.badge === 'number' ? { label: item.badge } : item.badge"
|
|
77
|
+
:class="ui.trailingBadge({ class: [props.ui?.trailingBadge, item.ui?.trailingBadge] })"
|
|
78
|
+
/>
|
|
79
|
+
</slot>
|
|
60
80
|
</TabsTrigger>
|
|
61
81
|
|
|
62
82
|
<slot name="list-trailing" />
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ComponentPublicInstance } from 'vue';
|
|
1
2
|
import type { TabsRootProps, TabsRootEmits } from 'reka-ui';
|
|
2
3
|
import type { AppConfig } from '@nuxt/schema';
|
|
3
4
|
import theme from '#build/ui/tabs';
|
|
4
|
-
import type { AvatarProps } from '../types';
|
|
5
|
+
import type { AvatarProps, BadgeProps } from '../types';
|
|
5
6
|
import type { DynamicSlots, ComponentConfig } from '../types/utils';
|
|
6
7
|
type Tabs = ComponentConfig<typeof theme, AppConfig, 'tabs'>;
|
|
7
8
|
export interface TabsItem {
|
|
@@ -11,13 +12,18 @@ export interface TabsItem {
|
|
|
11
12
|
*/
|
|
12
13
|
icon?: string;
|
|
13
14
|
avatar?: AvatarProps;
|
|
15
|
+
/**
|
|
16
|
+
* Display a badge on the item.
|
|
17
|
+
* `{ size: 'sm', color: 'neutral', variant: 'outline' }`{lang="ts-type"}
|
|
18
|
+
*/
|
|
19
|
+
badge?: string | number | BadgeProps;
|
|
14
20
|
slot?: string;
|
|
15
21
|
content?: string;
|
|
16
22
|
/** A unique value for the tab item. Defaults to the index. */
|
|
17
23
|
value?: string | number;
|
|
18
24
|
disabled?: boolean;
|
|
19
25
|
class?: any;
|
|
20
|
-
ui?: Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'label' | 'content'>;
|
|
26
|
+
ui?: Pick<Tabs['slots'], 'trigger' | 'leadingIcon' | 'leadingAvatar' | 'leadingAvatarSize' | 'label' | 'trailingBadge' | 'trailingBadgeSize' | 'content'>;
|
|
21
27
|
[key: string]: any;
|
|
22
28
|
}
|
|
23
29
|
export interface TabsProps<T extends TabsItem = TabsItem> extends Pick<TabsRootProps<string | number>, 'defaultValue' | 'modelValue' | 'activationMode' | 'unmountOnHide'> {
|
|
@@ -77,7 +83,9 @@ declare const _default: <T extends TabsItem>(__VLS_props: NonNullable<Awaited<ty
|
|
|
77
83
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
78
84
|
readonly "onUpdate:modelValue"?: ((payload: string | number) => any) | undefined;
|
|
79
85
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & TabsProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
80
|
-
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
86
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
87
|
+
triggersRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
|
|
88
|
+
}>): void;
|
|
81
89
|
attrs: any;
|
|
82
90
|
slots: TabsSlots<T>;
|
|
83
91
|
emit: (evt: "update:modelValue", payload: string | number) => void;
|
|
@@ -86,5 +94,5 @@ declare const _default: <T extends TabsItem>(__VLS_props: NonNullable<Awaited<ty
|
|
|
86
94
|
};
|
|
87
95
|
export default _default;
|
|
88
96
|
type __VLS_PrettifyLocal<T> = {
|
|
89
|
-
[K in keyof T]: T[K];
|
|
97
|
+
[K in keyof T as K]: T[K];
|
|
90
98
|
} & {};
|
|
@@ -5,6 +5,7 @@ import theme from "#build/ui/textarea";
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { ref, computed, onMounted, nextTick, watch } from "vue";
|
|
7
7
|
import { Primitive } from "reka-ui";
|
|
8
|
+
import { useVModel } from "@vueuse/core";
|
|
8
9
|
import { useAppConfig } from "#imports";
|
|
9
10
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
10
11
|
import { useFormField } from "../composables/useFormField";
|
|
@@ -30,6 +31,8 @@ const props = defineProps({
|
|
|
30
31
|
rows: { type: Number, required: false, default: 3 },
|
|
31
32
|
maxrows: { type: Number, required: false, default: 0 },
|
|
32
33
|
highlight: { type: Boolean, required: false },
|
|
34
|
+
modelValue: { type: null, required: false },
|
|
35
|
+
defaultValue: { type: null, required: false },
|
|
33
36
|
modelModifiers: { type: Object, required: false },
|
|
34
37
|
class: { type: null, required: false },
|
|
35
38
|
ui: { type: null, required: false },
|
|
@@ -44,7 +47,7 @@ const props = defineProps({
|
|
|
44
47
|
});
|
|
45
48
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
46
49
|
const slots = defineSlots();
|
|
47
|
-
const
|
|
50
|
+
const modelValue = useVModel(props, "modelValue", emits, { defaultValue: props.defaultValue });
|
|
48
51
|
const appConfig = useAppConfig();
|
|
49
52
|
const { emitFormFocus, emitFormBlur, emitFormInput, emitFormChange, size, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props, { deferInputValidation: true });
|
|
50
53
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
|
|
@@ -60,13 +63,13 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.textarea || {
|
|
|
60
63
|
}));
|
|
61
64
|
const textareaRef = ref(null);
|
|
62
65
|
function updateInput(value) {
|
|
63
|
-
if (modelModifiers
|
|
66
|
+
if (props.modelModifiers?.trim) {
|
|
64
67
|
value = value?.trim() ?? null;
|
|
65
68
|
}
|
|
66
|
-
if (modelModifiers
|
|
69
|
+
if (props.modelModifiers?.number) {
|
|
67
70
|
value = looseToNumber(value);
|
|
68
71
|
}
|
|
69
|
-
if (modelModifiers
|
|
72
|
+
if (props.modelModifiers?.nullify) {
|
|
70
73
|
value ||= null;
|
|
71
74
|
}
|
|
72
75
|
modelValue.value = value;
|
|
@@ -74,16 +77,16 @@ function updateInput(value) {
|
|
|
74
77
|
}
|
|
75
78
|
function onInput(event) {
|
|
76
79
|
autoResize();
|
|
77
|
-
if (!modelModifiers
|
|
80
|
+
if (!props.modelModifiers?.lazy) {
|
|
78
81
|
updateInput(event.target.value);
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
function onChange(event) {
|
|
82
85
|
const value = event.target.value;
|
|
83
|
-
if (modelModifiers
|
|
86
|
+
if (props.modelModifiers?.lazy) {
|
|
84
87
|
updateInput(value);
|
|
85
88
|
}
|
|
86
|
-
if (modelModifiers
|
|
89
|
+
if (props.modelModifiers?.trim) {
|
|
87
90
|
event.target.value = value.trim();
|
|
88
91
|
}
|
|
89
92
|
emitFormChange();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AppConfig } from '@nuxt/schema';
|
|
2
2
|
import theme from '#build/ui/textarea';
|
|
3
3
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ComponentConfig } from '../types/utils';
|
|
5
5
|
type Textarea = ComponentConfig<typeof theme, AppConfig, 'textarea'>;
|
|
6
|
-
|
|
6
|
+
type TextareaValue = string | number | null;
|
|
7
|
+
export interface TextareaProps<T extends TextareaValue = TextareaValue> extends UseComponentIconsProps {
|
|
7
8
|
/**
|
|
8
9
|
* The element or component this component should render as.
|
|
9
10
|
* @defaultValue 'div'
|
|
@@ -35,8 +36,11 @@ export interface TextareaProps extends UseComponentIconsProps {
|
|
|
35
36
|
maxrows?: number;
|
|
36
37
|
/** Highlight the ring color like a focus state. */
|
|
37
38
|
highlight?: boolean;
|
|
39
|
+
modelValue?: T;
|
|
40
|
+
defaultValue?: T;
|
|
38
41
|
modelModifiers?: {
|
|
39
42
|
string?: boolean;
|
|
43
|
+
number?: boolean;
|
|
40
44
|
trim?: boolean;
|
|
41
45
|
lazy?: boolean;
|
|
42
46
|
nullify?: boolean;
|
|
@@ -44,34 +48,32 @@ export interface TextareaProps extends UseComponentIconsProps {
|
|
|
44
48
|
class?: any;
|
|
45
49
|
ui?: Textarea['slots'];
|
|
46
50
|
}
|
|
47
|
-
export interface TextareaEmits<T extends
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
export interface TextareaEmits<T extends TextareaValue = TextareaValue> {
|
|
52
|
+
'update:modelValue': [payload: T];
|
|
53
|
+
'blur': [event: FocusEvent];
|
|
54
|
+
'change': [event: Event];
|
|
51
55
|
}
|
|
52
56
|
export interface TextareaSlots {
|
|
53
57
|
leading(props?: {}): any;
|
|
54
58
|
default(props?: {}): any;
|
|
55
59
|
trailing(props?: {}): any;
|
|
56
60
|
}
|
|
57
|
-
declare const _default: <T extends
|
|
61
|
+
declare const _default: <T extends TextareaValue>(__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<{
|
|
58
62
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
59
63
|
readonly onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
60
64
|
readonly onChange?: ((event: Event) => any) | undefined;
|
|
61
65
|
readonly "onUpdate:modelValue"?: ((payload: T) => any) | undefined;
|
|
62
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onChange" | "onUpdate:modelValue"> &
|
|
63
|
-
modelValue?: T;
|
|
64
|
-
}) & Partial<{}>> & import("vue").PublicProps;
|
|
66
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onChange" | "onUpdate:modelValue"> & TextareaProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
65
67
|
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
66
68
|
textareaRef: import("vue").Ref<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
|
|
67
69
|
}>): void;
|
|
68
70
|
attrs: any;
|
|
69
71
|
slots: TextareaSlots;
|
|
70
|
-
emit:
|
|
72
|
+
emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", payload: T) => void);
|
|
71
73
|
}>) => import("vue").VNode & {
|
|
72
74
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
73
75
|
};
|
|
74
76
|
export default _default;
|
|
75
77
|
type __VLS_PrettifyLocal<T> = {
|
|
76
|
-
[K in keyof T]: T[K];
|
|
78
|
+
[K in keyof T as K]: T[K];
|
|
77
79
|
} & {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/timeline";
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { Primitive, Separator } from "reka-ui";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
9
|
+
import { tv } from "../utils/tv";
|
|
10
|
+
import UAvatar from "./Avatar.vue";
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
as: { type: null, required: false },
|
|
13
|
+
items: { type: Array, required: true },
|
|
14
|
+
size: { type: null, required: false },
|
|
15
|
+
color: { type: null, required: false },
|
|
16
|
+
orientation: { type: null, required: false, default: "vertical" },
|
|
17
|
+
defaultValue: { type: [String, Number], required: false },
|
|
18
|
+
reverse: { type: Boolean, required: false },
|
|
19
|
+
class: { type: null, required: false },
|
|
20
|
+
ui: { type: null, required: false }
|
|
21
|
+
});
|
|
22
|
+
const slots = defineSlots();
|
|
23
|
+
const modelValue = defineModel({ type: [String, Number] });
|
|
24
|
+
const appConfig = useAppConfig();
|
|
25
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.timeline || {} })({
|
|
26
|
+
orientation: props.orientation,
|
|
27
|
+
size: props.size,
|
|
28
|
+
color: props.color,
|
|
29
|
+
reverse: props.reverse
|
|
30
|
+
}));
|
|
31
|
+
const currentStepIndex = computed(() => {
|
|
32
|
+
const value = modelValue.value ?? props.defaultValue;
|
|
33
|
+
if (typeof value === "string") {
|
|
34
|
+
return props.items.findIndex((item) => item.value === value) ?? -1;
|
|
35
|
+
}
|
|
36
|
+
if (props.reverse) {
|
|
37
|
+
return value != null ? props.items.length - 1 - value : -1;
|
|
38
|
+
} else {
|
|
39
|
+
return value ?? -1;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
function getItemState(index) {
|
|
43
|
+
if (currentStepIndex.value === -1) return void 0;
|
|
44
|
+
if (index === currentStepIndex.value) return "active";
|
|
45
|
+
if (props.reverse) {
|
|
46
|
+
return index > currentStepIndex.value ? "completed" : void 0;
|
|
47
|
+
} else {
|
|
48
|
+
return index < currentStepIndex.value ? "completed" : void 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
55
|
+
<div
|
|
56
|
+
v-for="(item, index) in items"
|
|
57
|
+
:key="item.value ?? index"
|
|
58
|
+
:class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
|
|
59
|
+
:data-state="getItemState(index)"
|
|
60
|
+
>
|
|
61
|
+
<div :class="ui.container({ class: [props.ui?.container, item.ui?.container] })">
|
|
62
|
+
<UAvatar :size="size" :icon="item.icon" v-bind="typeof item.avatar === 'object' ? item.avatar : {}" :class="ui.indicator({ class: [props.ui?.indicator, item.ui?.indicator] })" :ui="{ icon: 'text-inherit', fallback: 'text-inherit' }">
|
|
63
|
+
<slot :name="item.slot ? `${item.slot}-indicator` : 'indicator'" :item="item" />
|
|
64
|
+
</UAvatar>
|
|
65
|
+
|
|
66
|
+
<Separator
|
|
67
|
+
v-if="index < items.length - 1"
|
|
68
|
+
:class="ui.separator({ class: [props.ui?.separator, item.ui?.separator] })"
|
|
69
|
+
:orientation="props.orientation"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div :class="ui.wrapper({ class: [props.ui?.wrapper, item.ui?.wrapper] })">
|
|
74
|
+
<div v-if="item.date" :class="ui.date({ class: [props.ui?.date, item.ui?.date] })">
|
|
75
|
+
<slot :name="item.slot ? `${item.slot}-date` : 'date'" :item="item">
|
|
76
|
+
{{ item.date }}
|
|
77
|
+
</slot>
|
|
78
|
+
</div>
|
|
79
|
+
<div v-if="item.title || !!slots.title" :class="ui.title({ class: [props.ui?.title, item.ui?.title] })">
|
|
80
|
+
<slot :name="item.slot ? `${item.slot}-title` : 'title'" :item="item">
|
|
81
|
+
{{ item.title }}
|
|
82
|
+
</slot>
|
|
83
|
+
</div>
|
|
84
|
+
<div v-if="item.description || !!slots.description" :class="ui.description({ class: [props.ui?.description, item.ui?.description] })">
|
|
85
|
+
<slot :name="item.slot ? `${item.slot}-description` : 'description'" :item="item">
|
|
86
|
+
{{ item.description }}
|
|
87
|
+
</slot>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</Primitive>
|
|
92
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import theme from '#build/ui/timeline';
|
|
3
|
+
import type { AvatarProps } from '../types';
|
|
4
|
+
import type { DynamicSlots, ComponentConfig } from '../types/utils';
|
|
5
|
+
type Timeline = ComponentConfig<typeof theme, AppConfig, 'timeline'>;
|
|
6
|
+
export interface TimelineItem {
|
|
7
|
+
date?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
avatar?: AvatarProps;
|
|
12
|
+
value?: string | number;
|
|
13
|
+
slot?: string;
|
|
14
|
+
class?: any;
|
|
15
|
+
ui?: Pick<Timeline['slots'], 'item' | 'container' | 'indicator' | 'separator' | 'wrapper' | 'date' | 'title' | 'description'>;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export interface TimelineProps<T extends TimelineItem = TimelineItem> {
|
|
19
|
+
/**
|
|
20
|
+
* The element or component this component should render as.
|
|
21
|
+
* @defaultValue 'div'
|
|
22
|
+
*/
|
|
23
|
+
as?: any;
|
|
24
|
+
items: T[];
|
|
25
|
+
/**
|
|
26
|
+
* @defaultValue 'md'
|
|
27
|
+
*/
|
|
28
|
+
size?: Timeline['variants']['size'];
|
|
29
|
+
/**
|
|
30
|
+
* @defaultValue 'primary'
|
|
31
|
+
*/
|
|
32
|
+
color?: Timeline['variants']['color'];
|
|
33
|
+
/**
|
|
34
|
+
* The orientation of the Timeline.
|
|
35
|
+
* @defaultValue 'vertical'
|
|
36
|
+
*/
|
|
37
|
+
orientation?: Timeline['variants']['orientation'];
|
|
38
|
+
defaultValue?: string | number;
|
|
39
|
+
reverse?: boolean;
|
|
40
|
+
class?: any;
|
|
41
|
+
ui?: Timeline['slots'];
|
|
42
|
+
}
|
|
43
|
+
type SlotProps<T extends TimelineItem> = (props: {
|
|
44
|
+
item: T;
|
|
45
|
+
}) => any;
|
|
46
|
+
export type TimelineSlots<T extends TimelineItem = TimelineItem> = {
|
|
47
|
+
indicator: SlotProps<T>;
|
|
48
|
+
date: SlotProps<T>;
|
|
49
|
+
title: SlotProps<T>;
|
|
50
|
+
description: SlotProps<T>;
|
|
51
|
+
} & DynamicSlots<T, 'indicator' | 'date' | 'title' | 'description', {
|
|
52
|
+
item: T;
|
|
53
|
+
}>;
|
|
54
|
+
declare const _default: <T extends TimelineItem>(__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<{
|
|
55
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
56
|
+
readonly "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
57
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & (TimelineProps<T> & {
|
|
58
|
+
modelValue?: string | number;
|
|
59
|
+
}) & Partial<{}>> & import("vue").PublicProps;
|
|
60
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
61
|
+
attrs: any;
|
|
62
|
+
slots: TimelineSlots<T>;
|
|
63
|
+
emit: (evt: "update:modelValue", value: string | number | undefined) => void;
|
|
64
|
+
}>) => import("vue").VNode & {
|
|
65
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
66
|
+
};
|
|
67
|
+
export default _default;
|
|
68
|
+
type __VLS_PrettifyLocal<T> = {
|
|
69
|
+
[K in keyof T as K]: T[K];
|
|
70
|
+
} & {};
|
|
@@ -3,7 +3,7 @@ import theme from "#build/ui/toast";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { ref, computed, onMounted } from "vue";
|
|
6
|
+
import { ref, computed, onMounted, nextTick } from "vue";
|
|
7
7
|
import { ToastRoot, ToastTitle, ToastDescription, ToastAction, ToastClose, useForwardPropsEmits } from "reka-ui";
|
|
8
8
|
import { reactivePick } from "@vueuse/core";
|
|
9
9
|
import { useAppConfig } from "#imports";
|
|
@@ -12,6 +12,7 @@ import { tv } from "../utils/tv";
|
|
|
12
12
|
import UIcon from "./Icon.vue";
|
|
13
13
|
import UAvatar from "./Avatar.vue";
|
|
14
14
|
import UButton from "./Button.vue";
|
|
15
|
+
import UProgress from "./Progress.vue";
|
|
15
16
|
const props = defineProps({
|
|
16
17
|
as: { type: null, required: false },
|
|
17
18
|
title: { type: [String, Object, Function], required: false },
|
|
@@ -20,10 +21,10 @@ const props = defineProps({
|
|
|
20
21
|
avatar: { type: Object, required: false },
|
|
21
22
|
color: { type: null, required: false },
|
|
22
23
|
orientation: { type: null, required: false, default: "vertical" },
|
|
23
|
-
progress: { type: Boolean, required: false, default: true },
|
|
24
|
-
actions: { type: Array, required: false },
|
|
25
24
|
close: { type: [Boolean, Object], required: false, default: true },
|
|
26
25
|
closeIcon: { type: String, required: false },
|
|
26
|
+
actions: { type: Array, required: false },
|
|
27
|
+
progress: { type: [Boolean, Object], required: false, default: true },
|
|
27
28
|
class: { type: null, required: false },
|
|
28
29
|
ui: { type: null, required: false },
|
|
29
30
|
defaultOpen: { type: Boolean, required: false },
|
|
@@ -47,9 +48,9 @@ onMounted(() => {
|
|
|
47
48
|
if (!el.value) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
height.value = el.value
|
|
52
|
-
}
|
|
51
|
+
nextTick(() => {
|
|
52
|
+
height.value = el.value?.$el?.getBoundingClientRect()?.height;
|
|
53
|
+
});
|
|
53
54
|
});
|
|
54
55
|
defineExpose({
|
|
55
56
|
height
|
|
@@ -59,7 +60,7 @@ defineExpose({
|
|
|
59
60
|
<template>
|
|
60
61
|
<ToastRoot
|
|
61
62
|
ref="el"
|
|
62
|
-
v-slot="{ remaining, duration }"
|
|
63
|
+
v-slot="{ remaining, duration, open }"
|
|
63
64
|
v-bind="rootProps"
|
|
64
65
|
:data-orientation="orientation"
|
|
65
66
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
@@ -113,7 +114,6 @@ defineExpose({
|
|
|
113
114
|
<UButton
|
|
114
115
|
v-if="close"
|
|
115
116
|
:icon="closeIcon || appConfig.ui.icons.close"
|
|
116
|
-
size="md"
|
|
117
117
|
color="neutral"
|
|
118
118
|
variant="link"
|
|
119
119
|
:aria-label="t('toast.close')"
|
|
@@ -125,6 +125,13 @@ defineExpose({
|
|
|
125
125
|
</ToastClose>
|
|
126
126
|
</div>
|
|
127
127
|
|
|
128
|
-
<
|
|
128
|
+
<UProgress
|
|
129
|
+
v-if="progress && open && remaining > 0 && duration"
|
|
130
|
+
:model-value="remaining / duration * 100"
|
|
131
|
+
:color="color"
|
|
132
|
+
v-bind="typeof progress === 'object' ? progress : {}"
|
|
133
|
+
size="sm"
|
|
134
|
+
:class="ui.progress({ class: props.ui?.progress })"
|
|
135
|
+
/>
|
|
129
136
|
</ToastRoot>
|
|
130
137
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ToastRootProps, ToastRootEmits } from 'reka-ui';
|
|
2
2
|
import type { AppConfig } from '@nuxt/schema';
|
|
3
3
|
import theme from '#build/ui/toast';
|
|
4
|
-
import type { AvatarProps, ButtonProps } from '../types';
|
|
4
|
+
import type { AvatarProps, ButtonProps, ProgressProps } from '../types';
|
|
5
5
|
import type { StringOrVNode, ComponentConfig } from '../types/utils';
|
|
6
6
|
type Toast = ComponentConfig<typeof theme, AppConfig, 'toast'>;
|
|
7
7
|
export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
|
|
@@ -27,10 +27,17 @@ export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open'
|
|
|
27
27
|
*/
|
|
28
28
|
orientation?: Toast['variants']['orientation'];
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Display a close button to dismiss the toast.
|
|
31
|
+
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
31
32
|
* @defaultValue true
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
close?: boolean | Partial<ButtonProps>;
|
|
35
|
+
/**
|
|
36
|
+
* The icon displayed in the close button.
|
|
37
|
+
* @defaultValue appConfig.ui.icons.close
|
|
38
|
+
* @IconifyIcon
|
|
39
|
+
*/
|
|
40
|
+
closeIcon?: string;
|
|
34
41
|
/**
|
|
35
42
|
* Display a list of actions:
|
|
36
43
|
* - under the title and description when orientation is `vertical`
|
|
@@ -39,17 +46,11 @@ export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open'
|
|
|
39
46
|
*/
|
|
40
47
|
actions?: ButtonProps[];
|
|
41
48
|
/**
|
|
42
|
-
* Display a
|
|
43
|
-
* `{ size: '
|
|
49
|
+
* Display a progress bar showing the toast's remaining duration.
|
|
50
|
+
* `{ size: 'sm' }`{lang="ts-type"}
|
|
44
51
|
* @defaultValue true
|
|
45
52
|
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The icon displayed in the close button.
|
|
49
|
-
* @defaultValue appConfig.ui.icons.close
|
|
50
|
-
* @IconifyIcon
|
|
51
|
-
*/
|
|
52
|
-
closeIcon?: string;
|
|
53
|
+
progress?: boolean | Pick<ProgressProps, 'color'>;
|
|
53
54
|
class?: any;
|
|
54
55
|
ui?: Toast['slots'];
|
|
55
56
|
}
|
|
@@ -152,7 +153,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToastProps
|
|
|
152
153
|
}>, "currentTarget">) => any) | undefined;
|
|
153
154
|
}>, {
|
|
154
155
|
close: boolean | Partial<ButtonProps>;
|
|
155
|
-
progress: boolean
|
|
156
|
+
progress: boolean | Pick<ProgressProps, "color">;
|
|
156
157
|
orientation: Toast["variants"]["orientation"];
|
|
157
158
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToastSlots>;
|
|
158
159
|
export default _default;
|
|
@@ -30,7 +30,7 @@ export interface ToasterProps extends Omit<ToastProviderProps, 'swipeDirection'>
|
|
|
30
30
|
export interface ToasterSlots {
|
|
31
31
|
default(props?: {}): any;
|
|
32
32
|
}
|
|
33
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToasterProps,
|
|
33
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToasterProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
|
|
34
34
|
progress: boolean;
|
|
35
35
|
duration: number;
|
|
36
36
|
expand: boolean;
|
|
@@ -17,6 +17,7 @@ const props = defineProps({
|
|
|
17
17
|
content: { type: Object, required: false },
|
|
18
18
|
arrow: { type: [Boolean, Object], required: false },
|
|
19
19
|
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
20
|
+
reference: { type: null, required: false },
|
|
20
21
|
class: { type: null, required: false },
|
|
21
22
|
ui: { type: null, required: false },
|
|
22
23
|
defaultOpen: { type: Boolean, required: false },
|
|
@@ -41,7 +42,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tooltip || {}
|
|
|
41
42
|
|
|
42
43
|
<template>
|
|
43
44
|
<TooltipRoot v-slot="{ open }" v-bind="rootProps">
|
|
44
|
-
<TooltipTrigger v-if="!!slots.default" v-bind="$attrs" as-child :class="props.class">
|
|
45
|
+
<TooltipTrigger v-if="!!slots.default || !!reference" v-bind="$attrs" as-child :reference="reference" :class="props.class">
|
|
45
46
|
<slot :open="open" />
|
|
46
47
|
</TooltipTrigger>
|
|
47
48
|
|