@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,116 @@
|
|
|
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 { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxItemProps, ComboboxArrowProps } from 'radix-vue'
|
|
5
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/input-menu'
|
|
8
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
9
|
+
import type { AvatarProps, ChipProps, InputProps } from '../types'
|
|
10
|
+
import type { AcceptableValue, ArrayOrWrapped, PartialString } from '../types/utils'
|
|
11
|
+
|
|
12
|
+
const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
|
|
13
|
+
|
|
14
|
+
const inputMenu = tv({ extend: tv(theme), ...(appConfig.ui?.inputMenu || {}) })
|
|
15
|
+
|
|
16
|
+
export interface InputMenuItem extends Pick<ComboboxItemProps, 'disabled'> {
|
|
17
|
+
label?: string
|
|
18
|
+
icon?: string
|
|
19
|
+
avatar?: AvatarProps
|
|
20
|
+
chip?: ChipProps
|
|
21
|
+
/**
|
|
22
|
+
* The item type.
|
|
23
|
+
* @defaultValue 'item'
|
|
24
|
+
*/
|
|
25
|
+
type?: 'label' | 'separator' | 'item'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type InputMenuVariants = VariantProps<typeof inputMenu>
|
|
29
|
+
|
|
30
|
+
export interface InputMenuProps<T> extends Pick<ComboboxRootProps<T>, 'modelValue' | 'defaultValue' | 'selectedValue' | 'open' | 'defaultOpen' | 'searchTerm' | 'multiple' | 'disabled' | 'name' | 'resetSearchTermOnBlur'>, UseComponentIconsProps {
|
|
31
|
+
/**
|
|
32
|
+
* The element or component this component should render as.
|
|
33
|
+
* @defaultValue 'div'
|
|
34
|
+
*/
|
|
35
|
+
as?: any
|
|
36
|
+
id?: string
|
|
37
|
+
type?: InputHTMLAttributes['type']
|
|
38
|
+
/** The placeholder text when the input is empty. */
|
|
39
|
+
placeholder?: string
|
|
40
|
+
color?: InputMenuVariants['color']
|
|
41
|
+
variant?: InputMenuVariants['variant']
|
|
42
|
+
size?: InputMenuVariants['size']
|
|
43
|
+
required?: boolean
|
|
44
|
+
autofocus?: boolean
|
|
45
|
+
autofocusDelay?: number
|
|
46
|
+
/**
|
|
47
|
+
* The icon displayed to open the menu.
|
|
48
|
+
* @defaultValue appConfig.ui.icons.chevronDown
|
|
49
|
+
*/
|
|
50
|
+
trailingIcon?: string
|
|
51
|
+
/**
|
|
52
|
+
* The icon displayed when an item is selected.
|
|
53
|
+
* @defaultValue appConfig.ui.icons.check
|
|
54
|
+
*/
|
|
55
|
+
selectedIcon?: string
|
|
56
|
+
/**
|
|
57
|
+
* The icon displayed to delete a tag.
|
|
58
|
+
* Works only when `multiple` is `true`.
|
|
59
|
+
* @defaultValue appConfig.ui.icons.close
|
|
60
|
+
*/
|
|
61
|
+
deleteIcon?: string
|
|
62
|
+
/**
|
|
63
|
+
* The content of the menu.
|
|
64
|
+
* @defaultValue { side: 'bottom', sideOffset: 8, position: 'popper' }
|
|
65
|
+
*/
|
|
66
|
+
content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
67
|
+
/**
|
|
68
|
+
* Display an arrow alongside the menu.
|
|
69
|
+
* @defaultValue false
|
|
70
|
+
*/
|
|
71
|
+
arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>
|
|
72
|
+
/**
|
|
73
|
+
* Render the menu in a portal.
|
|
74
|
+
* @defaultValue true
|
|
75
|
+
*/
|
|
76
|
+
portal?: boolean
|
|
77
|
+
/**
|
|
78
|
+
* Whether to filter items or not, can be an array of fields to filter.
|
|
79
|
+
* When `false`, items will not be filtered which is useful for custom filtering.
|
|
80
|
+
* @defaultValue ['label']
|
|
81
|
+
*/
|
|
82
|
+
filter?: boolean | string[]
|
|
83
|
+
/**
|
|
84
|
+
* When `items` is an array of objects, select the field to use as the value instead of the object itself.
|
|
85
|
+
* @defaultValue undefined
|
|
86
|
+
*/
|
|
87
|
+
valueKey?: keyof T
|
|
88
|
+
items?: T[] | T[][]
|
|
89
|
+
/** Highlight the ring color like a focus state. */
|
|
90
|
+
highlight?: boolean
|
|
91
|
+
class?: any
|
|
92
|
+
ui?: PartialString<typeof inputMenu.slots>
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type InputMenuEmits<T> = ComboboxRootEmits<T> & {
|
|
96
|
+
change: [payload: Event]
|
|
97
|
+
blur: [payload: FocusEvent]
|
|
98
|
+
focus: [payload: FocusEvent]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type SlotProps<T> = (props: { item: T, index: number }) => any
|
|
102
|
+
|
|
103
|
+
export type InputMenuSlots<T> = {
|
|
104
|
+
'leading'(props: { modelValue: T, open: boolean, ui: any }): any
|
|
105
|
+
'trailing'(props: { modelValue: T, open: boolean, ui: any }): any
|
|
106
|
+
'empty'(props: { searchTerm?: string }): any
|
|
107
|
+
'item': SlotProps<T>
|
|
108
|
+
'item-leading': SlotProps<T>
|
|
109
|
+
'item-label': SlotProps<T>
|
|
110
|
+
'item-trailing': SlotProps<T>
|
|
111
|
+
'tags-item-text': SlotProps<T>
|
|
112
|
+
'tags-item-delete': SlotProps<T>
|
|
113
|
+
}
|
|
7
114
|
</script>
|
|
8
115
|
|
|
9
116
|
<script setup lang="ts" generic="T extends InputMenuItem | AcceptableValue">
|
|
@@ -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/kbd'
|
|
6
|
+
import type { KbdKey } from '../composables/useKbd'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { kbd: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const kbd = tv({ extend: tv(theme), ...(appConfig.ui?.kbd || {}) })
|
|
11
|
+
|
|
12
|
+
type KbdVariants = VariantProps<typeof kbd>
|
|
13
|
+
|
|
14
|
+
export interface KbdProps {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue 'kbd'
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
value?: KbdKey | string
|
|
21
|
+
variant?: KbdVariants['variant']
|
|
22
|
+
size?: KbdVariants['size']
|
|
23
|
+
class?: any
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface KbdSlots {
|
|
27
|
+
default(props?: {}): any
|
|
28
|
+
}
|
|
7
29
|
</script>
|
|
8
30
|
|
|
9
31
|
<script setup lang="ts">
|
|
@@ -1,9 +1,46 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ButtonHTMLAttributes } from 'vue'
|
|
3
|
+
import { tv } from 'tailwind-variants'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/link'
|
|
7
|
+
import type { NuxtLinkProps } from '#app'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { link: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const link = tv({ extend: tv(theme), ...(appConfig.ui?.link || {}) })
|
|
12
|
+
|
|
13
|
+
export interface LinkProps extends NuxtLinkProps {
|
|
14
|
+
/**
|
|
15
|
+
* The element or component this component should render as when not a link.
|
|
16
|
+
* @defaultValue 'button'
|
|
17
|
+
*/
|
|
18
|
+
as?: any
|
|
19
|
+
/**
|
|
20
|
+
* The type of the button when not a link.
|
|
21
|
+
* @defaultValue 'button'
|
|
22
|
+
*/
|
|
23
|
+
type?: ButtonHTMLAttributes['type']
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
/** Force the link to be active independent of the current route. */
|
|
26
|
+
active?: boolean
|
|
27
|
+
/** Will only be active if the current route is an exact match. */
|
|
28
|
+
exact?: boolean
|
|
29
|
+
/** Will only be active if the current route query is an exact match. */
|
|
30
|
+
exactQuery?: boolean
|
|
31
|
+
/** Will only be active if the current route hash is an exact match. */
|
|
32
|
+
exactHash?: boolean
|
|
33
|
+
/** The class to apply when the link is inactive. */
|
|
34
|
+
inactiveClass?: string
|
|
35
|
+
custom?: boolean
|
|
36
|
+
/** When `true`, only styles from `class`, `activeClass`, and `inactiveClass` will be applied. */
|
|
37
|
+
raw?: boolean
|
|
38
|
+
class?: any
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface LinkSlots {
|
|
42
|
+
default(props: { active: boolean }): any
|
|
43
|
+
}
|
|
7
44
|
</script>
|
|
8
45
|
|
|
9
46
|
<script setup lang="ts">
|
|
@@ -37,31 +74,31 @@ const ui = computed(() => tv({
|
|
|
37
74
|
}
|
|
38
75
|
}))
|
|
39
76
|
|
|
40
|
-
function isLinkActive(
|
|
77
|
+
function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) {
|
|
41
78
|
if (props.active !== undefined) {
|
|
42
79
|
return props.active
|
|
43
80
|
}
|
|
44
81
|
|
|
45
|
-
if (props.exactQuery && !isEqual(
|
|
82
|
+
if (props.exactQuery && !isEqual(linkRoute.query, route.query)) {
|
|
46
83
|
return false
|
|
47
84
|
}
|
|
48
|
-
if (props.exactHash &&
|
|
85
|
+
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
49
86
|
return false
|
|
50
87
|
}
|
|
51
88
|
|
|
52
|
-
if (props.exact &&
|
|
89
|
+
if (props.exact && isExactActive) {
|
|
53
90
|
return true
|
|
54
91
|
}
|
|
55
92
|
|
|
56
|
-
if (!props.exact &&
|
|
93
|
+
if (!props.exact && isActive) {
|
|
57
94
|
return true
|
|
58
95
|
}
|
|
59
96
|
|
|
60
97
|
return false
|
|
61
98
|
}
|
|
62
99
|
|
|
63
|
-
function resolveLinkClass(
|
|
64
|
-
const active = isLinkActive(
|
|
100
|
+
function resolveLinkClass({ route, isActive, isExactActive }: any) {
|
|
101
|
+
const active = isLinkActive({ route, isActive, isExactActive })
|
|
65
102
|
|
|
66
103
|
if (props.raw) {
|
|
67
104
|
return [props.class, active ? props.activeClass : props.inactiveClass]
|
|
@@ -72,12 +109,39 @@ function resolveLinkClass(slotProps: any) {
|
|
|
72
109
|
</script>
|
|
73
110
|
|
|
74
111
|
<template>
|
|
75
|
-
<NuxtLink v-slot="
|
|
112
|
+
<NuxtLink v-slot="{ href, navigate, route: linkRoute, rel, target, isExternal, isActive, isExactActive }" v-bind="nuxtLinkProps" custom>
|
|
76
113
|
<template v-if="custom">
|
|
77
|
-
<slot
|
|
114
|
+
<slot
|
|
115
|
+
v-bind="{
|
|
116
|
+
...$attrs,
|
|
117
|
+
as,
|
|
118
|
+
type,
|
|
119
|
+
disabled,
|
|
120
|
+
href,
|
|
121
|
+
navigate,
|
|
122
|
+
rel,
|
|
123
|
+
target,
|
|
124
|
+
isExternal,
|
|
125
|
+
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
126
|
+
}"
|
|
127
|
+
/>
|
|
78
128
|
</template>
|
|
79
|
-
<ULinkBase
|
|
80
|
-
|
|
129
|
+
<ULinkBase
|
|
130
|
+
v-else
|
|
131
|
+
v-bind="{
|
|
132
|
+
...$attrs,
|
|
133
|
+
as,
|
|
134
|
+
type,
|
|
135
|
+
disabled,
|
|
136
|
+
href,
|
|
137
|
+
navigate,
|
|
138
|
+
rel,
|
|
139
|
+
target,
|
|
140
|
+
isExternal
|
|
141
|
+
}"
|
|
142
|
+
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
143
|
+
>
|
|
144
|
+
<slot :active="isLinkActive({ route: linkRoute, isActive, isExactActive })" />
|
|
81
145
|
</ULinkBase>
|
|
82
146
|
</NuxtLink>
|
|
83
147
|
</template>
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface LinkBaseProps {
|
|
3
|
+
as?: string
|
|
4
|
+
type?: string
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
click?: (e: MouseEvent) => void
|
|
7
|
+
href?: string
|
|
8
|
+
navigate?: (e: MouseEvent) => void
|
|
9
|
+
rel?: string
|
|
10
|
+
target?: string
|
|
11
|
+
isExternal?: boolean
|
|
12
|
+
}
|
|
3
13
|
</script>
|
|
4
14
|
|
|
5
15
|
<script setup lang="ts">
|
|
@@ -1,9 +1,72 @@
|
|
|
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 { DialogRootProps, DialogRootEmits, DialogContentProps } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/modal'
|
|
7
|
+
import type { ButtonProps } from '../types'
|
|
8
|
+
|
|
9
|
+
const appConfig = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }
|
|
10
|
+
|
|
11
|
+
const modal = tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) })
|
|
12
|
+
|
|
13
|
+
export interface ModalProps extends DialogRootProps {
|
|
14
|
+
title?: string
|
|
15
|
+
description?: string
|
|
16
|
+
/** The content of the modal. */
|
|
17
|
+
content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
18
|
+
/**
|
|
19
|
+
* Render an overlay behind the modal.
|
|
20
|
+
* @defaultValue true
|
|
21
|
+
*/
|
|
22
|
+
overlay?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* Animate the modal when opening or closing.
|
|
25
|
+
* @defaultValue true
|
|
26
|
+
*/
|
|
27
|
+
transition?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* When `true`, the modal will take up the full screen.
|
|
30
|
+
* @defaultValue false
|
|
31
|
+
*/
|
|
32
|
+
fullscreen?: boolean
|
|
33
|
+
/**
|
|
34
|
+
* Render the modal in a portal.
|
|
35
|
+
* @defaultValue true
|
|
36
|
+
*/
|
|
37
|
+
portal?: boolean
|
|
38
|
+
/**
|
|
39
|
+
* Display a close button to dismiss the modal.
|
|
40
|
+
* `{ size: 'md', color: 'gray', variant: 'ghost' }`{lang="ts-type"}
|
|
41
|
+
* @defaultValue true
|
|
42
|
+
*/
|
|
43
|
+
close?: ButtonProps | boolean
|
|
44
|
+
/**
|
|
45
|
+
* The icon displayed in the close button.
|
|
46
|
+
* @defaultValue appConfig.ui.icons.close
|
|
47
|
+
*/
|
|
48
|
+
closeIcon?: string
|
|
49
|
+
/**
|
|
50
|
+
* When `true`, the modal will not close when clicking outside.
|
|
51
|
+
* @defaultValue false
|
|
52
|
+
*/
|
|
53
|
+
preventClose?: boolean
|
|
54
|
+
class?: any
|
|
55
|
+
ui?: Partial<typeof modal.slots>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ModalEmits extends DialogRootEmits {}
|
|
59
|
+
|
|
60
|
+
export interface ModalSlots {
|
|
61
|
+
default(props: { open: boolean }): any
|
|
62
|
+
content(props?: {}): any
|
|
63
|
+
header(props?: {}): any
|
|
64
|
+
title(props?: {}): any
|
|
65
|
+
description(props?: {}): any
|
|
66
|
+
close(props: { ui: any }): any
|
|
67
|
+
body(props?: {}): any
|
|
68
|
+
footer(props?: {}): any
|
|
69
|
+
}
|
|
7
70
|
</script>
|
|
8
71
|
|
|
9
72
|
<script setup lang="ts">
|
|
@@ -1,9 +1,79 @@
|
|
|
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 { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuItemProps, NavigationMenuContentProps } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/navigation-menu'
|
|
7
|
+
import type { AvatarProps, BadgeProps, LinkProps } from '../types'
|
|
8
|
+
import type { DynamicSlots } from '../types/utils'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const navigationMenu = tv({ extend: tv(theme), ...(appConfig.ui?.navigationMenu || {}) })
|
|
13
|
+
|
|
14
|
+
export interface NavigationMenuChildItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|
15
|
+
label: string
|
|
16
|
+
description?: string
|
|
17
|
+
icon?: string
|
|
18
|
+
select?(e: Event): void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface NavigationMenuItem extends Omit<LinkProps, 'raw' | 'custom'>, Pick<NavigationMenuItemProps, 'value'> {
|
|
22
|
+
label?: string
|
|
23
|
+
icon?: string
|
|
24
|
+
avatar?: AvatarProps
|
|
25
|
+
badge?: string | number | BadgeProps
|
|
26
|
+
trailingIcon?: string
|
|
27
|
+
slot?: string
|
|
28
|
+
children?: NavigationMenuChildItem[]
|
|
29
|
+
select?(e: Event): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type NavigationMenuVariants = VariantProps<typeof navigationMenu>
|
|
33
|
+
|
|
34
|
+
export interface NavigationMenuProps<T> extends Pick<NavigationMenuRootProps, 'defaultValue' | 'delayDuration' | 'disableClickTrigger' | 'disableHoverTrigger' | 'modelValue' | 'skipDelayDuration'> {
|
|
35
|
+
/**
|
|
36
|
+
* The element or component this component should render as.
|
|
37
|
+
* @defaultValue `div`
|
|
38
|
+
*/
|
|
39
|
+
as?: any
|
|
40
|
+
/**
|
|
41
|
+
* The icon displayed to open the menu.
|
|
42
|
+
* @defaultValue appConfig.ui.icons.chevronDown
|
|
43
|
+
*/
|
|
44
|
+
trailingIcon?: string
|
|
45
|
+
items?: T[] | T[][]
|
|
46
|
+
color?: NavigationMenuVariants['color']
|
|
47
|
+
variant?: NavigationMenuVariants['variant']
|
|
48
|
+
/**
|
|
49
|
+
* The orientation of the menu.
|
|
50
|
+
* @defaultValue 'horizontal'
|
|
51
|
+
*/
|
|
52
|
+
orientation?: NavigationMenuRootProps['orientation']
|
|
53
|
+
/** Display a line next to the active item. */
|
|
54
|
+
highlight?: boolean
|
|
55
|
+
highlightColor?: NavigationMenuVariants['highlightColor']
|
|
56
|
+
/** The content of the menu. */
|
|
57
|
+
content?: Omit<NavigationMenuContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
58
|
+
/**
|
|
59
|
+
* Display an arrow alongside the menu.
|
|
60
|
+
* @defaultValue false
|
|
61
|
+
*/
|
|
62
|
+
arrow?: boolean
|
|
63
|
+
class?: any
|
|
64
|
+
ui?: Partial<typeof navigationMenu.slots>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface NavigationMenuEmits extends NavigationMenuRootEmits {}
|
|
68
|
+
|
|
69
|
+
type SlotProps<T> = (props: { item: T, index: number, active?: boolean }) => any
|
|
70
|
+
|
|
71
|
+
export type NavigationMenuSlots<T extends { slot?: string }> = {
|
|
72
|
+
'item': SlotProps<T>
|
|
73
|
+
'item-leading': SlotProps<T>
|
|
74
|
+
'item-label': SlotProps<T>
|
|
75
|
+
'item-trailing': SlotProps<T>
|
|
76
|
+
} & DynamicSlots<T, SlotProps<T>>
|
|
7
77
|
</script>
|
|
8
78
|
|
|
9
79
|
<script setup lang="ts" generic="T extends NavigationMenuItem">
|
|
@@ -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 { PaginationRootProps, PaginationRootEmits } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import type { RouteLocationRaw } from '#vue-router'
|
|
6
|
+
import _appConfig from '#build/app.config'
|
|
7
|
+
import theme from '#build/ui/pagination'
|
|
8
|
+
import type { ButtonProps } from '../types'
|
|
9
|
+
|
|
10
|
+
const appConfig = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const pagination = tv({ extend: tv(theme), ...(appConfig.ui?.pagination || {}) })
|
|
13
|
+
|
|
14
|
+
export interface PaginationProps extends Pick<PaginationRootProps, 'defaultPage' | 'disabled' | 'itemsPerPage' | 'page' | 'showEdges' | 'siblingCount' | 'total'> {
|
|
15
|
+
/**
|
|
16
|
+
* The element or component this component should render as.
|
|
17
|
+
* @defaultValue `div`
|
|
18
|
+
*/
|
|
19
|
+
as?: any
|
|
20
|
+
/**
|
|
21
|
+
* The icon to use for the first page control.
|
|
22
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleLeft
|
|
23
|
+
*/
|
|
24
|
+
firstIcon?: string
|
|
25
|
+
/**
|
|
26
|
+
* The icon to use for the previous page control.
|
|
27
|
+
* @defaultValue appConfig.ui.icons.chevronLeft
|
|
28
|
+
*/
|
|
29
|
+
prevIcon?: string
|
|
30
|
+
/**
|
|
31
|
+
* The icon to use for the next page control.
|
|
32
|
+
* @defaultValue appConfig.ui.icons.chevronRight
|
|
33
|
+
*/
|
|
34
|
+
nextIcon?: string
|
|
35
|
+
/**
|
|
36
|
+
* The icon to use for the last page control.
|
|
37
|
+
* @defaultValue appConfig.ui.icons.chevronDoubleRight
|
|
38
|
+
*/
|
|
39
|
+
lastIcon?: string
|
|
40
|
+
/**
|
|
41
|
+
* The icon to use for the ellipsis control.
|
|
42
|
+
* @defaultValue appConfig.ui.icons.ellipsis
|
|
43
|
+
*/
|
|
44
|
+
ellipsisIcon?: string
|
|
45
|
+
/**
|
|
46
|
+
* The color of the pagination controls.
|
|
47
|
+
* @defaultValue 'white'
|
|
48
|
+
*/
|
|
49
|
+
color?: ButtonProps['color']
|
|
50
|
+
/**
|
|
51
|
+
* The variant of the pagination controls.
|
|
52
|
+
* @defaultValue 'solid'
|
|
53
|
+
*/
|
|
54
|
+
variant?: ButtonProps['variant']
|
|
55
|
+
/**
|
|
56
|
+
* The color of the active pagination control.
|
|
57
|
+
* @defaultValue 'black'
|
|
58
|
+
*/
|
|
59
|
+
activeColor?: ButtonProps['color']
|
|
60
|
+
/**
|
|
61
|
+
* The variant of the active pagination control.
|
|
62
|
+
* @defaultValue 'solid'
|
|
63
|
+
*/
|
|
64
|
+
activeVariant?: ButtonProps['variant']
|
|
65
|
+
/**
|
|
66
|
+
* Whether to show the first, previous, next, and last controls.
|
|
67
|
+
* @defaultValue true
|
|
68
|
+
*/
|
|
69
|
+
showControls?: boolean
|
|
70
|
+
size?: ButtonProps['size']
|
|
71
|
+
/**
|
|
72
|
+
* A function to render page controls as links.
|
|
73
|
+
* @param page The page number to navigate to.
|
|
74
|
+
*/
|
|
75
|
+
to?: (page: number) => RouteLocationRaw
|
|
76
|
+
class?: any
|
|
77
|
+
ui?: Partial<typeof pagination.slots>
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface PaginationEmits extends PaginationRootEmits {}
|
|
81
|
+
|
|
82
|
+
export interface PaginationSlots {
|
|
83
|
+
first(props?: {}): any
|
|
84
|
+
prev(props?: {}): any
|
|
85
|
+
next(props?: {}): any
|
|
86
|
+
last(props?: {}): any
|
|
87
|
+
ellipsis(props?: {}): any
|
|
88
|
+
item(props: {
|
|
89
|
+
page: number
|
|
90
|
+
pageCount: number
|
|
91
|
+
item: {
|
|
92
|
+
type: 'ellipsis'
|
|
93
|
+
} | {
|
|
94
|
+
type: 'page'
|
|
95
|
+
value: number
|
|
96
|
+
}
|
|
97
|
+
index: number
|
|
98
|
+
}): any
|
|
99
|
+
}
|
|
7
100
|
</script>
|
|
8
101
|
|
|
9
102
|
<script setup lang="ts">
|
|
@@ -1,9 +1,45 @@
|
|
|
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 { PopoverRootProps, HoverCardRootProps, PopoverRootEmits, PopoverContentProps, PopoverArrowProps } from 'radix-vue'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/popover'
|
|
7
|
+
|
|
8
|
+
const appConfig = _appConfig as AppConfig & { ui: { popover: Partial<typeof theme> } }
|
|
9
|
+
|
|
10
|
+
const popover = tv({ extend: tv(theme), ...(appConfig.ui?.popover || {}) })
|
|
11
|
+
|
|
12
|
+
export interface PopoverProps extends PopoverRootProps, Pick<HoverCardRootProps, 'openDelay' | 'closeDelay'> {
|
|
13
|
+
/**
|
|
14
|
+
* The display mode of the popover.
|
|
15
|
+
* @defaultValue 'click'
|
|
16
|
+
*/
|
|
17
|
+
mode?: 'click' | 'hover'
|
|
18
|
+
/**
|
|
19
|
+
* The content of the popover.
|
|
20
|
+
* @defaultValue { side: 'bottom', sideOffset: 8 }
|
|
21
|
+
*/
|
|
22
|
+
content?: Omit<PopoverContentProps, 'as' | 'asChild' | 'forceMount'>
|
|
23
|
+
/**
|
|
24
|
+
* Display an arrow alongside the popover.
|
|
25
|
+
* @defaultValue false
|
|
26
|
+
*/
|
|
27
|
+
arrow?: boolean | Omit<PopoverArrowProps, 'as' | 'asChild'>
|
|
28
|
+
/**
|
|
29
|
+
* Render the popover in a portal.
|
|
30
|
+
* @defaultValue true
|
|
31
|
+
*/
|
|
32
|
+
portal?: boolean
|
|
33
|
+
class?: any
|
|
34
|
+
ui?: Partial<typeof popover.slots>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PopoverEmits extends PopoverRootEmits {}
|
|
38
|
+
|
|
39
|
+
export interface PopoverSlots {
|
|
40
|
+
default(props: { open: boolean }): any
|
|
41
|
+
content(props?: {}): any
|
|
42
|
+
}
|
|
7
43
|
</script>
|
|
8
44
|
|
|
9
45
|
<script setup lang="ts">
|