@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,256 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ListboxRootProps, ListboxRootEmits } from 'reka-ui'
|
|
4
|
-
import type { FuseResult } from 'fuse.js'
|
|
5
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
-
import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
|
|
7
|
-
import _appConfig from '#build/app.config'
|
|
8
|
-
import theme from '#build/ui/command-palette'
|
|
9
|
-
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
10
|
-
import { tv } from '../utils/tv'
|
|
11
|
-
import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps, LinkProps } from '../types'
|
|
12
|
-
import type { PartialString } from '../types/utils'
|
|
13
|
-
|
|
14
|
-
const appConfigCommandPalette = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
|
|
15
|
-
|
|
16
|
-
const commandPalette = tv({ extend: tv(theme), ...(appConfigCommandPalette.ui?.commandPalette || {}) })
|
|
17
|
-
|
|
18
|
-
export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
19
|
-
prefix?: string
|
|
20
|
-
label?: string
|
|
21
|
-
suffix?: string
|
|
22
|
-
/**
|
|
23
|
-
* @IconifyIcon
|
|
24
|
-
*/
|
|
25
|
-
icon?: string
|
|
26
|
-
avatar?: AvatarProps
|
|
27
|
-
chip?: ChipProps
|
|
28
|
-
kbds?: KbdProps['value'][] | KbdProps[]
|
|
29
|
-
active?: boolean
|
|
30
|
-
loading?: boolean
|
|
31
|
-
disabled?: boolean
|
|
32
|
-
slot?: string
|
|
33
|
-
onSelect?(e?: Event): void
|
|
34
|
-
[key: string]: any
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface CommandPaletteGroup<T> {
|
|
38
|
-
id: string
|
|
39
|
-
label?: string
|
|
40
|
-
slot?: string
|
|
41
|
-
items?: T[]
|
|
42
|
-
/**
|
|
43
|
-
* Whether to filter group items with [useFuse](https://vueuse.org/integrations/useFuse).
|
|
44
|
-
* When `true`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
45
|
-
* @defaultValue false
|
|
46
|
-
*/
|
|
47
|
-
ignoreFilter?: boolean
|
|
48
|
-
/** Filter group items after the search happened. */
|
|
49
|
-
postFilter?: (searchTerm: string, items: T[]) => T[]
|
|
50
|
-
/**
|
|
51
|
-
* The icon displayed when an item is highlighted.
|
|
52
|
-
* @IconifyIcon
|
|
53
|
-
*/
|
|
54
|
-
highlightedIcon?: string
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'highlightOnHover'>, Pick<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
|
|
58
|
-
/**
|
|
59
|
-
* The element or component this component should render as.
|
|
60
|
-
* @defaultValue 'div'
|
|
61
|
-
*/
|
|
62
|
-
as?: any
|
|
63
|
-
/**
|
|
64
|
-
* The icon displayed in the input.
|
|
65
|
-
* @defaultValue appConfig.ui.icons.search
|
|
66
|
-
* @IconifyIcon
|
|
67
|
-
*/
|
|
68
|
-
icon?: string
|
|
69
|
-
/**
|
|
70
|
-
* The icon displayed when an item is selected.
|
|
71
|
-
* @defaultValue appConfig.ui.icons.check
|
|
72
|
-
* @IconifyIcon
|
|
73
|
-
*/
|
|
74
|
-
selectedIcon?: string
|
|
75
|
-
/**
|
|
76
|
-
* The placeholder text for the input.
|
|
77
|
-
* @defaultValue t('commandPalette.placeholder')
|
|
78
|
-
*/
|
|
79
|
-
placeholder?: InputProps['placeholder']
|
|
80
|
-
/**
|
|
81
|
-
* Automatically focus the input when component is mounted.
|
|
82
|
-
* @defaultValue true
|
|
83
|
-
*/
|
|
84
|
-
autofocus?: boolean
|
|
85
|
-
/**
|
|
86
|
-
* Display a close button in the input (useful when inside a Modal for example).
|
|
87
|
-
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
88
|
-
* @emits 'update:open'
|
|
89
|
-
* @defaultValue false
|
|
90
|
-
*/
|
|
91
|
-
close?: boolean | Partial<ButtonProps>
|
|
92
|
-
/**
|
|
93
|
-
* The icon displayed in the close button.
|
|
94
|
-
* @defaultValue appConfig.ui.icons.close
|
|
95
|
-
* @IconifyIcon
|
|
96
|
-
*/
|
|
97
|
-
closeIcon?: string
|
|
98
|
-
groups?: G[]
|
|
99
|
-
/**
|
|
100
|
-
* Options for [useFuse](https://vueuse.org/integrations/useFuse).
|
|
101
|
-
* @defaultValue {
|
|
102
|
-
fuseOptions: {
|
|
103
|
-
ignoreLocation: true,
|
|
104
|
-
threshold: 0.1,
|
|
105
|
-
keys: ['label', 'suffix']
|
|
106
|
-
},
|
|
107
|
-
resultLimit: 12,
|
|
108
|
-
matchAllWhenSearchEmpty: true
|
|
109
|
-
}
|
|
110
|
-
*/
|
|
111
|
-
fuse?: UseFuseOptions<T>
|
|
112
|
-
/**
|
|
113
|
-
* The key used to get the label from the item.
|
|
114
|
-
* @defaultValue 'label'
|
|
115
|
-
*/
|
|
116
|
-
labelKey?: string
|
|
117
|
-
class?: any
|
|
118
|
-
ui?: PartialString<typeof commandPalette.slots>
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export type CommandPaletteEmits<T> = ListboxRootEmits<T> & {
|
|
122
|
-
'update:open': [value: boolean]
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
126
|
-
|
|
127
|
-
export type CommandPaletteSlots<G extends { slot?: string }, T extends { slot?: string }> = {
|
|
128
|
-
'empty'(props: { searchTerm?: string }): any
|
|
129
|
-
'close'(props: { ui: ReturnType<typeof commandPalette> }): any
|
|
130
|
-
'item': SlotProps<T>
|
|
131
|
-
'item-leading': SlotProps<T>
|
|
132
|
-
'item-label': SlotProps<T>
|
|
133
|
-
'item-trailing': SlotProps<T>
|
|
134
|
-
} & Record<string, SlotProps<G>> & Record<string, SlotProps<T>>
|
|
135
|
-
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/command-palette";
|
|
136
3
|
</script>
|
|
137
4
|
|
|
138
|
-
<script setup
|
|
139
|
-
import { computed } from
|
|
140
|
-
import { ListboxRoot, ListboxFilter, ListboxContent, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, useForwardProps, useForwardPropsEmits } from
|
|
141
|
-
import { defu } from
|
|
142
|
-
import { reactivePick } from
|
|
143
|
-
import { useFuse } from
|
|
144
|
-
import { useAppConfig } from
|
|
145
|
-
import { useLocale } from
|
|
146
|
-
import { omit, get } from
|
|
147
|
-
import {
|
|
148
|
-
import {
|
|
149
|
-
import
|
|
150
|
-
import
|
|
151
|
-
import
|
|
152
|
-
import
|
|
153
|
-
import
|
|
154
|
-
import
|
|
155
|
-
import
|
|
156
|
-
import
|
|
157
|
-
|
|
158
|
-
const props =
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { ListboxRoot, ListboxFilter, ListboxContent, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, useForwardProps, useForwardPropsEmits } from "reka-ui";
|
|
8
|
+
import { defu } from "defu";
|
|
9
|
+
import { reactivePick } from "@vueuse/core";
|
|
10
|
+
import { useFuse } from "@vueuse/integrations/useFuse";
|
|
11
|
+
import { useAppConfig } from "#imports";
|
|
12
|
+
import { useLocale } from "../composables/useLocale";
|
|
13
|
+
import { omit, get } from "../utils";
|
|
14
|
+
import { tv } from "../utils/tv";
|
|
15
|
+
import { highlight } from "../utils/fuse";
|
|
16
|
+
import { pickLinkProps } from "../utils/link";
|
|
17
|
+
import UIcon from "./Icon.vue";
|
|
18
|
+
import UAvatar from "./Avatar.vue";
|
|
19
|
+
import UButton from "./Button.vue";
|
|
20
|
+
import UChip from "./Chip.vue";
|
|
21
|
+
import ULinkBase from "./LinkBase.vue";
|
|
22
|
+
import ULink from "./Link.vue";
|
|
23
|
+
import UInput from "./Input.vue";
|
|
24
|
+
import UKbd from "./Kbd.vue";
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
as: { type: null, required: false },
|
|
27
|
+
icon: { type: String, required: false },
|
|
28
|
+
selectedIcon: { type: String, required: false },
|
|
29
|
+
placeholder: { type: String, required: false },
|
|
30
|
+
autofocus: { type: Boolean, required: false, default: true },
|
|
31
|
+
close: { type: [Boolean, Object], required: false },
|
|
32
|
+
closeIcon: { type: String, required: false },
|
|
33
|
+
groups: { type: Array, required: false },
|
|
34
|
+
fuse: { type: Object, required: false },
|
|
35
|
+
labelKey: { type: String, required: false, default: "label" },
|
|
36
|
+
class: { type: null, required: false },
|
|
37
|
+
ui: { type: null, required: false },
|
|
38
|
+
multiple: { type: Boolean, required: false },
|
|
39
|
+
disabled: { type: Boolean, required: false },
|
|
40
|
+
modelValue: { type: null, required: false, default: "" },
|
|
41
|
+
defaultValue: { type: null, required: false },
|
|
42
|
+
highlightOnHover: { type: Boolean, required: false },
|
|
43
|
+
loading: { type: Boolean, required: false },
|
|
44
|
+
loadingIcon: { type: String, required: false }
|
|
45
|
+
});
|
|
46
|
+
const emits = defineEmits(["update:modelValue", "highlight", "entryFocus", "leave", "update:open"]);
|
|
47
|
+
const slots = defineSlots();
|
|
48
|
+
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
49
|
+
const { t } = useLocale();
|
|
50
|
+
const appConfig = useAppConfig();
|
|
51
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "disabled", "multiple", "modelValue", "defaultValue", "highlightOnHover"), emits);
|
|
52
|
+
const inputProps = useForwardProps(reactivePick(props, "loading", "loadingIcon"));
|
|
53
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.commandPalette || {} })());
|
|
177
54
|
const fuse = computed(() => defu({}, props.fuse, {
|
|
178
55
|
fuseOptions: {
|
|
179
56
|
ignoreLocation: true,
|
|
180
57
|
threshold: 0.1,
|
|
181
|
-
keys: [props.labelKey,
|
|
58
|
+
keys: [props.labelKey, "suffix"]
|
|
182
59
|
},
|
|
183
60
|
resultLimit: 12,
|
|
184
61
|
matchAllWhenSearchEmpty: true
|
|
185
|
-
}))
|
|
186
|
-
|
|
62
|
+
}));
|
|
187
63
|
const items = computed(() => props.groups?.filter((group) => {
|
|
188
64
|
if (!group.id) {
|
|
189
|
-
console.warn(`[@nuxt/ui] CommandPalette group is missing an \`id\` property`)
|
|
190
|
-
return false
|
|
65
|
+
console.warn(`[@nuxt/ui] CommandPalette group is missing an \`id\` property`);
|
|
66
|
+
return false;
|
|
191
67
|
}
|
|
192
|
-
|
|
193
68
|
if (group.ignoreFilter) {
|
|
194
|
-
return false
|
|
69
|
+
return false;
|
|
195
70
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
function getGroupWithItems(group: G, items: (T & { matches?: FuseResult<T>['matches'] })[]) {
|
|
203
|
-
if (group?.postFilter && typeof group.postFilter === 'function') {
|
|
204
|
-
items = group.postFilter(searchTerm.value, items)
|
|
71
|
+
return true;
|
|
72
|
+
}).flatMap((group) => group.items?.map((item) => ({ ...item, group: group.id })) || []) || []);
|
|
73
|
+
const { results: fuseResults } = useFuse(searchTerm, items, fuse);
|
|
74
|
+
function getGroupWithItems(group, items2) {
|
|
75
|
+
if (group?.postFilter && typeof group.postFilter === "function") {
|
|
76
|
+
items2 = group.postFilter(searchTerm.value, items2);
|
|
205
77
|
}
|
|
206
|
-
|
|
207
78
|
return {
|
|
208
79
|
...group,
|
|
209
|
-
items:
|
|
80
|
+
items: items2.slice(0, fuse.value.resultLimit).map((item) => {
|
|
210
81
|
return {
|
|
211
82
|
...item,
|
|
212
|
-
labelHtml: highlight
|
|
213
|
-
suffixHtml: highlight
|
|
214
|
-
}
|
|
83
|
+
labelHtml: highlight(item, searchTerm.value, props.labelKey),
|
|
84
|
+
suffixHtml: highlight(item, searchTerm.value, void 0, [props.labelKey])
|
|
85
|
+
};
|
|
215
86
|
})
|
|
216
|
-
}
|
|
87
|
+
};
|
|
217
88
|
}
|
|
218
|
-
|
|
219
89
|
const groups = computed(() => {
|
|
220
90
|
const groupsById = fuseResults.value.reduce((acc, result) => {
|
|
221
|
-
const { item, matches } = result
|
|
91
|
+
const { item, matches } = result;
|
|
222
92
|
if (!item.group) {
|
|
223
|
-
return acc
|
|
93
|
+
return acc;
|
|
224
94
|
}
|
|
225
|
-
|
|
226
|
-
acc[item.group]
|
|
227
|
-
acc
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const fuseGroups = Object.entries(groupsById).map(([id, items]) => {
|
|
233
|
-
const group = props.groups?.find(group => group.id === id)
|
|
95
|
+
acc[item.group] ||= [];
|
|
96
|
+
acc[item.group]?.push({ ...item, matches });
|
|
97
|
+
return acc;
|
|
98
|
+
}, {});
|
|
99
|
+
const fuseGroups = Object.entries(groupsById).map(([id, items2]) => {
|
|
100
|
+
const group = props.groups?.find((group2) => group2.id === id);
|
|
234
101
|
if (!group) {
|
|
235
|
-
return
|
|
102
|
+
return;
|
|
236
103
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
const nonFuseGroups = props.groups
|
|
242
|
-
?.map((group, index) => ({ ...group, index }))
|
|
243
|
-
?.filter(group => group.ignoreFilter && group.items?.length)
|
|
244
|
-
?.map(group => ({ ...getGroupWithItems(group, group.items || []), index: group.index })) || []
|
|
245
|
-
|
|
104
|
+
return getGroupWithItems(group, items2);
|
|
105
|
+
}).filter((group) => !!group);
|
|
106
|
+
const nonFuseGroups = props.groups?.map((group, index) => ({ ...group, index }))?.filter((group) => group.ignoreFilter && group.items?.length)?.map((group) => ({ ...getGroupWithItems(group, group.items || []), index: group.index })) || [];
|
|
246
107
|
return nonFuseGroups.reduce((acc, group) => {
|
|
247
|
-
acc.splice(group.index, 0, group)
|
|
248
|
-
return acc
|
|
249
|
-
}, [...fuseGroups])
|
|
250
|
-
})
|
|
108
|
+
acc.splice(group.index, 0, group);
|
|
109
|
+
return acc;
|
|
110
|
+
}, [...fuseGroups]);
|
|
111
|
+
});
|
|
251
112
|
</script>
|
|
252
113
|
|
|
253
|
-
<!-- eslint-disable vue/no-v-html -->
|
|
254
114
|
<template>
|
|
255
115
|
<ListboxRoot v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
256
116
|
<ListboxFilter v-model="searchTerm" as-child>
|
|
@@ -258,7 +118,6 @@ const groups = computed(() => {
|
|
|
258
118
|
:placeholder="placeholder || t('commandPalette.placeholder')"
|
|
259
119
|
variant="none"
|
|
260
120
|
:autofocus="autofocus"
|
|
261
|
-
size="lg"
|
|
262
121
|
v-bind="inputProps"
|
|
263
122
|
:icon="icon || appConfig.ui.icons.search"
|
|
264
123
|
:class="ui.input({ class: props.ui?.input })"
|
|
@@ -272,7 +131,7 @@ const groups = computed(() => {
|
|
|
272
131
|
color="neutral"
|
|
273
132
|
variant="ghost"
|
|
274
133
|
:aria-label="t('commandPalette.close')"
|
|
275
|
-
v-bind="
|
|
134
|
+
v-bind="typeof close === 'object' ? close : {}"
|
|
276
135
|
:class="ui.close({ class: props.ui?.close })"
|
|
277
136
|
@click="emits('update:open', false)"
|
|
278
137
|
/>
|
|
@@ -284,28 +143,28 @@ const groups = computed(() => {
|
|
|
284
143
|
<ListboxContent :class="ui.content({ class: props.ui?.content })">
|
|
285
144
|
<div v-if="groups?.length" :class="ui.viewport({ class: props.ui?.viewport })">
|
|
286
145
|
<ListboxGroup v-for="group in groups" :key="`group-${group.id}`" :class="ui.group({ class: props.ui?.group })">
|
|
287
|
-
<ListboxGroupLabel v-if="get(group, props.labelKey
|
|
288
|
-
{{ get(group, props.labelKey
|
|
146
|
+
<ListboxGroupLabel v-if="get(group, props.labelKey)" :class="ui.label({ class: props.ui?.label })">
|
|
147
|
+
{{ get(group, props.labelKey) }}
|
|
289
148
|
</ListboxGroupLabel>
|
|
290
149
|
|
|
291
150
|
<ListboxItem
|
|
292
151
|
v-for="(item, index) in group.items"
|
|
293
152
|
:key="`group-${group.id}-${index}`"
|
|
294
|
-
:value="omit(item, ['matches'
|
|
153
|
+
:value="omit(item, ['matches', 'group', 'onSelect', 'labelHtml', 'suffixHtml'])"
|
|
295
154
|
:disabled="item.disabled"
|
|
296
155
|
as-child
|
|
297
156
|
@select="item.onSelect"
|
|
298
157
|
>
|
|
299
158
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
|
300
159
|
<ULinkBase v-bind="slotProps" :class="ui.item({ class: props.ui?.item, active: active || item.active })">
|
|
301
|
-
<slot :name="
|
|
302
|
-
<slot :name="
|
|
160
|
+
<slot :name="item.slot || group.slot || 'item'" :item="item" :index="index">
|
|
161
|
+
<slot :name="item.slot ? `${item.slot}-leading` : group.slot ? `${group.slot}-leading` : `item-leading`" :item="item" :index="index">
|
|
303
162
|
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon, loading: true })" />
|
|
304
163
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon, active: active || item.active })" />
|
|
305
|
-
<UAvatar v-else-if="item.avatar" :size="
|
|
164
|
+
<UAvatar v-else-if="item.avatar" :size="props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar, active: active || item.active })" />
|
|
306
165
|
<UChip
|
|
307
166
|
v-else-if="item.chip"
|
|
308
|
-
:size="
|
|
167
|
+
:size="props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()"
|
|
309
168
|
inset
|
|
310
169
|
standalone
|
|
311
170
|
v-bind="item.chip"
|
|
@@ -313,20 +172,20 @@ const groups = computed(() => {
|
|
|
313
172
|
/>
|
|
314
173
|
</slot>
|
|
315
174
|
|
|
316
|
-
<span v-if="item.labelHtml || get(item, props.labelKey
|
|
317
|
-
<slot :name="
|
|
175
|
+
<span v-if="item.labelHtml || get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`]" :class="ui.itemLabel({ class: props.ui?.itemLabel, active: active || item.active })">
|
|
176
|
+
<slot :name="item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`" :item="item" :index="index">
|
|
318
177
|
<span v-if="item.prefix" :class="ui.itemLabelPrefix({ class: props.ui?.itemLabelPrefix })">{{ item.prefix }}</span>
|
|
319
178
|
|
|
320
|
-
<span :class="ui.itemLabelBase({ class: props.ui?.itemLabelBase, active: active || item.active })" v-html="item.labelHtml || get(item, props.labelKey
|
|
179
|
+
<span :class="ui.itemLabelBase({ class: props.ui?.itemLabelBase, active: active || item.active })" v-html="item.labelHtml || get(item, props.labelKey)" />
|
|
321
180
|
|
|
322
181
|
<span :class="ui.itemLabelSuffix({ class: props.ui?.itemLabelSuffix, active: active || item.active })" v-html="item.suffixHtml || item.suffix" />
|
|
323
182
|
</slot>
|
|
324
183
|
</span>
|
|
325
184
|
|
|
326
185
|
<span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
|
|
327
|
-
<slot :name="
|
|
186
|
+
<slot :name="item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`" :item="item" :index="index">
|
|
328
187
|
<span v-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: props.ui?.itemTrailingKbds })">
|
|
329
|
-
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="
|
|
188
|
+
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="props.ui?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
|
330
189
|
</span>
|
|
331
190
|
<UIcon v-else-if="group.highlightedIcon" :name="group.highlightedIcon" :class="ui.itemTrailingHighlightedIcon({ class: props.ui?.itemTrailingHighlightedIcon })" />
|
|
332
191
|
</slot>
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { ListboxRootProps, ListboxRootEmits } from 'reka-ui';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import type { UseFuseOptions } from '@vueuse/integrations/useFuse';
|
|
4
|
+
import theme from '#build/ui/command-palette';
|
|
5
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
6
|
+
import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps, LinkProps } from '../types';
|
|
7
|
+
import type { ComponentConfig } from '../types/utils';
|
|
8
|
+
type CommandPalette = ComponentConfig<typeof theme, AppConfig, 'commandPalette'>;
|
|
9
|
+
export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
|
|
10
|
+
prefix?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
suffix?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @IconifyIcon
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
avatar?: AvatarProps;
|
|
18
|
+
chip?: ChipProps;
|
|
19
|
+
kbds?: KbdProps['value'][] | KbdProps[];
|
|
20
|
+
active?: boolean;
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
slot?: string;
|
|
24
|
+
onSelect?(e?: Event): void;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface CommandPaletteGroup<T> {
|
|
28
|
+
id: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
slot?: string;
|
|
31
|
+
items?: T[];
|
|
32
|
+
/**
|
|
33
|
+
* Whether to filter group items with [useFuse](https://vueuse.org/integrations/useFuse).
|
|
34
|
+
* When `true`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
35
|
+
* @defaultValue false
|
|
36
|
+
*/
|
|
37
|
+
ignoreFilter?: boolean;
|
|
38
|
+
/** Filter group items after the search happened. */
|
|
39
|
+
postFilter?: (searchTerm: string, items: T[]) => T[];
|
|
40
|
+
/**
|
|
41
|
+
* The icon displayed when an item is highlighted.
|
|
42
|
+
* @IconifyIcon
|
|
43
|
+
*/
|
|
44
|
+
highlightedIcon?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CommandPaletteProps<G, T> extends Pick<ListboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'highlightOnHover'>, Pick<UseComponentIconsProps, 'loading' | 'loadingIcon'> {
|
|
47
|
+
/**
|
|
48
|
+
* The element or component this component should render as.
|
|
49
|
+
* @defaultValue 'div'
|
|
50
|
+
*/
|
|
51
|
+
as?: any;
|
|
52
|
+
/**
|
|
53
|
+
* The icon displayed in the input.
|
|
54
|
+
* @defaultValue appConfig.ui.icons.search
|
|
55
|
+
* @IconifyIcon
|
|
56
|
+
*/
|
|
57
|
+
icon?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The icon displayed when an item is selected.
|
|
60
|
+
* @defaultValue appConfig.ui.icons.check
|
|
61
|
+
* @IconifyIcon
|
|
62
|
+
*/
|
|
63
|
+
selectedIcon?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The placeholder text for the input.
|
|
66
|
+
* @defaultValue t('commandPalette.placeholder')
|
|
67
|
+
*/
|
|
68
|
+
placeholder?: InputProps['placeholder'];
|
|
69
|
+
/**
|
|
70
|
+
* Automatically focus the input when component is mounted.
|
|
71
|
+
* @defaultValue true
|
|
72
|
+
*/
|
|
73
|
+
autofocus?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Display a close button in the input (useful when inside a Modal for example).
|
|
76
|
+
* `{ size: 'md', color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
|
|
77
|
+
* @emits 'update:open'
|
|
78
|
+
* @defaultValue false
|
|
79
|
+
*/
|
|
80
|
+
close?: boolean | Partial<ButtonProps>;
|
|
81
|
+
/**
|
|
82
|
+
* The icon displayed in the close button.
|
|
83
|
+
* @defaultValue appConfig.ui.icons.close
|
|
84
|
+
* @IconifyIcon
|
|
85
|
+
*/
|
|
86
|
+
closeIcon?: string;
|
|
87
|
+
groups?: G[];
|
|
88
|
+
/**
|
|
89
|
+
* Options for [useFuse](https://vueuse.org/integrations/useFuse).
|
|
90
|
+
* @defaultValue {
|
|
91
|
+
fuseOptions: {
|
|
92
|
+
ignoreLocation: true,
|
|
93
|
+
threshold: 0.1,
|
|
94
|
+
keys: ['label', 'suffix']
|
|
95
|
+
},
|
|
96
|
+
resultLimit: 12,
|
|
97
|
+
matchAllWhenSearchEmpty: true
|
|
98
|
+
}
|
|
99
|
+
*/
|
|
100
|
+
fuse?: UseFuseOptions<T>;
|
|
101
|
+
/**
|
|
102
|
+
* The key used to get the label from the item.
|
|
103
|
+
* @defaultValue 'label'
|
|
104
|
+
*/
|
|
105
|
+
labelKey?: string;
|
|
106
|
+
class?: any;
|
|
107
|
+
ui?: CommandPalette['slots'];
|
|
108
|
+
}
|
|
109
|
+
export type CommandPaletteEmits<T> = ListboxRootEmits<T> & {
|
|
110
|
+
'update:open': [value: boolean];
|
|
111
|
+
};
|
|
112
|
+
type SlotProps<T> = (props: {
|
|
113
|
+
item: T;
|
|
114
|
+
index: number;
|
|
115
|
+
}) => any;
|
|
116
|
+
export type CommandPaletteSlots<G extends {
|
|
117
|
+
slot?: string;
|
|
118
|
+
}, T extends {
|
|
119
|
+
slot?: string;
|
|
120
|
+
}> = {
|
|
121
|
+
'empty'(props: {
|
|
122
|
+
searchTerm?: string;
|
|
123
|
+
}): any;
|
|
124
|
+
'close'(props: {
|
|
125
|
+
ui: {
|
|
126
|
+
[K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string;
|
|
127
|
+
};
|
|
128
|
+
}): any;
|
|
129
|
+
'item': SlotProps<T>;
|
|
130
|
+
'item-leading': SlotProps<T>;
|
|
131
|
+
'item-label': SlotProps<T>;
|
|
132
|
+
'item-trailing': SlotProps<T>;
|
|
133
|
+
} & Record<string, SlotProps<G>> & Record<string, SlotProps<T>>;
|
|
134
|
+
declare const _default: <G extends CommandPaletteGroup<T>, T extends CommandPaletteItem>(__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<{
|
|
135
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ({
|
|
136
|
+
searchTerm?: string;
|
|
137
|
+
} & CommandPaletteProps<G, T>) & Partial<{}>> & (import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
|
|
138
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
139
|
+
attrs: any;
|
|
140
|
+
slots: Readonly<{
|
|
141
|
+
empty(props: {
|
|
142
|
+
searchTerm?: string;
|
|
143
|
+
}): any;
|
|
144
|
+
close(props: {
|
|
145
|
+
ui: { [K in keyof Required<CommandPalette["slots"]>]: (props?: Record<string, any>) => string; };
|
|
146
|
+
}): any;
|
|
147
|
+
item: SlotProps<T>;
|
|
148
|
+
'item-leading': SlotProps<T>;
|
|
149
|
+
'item-label': SlotProps<T>;
|
|
150
|
+
'item-trailing': SlotProps<T>;
|
|
151
|
+
} & Record<string, SlotProps<G>> & Record<string, SlotProps<T>>> & {
|
|
152
|
+
empty(props: {
|
|
153
|
+
searchTerm?: string;
|
|
154
|
+
}): any;
|
|
155
|
+
close(props: {
|
|
156
|
+
ui: { [K in keyof Required<CommandPalette["slots"]>]: (props?: Record<string, any>) => string; };
|
|
157
|
+
}): any;
|
|
158
|
+
item: SlotProps<T>;
|
|
159
|
+
'item-leading': SlotProps<T>;
|
|
160
|
+
'item-label': SlotProps<T>;
|
|
161
|
+
'item-trailing': SlotProps<T>;
|
|
162
|
+
} & Record<string, SlotProps<G>> & Record<string, SlotProps<T>>;
|
|
163
|
+
emit: (((evt: "highlight", payload: {
|
|
164
|
+
ref: HTMLElement;
|
|
165
|
+
value: T;
|
|
166
|
+
} | undefined) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", value: T) => void) & ((evt: "entryFocus", event: CustomEvent<any>) => void) & ((evt: "leave", event: Event) => void)) & ((evt: "update:searchTerm", value: string) => void);
|
|
167
|
+
}>) => import("vue").VNode & {
|
|
168
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
169
|
+
};
|
|
170
|
+
export default _default;
|
|
171
|
+
type __VLS_PrettifyLocal<T> = {
|
|
172
|
+
[K in keyof T]: T[K];
|
|
173
|
+
} & {};
|
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import _appConfig from '#build/app.config'
|
|
4
|
-
import theme from '#build/ui/container'
|
|
5
|
-
import { tv } from '../utils/tv'
|
|
6
|
-
|
|
7
|
-
const appConfigContainer = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
|
|
8
|
-
|
|
9
|
-
const container = tv({ extend: tv(theme), ...(appConfigContainer.ui?.container || {}) })
|
|
10
|
-
|
|
11
|
-
export interface ContainerProps {
|
|
12
|
-
/**
|
|
13
|
-
* The element or component this component should render as.
|
|
14
|
-
* @defaultValue 'div'
|
|
15
|
-
*/
|
|
16
|
-
as?: any
|
|
17
|
-
class?: any
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ContainerSlots {
|
|
21
|
-
default(props?: {}): any
|
|
22
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/ui/container";
|
|
23
3
|
</script>
|
|
24
4
|
|
|
25
|
-
<script setup
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
9
|
+
import { tv } from "../utils/tv";
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
as: { type: null, required: false },
|
|
12
|
+
class: { type: null, required: false }
|
|
13
|
+
});
|
|
14
|
+
defineSlots();
|
|
15
|
+
const appConfig = useAppConfig();
|
|
16
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.container || {} }));
|
|
30
17
|
</script>
|
|
31
18
|
|
|
32
19
|
<template>
|
|
33
|
-
<Primitive :as="as" :class="
|
|
20
|
+
<Primitive :as="as" :class="ui({ class: props.class })">
|
|
34
21
|
<slot />
|
|
35
22
|
</Primitive>
|
|
36
23
|
</template>
|