@nuxt/ui 3.0.0-alpha.0 → 3.0.0-alpha.2
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.d.mts +9 -2
- package/dist/module.d.ts +9 -2
- package/dist/module.json +3 -3
- package/dist/module.mjs +62 -103
- 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 +68 -10
- 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 +100 -7
- 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 +58 -26
- 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 +18 -7
- 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 +89 -7
- package/dist/runtime/components/SelectMenu.vue +105 -7
- 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 +28 -7
- 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 +7 -3
- package/dist/runtime/composables/useFormField.js +12 -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 +2 -2
- 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/index.d.ts +1 -1
- package/dist/runtime/utils/link.d.ts +23 -55
- package/package.json +26 -25
- 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,31 @@
|
|
|
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/badge'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
|
|
10
|
+
|
|
11
|
+
type BadgeVariants = VariantProps<typeof badge>
|
|
12
|
+
|
|
13
|
+
export interface BadgeProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'span'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
label?: string | number
|
|
20
|
+
color?: BadgeVariants['color']
|
|
21
|
+
variant?: BadgeVariants['variant']
|
|
22
|
+
size?: BadgeVariants['size']
|
|
23
|
+
class?: any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface BadgeSlots {
|
|
27
|
+
default(props?: {}): any
|
|
28
|
+
}
|
|
7
29
|
</script>
|
|
8
30
|
|
|
9
31
|
<script setup lang="ts">
|
|
@@ -1,9 +1,47 @@
|
|
|
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/breadcrumb'
|
|
6
|
+
import type { AvatarProps, LinkProps } from '../types'
|
|
7
|
+
import type { DynamicSlots } from '../types/utils'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const breadcrumb = tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb || {}) })
|
|
12
|
+
|
|
13
|
+
export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
14
|
+
label?: string
|
|
15
|
+
icon?: string
|
|
16
|
+
avatar?: AvatarProps
|
|
17
|
+
slot?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface BreadcrumbProps<T> {
|
|
21
|
+
/**
|
|
22
|
+
* The element or component this component should render as.
|
|
23
|
+
* @defaultValue 'div'
|
|
24
|
+
*/
|
|
25
|
+
as?: any
|
|
26
|
+
items?: T[]
|
|
27
|
+
/**
|
|
28
|
+
* The icon to use as a separator.
|
|
29
|
+
* @defaultValue appConfig.ui.icons.chevronRight
|
|
30
|
+
*/
|
|
31
|
+
separatorIcon?: string
|
|
32
|
+
class?: any
|
|
33
|
+
ui?: Partial<typeof breadcrumb.slots>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
|
|
37
|
+
|
|
38
|
+
export type BreadcrumbSlots<T extends { slot?: string }> = {
|
|
39
|
+
'item': SlotProps<T>
|
|
40
|
+
'item-leading': SlotProps<T>
|
|
41
|
+
'item-label': SlotProps<T>
|
|
42
|
+
'item-trailing': SlotProps<T>
|
|
43
|
+
'separator'(props?: {}): any
|
|
44
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
7
45
|
</script>
|
|
8
46
|
|
|
9
47
|
<script setup lang="ts" generic="T extends BreadcrumbItem">
|
|
@@ -1,13 +1,44 @@
|
|
|
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/button'
|
|
6
|
+
import type { LinkProps } from './Link.vue'
|
|
7
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
+
import type { PartialString } from '../types/utils'
|
|
9
|
+
import { formLoadingInjectionKey } from '../composables/useFormField'
|
|
10
|
+
|
|
11
|
+
const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
|
|
12
|
+
|
|
13
|
+
const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) })
|
|
14
|
+
|
|
15
|
+
type ButtonVariants = VariantProps<typeof button>
|
|
16
|
+
|
|
17
|
+
export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
|
|
18
|
+
label?: string
|
|
19
|
+
color?: ButtonVariants['color']
|
|
20
|
+
variant?: ButtonVariants['variant']
|
|
21
|
+
size?: ButtonVariants['size']
|
|
22
|
+
/** Render the button with equal padding on all sides. */
|
|
23
|
+
square?: boolean
|
|
24
|
+
/** Render the button full width. */
|
|
25
|
+
block?: boolean
|
|
26
|
+
/** Set loading state automatically based on the `@click` promise state */
|
|
27
|
+
loadingAuto?: boolean
|
|
28
|
+
onClick?: ((event: MouseEvent) => void | Promise<void>) | Array<((event: MouseEvent) => void | Promise<void>)>
|
|
29
|
+
class?: any
|
|
30
|
+
ui?: PartialString<typeof button.slots>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ButtonSlots {
|
|
34
|
+
leading(props?: {}): any
|
|
35
|
+
default(props?: {}): any
|
|
36
|
+
trailing(props?: {}): any
|
|
37
|
+
}
|
|
7
38
|
</script>
|
|
8
39
|
|
|
9
40
|
<script setup lang="ts">
|
|
10
|
-
import { computed } from 'vue'
|
|
41
|
+
import { type Ref, computed, ref, inject } from 'vue'
|
|
11
42
|
import { useForwardProps } from 'radix-vue'
|
|
12
43
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
13
44
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
@@ -21,13 +52,33 @@ const slots = defineSlots<ButtonSlots>()
|
|
|
21
52
|
const linkProps = useForwardProps(pickLinkProps(props))
|
|
22
53
|
|
|
23
54
|
const { orientation, size: buttonSize } = useButtonGroup<ButtonProps>(props)
|
|
24
|
-
|
|
55
|
+
|
|
56
|
+
const loadingAutoState = ref(false)
|
|
57
|
+
const formLoading = inject<Ref<boolean> | undefined>(formLoadingInjectionKey, undefined)
|
|
58
|
+
|
|
59
|
+
async function onClickWrapper(event: MouseEvent) {
|
|
60
|
+
loadingAutoState.value = true
|
|
61
|
+
const callbacks = Array.isArray(props.onClick) ? props.onClick : [props.onClick]
|
|
62
|
+
try {
|
|
63
|
+
await Promise.all(callbacks.map(fn => fn?.(event)))
|
|
64
|
+
} finally {
|
|
65
|
+
loadingAutoState.value = false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const isLoading = computed(() => {
|
|
70
|
+
return props.loading || (props.loadingAuto && (loadingAutoState.value || (formLoading?.value && props.type === 'submit')))
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(
|
|
74
|
+
computed(() => ({ ...props, loading: isLoading.value }))
|
|
75
|
+
)
|
|
25
76
|
|
|
26
77
|
const ui = computed(() => button({
|
|
27
78
|
color: props.color,
|
|
28
79
|
variant: props.variant,
|
|
29
80
|
size: buttonSize.value,
|
|
30
|
-
loading:
|
|
81
|
+
loading: isLoading.value,
|
|
31
82
|
block: props.block,
|
|
32
83
|
square: props.square || (!slots.default && !props.label),
|
|
33
84
|
leading: isLeading.value,
|
|
@@ -37,7 +88,14 @@ const ui = computed(() => button({
|
|
|
37
88
|
</script>
|
|
38
89
|
|
|
39
90
|
<template>
|
|
40
|
-
<ULink
|
|
91
|
+
<ULink
|
|
92
|
+
:type="type"
|
|
93
|
+
:disabled="disabled || isLoading"
|
|
94
|
+
:class="ui.base({ class: [props.class, props.ui?.base] })"
|
|
95
|
+
v-bind="linkProps"
|
|
96
|
+
raw
|
|
97
|
+
@click="onClickWrapper"
|
|
98
|
+
>
|
|
41
99
|
<slot name="leading">
|
|
42
100
|
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
|
43
101
|
</slot>
|
|
@@ -1,9 +1,33 @@
|
|
|
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/button-group'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const buttonGroup = tv({ extend: tv(theme), ...(appConfig.ui?.buttonGroup) })
|
|
10
|
+
|
|
11
|
+
type ButtonGroupVariants = VariantProps<typeof buttonGroup>
|
|
12
|
+
|
|
13
|
+
export interface ButtonGroupProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
size?: ButtonGroupVariants['size']
|
|
20
|
+
/**
|
|
21
|
+
* The orientation the buttons are laid out.
|
|
22
|
+
* @defaultValue 'horizontal'
|
|
23
|
+
*/
|
|
24
|
+
orientation?: ButtonGroupVariants['orientation']
|
|
25
|
+
class?: any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ButtonGroupSlots {
|
|
29
|
+
default(props?: {}): any
|
|
30
|
+
}
|
|
7
31
|
</script>
|
|
8
32
|
|
|
9
33
|
<script setup lang="ts">
|
|
@@ -1,9 +1,28 @@
|
|
|
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/card'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { card: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) })
|
|
10
|
+
|
|
11
|
+
export interface CardProps {
|
|
12
|
+
/**
|
|
13
|
+
* The element or component this component should render as.
|
|
14
|
+
* @defaultValue 'div'
|
|
15
|
+
*/
|
|
16
|
+
as?: any
|
|
17
|
+
class?: any
|
|
18
|
+
ui?: Partial<typeof card.slots>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CardSlots {
|
|
22
|
+
header(props?: {}): any
|
|
23
|
+
default(props?: {}): any
|
|
24
|
+
footer(props?: {}): any
|
|
25
|
+
}
|
|
7
26
|
</script>
|
|
8
27
|
|
|
9
28
|
<script setup lang="ts">
|
|
@@ -1,9 +1,48 @@
|
|
|
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 { CheckboxRootProps } from 'radix-vue'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/checkbox'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) })
|
|
12
|
+
|
|
13
|
+
type CheckboxVariants = VariantProps<typeof checkbox>
|
|
14
|
+
|
|
15
|
+
export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id'> {
|
|
16
|
+
label?: string
|
|
17
|
+
description?: string
|
|
18
|
+
color?: CheckboxVariants['color']
|
|
19
|
+
size?: CheckboxVariants['size']
|
|
20
|
+
/**
|
|
21
|
+
* The icon displayed when checked.
|
|
22
|
+
* @defaultValue appConfig.ui.icons.check
|
|
23
|
+
*/
|
|
24
|
+
icon?: string
|
|
25
|
+
indeterminate?: InputHTMLAttributes['indeterminate']
|
|
26
|
+
/**
|
|
27
|
+
* The icon displayed when the checkbox is indeterminate.
|
|
28
|
+
* @defaultValue appConfig.ui.icons.minus
|
|
29
|
+
*/
|
|
30
|
+
indeterminateIcon?: string
|
|
31
|
+
/** The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. */
|
|
32
|
+
defaultValue?: boolean
|
|
33
|
+
class?: any
|
|
34
|
+
ui?: Partial<typeof checkbox.slots>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CheckboxEmits {
|
|
38
|
+
(e: 'update:modelValue', payload: boolean): void
|
|
39
|
+
(e: 'change', payload: Event): void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CheckboxSlots {
|
|
43
|
+
label(props: { label?: string }): any
|
|
44
|
+
description(props: { description?: string }): any
|
|
45
|
+
}
|
|
7
46
|
</script>
|
|
8
47
|
|
|
9
48
|
<script setup lang="ts">
|
|
@@ -1,9 +1,42 @@
|
|
|
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/chip'
|
|
6
|
+
|
|
7
|
+
const appConfig = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
|
|
8
|
+
|
|
9
|
+
const chip = tv({ extend: tv(theme), ...(appConfig.ui?.chip || {}) })
|
|
10
|
+
|
|
11
|
+
type ChipVariants = VariantProps<typeof chip>
|
|
12
|
+
|
|
13
|
+
export interface ChipProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as.
|
|
16
|
+
* @defaultValue 'div'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
/** Display some text inside the chip. */
|
|
20
|
+
text?: string | number
|
|
21
|
+
color?: ChipVariants['color']
|
|
22
|
+
size?: ChipVariants['size']
|
|
23
|
+
position?: ChipVariants['position']
|
|
24
|
+
/** When `true`, translate the chip at the edge for non rounded elements. */
|
|
25
|
+
inset?: boolean
|
|
26
|
+
/** When `true`, render the chip relatively to the parent. */
|
|
27
|
+
standalone?: boolean
|
|
28
|
+
class?: any
|
|
29
|
+
ui?: Partial<typeof chip.slots>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ChipEmits {
|
|
33
|
+
(e: 'update:show', payload: boolean): void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ChipSlots {
|
|
37
|
+
default(props?: {}): any
|
|
38
|
+
content(props?: {}): any
|
|
39
|
+
}
|
|
7
40
|
</script>
|
|
8
41
|
|
|
9
42
|
<script setup lang="ts">
|
|
@@ -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">
|
|
@@ -87,7 +180,7 @@ const groups = computed(() => {
|
|
|
87
180
|
}
|
|
88
181
|
|
|
89
182
|
acc[item.group] ||= []
|
|
90
|
-
acc[item.group]
|
|
183
|
+
acc[item.group]?.push({ ...item, matches })
|
|
91
184
|
|
|
92
185
|
return acc
|
|
93
186
|
}, {} as Record<string, (T & { matches?: FuseResult<T>['matches'] })[]>)
|
|
@@ -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">
|