@nuxt/ui 3.0.2 → 3.1.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/accordion.ts +25 -4
- package/.nuxt/ui/alert.ts +52 -31
- package/.nuxt/ui/avatar-group.ts +24 -3
- package/.nuxt/ui/avatar.ts +26 -5
- package/.nuxt/ui/badge.ts +56 -35
- package/.nuxt/ui/breadcrumb.ts +28 -7
- package/.nuxt/ui/button-group.ts +23 -2
- package/.nuxt/ui/button.ts +66 -45
- package/.nuxt/ui/calendar.ts +39 -18
- package/.nuxt/ui/card.ts +28 -7
- package/.nuxt/ui/carousel.ts +29 -8
- package/.nuxt/ui/checkbox-group.ts +82 -0
- package/.nuxt/ui/checkbox.ts +163 -29
- package/.nuxt/ui/chip.ts +31 -10
- package/.nuxt/ui/collapsible.ts +23 -2
- package/.nuxt/ui/color-picker.ts +26 -5
- package/.nuxt/ui/command-palette.ts +37 -16
- package/.nuxt/ui/container.ts +23 -2
- package/.nuxt/ui/context-menu.ts +56 -35
- package/.nuxt/ui/drawer.ts +33 -12
- package/.nuxt/ui/dropdown-menu.ts +57 -36
- package/.nuxt/ui/form-field.ts +29 -8
- package/.nuxt/ui/form.ts +23 -2
- package/.nuxt/ui/index.ts +1 -0
- package/.nuxt/ui/input-menu.ts +65 -44
- package/.nuxt/ui/input-number.ts +43 -22
- package/.nuxt/ui/input.ts +46 -25
- package/.nuxt/ui/kbd.ts +27 -6
- package/.nuxt/ui/link.ts +26 -5
- package/.nuxt/ui/modal.ts +28 -7
- package/.nuxt/ui/navigation-menu.ts +102 -83
- package/.nuxt/ui/pagination.ts +23 -2
- package/.nuxt/ui/pin-input.ts +43 -22
- package/.nuxt/ui/popover.ts +25 -4
- package/.nuxt/ui/progress.ts +40 -19
- package/.nuxt/ui/radio-group.ts +273 -37
- package/.nuxt/ui/select-menu.ts +59 -35
- package/.nuxt/ui/select.ts +55 -34
- package/.nuxt/ui/separator.ts +31 -10
- package/.nuxt/ui/skeleton.ts +24 -3
- package/.nuxt/ui/slideover.ts +27 -6
- package/.nuxt/ui/slider.ts +39 -18
- package/.nuxt/ui/stepper.ts +41 -20
- package/.nuxt/ui/switch.ts +43 -22
- package/.nuxt/ui/table.ts +38 -17
- package/.nuxt/ui/tabs.ts +55 -34
- package/.nuxt/ui/textarea.ts +63 -37
- package/.nuxt/ui/toast.ts +47 -26
- package/.nuxt/ui/toaster.ts +23 -2
- package/.nuxt/ui/tooltip.ts +25 -4
- package/.nuxt/ui/tree.ts +41 -20
- package/.nuxt/ui.css +56 -12
- package/README.md +11 -0
- package/cli/templates.mjs +18 -17
- package/dist/module.json +5 -5
- package/dist/module.mjs +11 -7
- package/dist/runtime/components/Accordion.vue +36 -93
- package/dist/runtime/components/Accordion.vue.d.ts +91 -0
- package/dist/runtime/components/Alert.vue +37 -100
- package/dist/runtime/components/Alert.vue.d.ts +96 -0
- package/dist/runtime/components/App.vue +28 -34
- package/dist/runtime/components/App.vue.d.ts +24 -0
- package/dist/runtime/components/Avatar.vue +42 -75
- package/dist/runtime/components/Avatar.vue.d.ts +60 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
- package/dist/runtime/components/Badge.vue +33 -62
- package/dist/runtime/components/Badge.vue.d.ts +62 -0
- package/dist/runtime/components/Breadcrumb.vue +37 -90
- package/dist/runtime/components/Breadcrumb.vue.d.ts +82 -0
- package/dist/runtime/components/Button.vue +95 -104
- package/dist/runtime/components/Button.vue.d.ts +73 -0
- package/dist/runtime/components/ButtonGroup.vue +20 -46
- package/dist/runtime/components/ButtonGroup.vue.d.ts +55 -0
- package/dist/runtime/components/Calendar.vue +67 -150
- package/dist/runtime/components/Calendar.vue.d.ts +107 -0
- package/dist/runtime/components/Card.vue +18 -40
- package/dist/runtime/components/Card.vue.d.ts +38 -0
- package/dist/runtime/components/Carousel.vue +112 -234
- package/dist/runtime/components/Carousel.vue.d.ts +120 -0
- package/dist/runtime/components/Checkbox.vue +52 -93
- package/dist/runtime/components/Checkbox.vue.d.ts +76 -0
- package/dist/runtime/components/CheckboxGroup.vue +121 -0
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +75 -0
- package/dist/runtime/components/Chip.vue +26 -69
- package/dist/runtime/components/Chip.vue.d.ts +71 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
- package/dist/runtime/components/ColorPicker.vue +111 -197
- package/dist/runtime/components/ColorPicker.vue.d.ts +63 -0
- package/dist/runtime/components/CommandPalette.vue +96 -237
- package/dist/runtime/components/CommandPalette.vue.d.ts +173 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/ContextMenu.vue +34 -133
- package/dist/runtime/components/ContextMenu.vue.d.ts +127 -0
- package/dist/runtime/components/ContextMenuContent.vue +73 -81
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +105 -0
- package/dist/runtime/components/Drawer.vue +49 -83
- package/dist/runtime/components/Drawer.vue.d.ts +88 -0
- package/dist/runtime/components/DropdownMenu.vue +39 -142
- package/dist/runtime/components/DropdownMenu.vue.d.ts +141 -0
- package/dist/runtime/components/DropdownMenuContent.vue +78 -88
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +55 -0
- package/dist/runtime/components/Form.vue +135 -220
- package/dist/runtime/components/Form.vue.d.ts +66 -0
- package/dist/runtime/components/FormField.vue +35 -77
- package/dist/runtime/components/FormField.vue.d.ts +70 -0
- package/dist/runtime/components/Icon.vue +12 -19
- package/dist/runtime/components/Icon.vue.d.ts +17 -0
- package/dist/runtime/components/Input.vue +82 -140
- package/dist/runtime/components/Input.vue.d.ts +91 -0
- package/dist/runtime/components/InputMenu.vue +185 -332
- package/dist/runtime/components/InputMenu.vue.d.ts +312 -0
- package/dist/runtime/components/InputNumber.vue +71 -133
- package/dist/runtime/components/InputNumber.vue.d.ts +193 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +55 -0
- package/dist/runtime/components/Link.vue +98 -176
- package/dist/runtime/components/Link.vue.d.ts +124 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +53 -116
- package/dist/runtime/components/Modal.vue.d.ts +109 -0
- package/dist/runtime/components/NavigationMenu.vue +77 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.vue +46 -140
- package/dist/runtime/components/Pagination.vue.d.ts +143 -0
- package/dist/runtime/components/PinInput.vue +61 -78
- package/dist/runtime/components/PinInput.vue.d.ts +68 -0
- package/dist/runtime/components/Popover.vue +47 -84
- package/dist/runtime/components/Popover.vue.d.ts +80 -0
- package/dist/runtime/components/Progress.vue +70 -131
- package/dist/runtime/components/Progress.vue.d.ts +97 -0
- package/dist/runtime/components/RadioGroup.vue +70 -132
- package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
- package/dist/runtime/components/Select.vue +110 -224
- package/dist/runtime/components/Select.vue.d.ts +139 -0
- package/dist/runtime/components/SelectMenu.vue +161 -310
- package/dist/runtime/components/SelectMenu.vue.d.ts +184 -0
- package/dist/runtime/components/Separator.vue +29 -71
- package/dist/runtime/components/Separator.vue.d.ts +75 -0
- package/dist/runtime/components/Skeleton.vue +21 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +53 -120
- package/dist/runtime/components/Slideover.vue.d.ts +111 -0
- package/dist/runtime/components/Slider.vue +46 -84
- package/dist/runtime/components/Slider.vue.d.ts +71 -0
- package/dist/runtime/components/Stepper.vue +45 -115
- package/dist/runtime/components/Stepper.vue.d.ts +89 -0
- package/dist/runtime/components/Switch.vue +45 -93
- package/dist/runtime/components/Switch.vue.d.ts +73 -0
- package/dist/runtime/components/Table.vue +163 -267
- package/dist/runtime/components/Table.vue.d.ts +183 -0
- package/dist/runtime/components/Tabs.vue +41 -107
- package/dist/runtime/components/Tabs.vue.d.ts +104 -0
- package/dist/runtime/components/Textarea.vue +113 -158
- package/dist/runtime/components/Textarea.vue.d.ts +95 -0
- package/dist/runtime/components/Toast.vue +49 -110
- package/dist/runtime/components/Toast.vue.d.ts +95 -0
- package/dist/runtime/components/Toaster.vue +70 -107
- package/dist/runtime/components/Toaster.vue.d.ts +63 -0
- package/dist/runtime/components/Tooltip.vue +38 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
- package/dist/runtime/components/Tree.vue +59 -166
- package/dist/runtime/components/Tree.vue.d.ts +128 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/composables/usePortal.d.ts +6 -0
- package/dist/runtime/composables/usePortal.js +17 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/inertia/components/Link.vue +146 -0
- package/dist/runtime/inertia/components/Link.vue.d.ts +92 -0
- package/dist/runtime/inertia/stubs.d.ts +43 -0
- package/dist/runtime/inertia/stubs.js +82 -0
- package/dist/runtime/locale/bg.d.ts +3 -0
- package/dist/runtime/locale/bg.js +54 -0
- package/dist/runtime/locale/index.d.ts +5 -1
- package/dist/runtime/locale/index.js +5 -1
- package/dist/runtime/locale/kk.d.ts +3 -0
- package/dist/runtime/locale/kk.js +54 -0
- package/dist/runtime/locale/tj.d.ts +3 -0
- package/dist/runtime/locale/tj.js +54 -0
- package/dist/runtime/locale/ug_cn.d.ts +3 -0
- package/dist/runtime/locale/ug_cn.js +55 -0
- package/dist/runtime/types/form.d.ts +4 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +47 -7
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/link.js +1 -0
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Icon.vue +7 -8
- package/dist/runtime/vue/components/Icon.vue.d.ts +14 -0
- package/dist/runtime/vue/components/Link.vue +118 -202
- package/dist/runtime/vue/components/Link.vue.d.ts +124 -0
- package/dist/runtime/vue/stubs.d.ts +2 -2
- package/dist/shared/{ui.BkNUP964.mjs → ui.D7lOOabO.mjs} +621 -362
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.d.mts +4 -0
- package/dist/unplugin.mjs +25 -4
- package/dist/vite.mjs +1 -1
- package/package.json +94 -53
- package/dist/module.cjs +0 -62
- package/dist/module.d.cts +0 -45
- package/dist/module.d.ts +0 -45
- package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -232
- package/dist/unplugin.d.cts +0 -62
- package/dist/unplugin.d.ts +0 -62
- package/dist/vite.cjs +0 -23
- package/dist/vite.d.cts +0 -15
- package/dist/vite.d.ts +0 -15
|
@@ -1,110 +1,47 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
-
import _appConfig from '#build/app.config'
|
|
5
|
-
import theme from '#build/ui/alert'
|
|
6
|
-
import { tv } from '../utils/tv'
|
|
7
|
-
import type { AvatarProps, ButtonProps } from '../types'
|
|
8
|
-
|
|
9
|
-
const appConfigAlert = _appConfig as AppConfig & { ui: { alert: Partial<typeof theme> } }
|
|
10
|
-
|
|
11
|
-
const alert = tv({ extend: tv(theme), ...(appConfigAlert.ui?.alert || {}) })
|
|
12
|
-
|
|
13
|
-
type AlertVariants = VariantProps<typeof alert>
|
|
14
|
-
|
|
15
|
-
export interface AlertProps {
|
|
16
|
-
/**
|
|
17
|
-
* The element or component this component should render as.
|
|
18
|
-
* @defaultValue 'div'
|
|
19
|
-
*/
|
|
20
|
-
as?: any
|
|
21
|
-
title?: string
|
|
22
|
-
description?: string
|
|
23
|
-
/**
|
|
24
|
-
* @IconifyIcon
|
|
25
|
-
*/
|
|
26
|
-
icon?: string
|
|
27
|
-
avatar?: AvatarProps
|
|
28
|
-
/**
|
|
29
|
-
* @defaultValue 'primary'
|
|
30
|
-
*/
|
|
31
|
-
color?: AlertVariants['color']
|
|
32
|
-
/**
|
|
33
|
-
* @defaultValue 'solid'
|
|
34
|
-
*/
|
|
35
|
-
variant?: AlertVariants['variant']
|
|
36
|
-
/**
|
|
37
|
-
* The orientation between the content and the actions.
|
|
38
|
-
* @defaultValue 'vertical'
|
|
39
|
-
*/
|
|
40
|
-
orientation?: AlertVariants['orientation']
|
|
41
|
-
/**
|
|
42
|
-
* Display a list of actions:
|
|
43
|
-
* - under the title and description when orientation is `vertical`
|
|
44
|
-
* - next to the close button when orientation is `horizontal`
|
|
45
|
-
* `{ size: 'xs' }`{lang="ts-type"}
|
|
46
|
-
*/
|
|
47
|
-
actions?: ButtonProps[]
|
|
48
|
-
/**
|
|
49
|
-
* Display a close button to dismiss the alert.
|
|
50
|
-
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
51
|
-
* @emits 'update:open'
|
|
52
|
-
* @defaultValue false
|
|
53
|
-
*/
|
|
54
|
-
close?: boolean | Partial<ButtonProps>
|
|
55
|
-
/**
|
|
56
|
-
* The icon displayed in the close button.
|
|
57
|
-
* @defaultValue appConfig.ui.icons.close
|
|
58
|
-
* @IconifyIcon
|
|
59
|
-
*/
|
|
60
|
-
closeIcon?: string
|
|
61
|
-
class?: any
|
|
62
|
-
ui?: Partial<typeof alert.slots>
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface AlertEmits {
|
|
66
|
-
(e: 'update:open', value: boolean): void
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface AlertSlots {
|
|
70
|
-
leading(props?: {}): any
|
|
71
|
-
title(props?: {}): any
|
|
72
|
-
description(props?: {}): any
|
|
73
|
-
actions(props?: {}): any
|
|
74
|
-
close(props: { ui: ReturnType<typeof alert> }): any
|
|
75
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/alert";
|
|
76
3
|
</script>
|
|
77
4
|
|
|
78
|
-
<script setup
|
|
79
|
-
import { computed } from
|
|
80
|
-
import { Primitive } from
|
|
81
|
-
import { useAppConfig } from
|
|
82
|
-
import { useLocale } from
|
|
83
|
-
import
|
|
84
|
-
import
|
|
85
|
-
import
|
|
86
|
-
|
|
87
|
-
const props =
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
9
|
+
import { useLocale } from "../composables/useLocale";
|
|
10
|
+
import { tv } from "../utils/tv";
|
|
11
|
+
import UIcon from "./Icon.vue";
|
|
12
|
+
import UAvatar from "./Avatar.vue";
|
|
13
|
+
import UButton from "./Button.vue";
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
as: { type: null, required: false },
|
|
16
|
+
title: { type: String, required: false },
|
|
17
|
+
description: { type: String, required: false },
|
|
18
|
+
icon: { type: String, required: false },
|
|
19
|
+
avatar: { type: Object, required: false },
|
|
20
|
+
color: { type: null, required: false },
|
|
21
|
+
variant: { type: null, required: false },
|
|
22
|
+
orientation: { type: null, required: false, default: "vertical" },
|
|
23
|
+
actions: { type: Array, required: false },
|
|
24
|
+
close: { type: [Boolean, Object], required: false },
|
|
25
|
+
closeIcon: { type: String, required: false },
|
|
26
|
+
class: { type: null, required: false },
|
|
27
|
+
ui: { type: null, required: false }
|
|
28
|
+
});
|
|
29
|
+
const emits = defineEmits(["update:open"]);
|
|
30
|
+
const slots = defineSlots();
|
|
31
|
+
const { t } = useLocale();
|
|
32
|
+
const appConfig = useAppConfig();
|
|
33
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.alert || {} })({
|
|
97
34
|
color: props.color,
|
|
98
35
|
variant: props.variant,
|
|
99
36
|
orientation: props.orientation,
|
|
100
37
|
title: !!props.title || !!slots.title
|
|
101
|
-
}))
|
|
38
|
+
}));
|
|
102
39
|
</script>
|
|
103
40
|
|
|
104
41
|
<template>
|
|
105
42
|
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
106
43
|
<slot name="leading">
|
|
107
|
-
<UAvatar v-if="avatar" :size="
|
|
44
|
+
<UAvatar v-if="avatar" :size="props.ui?.avatarSize || ui.avatarSize()" v-bind="avatar" :class="ui.avatar({ class: props.ui?.avatar })" />
|
|
108
45
|
<UIcon v-else-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
109
46
|
</slot>
|
|
110
47
|
|
|
@@ -120,15 +57,15 @@ const ui = computed(() => alert({
|
|
|
120
57
|
</slot>
|
|
121
58
|
</div>
|
|
122
59
|
|
|
123
|
-
<div v-if="orientation === 'vertical' && actions?.length" :class="ui.actions({ class: props.ui?.actions })">
|
|
60
|
+
<div v-if="orientation === 'vertical' && (actions?.length || !!slots.actions)" :class="ui.actions({ class: props.ui?.actions })">
|
|
124
61
|
<slot name="actions">
|
|
125
62
|
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
126
63
|
</slot>
|
|
127
64
|
</div>
|
|
128
65
|
</div>
|
|
129
66
|
|
|
130
|
-
<div v-if="
|
|
131
|
-
<template v-if="orientation === 'horizontal' && actions?.length">
|
|
67
|
+
<div v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions) || close" :class="ui.actions({ class: props.ui?.actions, orientation: 'horizontal' })">
|
|
68
|
+
<template v-if="orientation === 'horizontal' && (actions?.length || !!slots.actions)">
|
|
132
69
|
<slot name="actions">
|
|
133
70
|
<UButton v-for="(action, index) in actions" :key="index" size="xs" v-bind="action" />
|
|
134
71
|
</slot>
|
|
@@ -142,7 +79,7 @@ const ui = computed(() => alert({
|
|
|
142
79
|
color="neutral"
|
|
143
80
|
variant="link"
|
|
144
81
|
:aria-label="t('alert.close')"
|
|
145
|
-
v-bind="
|
|
82
|
+
v-bind="typeof close === 'object' ? close : {}"
|
|
146
83
|
:class="ui.close({ class: props.ui?.close })"
|
|
147
84
|
@click="emits('update:open', false)"
|
|
148
85
|
/>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import theme from '#build/ui/alert';
|
|
3
|
+
import type { AvatarProps, ButtonProps } from '../types';
|
|
4
|
+
import type { ComponentConfig } from '../types/utils';
|
|
5
|
+
type Alert = ComponentConfig<typeof theme, AppConfig, 'alert'>;
|
|
6
|
+
export interface AlertProps {
|
|
7
|
+
/**
|
|
8
|
+
* The element or component this component should render as.
|
|
9
|
+
* @defaultValue 'div'
|
|
10
|
+
*/
|
|
11
|
+
as?: any;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
/**
|
|
15
|
+
* @IconifyIcon
|
|
16
|
+
*/
|
|
17
|
+
icon?: string;
|
|
18
|
+
avatar?: AvatarProps;
|
|
19
|
+
/**
|
|
20
|
+
* @defaultValue 'primary'
|
|
21
|
+
*/
|
|
22
|
+
color?: Alert['variants']['color'];
|
|
23
|
+
/**
|
|
24
|
+
* @defaultValue 'solid'
|
|
25
|
+
*/
|
|
26
|
+
variant?: Alert['variants']['variant'];
|
|
27
|
+
/**
|
|
28
|
+
* The orientation between the content and the actions.
|
|
29
|
+
* @defaultValue 'vertical'
|
|
30
|
+
*/
|
|
31
|
+
orientation?: Alert['variants']['orientation'];
|
|
32
|
+
/**
|
|
33
|
+
* Display a list of actions:
|
|
34
|
+
* - under the title and description when orientation is `vertical`
|
|
35
|
+
* - next to the close button when orientation is `horizontal`
|
|
36
|
+
* `{ size: 'xs' }`{lang="ts-type"}
|
|
37
|
+
*/
|
|
38
|
+
actions?: ButtonProps[];
|
|
39
|
+
/**
|
|
40
|
+
* Display a close button to dismiss the alert.
|
|
41
|
+
* `{ size: 'md', color: 'neutral', variant: 'link' }`{lang="ts-type"}
|
|
42
|
+
* @emits 'update:open'
|
|
43
|
+
* @defaultValue false
|
|
44
|
+
*/
|
|
45
|
+
close?: boolean | Partial<ButtonProps>;
|
|
46
|
+
/**
|
|
47
|
+
* The icon displayed in the close button.
|
|
48
|
+
* @defaultValue appConfig.ui.icons.close
|
|
49
|
+
* @IconifyIcon
|
|
50
|
+
*/
|
|
51
|
+
closeIcon?: string;
|
|
52
|
+
class?: any;
|
|
53
|
+
ui?: Alert['slots'];
|
|
54
|
+
}
|
|
55
|
+
export interface AlertEmits {
|
|
56
|
+
(e: 'update:open', value: boolean): void;
|
|
57
|
+
}
|
|
58
|
+
export interface AlertSlots {
|
|
59
|
+
leading(props?: {}): any;
|
|
60
|
+
title(props?: {}): any;
|
|
61
|
+
description(props?: {}): any;
|
|
62
|
+
actions(props?: {}): any;
|
|
63
|
+
close(props: {
|
|
64
|
+
ui: {
|
|
65
|
+
[K in keyof Required<Alert['slots']>]: (props?: Record<string, any>) => string;
|
|
66
|
+
};
|
|
67
|
+
}): any;
|
|
68
|
+
}
|
|
69
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<AlertProps>, {
|
|
70
|
+
orientation: string;
|
|
71
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any, string, import("vue").PublicProps, any, {
|
|
72
|
+
orientation: Alert["variants"]["orientation"];
|
|
73
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<AlertSlots> & AlertSlots>;
|
|
74
|
+
export default _default;
|
|
75
|
+
type __VLS_WithDefaults<P, D> = {
|
|
76
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
77
|
+
default: D[K];
|
|
78
|
+
}> : P[K];
|
|
79
|
+
};
|
|
80
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
81
|
+
type __VLS_TypePropsToOption<T> = {
|
|
82
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
83
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
84
|
+
} : {
|
|
85
|
+
type: import('vue').PropType<T[K]>;
|
|
86
|
+
required: true;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
90
|
+
new (): {
|
|
91
|
+
$slots: S;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
type __VLS_PrettifyLocal<T> = {
|
|
95
|
+
[K in keyof T]: T[K];
|
|
96
|
+
} & {};
|
|
@@ -1,43 +1,37 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
|
|
3
|
-
import type { ToasterProps, Locale, Messages } from '../types'
|
|
4
|
-
|
|
5
|
-
export interface AppProps<T extends Messages = Messages> extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
6
|
-
tooltip?: TooltipProviderProps
|
|
7
|
-
toaster?: ToasterProps | null
|
|
8
|
-
locale?: Locale<T>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface AppSlots {
|
|
12
|
-
default(props?: {}): any
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
<script>
|
|
15
2
|
export default {
|
|
16
|
-
name:
|
|
17
|
-
}
|
|
3
|
+
name: "App"
|
|
4
|
+
};
|
|
18
5
|
</script>
|
|
19
6
|
|
|
20
|
-
<script setup
|
|
21
|
-
import { toRef, useId, provide } from
|
|
22
|
-
import { ConfigProvider, TooltipProvider, useForwardProps } from
|
|
23
|
-
import { reactivePick } from
|
|
24
|
-
import { localeContextInjectionKey } from
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
const props = defineProps
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
<script setup>
|
|
8
|
+
import { toRef, useId, provide } from "vue";
|
|
9
|
+
import { ConfigProvider, TooltipProvider, useForwardProps } from "reka-ui";
|
|
10
|
+
import { reactivePick } from "@vueuse/core";
|
|
11
|
+
import { localeContextInjectionKey } from "../composables/useLocale";
|
|
12
|
+
import { portalTargetInjectionKey } from "../composables/usePortal";
|
|
13
|
+
import UToaster from "./Toaster.vue";
|
|
14
|
+
import UOverlayProvider from "./OverlayProvider.vue";
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
tooltip: { type: Object, required: false },
|
|
17
|
+
toaster: { type: [Object, null], required: false },
|
|
18
|
+
locale: { type: null, required: false },
|
|
19
|
+
portal: { type: null, required: false, default: "body" },
|
|
20
|
+
scrollBody: { type: [Boolean, Object], required: false },
|
|
21
|
+
nonce: { type: String, required: false }
|
|
22
|
+
});
|
|
23
|
+
defineSlots();
|
|
24
|
+
const configProviderProps = useForwardProps(reactivePick(props, "scrollBody"));
|
|
25
|
+
const tooltipProps = toRef(() => props.tooltip);
|
|
26
|
+
const toasterProps = toRef(() => props.toaster);
|
|
27
|
+
const locale = toRef(() => props.locale);
|
|
28
|
+
provide(localeContextInjectionKey, locale);
|
|
29
|
+
const portal = toRef(() => props.portal);
|
|
30
|
+
provide(portalTargetInjectionKey, portal);
|
|
37
31
|
</script>
|
|
38
32
|
|
|
39
33
|
<template>
|
|
40
|
-
<ConfigProvider :use-id="() =>
|
|
34
|
+
<ConfigProvider :use-id="() => useId()" :dir="locale?.dir" :locale="locale?.code" v-bind="configProviderProps">
|
|
41
35
|
<TooltipProvider v-bind="tooltipProps">
|
|
42
36
|
<UToaster v-if="toaster !== null" v-bind="toasterProps">
|
|
43
37
|
<slot />
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui';
|
|
2
|
+
import type { ToasterProps, Locale, Messages } from '../types';
|
|
3
|
+
export interface AppProps<T extends Messages = Messages> extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
4
|
+
tooltip?: TooltipProviderProps;
|
|
5
|
+
toaster?: ToasterProps | null;
|
|
6
|
+
locale?: Locale<T>;
|
|
7
|
+
portal?: string | HTMLElement;
|
|
8
|
+
}
|
|
9
|
+
export interface AppSlots {
|
|
10
|
+
default(props?: {}): any;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: <T extends Messages>(__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<{
|
|
13
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & AppProps<T> & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
|
|
14
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
15
|
+
attrs: any;
|
|
16
|
+
slots: Readonly<AppSlots> & AppSlots;
|
|
17
|
+
emit: {};
|
|
18
|
+
}>) => import("vue").VNode & {
|
|
19
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_PrettifyLocal<T> = {
|
|
23
|
+
[K in keyof T]: T[K];
|
|
24
|
+
} & {};
|
|
@@ -1,85 +1,52 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
-
import _appConfig from '#build/app.config'
|
|
5
|
-
import theme from '#build/ui/avatar'
|
|
6
|
-
import { tv } from '../utils/tv'
|
|
7
|
-
|
|
8
|
-
const appConfigAvatar = _appConfig as AppConfig & { ui: { avatar: Partial<typeof theme> } }
|
|
9
|
-
|
|
10
|
-
const avatar = tv({ extend: tv(theme), ...(appConfigAvatar.ui?.avatar || {}) })
|
|
11
|
-
|
|
12
|
-
type AvatarVariants = VariantProps<typeof avatar>
|
|
13
|
-
|
|
14
|
-
export interface AvatarProps {
|
|
15
|
-
/**
|
|
16
|
-
* The element or component this component should render as.
|
|
17
|
-
* @defaultValue 'span'
|
|
18
|
-
*/
|
|
19
|
-
as?: any
|
|
20
|
-
src?: string
|
|
21
|
-
alt?: string
|
|
22
|
-
/**
|
|
23
|
-
* @IconifyIcon
|
|
24
|
-
*/
|
|
25
|
-
icon?: string
|
|
26
|
-
text?: string
|
|
27
|
-
/**
|
|
28
|
-
* @defaultValue 'md'
|
|
29
|
-
*/
|
|
30
|
-
size?: AvatarVariants['size']
|
|
31
|
-
class?: any
|
|
32
|
-
style?: any
|
|
33
|
-
ui?: Partial<typeof avatar.slots>
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface AvatarSlots {
|
|
37
|
-
default(props?: {}): any
|
|
38
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/avatar";
|
|
39
3
|
</script>
|
|
40
4
|
|
|
41
|
-
<script setup
|
|
42
|
-
import { ref, computed, watch } from
|
|
43
|
-
import { Primitive, Slot } from
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const props =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { ref, computed, watch } from "vue";
|
|
7
|
+
import { Primitive, Slot } from "reka-ui";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
9
|
+
import ImageComponent from "#build/ui-image-component";
|
|
10
|
+
import { useAvatarGroup } from "../composables/useAvatarGroup";
|
|
11
|
+
import { tv } from "../utils/tv";
|
|
12
|
+
import UIcon from "./Icon.vue";
|
|
13
|
+
defineOptions({ inheritAttrs: false });
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
as: { type: null, required: false, default: "span" },
|
|
16
|
+
src: { type: String, required: false },
|
|
17
|
+
alt: { type: String, required: false },
|
|
18
|
+
icon: { type: String, required: false },
|
|
19
|
+
text: { type: String, required: false },
|
|
20
|
+
size: { type: null, required: false },
|
|
21
|
+
class: { type: null, required: false },
|
|
22
|
+
style: { type: null, required: false },
|
|
23
|
+
ui: { type: null, required: false }
|
|
24
|
+
});
|
|
25
|
+
const fallback = computed(() => props.text || (props.alt || "").split(" ").map((word) => word.charAt(0)).join("").substring(0, 2));
|
|
26
|
+
const appConfig = useAppConfig();
|
|
27
|
+
const { size } = useAvatarGroup(props);
|
|
28
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.avatar || {} })({
|
|
58
29
|
size: size.value
|
|
59
|
-
}))
|
|
60
|
-
|
|
30
|
+
}));
|
|
61
31
|
const sizePx = computed(() => ({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})[props.size ||
|
|
72
|
-
|
|
73
|
-
const error = ref(false)
|
|
74
|
-
|
|
32
|
+
"3xs": 16,
|
|
33
|
+
"2xs": 20,
|
|
34
|
+
"xs": 24,
|
|
35
|
+
"sm": 28,
|
|
36
|
+
"md": 32,
|
|
37
|
+
"lg": 36,
|
|
38
|
+
"xl": 40,
|
|
39
|
+
"2xl": 44,
|
|
40
|
+
"3xl": 48
|
|
41
|
+
})[props.size || "md"]);
|
|
42
|
+
const error = ref(false);
|
|
75
43
|
watch(() => props.src, () => {
|
|
76
44
|
if (error.value) {
|
|
77
|
-
error.value = false
|
|
45
|
+
error.value = false;
|
|
78
46
|
}
|
|
79
|
-
})
|
|
80
|
-
|
|
47
|
+
});
|
|
81
48
|
function onError() {
|
|
82
|
-
error.value = true
|
|
49
|
+
error.value = true;
|
|
83
50
|
}
|
|
84
51
|
</script>
|
|
85
52
|
|
|
@@ -101,7 +68,7 @@ function onError() {
|
|
|
101
68
|
<Slot v-else v-bind="$attrs">
|
|
102
69
|
<slot>
|
|
103
70
|
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
|
104
|
-
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || '
|
|
71
|
+
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || '\xA0' }}</span>
|
|
105
72
|
</slot>
|
|
106
73
|
</Slot>
|
|
107
74
|
</Primitive>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import theme from '#build/ui/avatar';
|
|
3
|
+
import type { ComponentConfig } from '../types/utils';
|
|
4
|
+
type Avatar = ComponentConfig<typeof theme, AppConfig, 'avatar'>;
|
|
5
|
+
export interface AvatarProps {
|
|
6
|
+
/**
|
|
7
|
+
* The element or component this component should render as.
|
|
8
|
+
* @defaultValue 'span'
|
|
9
|
+
*/
|
|
10
|
+
as?: any;
|
|
11
|
+
src?: string;
|
|
12
|
+
alt?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @IconifyIcon
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
text?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @defaultValue 'md'
|
|
20
|
+
*/
|
|
21
|
+
size?: Avatar['variants']['size'];
|
|
22
|
+
class?: any;
|
|
23
|
+
style?: any;
|
|
24
|
+
ui?: Avatar['slots'];
|
|
25
|
+
}
|
|
26
|
+
export interface AvatarSlots {
|
|
27
|
+
default(props?: {}): any;
|
|
28
|
+
}
|
|
29
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<AvatarProps>, {
|
|
30
|
+
as: string;
|
|
31
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<AvatarProps>, {
|
|
32
|
+
as: string;
|
|
33
|
+
}>>> & Readonly<{}>, {
|
|
34
|
+
as: any;
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
36
|
+
default?(_: {}): any;
|
|
37
|
+
}>;
|
|
38
|
+
export default _default;
|
|
39
|
+
type __VLS_WithDefaults<P, D> = {
|
|
40
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
41
|
+
default: D[K];
|
|
42
|
+
}> : P[K];
|
|
43
|
+
};
|
|
44
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
45
|
+
type __VLS_TypePropsToOption<T> = {
|
|
46
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
47
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
48
|
+
} : {
|
|
49
|
+
type: import('vue').PropType<T[K]>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
54
|
+
new (): {
|
|
55
|
+
$slots: S;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
type __VLS_PrettifyLocal<T> = {
|
|
59
|
+
[K in keyof T]: T[K];
|
|
60
|
+
} & {};
|