@nuxt/ui 3.0.0-alpha.0 → 3.0.0-alpha.1
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/README.md +1 -1
- package/cli/node_modules/.ignored/citty/LICENSE +36 -0
- package/cli/node_modules/.ignored/citty/README.md +134 -0
- package/cli/node_modules/.ignored/citty/dist/index.cjs +475 -0
- package/cli/node_modules/.ignored/citty/dist/index.d.cts +80 -0
- package/cli/node_modules/.ignored/citty/dist/index.d.mts +80 -0
- package/cli/node_modules/.ignored/citty/dist/index.d.ts +80 -0
- package/cli/node_modules/.ignored/citty/dist/index.mjs +463 -0
- package/cli/node_modules/.ignored/citty/package.json +49 -0
- package/cli/node_modules/.ignored/consola/LICENSE +47 -0
- package/cli/node_modules/.ignored/consola/README.md +318 -0
- package/cli/node_modules/.ignored/consola/core.d.ts +1 -0
- package/cli/node_modules/.ignored/consola/dist/basic.cjs +32 -0
- package/cli/node_modules/.ignored/consola/dist/basic.d.ts +9 -0
- package/cli/node_modules/.ignored/consola/dist/basic.mjs +24 -0
- package/cli/node_modules/.ignored/consola/dist/browser.cjs +80 -0
- package/cli/node_modules/.ignored/consola/dist/browser.d.ts +7 -0
- package/cli/node_modules/.ignored/consola/dist/browser.mjs +72 -0
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +436 -0
- package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +429 -0
- package/cli/node_modules/.ignored/consola/dist/core.cjs +415 -0
- package/cli/node_modules/.ignored/consola/dist/core.d.ts +124 -0
- package/cli/node_modules/.ignored/consola/dist/core.mjs +410 -0
- package/cli/node_modules/.ignored/consola/dist/index.cjs +21 -0
- package/cli/node_modules/.ignored/consola/dist/index.d.ts +9 -0
- package/cli/node_modules/.ignored/consola/dist/index.mjs +8 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +62 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +636 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +645 -0
- package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +65 -0
- package/cli/node_modules/.ignored/consola/dist/utils.cjs +308 -0
- package/cli/node_modules/.ignored/consola/dist/utils.d.ts +169 -0
- package/cli/node_modules/.ignored/consola/dist/utils.mjs +284 -0
- package/cli/node_modules/.ignored/consola/lib/index.cjs +9 -0
- package/cli/node_modules/.ignored/consola/package.json +101 -0
- package/cli/node_modules/.ignored/consola/utils.d.ts +1 -0
- package/cli/node_modules/.ignored/pathe/LICENSE +44 -0
- package/cli/node_modules/.ignored/pathe/README.md +69 -0
- package/cli/node_modules/.ignored/pathe/dist/index.cjs +23 -0
- package/cli/node_modules/.ignored/pathe/dist/index.d.cts +36 -0
- package/cli/node_modules/.ignored/pathe/dist/index.d.mts +36 -0
- package/cli/node_modules/.ignored/pathe/dist/index.d.ts +36 -0
- package/cli/node_modules/.ignored/pathe/dist/index.mjs +1 -0
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +238 -0
- package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +221 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.cjs +58 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +5 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +5 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +5 -0
- package/cli/node_modules/.ignored/pathe/dist/utils.mjs +54 -0
- package/cli/node_modules/.ignored/pathe/package.json +48 -0
- package/cli/node_modules/.ignored/pathe/utils.d.ts +1 -0
- package/cli/node_modules/.ignored/scule/LICENSE +21 -0
- package/cli/node_modules/.ignored/scule/README.md +149 -0
- package/cli/node_modules/.ignored/scule/dist/index.cjs +92 -0
- package/cli/node_modules/.ignored/scule/dist/index.d.cts +57 -0
- package/cli/node_modules/.ignored/scule/dist/index.d.mts +57 -0
- package/cli/node_modules/.ignored/scule/dist/index.d.ts +57 -0
- package/cli/node_modules/.ignored/scule/dist/index.mjs +80 -0
- package/cli/node_modules/.ignored/scule/package.json +43 -0
- package/cli/node_modules/.package-lock.json +33 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +7 -55
- package/dist/runtime/components/Accordion.vue +49 -6
- package/dist/runtime/components/Alert.vue +58 -6
- package/dist/runtime/components/App.vue +12 -2
- package/dist/runtime/components/Avatar.vue +27 -6
- package/dist/runtime/components/AvatarGroup.vue +30 -6
- package/dist/runtime/components/Badge.vue +28 -6
- package/dist/runtime/components/Breadcrumb.vue +44 -6
- package/dist/runtime/components/Button.vue +33 -6
- package/dist/runtime/components/ButtonGroup.vue +30 -6
- package/dist/runtime/components/Card.vue +25 -6
- package/dist/runtime/components/Checkbox.vue +45 -6
- package/dist/runtime/components/Chip.vue +39 -6
- package/dist/runtime/components/Collapsible.vue +27 -6
- package/dist/runtime/components/CommandPalette.vue +99 -6
- package/dist/runtime/components/Container.vue +22 -6
- package/dist/runtime/components/ContextMenu.vue +58 -6
- package/dist/runtime/components/ContextMenuContent.vue +18 -4
- package/dist/runtime/components/Drawer.vue +48 -6
- package/dist/runtime/components/DropdownMenu.vue +66 -6
- package/dist/runtime/components/DropdownMenuContent.vue +22 -4
- package/dist/runtime/components/Form.vue +34 -13
- package/dist/runtime/components/FormField.vue +41 -16
- package/dist/runtime/components/Icon.vue +12 -2
- package/dist/runtime/components/Input.vue +46 -6
- package/dist/runtime/components/InputMenu.vue +113 -6
- package/dist/runtime/components/Kbd.vue +28 -6
- package/dist/runtime/components/Link.vue +81 -17
- package/dist/runtime/components/LinkBase.vue +12 -2
- package/dist/runtime/components/Modal.vue +69 -6
- package/dist/runtime/components/NavigationMenu.vue +76 -6
- package/dist/runtime/components/Pagination.vue +99 -6
- package/dist/runtime/components/Popover.vue +42 -6
- package/dist/runtime/components/Progress.vue +44 -6
- package/dist/runtime/components/RadioGroup.vue +55 -7
- package/dist/runtime/components/Select.vue +88 -6
- package/dist/runtime/components/SelectMenu.vue +104 -6
- package/dist/runtime/components/Separator.vue +41 -6
- package/dist/runtime/components/Skeleton.vue +18 -6
- package/dist/runtime/components/Slideover.vue +67 -6
- package/dist/runtime/components/Slider.vue +36 -6
- package/dist/runtime/components/Switch.vue +50 -6
- package/dist/runtime/components/Tabs.vue +59 -6
- package/dist/runtime/components/Textarea.vue +46 -6
- package/dist/runtime/components/Toast.vue +55 -6
- package/dist/runtime/components/Toaster.vue +27 -6
- package/dist/runtime/components/Tooltip.vue +42 -6
- package/dist/runtime/composables/useAvatarGroup.d.ts +2 -2
- package/dist/runtime/composables/useButtonGroup.d.ts +3 -3
- package/dist/runtime/composables/useFormField.d.ts +6 -3
- package/dist/runtime/composables/useFormField.js +11 -7
- package/dist/runtime/composables/useModal.d.ts +1 -1
- package/dist/runtime/composables/useSlideover.d.ts +1 -1
- package/dist/runtime/composables/useToast.d.ts +1 -1
- package/dist/runtime/index.css +1 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/modal.d.ts +2 -0
- package/dist/runtime/plugins/slideover.d.ts +2 -0
- package/dist/runtime/types/form.d.ts +1 -2
- package/dist/runtime/utils/link.d.ts +23 -55
- package/package.json +13 -14
- package/dist/runtime/assets/css/animations.css +0 -1
- package/dist/runtime/components/Accordion.vue.d.ts +0 -492
- package/dist/runtime/components/Alert.vue.d.ts +0 -548
- package/dist/runtime/components/App.vue.d.ts +0 -25
- package/dist/runtime/components/Avatar.vue.d.ts +0 -384
- package/dist/runtime/components/AvatarGroup.vue.d.ts +0 -381
- package/dist/runtime/components/Badge.vue.d.ts +0 -422
- package/dist/runtime/components/Breadcrumb.vue.d.ts +0 -307
- package/dist/runtime/components/Button.vue.d.ts +0 -949
- package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -182
- package/dist/runtime/components/Card.vue.d.ts +0 -191
- package/dist/runtime/components/Checkbox.vue.d.ts +0 -819
- package/dist/runtime/components/Chip.vue.d.ts +0 -590
- package/dist/runtime/components/Collapsible.vue.d.ts +0 -159
- package/dist/runtime/components/CommandPalette.vue.d.ts +0 -684
- package/dist/runtime/components/Container.vue.d.ts +0 -27
- package/dist/runtime/components/ContextMenu.vue.d.ts +0 -796
- package/dist/runtime/components/ContextMenuContent.vue.d.ts +0 -0
- package/dist/runtime/components/Drawer.vue.d.ts +0 -343
- package/dist/runtime/components/DropdownMenu.vue.d.ts +0 -815
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +0 -0
- package/dist/runtime/components/Form.vue.d.ts +0 -39
- package/dist/runtime/components/FormField.vue.d.ts +0 -356
- package/dist/runtime/components/Icon.vue.d.ts +0 -17
- package/dist/runtime/components/Input.vue.d.ts +0 -1137
- package/dist/runtime/components/InputMenu.vue.d.ts +0 -2121
- package/dist/runtime/components/Kbd.vue.d.ts +0 -169
- package/dist/runtime/components/Link.vue.d.ts +0 -76
- package/dist/runtime/components/LinkBase.vue.d.ts +0 -49
- package/dist/runtime/components/Modal.vue.d.ts +0 -319
- package/dist/runtime/components/NavigationMenu.vue.d.ts +0 -1789
- package/dist/runtime/components/Pagination.vue.d.ts +0 -295
- package/dist/runtime/components/Popover.vue.d.ts +0 -197
- package/dist/runtime/components/Progress.vue.d.ts +0 -1781
- package/dist/runtime/components/RadioGroup.vue.d.ts +0 -1715
- package/dist/runtime/components/Select.vue.d.ts +0 -1569
- package/dist/runtime/components/SelectMenu.vue.d.ts +0 -1661
- package/dist/runtime/components/Separator.vue.d.ts +0 -0
- package/dist/runtime/components/Skeleton.vue.d.ts +0 -26
- package/dist/runtime/components/Slideover.vue.d.ts +0 -375
- package/dist/runtime/components/Slider.vue.d.ts +0 -0
- package/dist/runtime/components/Switch.vue.d.ts +0 -1676
- package/dist/runtime/components/Tabs.vue.d.ts +0 -934
- package/dist/runtime/components/Textarea.vue.d.ts +0 -1133
- package/dist/runtime/components/Toast.vue.d.ts +0 -0
- package/dist/runtime/components/Toaster.vue.d.ts +0 -362
- package/dist/runtime/components/Tooltip.vue.d.ts +0 -248
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/collapsible'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
|
|
11
|
+
|
|
12
|
+
export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled'> {
|
|
13
|
+
/**
|
|
14
|
+
* The element or component this component should render as.
|
|
15
|
+
* @defaultValue 'div'
|
|
16
|
+
*/
|
|
17
|
+
as?: any
|
|
18
|
+
class?: any
|
|
19
|
+
ui?: Partial<typeof collapsible.slots>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CollapsibleEmits extends CollapsibleRootEmits {}
|
|
23
|
+
|
|
24
|
+
export interface CollapsibleSlots {
|
|
25
|
+
default(props: { open: boolean }): any
|
|
26
|
+
content(props?: {}): any
|
|
27
|
+
}
|
|
7
28
|
</script>
|
|
8
29
|
|
|
9
30
|
<script setup lang="ts">
|
|
@@ -1,9 +1,102 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { ComboboxRootProps, ComboboxRootEmits, ComboboxItemProps } from 'radix-vue'
|
|
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 type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
|
|
11
|
+
import type { DynamicSlots, PartialString } from '../types/utils'
|
|
12
|
+
|
|
13
|
+
const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
|
|
14
|
+
|
|
15
|
+
const commandPalette = tv({ extend: tv(theme), ...(appConfig.ui?.commandPalette || {}) })
|
|
16
|
+
|
|
17
|
+
export interface CommandPaletteItem extends Pick<ComboboxItemProps, 'disabled'> {
|
|
18
|
+
prefix?: string
|
|
19
|
+
label?: string
|
|
20
|
+
suffix?: string
|
|
21
|
+
icon?: string
|
|
22
|
+
avatar?: AvatarProps
|
|
23
|
+
chip?: ChipProps
|
|
24
|
+
kbds?: KbdProps['value'][] | KbdProps[]
|
|
25
|
+
slot?: string
|
|
26
|
+
select?(e?: Event): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CommandPaletteGroup<T> {
|
|
30
|
+
id: string
|
|
31
|
+
label?: string
|
|
32
|
+
slot?: string
|
|
33
|
+
items?: T[]
|
|
34
|
+
/**
|
|
35
|
+
* Wether to filter group items with [useFuse](https://vueuse.org/integrations/useFuse).
|
|
36
|
+
* When `false`, items will not be filtered which is useful for custom filtering (useAsyncData, useFetch, etc.).
|
|
37
|
+
* @defaultValue true
|
|
38
|
+
*/
|
|
39
|
+
filter?: boolean
|
|
40
|
+
/** Filter group items after the search happened. */
|
|
41
|
+
postFilter?: (searchTerm: string, items: T[]) => T[]
|
|
42
|
+
/** The icon displayed when an item is highlighted. */
|
|
43
|
+
highlightedIcon?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface CommandPaletteProps<G, T> extends Pick<ComboboxRootProps, 'multiple' | 'disabled' | 'modelValue' | 'defaultValue' | 'selectedValue' | 'resetSearchTermOnBlur'>, 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
|
+
*/
|
|
56
|
+
icon?: string
|
|
57
|
+
/**
|
|
58
|
+
* The icon displayed when an item is selected.
|
|
59
|
+
* @defaultValue appConfig.ui.icons.check
|
|
60
|
+
*/
|
|
61
|
+
selectedIcon?: string
|
|
62
|
+
/**
|
|
63
|
+
* The placeholder text for the input.
|
|
64
|
+
* @defaultValue 'Type a command or search...'
|
|
65
|
+
*/
|
|
66
|
+
placeholder?: InputProps['placeholder']
|
|
67
|
+
/**
|
|
68
|
+
* Display a close button in the input (useful when inside a `UModal`).
|
|
69
|
+
* `{ size: 'md', color: 'gray', variant: 'ghost' }`{lang="ts-type"}
|
|
70
|
+
* @defaultValue false
|
|
71
|
+
*/
|
|
72
|
+
close?: ButtonProps | boolean
|
|
73
|
+
/**
|
|
74
|
+
* The icon displayed in the close button.
|
|
75
|
+
* @defaultValue appConfig.ui.icons.close
|
|
76
|
+
*/
|
|
77
|
+
closeIcon?: string
|
|
78
|
+
groups?: G[]
|
|
79
|
+
/**
|
|
80
|
+
* Options for [useFuse](https://vueuse.org/integrations/useFuse).
|
|
81
|
+
* @defaultValue { ignoreLocation: true, threshold: 0.1, keys: ['label', 'suffix'], resultLimit: 12, matchAllWhenSearchEmpty: true }
|
|
82
|
+
*/
|
|
83
|
+
fuse?: UseFuseOptions<T>
|
|
84
|
+
class?: any
|
|
85
|
+
ui?: PartialString<typeof commandPalette.slots>
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type CommandPaletteEmits<T> = ComboboxRootEmits<T>
|
|
89
|
+
|
|
90
|
+
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
91
|
+
|
|
92
|
+
export type CommandPaletteSlots<G extends { slot?: string }, T extends { slot?: string }> = {
|
|
93
|
+
'empty'(props: { searchTerm?: string }): any
|
|
94
|
+
'close'(props: { ui: any }): any
|
|
95
|
+
'item': SlotProps<T>
|
|
96
|
+
'item-leading': SlotProps<T>
|
|
97
|
+
'item-label': SlotProps<T>
|
|
98
|
+
'item-trailing': SlotProps<T>
|
|
99
|
+
} & DynamicSlots<G, SlotProps<T>> & DynamicSlots<T, SlotProps<T>>
|
|
7
100
|
</script>
|
|
8
101
|
|
|
9
102
|
<script setup lang="ts" generic="G extends CommandPaletteGroup<T>, T extends CommandPaletteItem">
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/container'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const container = tv({ extend: tv(theme), ...(appConfig.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
|
+
}
|
|
7
23
|
</script>
|
|
8
24
|
|
|
9
25
|
<script setup lang="ts">
|
|
@@ -1,9 +1,61 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProps, ContextMenuTriggerProps, ContextMenuItemProps } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/context-menu'
|
|
7
|
+
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
|
8
|
+
import type { DynamicSlots } from '../types/utils'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const contextMenu = tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu || {}) })
|
|
13
|
+
|
|
14
|
+
export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<ContextMenuItemProps, 'disabled'> {
|
|
15
|
+
label?: string
|
|
16
|
+
icon?: string
|
|
17
|
+
avatar?: AvatarProps
|
|
18
|
+
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
19
|
+
kbds?: KbdProps['value'][] | KbdProps[]
|
|
20
|
+
/**
|
|
21
|
+
* The item type.
|
|
22
|
+
* @defaultValue 'link'
|
|
23
|
+
*/
|
|
24
|
+
type?: 'label' | 'separator' | 'link'
|
|
25
|
+
slot?: string
|
|
26
|
+
open?: boolean
|
|
27
|
+
defaultOpen?: boolean
|
|
28
|
+
children?: ContextMenuItem[] | ContextMenuItem[][]
|
|
29
|
+
select?(e: Event): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type ContextMenuVariants = VariantProps<typeof contextMenu>
|
|
33
|
+
|
|
34
|
+
export interface ContextMenuProps<T> extends Omit<ContextMenuRootProps, 'dir'>, Pick<ContextMenuTriggerProps, 'disabled'> {
|
|
35
|
+
size?: ContextMenuVariants['size']
|
|
36
|
+
items?: T[] | T[][]
|
|
37
|
+
/** The content of the menu. */
|
|
38
|
+
content?: Omit<ContextMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
39
|
+
/**
|
|
40
|
+
* Render the menu in a portal.
|
|
41
|
+
* @defaultValue true
|
|
42
|
+
*/
|
|
43
|
+
portal?: boolean
|
|
44
|
+
class?: any
|
|
45
|
+
ui?: Partial<typeof contextMenu.slots>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ContextMenuEmits extends ContextMenuRootEmits {}
|
|
49
|
+
|
|
50
|
+
type SlotProps<T> = (props: { item: T, active?: boolean, index: number }) => any
|
|
51
|
+
|
|
52
|
+
export type ContextMenuSlots<T extends { slot?: string }> = {
|
|
53
|
+
'default'(props?: {}): any
|
|
54
|
+
'item': SlotProps<T>
|
|
55
|
+
'item-leading': SlotProps<T>
|
|
56
|
+
'item-label': SlotProps<T>
|
|
57
|
+
'item-trailing': SlotProps<T>
|
|
58
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
7
59
|
</script>
|
|
8
60
|
|
|
9
61
|
<script setup lang="ts" generic="T extends ContextMenuItem">
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { ContextMenuContentProps as RadixContextMenuContentProps, ContextMenuContentEmits as RadixContextMenuContentEmits } from 'radix-vue'
|
|
4
|
+
import theme from '#build/ui/context-menu'
|
|
5
|
+
import type { KbdProps, AvatarProps, ContextMenuItem, ContextMenuSlots } from '../types'
|
|
6
|
+
|
|
7
|
+
const _contextMenu = tv(theme)()
|
|
8
|
+
|
|
9
|
+
interface ContextMenuContentProps<T> extends Omit<RadixContextMenuContentProps, 'as' | 'asChild' | 'forceMount'> {
|
|
10
|
+
items?: T[] | T[][]
|
|
11
|
+
portal?: boolean
|
|
12
|
+
sub?: boolean
|
|
13
|
+
class?: any
|
|
14
|
+
ui: typeof _contextMenu
|
|
15
|
+
uiOverride?: any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ContextMenuContentEmits extends RadixContextMenuContentEmits {}
|
|
5
19
|
</script>
|
|
6
20
|
|
|
7
21
|
<script setup lang="ts" generic="T extends ContextMenuItem">
|
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { DrawerRootProps, DrawerRootEmits } from 'vaul-vue'
|
|
4
|
+
import type { DialogContentProps } from 'radix-vue'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/drawer'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const drawer = tv({ extend: tv(theme), ...(appConfig.ui?.drawer || {}) })
|
|
12
|
+
|
|
13
|
+
export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'defaultOpen' | 'direction' | 'dismissible' | 'fadeFromIndex' | 'fixed' | 'modal' | 'nested' | 'open' | 'scrollLockTimeout' | 'shouldScaleBackground' | 'snapPoints'> {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
title?: string
|
|
20
|
+
description?: string
|
|
21
|
+
/** The content of the drawer. */
|
|
22
|
+
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
23
|
+
/**
|
|
24
|
+
* Render an overlay behind the drawer.
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
overlay?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* Render the drawer in a portal.
|
|
30
|
+
* @defaultValue true
|
|
31
|
+
*/
|
|
32
|
+
portal?: boolean
|
|
33
|
+
class?: any
|
|
34
|
+
ui?: Partial<typeof drawer.slots>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DrawerEmits extends DrawerRootEmits {}
|
|
38
|
+
|
|
39
|
+
export interface DrawerSlots {
|
|
40
|
+
default(props?: {}): any
|
|
41
|
+
handle(props?: {}): any
|
|
42
|
+
content(props?: {}): any
|
|
43
|
+
header(props?: {}): any
|
|
44
|
+
title(props?: {}): any
|
|
45
|
+
description(props?: {}): any
|
|
46
|
+
body(props?: {}): any
|
|
47
|
+
footer(props?: {}): any
|
|
48
|
+
}
|
|
7
49
|
</script>
|
|
8
50
|
|
|
9
51
|
<script setup lang="ts">
|
|
@@ -1,9 +1,69 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuArrowProps, DropdownMenuTriggerProps, DropdownMenuItemProps } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/dropdown-menu'
|
|
7
|
+
import type { AvatarProps, KbdProps, LinkProps } from '../types'
|
|
8
|
+
import type { DynamicSlots } from '../types/utils'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const dropdownMenu = tv({ extend: tv(theme), ...(appConfig.ui?.dropdownMenu || {}) })
|
|
13
|
+
|
|
14
|
+
export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'>, Pick<DropdownMenuItemProps, 'disabled'> {
|
|
15
|
+
label?: string
|
|
16
|
+
icon?: string
|
|
17
|
+
avatar?: AvatarProps
|
|
18
|
+
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
19
|
+
kbds?: KbdProps['value'][] | KbdProps[]
|
|
20
|
+
/**
|
|
21
|
+
* The item type.
|
|
22
|
+
* @defaultValue 'link'
|
|
23
|
+
*/
|
|
24
|
+
type?: 'label' | 'separator' | 'link'
|
|
25
|
+
slot?: string
|
|
26
|
+
open?: boolean
|
|
27
|
+
defaultOpen?: boolean
|
|
28
|
+
children?: DropdownMenuItem[] | DropdownMenuItem[][]
|
|
29
|
+
select?(e: Event): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type DropdownMenuVariants = VariantProps<typeof dropdownMenu>
|
|
33
|
+
|
|
34
|
+
export interface DropdownMenuProps<T> extends Omit<DropdownMenuRootProps, 'dir'>, Pick<DropdownMenuTriggerProps, 'disabled'> {
|
|
35
|
+
size?: DropdownMenuVariants['size']
|
|
36
|
+
items?: T[] | T[][]
|
|
37
|
+
/**
|
|
38
|
+
* The content of the menu.
|
|
39
|
+
* @defaultValue { side: 'bottom', sideOffset: 8 }
|
|
40
|
+
*/
|
|
41
|
+
content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
42
|
+
/**
|
|
43
|
+
* Display an arrow alongside the menu.
|
|
44
|
+
* @defaultValue false
|
|
45
|
+
*/
|
|
46
|
+
arrow?: boolean | Omit<DropdownMenuArrowProps, 'as' | 'asChild'>
|
|
47
|
+
/**
|
|
48
|
+
* Render the menu in a portal.
|
|
49
|
+
* @defaultValue true
|
|
50
|
+
*/
|
|
51
|
+
portal?: boolean
|
|
52
|
+
class?: any
|
|
53
|
+
ui?: Partial<typeof dropdownMenu.slots>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface DropdownMenuEmits extends DropdownMenuRootEmits {}
|
|
57
|
+
|
|
58
|
+
type SlotProps<T> = (props: { item: T, active?: boolean, index: number }) => any
|
|
59
|
+
|
|
60
|
+
export type DropdownMenuSlots<T extends { slot?: string }> = {
|
|
61
|
+
'default'(props: { open: boolean }): any
|
|
62
|
+
'item': SlotProps<T>
|
|
63
|
+
'item-leading': SlotProps<T>
|
|
64
|
+
'item-label': SlotProps<T>
|
|
65
|
+
'item-trailing': SlotProps<T>
|
|
66
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
7
67
|
</script>
|
|
8
68
|
|
|
9
69
|
<script setup lang="ts" generic="T extends DropdownMenuItem">
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { DropdownMenuContentProps as RadixDropdownMenuContentProps, DropdownMenuContentEmits as RadixDropdownMenuContentEmits } from 'radix-vue'
|
|
4
|
+
import theme from '#build/ui/dropdown-menu'
|
|
5
|
+
import type { KbdProps, AvatarProps, DropdownMenuItem, DropdownMenuSlots } from '../types'
|
|
6
|
+
|
|
7
|
+
const _dropdownMenu = tv(theme)()
|
|
8
|
+
|
|
9
|
+
interface DropdownMenuContentProps<T> extends Omit<RadixDropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> {
|
|
10
|
+
items?: T[] | T[][]
|
|
11
|
+
portal?: boolean
|
|
12
|
+
sub?: boolean
|
|
13
|
+
class?: any
|
|
14
|
+
ui: typeof _dropdownMenu
|
|
15
|
+
uiOverride?: any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DropdownMenuContentEmits extends RadixDropdownMenuContentEmits {}
|
|
19
|
+
|
|
20
|
+
type DropdownMenuContentSlots<T extends { slot?: string }> = Omit<DropdownMenuSlots<T>, 'default'> & {
|
|
21
|
+
default(props?: {}): any
|
|
22
|
+
}
|
|
5
23
|
</script>
|
|
6
24
|
|
|
7
25
|
<script setup lang="ts" generic="T extends DropdownMenuItem">
|
|
@@ -1,9 +1,33 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/form'
|
|
6
|
+
import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormEvent, Form, FormErrorWithId } from '../types/form'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { form: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const form = tv({ extend: tv(theme), ...(appConfig.ui?.form || {}) })
|
|
11
|
+
|
|
12
|
+
export interface FormProps<T extends object> {
|
|
13
|
+
id?: string | number
|
|
14
|
+
schema?: FormSchema<T>
|
|
15
|
+
state: Partial<T>
|
|
16
|
+
validate?: (state: Partial<T>) => Promise<FormError[]>
|
|
17
|
+
validateOn?: FormInputEvents[]
|
|
18
|
+
disabled?: boolean
|
|
19
|
+
validateOnInputDelay?: number
|
|
20
|
+
class?: any
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FormEmits<T extends object> {
|
|
24
|
+
(e: 'submit', payload: FormSubmitEvent<T>): void
|
|
25
|
+
(e: 'error', payload: FormErrorEvent): void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface FormSlots {
|
|
29
|
+
default(props?: {}): any
|
|
30
|
+
}
|
|
7
31
|
</script>
|
|
8
32
|
|
|
9
33
|
<script lang="ts" setup generic="T extends object">
|
|
@@ -22,7 +46,7 @@ const props = withDefaults(defineProps<FormProps<T>>(), {
|
|
|
22
46
|
const emits = defineEmits<FormEmits<T>>()
|
|
23
47
|
defineSlots<FormSlots>()
|
|
24
48
|
|
|
25
|
-
const formId = props.id ?? useId()
|
|
49
|
+
const formId = props.id ?? useId() as string
|
|
26
50
|
|
|
27
51
|
const bus = useEventBus<FormEvent>(`form-${formId}`)
|
|
28
52
|
const parentBus = inject(
|
|
@@ -133,15 +157,12 @@ async function _validate(opts: { name?: string | string[], silent?: boolean, nes
|
|
|
133
157
|
}
|
|
134
158
|
|
|
135
159
|
async function onSubmit(payload: Event) {
|
|
136
|
-
const event = payload as
|
|
160
|
+
const event = payload as FormSubmitEvent<any>
|
|
137
161
|
|
|
138
162
|
try {
|
|
139
163
|
await _validate({ nested: true })
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
data: props.state
|
|
143
|
-
}
|
|
144
|
-
emits('submit', submitEvent)
|
|
164
|
+
event.data = props.state
|
|
165
|
+
emits('submit', event)
|
|
145
166
|
} catch (error) {
|
|
146
167
|
if (!(error instanceof FormValidationException)) {
|
|
147
168
|
throw error
|
|
@@ -1,16 +1,45 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { tv } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
4
|
+
import _appConfig from '#build/app.config'
|
|
5
|
+
import theme from '#build/ui/form-field'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { formField: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const formField = tv({ extend: tv(theme), ...(appConfig.ui?.formField || {}) })
|
|
10
|
+
|
|
11
|
+
type FormFieldVariants = VariantProps<typeof formField>
|
|
12
|
+
|
|
13
|
+
export interface FormFieldProps {
|
|
14
|
+
name?: string
|
|
15
|
+
label?: string
|
|
16
|
+
description?: string
|
|
17
|
+
help?: string
|
|
18
|
+
error?: string | boolean
|
|
19
|
+
hint?: string
|
|
20
|
+
size?: FormFieldVariants['size']
|
|
21
|
+
required?: boolean
|
|
22
|
+
eagerValidation?: boolean
|
|
23
|
+
validateOnInputDelay?: number
|
|
24
|
+
class?: any
|
|
25
|
+
ui?: Partial<typeof formField.slots>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface FormFieldSlots {
|
|
29
|
+
label(props: { label?: string }): any
|
|
30
|
+
hint(props: { hint?: string }): any
|
|
31
|
+
description(props: { description?: string }): any
|
|
32
|
+
help(props: { help?: string }): any
|
|
33
|
+
error(props: { error?: string | boolean }): any
|
|
34
|
+
default(props: { error?: string | boolean }): any
|
|
35
|
+
}
|
|
7
36
|
</script>
|
|
8
37
|
|
|
9
38
|
<script setup lang="ts">
|
|
10
39
|
import { computed, ref, inject, provide, type Ref, useId } from 'vue'
|
|
11
40
|
import { Label } from 'radix-vue'
|
|
12
|
-
import { formFieldInjectionKey } from '../composables/useFormField'
|
|
13
|
-
import type { FormError } from '../types/form'
|
|
41
|
+
import { formFieldInjectionKey, inputIdInjectionKey } from '../composables/useFormField'
|
|
42
|
+
import type { FormError, FormFieldInjectedOptions } from '../types/form'
|
|
14
43
|
|
|
15
44
|
const props = defineProps<FormFieldProps>()
|
|
16
45
|
const slots = defineSlots<FormFieldSlots>()
|
|
@@ -22,23 +51,19 @@ const ui = computed(() => formField({
|
|
|
22
51
|
|
|
23
52
|
const formErrors = inject<Ref<FormError[]> | null>('form-errors', null)
|
|
24
53
|
|
|
25
|
-
const error = computed(() =>
|
|
26
|
-
return (props.error && typeof props.error === 'string')
|
|
27
|
-
|| typeof props.error === 'boolean'
|
|
28
|
-
? props.error
|
|
29
|
-
: formErrors?.value?.find(error => error.name === props.name)?.message
|
|
30
|
-
})
|
|
54
|
+
const error = computed(() => props.error || formErrors?.value?.find(error => error.name === props.name)?.message)
|
|
31
55
|
|
|
32
56
|
const id = ref(useId())
|
|
33
57
|
|
|
58
|
+
provide(inputIdInjectionKey, id)
|
|
59
|
+
|
|
34
60
|
provide(formFieldInjectionKey, computed(() => ({
|
|
35
|
-
id: id.value,
|
|
36
61
|
error: error.value,
|
|
37
62
|
name: props.name,
|
|
38
63
|
size: props.size,
|
|
39
64
|
eagerValidation: props.eagerValidation,
|
|
40
65
|
validateOnInputDelay: props.validateOnInputDelay
|
|
41
|
-
})))
|
|
66
|
+
}) as FormFieldInjectedOptions<FormFieldProps>))
|
|
42
67
|
</script>
|
|
43
68
|
|
|
44
69
|
<template>
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
name: string
|
|
4
|
+
mode?: 'svg' | 'css'
|
|
5
|
+
size?: string | number
|
|
6
|
+
customize?: (
|
|
7
|
+
content: string,
|
|
8
|
+
name?: string,
|
|
9
|
+
prefix?: string,
|
|
10
|
+
provider?: string
|
|
11
|
+
) => string
|
|
12
|
+
}
|
|
3
13
|
</script>
|
|
4
14
|
|
|
5
15
|
<script setup lang="ts">
|
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { InputHTMLAttributes } from 'vue'
|
|
3
|
+
import { tv, type VariantProps } from 'tailwind-variants'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/input'
|
|
7
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
+
import type { PartialString } from '../types/utils'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { input: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const input = tv({ extend: tv(theme), ...(appConfig.ui?.input || {}) })
|
|
13
|
+
|
|
14
|
+
type InputVariants = VariantProps<typeof input>
|
|
15
|
+
|
|
16
|
+
export interface InputProps extends UseComponentIconsProps {
|
|
17
|
+
id?: string
|
|
18
|
+
name?: string
|
|
19
|
+
type?: InputHTMLAttributes['type']
|
|
20
|
+
/** The placeholder text when the input is empty. */
|
|
21
|
+
placeholder?: string
|
|
22
|
+
color?: InputVariants['color']
|
|
23
|
+
variant?: InputVariants['variant']
|
|
24
|
+
size?: InputVariants['size']
|
|
25
|
+
required?: boolean
|
|
26
|
+
autocomplete?: InputHTMLAttributes['autocomplete']
|
|
27
|
+
autofocus?: boolean
|
|
28
|
+
autofocusDelay?: number
|
|
29
|
+
disabled?: boolean
|
|
30
|
+
/** Highlight the ring color like a focus state. */
|
|
31
|
+
highlight?: boolean
|
|
32
|
+
class?: any
|
|
33
|
+
ui?: PartialString<typeof input.slots>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface InputEmits {
|
|
37
|
+
(e: 'update:modelValue', payload: string | number): void
|
|
38
|
+
(e: 'blur', event: FocusEvent): void
|
|
39
|
+
(e: 'change', event: Event): void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface InputSlots {
|
|
43
|
+
leading(props?: {}): any
|
|
44
|
+
default(props?: {}): any
|
|
45
|
+
trailing(props?: {}): any
|
|
46
|
+
}
|
|
7
47
|
</script>
|
|
8
48
|
|
|
9
49
|
<script setup lang="ts">
|