@nuxt/ui 4.0.0-alpha.1 → 4.0.0-beta.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/content/content-navigation.ts +2 -1
- package/.nuxt/ui/marquee.ts +1 -1
- package/.nuxt/ui/progress.ts +3 -3
- package/.nuxt/ui/prose/code-tree.ts +1 -1
- package/.nuxt/ui/prose/img.ts +1 -1
- package/.nuxt/ui/tree.ts +1 -1
- package/README.md +14 -1
- package/dist/module.d.mts +6 -6
- package/dist/module.json +2 -2
- package/dist/module.mjs +8 -6
- package/dist/runtime/components/Accordion.d.vue.ts +79 -0
- package/dist/runtime/components/Accordion.vue +3 -3
- package/dist/runtime/components/Accordion.vue.d.ts +2 -2
- package/dist/runtime/components/Alert.d.vue.ts +81 -0
- package/dist/runtime/components/App.d.vue.ts +25 -0
- package/dist/runtime/components/AuthForm.d.vue.ts +128 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +39 -1
- package/dist/runtime/components/Avatar.d.vue.ts +41 -0
- package/dist/runtime/components/AvatarGroup.d.vue.ts +31 -0
- package/dist/runtime/components/Badge.d.vue.ts +43 -0
- package/dist/runtime/components/Banner.d.vue.ts +72 -0
- package/dist/runtime/components/Banner.vue +1 -1
- package/dist/runtime/components/BlogPost.d.vue.ts +60 -0
- package/dist/runtime/components/BlogPosts.d.vue.ts +31 -0
- package/dist/runtime/components/Breadcrumb.d.vue.ts +67 -0
- package/dist/runtime/components/Breadcrumb.vue +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +2 -2
- package/dist/runtime/components/Button.d.vue.ts +44 -0
- package/dist/runtime/components/Calendar.d.vue.ts +112 -0
- package/dist/runtime/components/Card.d.vue.ts +29 -0
- package/dist/runtime/components/Carousel.d.vue.ts +127 -0
- package/dist/runtime/components/Carousel.vue.d.ts +10 -10
- package/dist/runtime/components/ChangelogVersion.d.vue.ts +59 -0
- package/dist/runtime/components/ChangelogVersions.d.vue.ts +78 -0
- package/dist/runtime/components/ChangelogVersions.vue +2 -2
- package/dist/runtime/components/ChatMessage.d.vue.ts +67 -0
- package/dist/runtime/components/ChatMessages.d.vue.ts +83 -0
- package/dist/runtime/components/ChatMessages.vue +6 -6
- package/dist/runtime/components/ChatPalette.d.vue.ts +24 -0
- package/dist/runtime/components/ChatPrompt.d.vue.ts +61 -0
- package/dist/runtime/components/ChatPrompt.vue +2 -2
- package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +100 -0
- package/dist/runtime/components/Checkbox.d.vue.ts +74 -0
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +89 -0
- package/dist/runtime/components/CheckboxGroup.vue +8 -8
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +20 -16
- package/dist/runtime/components/Chip.d.vue.ts +57 -0
- package/dist/runtime/components/Collapsible.d.vue.ts +35 -0
- package/dist/runtime/components/ColorPicker.d.vue.ts +48 -0
- package/dist/runtime/components/CommandPalette.d.vue.ts +193 -0
- package/dist/runtime/components/CommandPalette.vue +5 -4
- package/dist/runtime/components/CommandPalette.vue.d.ts +2 -1
- package/dist/runtime/components/Container.d.vue.ts +18 -0
- package/dist/runtime/components/ContextMenu.d.vue.ts +110 -0
- package/dist/runtime/components/ContextMenu.vue +2 -2
- package/dist/runtime/components/ContextMenu.vue.d.ts +2 -2
- package/dist/runtime/components/ContextMenuContent.d.vue.ts +50 -0
- package/dist/runtime/components/ContextMenuContent.vue +2 -2
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +2 -2
- package/dist/runtime/components/DashboardGroup.d.vue.ts +24 -0
- package/dist/runtime/components/DashboardGroup.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardNavbar.d.vue.ts +52 -0
- package/dist/runtime/components/DashboardPanel.d.vue.ts +30 -0
- package/dist/runtime/components/DashboardResizeHandle.d.vue.ts +18 -0
- package/dist/runtime/components/DashboardSearch.d.vue.ts +91 -0
- package/dist/runtime/components/DashboardSearch.vue +2 -2
- package/dist/runtime/components/DashboardSearchButton.d.vue.ts +59 -0
- package/dist/runtime/components/DashboardSearchButton.vue +2 -2
- package/dist/runtime/components/DashboardSidebar.d.vue.ts +75 -0
- package/dist/runtime/components/DashboardSidebarCollapse.d.vue.ts +19 -0
- package/dist/runtime/components/DashboardSidebarToggle.d.vue.ts +19 -0
- package/dist/runtime/components/DashboardToolbar.d.vue.ts +25 -0
- package/dist/runtime/components/Drawer.d.vue.ts +84 -0
- package/dist/runtime/components/DropdownMenu.d.vue.ts +120 -0
- package/dist/runtime/components/DropdownMenu.vue +2 -2
- package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -2
- package/dist/runtime/components/DropdownMenuContent.d.vue.ts +56 -0
- package/dist/runtime/components/DropdownMenuContent.vue +2 -2
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +2 -2
- package/dist/runtime/components/Error.d.vue.ts +47 -0
- package/dist/runtime/components/FieldGroup.d.vue.ts +34 -0
- package/dist/runtime/components/FileUpload.d.vue.ts +166 -0
- package/dist/runtime/components/FileUpload.vue +1 -0
- package/dist/runtime/components/Footer.d.vue.ts +29 -0
- package/dist/runtime/components/FooterColumns.d.vue.ts +57 -0
- package/dist/runtime/components/Form.d.vue.ts +114 -0
- package/dist/runtime/components/Form.vue +144 -60
- package/dist/runtime/components/Form.vue.d.ts +54 -11
- package/dist/runtime/components/FormField.d.vue.ts +61 -0
- package/dist/runtime/components/FormField.vue +9 -3
- package/dist/runtime/components/Header.d.vue.ts +68 -0
- package/dist/runtime/components/Icon.d.vue.ts +8 -0
- package/dist/runtime/components/Input.d.vue.ts +74 -0
- package/dist/runtime/components/Input.vue.d.ts +4 -3
- package/dist/runtime/components/InputMenu.d.vue.ts +330 -0
- package/dist/runtime/components/InputMenu.vue +2 -2
- package/dist/runtime/components/InputMenu.vue.d.ts +4 -4
- package/dist/runtime/components/InputNumber.d.vue.ts +188 -0
- package/dist/runtime/components/InputNumber.vue +2 -2
- package/dist/runtime/components/InputNumber.vue.d.ts +0 -2
- package/dist/runtime/components/InputTags.d.vue.ts +186 -0
- package/dist/runtime/components/InputTags.vue +2 -2
- package/dist/runtime/components/Kbd.d.vue.ts +38 -0
- package/dist/runtime/components/Link.d.vue.ts +91 -0
- package/dist/runtime/components/LinkBase.d.vue.ts +25 -0
- package/dist/runtime/components/Main.d.vue.ts +20 -0
- package/dist/runtime/components/Marquee.d.vue.ts +32 -0
- package/dist/runtime/components/Marquee.vue +1 -1
- package/dist/runtime/components/Modal.d.vue.ts +107 -0
- package/dist/runtime/components/NavigationMenu.d.vue.ts +171 -0
- package/dist/runtime/components/NavigationMenu.vue.d.ts +2 -2
- package/dist/runtime/components/OverlayProvider.d.vue.ts +2 -0
- package/dist/runtime/components/Page.d.vue.ts +25 -0
- package/dist/runtime/components/PageAnchors.d.vue.ts +47 -0
- package/dist/runtime/components/PageAside.d.vue.ts +27 -0
- package/dist/runtime/components/PageBody.d.vue.ts +18 -0
- package/dist/runtime/components/PageCTA.d.vue.ts +56 -0
- package/dist/runtime/components/PageCard.d.vue.ts +72 -0
- package/dist/runtime/components/PageColumns.d.vue.ts +18 -0
- package/dist/runtime/components/PageFeature.d.vue.ts +44 -0
- package/dist/runtime/components/PageGrid.d.vue.ts +18 -0
- package/dist/runtime/components/PageHeader.d.vue.ts +36 -0
- package/dist/runtime/components/PageHero.d.vue.ts +53 -0
- package/dist/runtime/components/PageLinks.d.vue.ts +49 -0
- package/dist/runtime/components/PageList.d.vue.ts +21 -0
- package/dist/runtime/components/PageLogos.d.vue.ts +33 -0
- package/dist/runtime/components/PageSection.d.vue.ts +68 -0
- package/dist/runtime/components/Pagination.d.vue.ts +118 -0
- package/dist/runtime/components/PinInput.d.vue.ts +60 -0
- package/dist/runtime/components/Popover.d.vue.ts +71 -0
- package/dist/runtime/components/PricingPlan.d.vue.ts +112 -0
- package/dist/runtime/components/PricingPlans.d.vue.ts +44 -0
- package/dist/runtime/components/PricingTable.d.vue.ts +105 -0
- package/dist/runtime/components/Progress.d.vue.ts +66 -0
- package/dist/runtime/components/Progress.vue +2 -3
- package/dist/runtime/components/RadioGroup.d.vue.ts +99 -0
- package/dist/runtime/components/RadioGroup.vue +13 -11
- package/dist/runtime/components/RadioGroup.vue.d.ts +17 -13
- package/dist/runtime/components/Select.d.vue.ts +254 -0
- package/dist/runtime/components/Select.vue +3 -3
- package/dist/runtime/components/Select.vue.d.ts +5 -5
- package/dist/runtime/components/SelectMenu.d.vue.ts +303 -0
- package/dist/runtime/components/SelectMenu.vue.d.ts +4 -4
- package/dist/runtime/components/Separator.d.vue.ts +54 -0
- package/dist/runtime/components/Skeleton.d.vue.ts +17 -0
- package/dist/runtime/components/Slideover.d.vue.ts +108 -0
- package/dist/runtime/components/Slider.d.vue.ts +57 -0
- package/dist/runtime/components/Stepper.d.vue.ts +87 -0
- package/dist/runtime/components/Switch.d.vue.ts +71 -0
- package/dist/runtime/components/Table.d.vue.ts +201 -0
- package/dist/runtime/components/Table.vue.d.ts +26 -26
- package/dist/runtime/components/Tabs.d.vue.ts +99 -0
- package/dist/runtime/components/Tabs.vue +12 -5
- package/dist/runtime/components/Tabs.vue.d.ts +2 -2
- package/dist/runtime/components/Textarea.d.vue.ts +74 -0
- package/dist/runtime/components/Timeline.d.vue.ts +71 -0
- package/dist/runtime/components/Toast.d.vue.ts +165 -0
- package/dist/runtime/components/Toaster.d.vue.ts +44 -0
- package/dist/runtime/components/Tooltip.d.vue.ts +57 -0
- package/dist/runtime/components/Tree.d.vue.ts +112 -0
- package/dist/runtime/components/Tree.vue +88 -47
- package/dist/runtime/components/Tree.vue.d.ts +20 -24
- package/dist/runtime/components/User.d.vue.ts +47 -0
- package/dist/runtime/components/color-mode/ColorModeAvatar.d.vue.ts +7 -0
- package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +23 -0
- package/dist/runtime/components/color-mode/ColorModeImage.d.vue.ts +6 -0
- package/dist/runtime/components/color-mode/ColorModeSelect.d.vue.ts +5 -0
- package/dist/runtime/components/color-mode/ColorModeSwitch.d.vue.ts +5 -0
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +102 -0
- package/dist/runtime/components/content/ContentNavigation.vue +5 -4
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +2 -2
- package/dist/runtime/components/content/ContentSearch.d.vue.ts +114 -0
- package/dist/runtime/components/content/ContentSearch.vue +2 -2
- package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +59 -0
- package/dist/runtime/components/content/ContentSearchButton.vue +2 -2
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +59 -0
- package/dist/runtime/components/content/ContentToc.d.vue.ts +88 -0
- package/dist/runtime/components/locale/LocaleSelect.d.vue.ts +15 -0
- package/dist/runtime/components/prose/A.d.vue.ts +15 -0
- package/dist/runtime/components/prose/Accordion.d.vue.ts +16 -0
- package/dist/runtime/components/prose/AccordionItem.d.vue.ts +15 -0
- package/dist/runtime/components/prose/Badge.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Blockquote.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Callout.d.vue.ts +26 -0
- package/dist/runtime/components/prose/Card.d.vue.ts +29 -0
- package/dist/runtime/components/prose/CardGroup.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Code.d.vue.ts +22 -0
- package/dist/runtime/components/prose/CodeCollapse.d.vue.ts +47 -0
- package/dist/runtime/components/prose/CodeGroup.d.vue.ts +37 -0
- package/dist/runtime/components/prose/CodeIcon.d.vue.ts +7 -0
- package/dist/runtime/components/prose/CodePreview.d.vue.ts +19 -0
- package/dist/runtime/components/prose/CodeTree.d.vue.ts +28 -0
- package/dist/runtime/components/prose/CodeTree.vue +38 -31
- package/dist/runtime/components/prose/Collapsible.d.vue.ts +39 -0
- package/dist/runtime/components/prose/Em.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Field.d.vue.ts +39 -0
- package/dist/runtime/components/prose/FieldGroup.d.vue.ts +18 -0
- package/dist/runtime/components/prose/H1.d.vue.ts +19 -0
- package/dist/runtime/components/prose/H2.d.vue.ts +19 -0
- package/dist/runtime/components/prose/H3.d.vue.ts +19 -0
- package/dist/runtime/components/prose/H4.d.vue.ts +19 -0
- package/dist/runtime/components/prose/Hr.d.vue.ts +5 -0
- package/dist/runtime/components/prose/Icon.d.vue.ts +6 -0
- package/dist/runtime/components/prose/Img.d.vue.ts +21 -0
- package/dist/runtime/components/prose/Kbd.d.vue.ts +6 -0
- package/dist/runtime/components/prose/Li.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Ol.d.vue.ts +13 -0
- package/dist/runtime/components/prose/P.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Pre.d.vue.ts +26 -0
- package/dist/runtime/components/prose/Script.d.vue.ts +5 -0
- package/dist/runtime/components/prose/Steps.d.vue.ts +22 -0
- package/dist/runtime/components/prose/Strong.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Table.d.vue.ts +18 -0
- package/dist/runtime/components/prose/Tabs.d.vue.ts +36 -0
- package/dist/runtime/components/prose/TabsItem.d.vue.ts +15 -0
- package/dist/runtime/components/prose/Tbody.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Td.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Th.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Thead.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Tr.d.vue.ts +13 -0
- package/dist/runtime/components/prose/Ul.d.vue.ts +13 -0
- package/dist/runtime/components/prose/callout/Caution.d.vue.ts +14 -0
- package/dist/runtime/components/prose/callout/Note.d.vue.ts +14 -0
- package/dist/runtime/components/prose/callout/Tip.d.vue.ts +14 -0
- package/dist/runtime/components/prose/callout/Warning.d.vue.ts +14 -0
- package/dist/runtime/composables/useFormField.d.ts +1 -0
- package/dist/runtime/composables/useFormField.js +1 -4
- package/dist/runtime/inertia/components/Link.d.vue.ts +63 -0
- package/dist/runtime/inertia/components/LinkBase.d.vue.ts +25 -0
- package/dist/runtime/locale/de_ch.d.ts +3 -0
- package/dist/runtime/locale/de_ch.js +129 -0
- package/dist/runtime/locale/id.js +1 -1
- package/dist/runtime/locale/index.d.ts +2 -0
- package/dist/runtime/locale/index.js +2 -0
- package/dist/runtime/locale/ka.d.ts +3 -0
- package/dist/runtime/locale/ka.js +132 -0
- package/dist/runtime/locale/pt.js +2 -2
- package/dist/runtime/types/form.d.ts +12 -13
- package/dist/runtime/types/form.js +1 -3
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/tv.d.ts +9 -2
- package/dist/runtime/types/utils.d.ts +7 -3
- package/dist/runtime/utils/form.d.ts +2 -6
- package/dist/runtime/utils/form.js +28 -60
- package/dist/runtime/utils/fuse.d.ts +2 -1
- package/dist/runtime/utils/index.d.ts +3 -3
- package/dist/runtime/utils/index.js +6 -3
- package/dist/runtime/vue/components/Icon.d.vue.ts +6 -0
- package/dist/runtime/vue/components/Link.d.vue.ts +93 -0
- package/dist/runtime/vue/components/color-mode/ColorModeButton.d.vue.ts +16 -0
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.d.vue.ts +5 -0
- package/dist/runtime/vue/components/color-mode/ColorModeSwitch.d.vue.ts +5 -0
- package/dist/shared/{ui.BEZXPd3d.mjs → ui.DGJZ-1aX.mjs} +18 -13
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +27 -40
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import theme from '#build/ui/timeline';
|
|
3
|
+
import type { AvatarProps, IconProps } from '../types';
|
|
4
|
+
import type { DynamicSlots } from '../types/utils';
|
|
5
|
+
import type { ComponentConfig } from '../types/tv';
|
|
6
|
+
type Timeline = ComponentConfig<typeof theme, AppConfig, 'timeline'>;
|
|
7
|
+
export interface TimelineItem {
|
|
8
|
+
date?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: IconProps['name'];
|
|
12
|
+
avatar?: AvatarProps;
|
|
13
|
+
value?: string | number;
|
|
14
|
+
slot?: string;
|
|
15
|
+
class?: any;
|
|
16
|
+
ui?: Pick<Timeline['slots'], 'item' | 'container' | 'indicator' | 'separator' | 'wrapper' | 'date' | 'title' | 'description'>;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export interface TimelineProps<T extends TimelineItem = TimelineItem> {
|
|
20
|
+
/**
|
|
21
|
+
* The element or component this component should render as.
|
|
22
|
+
* @defaultValue 'div'
|
|
23
|
+
*/
|
|
24
|
+
as?: any;
|
|
25
|
+
items: T[];
|
|
26
|
+
/**
|
|
27
|
+
* @defaultValue 'md'
|
|
28
|
+
*/
|
|
29
|
+
size?: Timeline['variants']['size'];
|
|
30
|
+
/**
|
|
31
|
+
* @defaultValue 'primary'
|
|
32
|
+
*/
|
|
33
|
+
color?: Timeline['variants']['color'];
|
|
34
|
+
/**
|
|
35
|
+
* The orientation of the Timeline.
|
|
36
|
+
* @defaultValue 'vertical'
|
|
37
|
+
*/
|
|
38
|
+
orientation?: Timeline['variants']['orientation'];
|
|
39
|
+
defaultValue?: string | number;
|
|
40
|
+
reverse?: boolean;
|
|
41
|
+
class?: any;
|
|
42
|
+
ui?: Timeline['slots'];
|
|
43
|
+
}
|
|
44
|
+
type SlotProps<T extends TimelineItem> = (props: {
|
|
45
|
+
item: T;
|
|
46
|
+
}) => any;
|
|
47
|
+
export type TimelineSlots<T extends TimelineItem = TimelineItem> = {
|
|
48
|
+
indicator: SlotProps<T>;
|
|
49
|
+
date: SlotProps<T>;
|
|
50
|
+
title: SlotProps<T>;
|
|
51
|
+
description: SlotProps<T>;
|
|
52
|
+
} & DynamicSlots<T, 'indicator' | 'date' | 'title' | 'description', {
|
|
53
|
+
item: T;
|
|
54
|
+
}>;
|
|
55
|
+
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<{
|
|
56
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
57
|
+
readonly "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
58
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & (TimelineProps<T> & {
|
|
59
|
+
modelValue?: string | number;
|
|
60
|
+
}) & {}> & import("vue").PublicProps;
|
|
61
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
62
|
+
attrs: any;
|
|
63
|
+
slots: TimelineSlots<T>;
|
|
64
|
+
emit: (evt: "update:modelValue", value: string | number | undefined) => void;
|
|
65
|
+
}>) => import("vue").VNode & {
|
|
66
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
67
|
+
};
|
|
68
|
+
export default _default;
|
|
69
|
+
type __VLS_PrettifyLocal<T> = {
|
|
70
|
+
[K in keyof T as K]: T[K];
|
|
71
|
+
} & {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { ToastRootProps, ToastRootEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/toast';
|
|
4
|
+
import type { AvatarProps, ButtonProps, IconProps, ProgressProps } from '../types';
|
|
5
|
+
import type { StringOrVNode } from '../types/utils';
|
|
6
|
+
import type { ComponentConfig } from '../types/tv';
|
|
7
|
+
type Toast = ComponentConfig<typeof theme, AppConfig, 'toast'>;
|
|
8
|
+
export interface ToastProps extends Pick<ToastRootProps, 'defaultOpen' | 'open' | 'type' | 'duration'> {
|
|
9
|
+
/**
|
|
10
|
+
* The element or component this component should render as.
|
|
11
|
+
* @defaultValue 'li'
|
|
12
|
+
*/
|
|
13
|
+
as?: any;
|
|
14
|
+
title?: StringOrVNode;
|
|
15
|
+
description?: StringOrVNode;
|
|
16
|
+
/**
|
|
17
|
+
* @IconifyIcon
|
|
18
|
+
*/
|
|
19
|
+
icon?: IconProps['name'];
|
|
20
|
+
avatar?: AvatarProps;
|
|
21
|
+
/**
|
|
22
|
+
* @defaultValue 'primary'
|
|
23
|
+
*/
|
|
24
|
+
color?: Toast['variants']['color'];
|
|
25
|
+
/**
|
|
26
|
+
* The orientation between the content and the actions.
|
|
27
|
+
* @defaultValue 'vertical'
|
|
28
|
+
*/
|
|
29
|
+
orientation?: Toast['variants']['orientation'];
|
|
30
|
+
/**
|
|
31
|
+
* Display a close button to dismiss the toast.
|
|
32
|
+
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
33
|
+
* @defaultValue true
|
|
34
|
+
*/
|
|
35
|
+
close?: boolean | Partial<ButtonProps>;
|
|
36
|
+
/**
|
|
37
|
+
* The icon displayed in the close button.
|
|
38
|
+
* @defaultValue appConfig.ui.icons.close
|
|
39
|
+
* @IconifyIcon
|
|
40
|
+
*/
|
|
41
|
+
closeIcon?: IconProps['name'];
|
|
42
|
+
/**
|
|
43
|
+
* Display a list of actions:
|
|
44
|
+
* - under the title and description when orientation is `vertical`
|
|
45
|
+
* - next to the close button when orientation is `horizontal`
|
|
46
|
+
* `{ size: 'xs' }`{lang="ts-type"}
|
|
47
|
+
*/
|
|
48
|
+
actions?: ButtonProps[];
|
|
49
|
+
/**
|
|
50
|
+
* Display a progress bar showing the toast's remaining duration.
|
|
51
|
+
* `{ size: 'sm' }`{lang="ts-type"}
|
|
52
|
+
* @defaultValue true
|
|
53
|
+
*/
|
|
54
|
+
progress?: boolean | Pick<ProgressProps, 'color' | 'ui'>;
|
|
55
|
+
class?: any;
|
|
56
|
+
ui?: Toast['slots'];
|
|
57
|
+
}
|
|
58
|
+
export interface ToastEmits extends ToastRootEmits {
|
|
59
|
+
}
|
|
60
|
+
export interface ToastSlots {
|
|
61
|
+
leading(props?: {}): any;
|
|
62
|
+
title(props?: {}): any;
|
|
63
|
+
description(props?: {}): any;
|
|
64
|
+
actions(props?: {}): any;
|
|
65
|
+
close(props: {
|
|
66
|
+
ui: {
|
|
67
|
+
[K in keyof Required<Toast['slots']>]: (props?: Record<string, any>) => string;
|
|
68
|
+
};
|
|
69
|
+
}): any;
|
|
70
|
+
}
|
|
71
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToastProps, {
|
|
72
|
+
height: import("vue").Ref<number, number>;
|
|
73
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
74
|
+
pause: () => any;
|
|
75
|
+
"update:open": (value: boolean) => any;
|
|
76
|
+
escapeKeyDown: (event: KeyboardEvent) => any;
|
|
77
|
+
resume: () => any;
|
|
78
|
+
swipeStart: (event: {
|
|
79
|
+
currentTarget: EventTarget & HTMLElement;
|
|
80
|
+
} & Omit<CustomEvent<{
|
|
81
|
+
originalEvent: PointerEvent;
|
|
82
|
+
delta: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
};
|
|
86
|
+
}>, "currentTarget">) => any;
|
|
87
|
+
swipeMove: (event: {
|
|
88
|
+
currentTarget: EventTarget & HTMLElement;
|
|
89
|
+
} & Omit<CustomEvent<{
|
|
90
|
+
originalEvent: PointerEvent;
|
|
91
|
+
delta: {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
};
|
|
95
|
+
}>, "currentTarget">) => any;
|
|
96
|
+
swipeCancel: (event: {
|
|
97
|
+
currentTarget: EventTarget & HTMLElement;
|
|
98
|
+
} & Omit<CustomEvent<{
|
|
99
|
+
originalEvent: PointerEvent;
|
|
100
|
+
delta: {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
};
|
|
104
|
+
}>, "currentTarget">) => any;
|
|
105
|
+
swipeEnd: (event: {
|
|
106
|
+
currentTarget: EventTarget & HTMLElement;
|
|
107
|
+
} & Omit<CustomEvent<{
|
|
108
|
+
originalEvent: PointerEvent;
|
|
109
|
+
delta: {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
};
|
|
113
|
+
}>, "currentTarget">) => any;
|
|
114
|
+
}, string, import("vue").PublicProps, Readonly<ToastProps> & Readonly<{
|
|
115
|
+
onPause?: (() => any) | undefined;
|
|
116
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
117
|
+
onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
|
|
118
|
+
onResume?: (() => any) | undefined;
|
|
119
|
+
onSwipeStart?: ((event: {
|
|
120
|
+
currentTarget: EventTarget & HTMLElement;
|
|
121
|
+
} & Omit<CustomEvent<{
|
|
122
|
+
originalEvent: PointerEvent;
|
|
123
|
+
delta: {
|
|
124
|
+
x: number;
|
|
125
|
+
y: number;
|
|
126
|
+
};
|
|
127
|
+
}>, "currentTarget">) => any) | undefined;
|
|
128
|
+
onSwipeMove?: ((event: {
|
|
129
|
+
currentTarget: EventTarget & HTMLElement;
|
|
130
|
+
} & Omit<CustomEvent<{
|
|
131
|
+
originalEvent: PointerEvent;
|
|
132
|
+
delta: {
|
|
133
|
+
x: number;
|
|
134
|
+
y: number;
|
|
135
|
+
};
|
|
136
|
+
}>, "currentTarget">) => any) | undefined;
|
|
137
|
+
onSwipeCancel?: ((event: {
|
|
138
|
+
currentTarget: EventTarget & HTMLElement;
|
|
139
|
+
} & Omit<CustomEvent<{
|
|
140
|
+
originalEvent: PointerEvent;
|
|
141
|
+
delta: {
|
|
142
|
+
x: number;
|
|
143
|
+
y: number;
|
|
144
|
+
};
|
|
145
|
+
}>, "currentTarget">) => any) | undefined;
|
|
146
|
+
onSwipeEnd?: ((event: {
|
|
147
|
+
currentTarget: EventTarget & HTMLElement;
|
|
148
|
+
} & Omit<CustomEvent<{
|
|
149
|
+
originalEvent: PointerEvent;
|
|
150
|
+
delta: {
|
|
151
|
+
x: number;
|
|
152
|
+
y: number;
|
|
153
|
+
};
|
|
154
|
+
}>, "currentTarget">) => any) | undefined;
|
|
155
|
+
}>, {
|
|
156
|
+
close: boolean | Partial<ButtonProps>;
|
|
157
|
+
progress: boolean | Pick<ProgressProps, "color" | "ui">;
|
|
158
|
+
orientation: Toast["variants"]["orientation"];
|
|
159
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToastSlots>;
|
|
160
|
+
export default _default;
|
|
161
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
162
|
+
new (): {
|
|
163
|
+
$slots: S;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ToastProviderProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/toaster';
|
|
4
|
+
import type { ComponentConfig } from '../types/tv';
|
|
5
|
+
type Toaster = ComponentConfig<typeof theme, AppConfig, 'toaster'>;
|
|
6
|
+
export interface ToasterProps extends Omit<ToastProviderProps, 'swipeDirection'> {
|
|
7
|
+
/**
|
|
8
|
+
* The position on the screen to display the toasts.
|
|
9
|
+
* @defaultValue 'bottom-right'
|
|
10
|
+
*/
|
|
11
|
+
position?: Toaster['variants']['position'];
|
|
12
|
+
/**
|
|
13
|
+
* Expand the toasts to show multiple toasts at once.
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
expand?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to show the progress bar on all toasts.
|
|
19
|
+
* @defaultValue true
|
|
20
|
+
*/
|
|
21
|
+
progress?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Render the toaster in a portal.
|
|
24
|
+
* @defaultValue true
|
|
25
|
+
*/
|
|
26
|
+
portal?: boolean | string | HTMLElement;
|
|
27
|
+
class?: any;
|
|
28
|
+
ui?: Toaster['slots'];
|
|
29
|
+
}
|
|
30
|
+
export interface ToasterSlots {
|
|
31
|
+
default(props?: {}): any;
|
|
32
|
+
}
|
|
33
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<ToasterProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
|
|
34
|
+
progress: boolean;
|
|
35
|
+
expand: boolean;
|
|
36
|
+
duration: number;
|
|
37
|
+
portal: boolean | string | HTMLElement;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ToasterSlots>;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
41
|
+
new (): {
|
|
42
|
+
$slots: S;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipContentEmits, TooltipArrowProps, TooltipTriggerProps } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/tooltip';
|
|
4
|
+
import type { KbdProps } from '../types';
|
|
5
|
+
import type { EmitsToProps } from '../types/utils';
|
|
6
|
+
import type { ComponentConfig } from '../types/tv';
|
|
7
|
+
type Tooltip = ComponentConfig<typeof theme, AppConfig, 'tooltip'>;
|
|
8
|
+
export interface TooltipProps extends TooltipRootProps {
|
|
9
|
+
/** The text content of the tooltip. */
|
|
10
|
+
text?: string;
|
|
11
|
+
/** The keyboard keys to display in the tooltip. */
|
|
12
|
+
kbds?: KbdProps['value'][] | KbdProps[];
|
|
13
|
+
/**
|
|
14
|
+
* The content of the tooltip.
|
|
15
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
|
|
16
|
+
*/
|
|
17
|
+
content?: Omit<TooltipContentProps, 'as' | 'asChild'> & Partial<EmitsToProps<TooltipContentEmits>>;
|
|
18
|
+
/**
|
|
19
|
+
* Display an arrow alongside the tooltip.
|
|
20
|
+
* @defaultValue false
|
|
21
|
+
*/
|
|
22
|
+
arrow?: boolean | Omit<TooltipArrowProps, 'as' | 'asChild'>;
|
|
23
|
+
/**
|
|
24
|
+
* Render the tooltip in a portal.
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
portal?: boolean | string | HTMLElement;
|
|
28
|
+
/**
|
|
29
|
+
* The reference (or anchor) element that is being referred to for positioning.
|
|
30
|
+
*
|
|
31
|
+
* If not provided will use the current component as anchor.
|
|
32
|
+
*/
|
|
33
|
+
reference?: TooltipTriggerProps['reference'];
|
|
34
|
+
class?: any;
|
|
35
|
+
ui?: Tooltip['slots'];
|
|
36
|
+
}
|
|
37
|
+
export interface TooltipEmits extends TooltipRootEmits {
|
|
38
|
+
}
|
|
39
|
+
export interface TooltipSlots {
|
|
40
|
+
default(props: {
|
|
41
|
+
open: boolean;
|
|
42
|
+
}): any;
|
|
43
|
+
content(props?: {}): any;
|
|
44
|
+
}
|
|
45
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<TooltipProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
46
|
+
"update:open": (value: boolean) => any;
|
|
47
|
+
}, string, import("vue").PublicProps, Readonly<TooltipProps> & Readonly<{
|
|
48
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
49
|
+
}>, {
|
|
50
|
+
portal: boolean | string | HTMLElement;
|
|
51
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, TooltipSlots>;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { TreeRootProps, TreeRootEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/ui/tree';
|
|
4
|
+
import type { IconProps } from '../types';
|
|
5
|
+
import type { DynamicSlots, GetItemKeys } from '../types/utils';
|
|
6
|
+
import type { ComponentConfig } from '../types/tv';
|
|
7
|
+
type Tree = ComponentConfig<typeof theme, AppConfig, 'tree'>;
|
|
8
|
+
export type TreeItem = {
|
|
9
|
+
/**
|
|
10
|
+
* @IconifyIcon
|
|
11
|
+
*/
|
|
12
|
+
icon?: IconProps['name'];
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @IconifyIcon
|
|
16
|
+
*/
|
|
17
|
+
trailingIcon?: IconProps['name'];
|
|
18
|
+
defaultExpanded?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
slot?: string;
|
|
21
|
+
children?: TreeItem[];
|
|
22
|
+
onToggle?(e: Event): void;
|
|
23
|
+
onSelect?(e?: Event): void;
|
|
24
|
+
class?: any;
|
|
25
|
+
ui?: Pick<Tree['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'>;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
export interface TreeProps<T extends TreeItem[] = TreeItem[], M extends boolean = false> extends Pick<TreeRootProps<T>, 'expanded' | 'defaultExpanded' | 'selectionBehavior' | 'propagateSelect' | 'disabled' | 'bubbleSelect'> {
|
|
29
|
+
/**
|
|
30
|
+
* The element or component this component should render as.
|
|
31
|
+
* @defaultValue 'ul'
|
|
32
|
+
*/
|
|
33
|
+
as?: any;
|
|
34
|
+
/**
|
|
35
|
+
* @defaultValue 'primary'
|
|
36
|
+
*/
|
|
37
|
+
color?: Tree['variants']['color'];
|
|
38
|
+
/**
|
|
39
|
+
* @defaultValue 'md'
|
|
40
|
+
*/
|
|
41
|
+
size?: Tree['variants']['size'];
|
|
42
|
+
/** This function is passed the index of each item and should return a unique key for that item */
|
|
43
|
+
getKey?: (val: T[number]) => string;
|
|
44
|
+
/**
|
|
45
|
+
* The key used to get the label from the item.
|
|
46
|
+
* @defaultValue 'label'
|
|
47
|
+
*/
|
|
48
|
+
labelKey?: GetItemKeys<T>;
|
|
49
|
+
/**
|
|
50
|
+
* The icon displayed on the right side of a parent node.
|
|
51
|
+
* @defaultValue appConfig.ui.icons.chevronDown
|
|
52
|
+
* @IconifyIcon
|
|
53
|
+
*/
|
|
54
|
+
trailingIcon?: IconProps['name'];
|
|
55
|
+
/**
|
|
56
|
+
* The icon displayed when a parent node is expanded.
|
|
57
|
+
* @defaultValue appConfig.ui.icons.folderOpen
|
|
58
|
+
* @IconifyIcon
|
|
59
|
+
*/
|
|
60
|
+
expandedIcon?: IconProps['name'];
|
|
61
|
+
/**
|
|
62
|
+
* The icon displayed when a parent node is collapsed.
|
|
63
|
+
* @defaultValue appConfig.ui.icons.folder
|
|
64
|
+
* @IconifyIcon
|
|
65
|
+
*/
|
|
66
|
+
collapsedIcon?: IconProps['name'];
|
|
67
|
+
items?: T;
|
|
68
|
+
/** The controlled value of the Tree. Can be bind as `v-model`. */
|
|
69
|
+
modelValue?: M extends true ? T[number][] : T[number];
|
|
70
|
+
/** The value of the Tree when initially rendered. Use when you do not need to control the state of the Tree. */
|
|
71
|
+
defaultValue?: M extends true ? T[number][] : T[number];
|
|
72
|
+
/** Whether multiple options can be selected or not. */
|
|
73
|
+
multiple?: M & boolean;
|
|
74
|
+
class?: any;
|
|
75
|
+
ui?: Tree['slots'];
|
|
76
|
+
}
|
|
77
|
+
export type TreeEmits<T extends TreeItem[] = TreeItem[], M extends boolean = false> = TreeRootEmits<T[number], M>;
|
|
78
|
+
type SlotProps<T extends TreeItem> = (props: {
|
|
79
|
+
item: T;
|
|
80
|
+
index: number;
|
|
81
|
+
level: number;
|
|
82
|
+
expanded: boolean;
|
|
83
|
+
selected: boolean;
|
|
84
|
+
}) => any;
|
|
85
|
+
export type TreeSlots<T extends TreeItem[] = TreeItem[]> = {
|
|
86
|
+
'item-wrapper': SlotProps<T[number]>;
|
|
87
|
+
'item': SlotProps<T[number]>;
|
|
88
|
+
'item-leading': SlotProps<T[number]>;
|
|
89
|
+
'item-label': SlotProps<T[number]>;
|
|
90
|
+
'item-trailing': SlotProps<T[number]>;
|
|
91
|
+
} & DynamicSlots<T[number], undefined, {
|
|
92
|
+
index: number;
|
|
93
|
+
level: number;
|
|
94
|
+
expanded: boolean;
|
|
95
|
+
selected: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
declare const _default: <T extends TreeItem[], M extends boolean = false>(__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<{
|
|
98
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
99
|
+
readonly "onUpdate:modelValue"?: ((val: M extends true ? T[number][] : T[number]) => any) | undefined;
|
|
100
|
+
readonly "onUpdate:expanded"?: ((val: string[]) => any) | undefined;
|
|
101
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:expanded"> & TreeProps<T, M> & {}> & import("vue").PublicProps;
|
|
102
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
103
|
+
attrs: any;
|
|
104
|
+
slots: TreeSlots<T>;
|
|
105
|
+
emit: ((evt: "update:modelValue", val: M extends true ? T[number][] : T[number]) => void) & ((evt: "update:expanded", val: string[]) => void);
|
|
106
|
+
}>) => import("vue").VNode & {
|
|
107
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
108
|
+
};
|
|
109
|
+
export default _default;
|
|
110
|
+
type __VLS_PrettifyLocal<T> = {
|
|
111
|
+
[K in keyof T as K]: T[K];
|
|
112
|
+
} & {};
|
|
@@ -15,7 +15,7 @@ const props = defineProps({
|
|
|
15
15
|
as: { type: null, required: false },
|
|
16
16
|
color: { type: null, required: false },
|
|
17
17
|
size: { type: null, required: false },
|
|
18
|
-
|
|
18
|
+
getKey: { type: Function, required: false },
|
|
19
19
|
labelKey: { type: null, required: false, default: "label" },
|
|
20
20
|
trailingIcon: { type: [String, Object], required: false },
|
|
21
21
|
expandedIcon: { type: [String, Object], required: false },
|
|
@@ -33,10 +33,10 @@ const props = defineProps({
|
|
|
33
33
|
disabled: { type: Boolean, required: false },
|
|
34
34
|
bubbleSelect: { type: Boolean, required: false }
|
|
35
35
|
});
|
|
36
|
-
const emits = defineEmits(["update:
|
|
36
|
+
const emits = defineEmits(["update:modelValue", "update:expanded"]);
|
|
37
37
|
const slots = defineSlots();
|
|
38
38
|
const appConfig = useAppConfig();
|
|
39
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "
|
|
39
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "items", "multiple", "expanded", "disabled", "propagateSelect", "bubbleSelect"), emits);
|
|
40
40
|
const [DefineTreeTemplate, ReuseTreeTemplate] = createReusableTemplate();
|
|
41
41
|
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tree || {} })({
|
|
42
42
|
color: props.color,
|
|
@@ -45,11 +45,11 @@ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.tree || {} })
|
|
|
45
45
|
function getItemLabel(item) {
|
|
46
46
|
return get(item, props.labelKey);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function getItemKey(item) {
|
|
49
|
+
return props.getKey ? props.getKey(item) || getItemLabel(item) : getItemLabel(item);
|
|
50
50
|
}
|
|
51
51
|
function getDefaultOpenedItems(item) {
|
|
52
|
-
const currentItem = item.defaultExpanded ?
|
|
52
|
+
const currentItem = item.defaultExpanded ? getItemKey(item) : null;
|
|
53
53
|
const childItems = item.children?.flatMap((child) => getDefaultOpenedItems(child)) ?? [];
|
|
54
54
|
return [currentItem, ...childItems].filter(Boolean);
|
|
55
55
|
}
|
|
@@ -60,65 +60,106 @@ const defaultExpanded = computed(
|
|
|
60
60
|
|
|
61
61
|
<template>
|
|
62
62
|
<DefineTreeTemplate v-slot="{ items, level }">
|
|
63
|
-
<
|
|
63
|
+
<TreeItem
|
|
64
64
|
v-for="(item, index) in items"
|
|
65
65
|
:key="`${level}-${index}`"
|
|
66
|
-
|
|
66
|
+
v-slot="{ isExpanded, isSelected }"
|
|
67
|
+
:level="level"
|
|
68
|
+
:value="item"
|
|
69
|
+
:class="level > 1 ? ui.itemWithChildren({ class: [props.ui?.itemWithChildren, item.ui?.itemWithChildren] }) : ui.item({ class: [props.ui?.item, item.ui?.item] })"
|
|
70
|
+
@toggle="item.onToggle"
|
|
71
|
+
@select="item.onSelect"
|
|
67
72
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
:
|
|
72
|
-
:value="item"
|
|
73
|
-
@toggle="item.onToggle"
|
|
74
|
-
@select="item.onSelect"
|
|
73
|
+
<slot
|
|
74
|
+
:name="item.slot ? `${item.slot}-wrapper` : 'item-wrapper'"
|
|
75
|
+
v-bind="{ index, level, expanded: isExpanded, selected: isSelected }"
|
|
76
|
+
:item="item"
|
|
75
77
|
>
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
<button
|
|
79
|
+
type="button"
|
|
80
|
+
:disabled="item.disabled || disabled"
|
|
81
|
+
:data-expanded="isExpanded"
|
|
82
|
+
:class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], selected: isSelected, disabled: item.disabled || disabled })"
|
|
83
|
+
>
|
|
84
|
+
<slot
|
|
85
|
+
:name="item.slot || 'item'"
|
|
86
|
+
v-bind="{ index, level, expanded: isExpanded, selected: isSelected }"
|
|
87
|
+
:item="item"
|
|
88
|
+
>
|
|
89
|
+
<slot
|
|
90
|
+
:name="item.slot ? `${item.slot}-leading` : 'item-leading'"
|
|
91
|
+
v-bind="{ index, level, expanded: isExpanded, selected: isSelected }"
|
|
92
|
+
:item="item"
|
|
93
|
+
>
|
|
94
|
+
<UIcon
|
|
95
|
+
v-if="item.icon"
|
|
96
|
+
:name="item.icon"
|
|
97
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon] })"
|
|
98
|
+
/>
|
|
99
|
+
<UIcon
|
|
100
|
+
v-else-if="item.children?.length"
|
|
101
|
+
:name="isExpanded ? expandedIcon ?? appConfig.ui.icons.folderOpen : collapsedIcon ?? appConfig.ui.icons.folder"
|
|
102
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon] })"
|
|
103
|
+
/>
|
|
104
|
+
</slot>
|
|
105
|
+
|
|
106
|
+
<span
|
|
107
|
+
v-if="getItemLabel(item) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']"
|
|
108
|
+
:class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })"
|
|
109
|
+
>
|
|
110
|
+
<slot
|
|
111
|
+
:name="item.slot ? `${item.slot}-label` : 'item-label'"
|
|
112
|
+
v-bind="{ index, level, expanded: isExpanded, selected: isSelected }"
|
|
113
|
+
:item="item"
|
|
114
|
+
>
|
|
115
|
+
{{ getItemLabel(item) }}
|
|
116
|
+
</slot>
|
|
117
|
+
</span>
|
|
118
|
+
|
|
119
|
+
<span
|
|
120
|
+
v-if="item.trailingIcon || item.children?.length || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']"
|
|
121
|
+
:class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })"
|
|
122
|
+
>
|
|
123
|
+
<slot
|
|
124
|
+
:name="item.slot ? `${item.slot}-trailing` : 'item-trailing'"
|
|
125
|
+
v-bind="{ index, level, expanded: isExpanded, selected: isSelected }"
|
|
126
|
+
:item="item"
|
|
127
|
+
>
|
|
80
128
|
<UIcon
|
|
81
|
-
v-if="item.
|
|
82
|
-
:name="item.
|
|
83
|
-
:class="ui.
|
|
129
|
+
v-if="item.trailingIcon"
|
|
130
|
+
:name="item.trailingIcon"
|
|
131
|
+
:class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon] })"
|
|
84
132
|
/>
|
|
85
133
|
<UIcon
|
|
86
134
|
v-else-if="item.children?.length"
|
|
87
|
-
:name="
|
|
88
|
-
:class="ui.
|
|
135
|
+
:name="trailingIcon ?? appConfig.ui.icons.chevronDown"
|
|
136
|
+
:class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon] })"
|
|
89
137
|
/>
|
|
90
138
|
</slot>
|
|
139
|
+
</span>
|
|
140
|
+
</slot>
|
|
141
|
+
</button>
|
|
142
|
+
</slot>
|
|
91
143
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<UIcon v-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon] })" />
|
|
101
|
-
<UIcon v-else-if="item.children?.length" :name="trailingIcon ?? appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon] })" />
|
|
102
|
-
</slot>
|
|
103
|
-
</span>
|
|
104
|
-
</slot>
|
|
105
|
-
</button>
|
|
106
|
-
</slot>
|
|
107
|
-
|
|
108
|
-
<ul v-if="item.children?.length && isExpanded" :class="ui.listWithChildren({ class: [props.ui?.listWithChildren, item.ui?.listWithChildren] })">
|
|
109
|
-
<ReuseTreeTemplate :items="item.children" :level="level + 1" />
|
|
110
|
-
</ul>
|
|
111
|
-
</TreeItem>
|
|
112
|
-
</li>
|
|
144
|
+
<ul
|
|
145
|
+
v-if="item.children?.length && isExpanded"
|
|
146
|
+
role="group"
|
|
147
|
+
:class="ui.listWithChildren({ class: [props.ui?.listWithChildren, item.ui?.listWithChildren] })"
|
|
148
|
+
>
|
|
149
|
+
<ReuseTreeTemplate :items="item.children" :level="level + 1" />
|
|
150
|
+
</ul>
|
|
151
|
+
</TreeItem>
|
|
113
152
|
</DefineTreeTemplate>
|
|
114
153
|
|
|
115
154
|
<TreeRoot
|
|
116
155
|
v-bind="{ ...rootProps, ...$attrs }"
|
|
156
|
+
:model-value="modelValue"
|
|
157
|
+
:default-value="defaultValue"
|
|
117
158
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
118
|
-
:get-key="
|
|
159
|
+
:get-key="getItemKey"
|
|
119
160
|
:default-expanded="defaultExpanded"
|
|
120
161
|
:selection-behavior="selectionBehavior"
|
|
121
162
|
>
|
|
122
|
-
<ReuseTreeTemplate :items="items" :level="
|
|
163
|
+
<ReuseTreeTemplate :items="items" :level="1" />
|
|
123
164
|
</TreeRoot>
|
|
124
165
|
</template>
|