@una-ui/nuxt 0.28.0-beta.1 → 0.29.0-beta.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/elements/Button.vue +1 -0
- package/dist/runtime/components/elements/Skeleton.vue +3 -2
- package/dist/runtime/components/elements/Toggle.vue +1 -1
- package/dist/runtime/components/elements/avatar/Avatar.vue +58 -0
- package/dist/runtime/components/elements/avatar/AvatarFallback.vue +46 -0
- package/dist/runtime/components/elements/avatar/AvatarImage.vue +19 -0
- package/dist/runtime/components/elements/dialog/DialogDescription.vue +1 -1
- package/dist/runtime/components/elements/dialog/DialogOverlay.vue +1 -0
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenu.vue +73 -75
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenuContent.vue +1 -1
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenuSubContent.vue +1 -1
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenuSubTrigger.vue +18 -20
- package/dist/runtime/components/elements/dropdown-menu/DropdownMenuTrigger.vue +16 -18
- package/dist/runtime/components/elements/tooltip/Tooltip.vue +14 -7
- package/dist/runtime/components/forms/Checkbox.vue +15 -11
- package/dist/runtime/components/forms/Input.vue +6 -5
- package/dist/runtime/components/forms/Slider.vue +4 -1
- package/dist/runtime/components/forms/Switch.vue +6 -5
- package/dist/runtime/components/forms/select/Select.vue +9 -9
- package/dist/runtime/components/misc/ThemeSwitcher.vue +12 -6
- package/dist/runtime/components/slots/AvatarGroupDefault.js +2 -2
- package/dist/runtime/types/avatar.d.ts +49 -55
- package/dist/runtime/types/button.d.ts +6 -0
- package/dist/runtime/types/checkbox.d.ts +4 -21
- package/dist/runtime/types/select.d.ts +11 -6
- package/dist/runtime/types/separator.d.ts +2 -2
- package/dist/runtime/types/skeleton.d.ts +10 -2
- package/dist/runtime/types/tooltip.d.ts +3 -9
- package/package.json +18 -18
- package/dist/runtime/components/elements/Avatar.vue +0 -83
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -52,6 +52,7 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
|
|
|
52
52
|
:type="to ? null : type"
|
|
53
53
|
:class="cn(
|
|
54
54
|
(square === '' || square === true) && 'btn-square',
|
|
55
|
+
block && 'btn-block',
|
|
55
56
|
!rounded && 'btn-default-radius',
|
|
56
57
|
!hasVariant && !isBaseVariant ? una?.btnDefaultVariant : null,
|
|
57
58
|
reverse && 'btn-reverse',
|
|
@@ -15,7 +15,7 @@ const props = withDefaults(defineProps<NToggleProps>(), {
|
|
|
15
15
|
const emits = defineEmits<ToggleEmits>()
|
|
16
16
|
|
|
17
17
|
const delegatedProps = computed(() => {
|
|
18
|
-
const { class: _,
|
|
18
|
+
const { class: _, ...delegated } = props
|
|
19
19
|
|
|
20
20
|
return delegated
|
|
21
21
|
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NAvatarProps } from '../../../types'
|
|
3
|
+
import { AvatarRoot } from 'radix-vue'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
import AvatarFallback from './AvatarFallback.vue'
|
|
6
|
+
import AvatarImage from './AvatarImage.vue'
|
|
7
|
+
|
|
8
|
+
defineOptions({
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<NAvatarProps>(), {
|
|
13
|
+
as: 'span',
|
|
14
|
+
size: 'md',
|
|
15
|
+
rounded: 'full',
|
|
16
|
+
square: '2.5em',
|
|
17
|
+
avatar: 'soft',
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<AvatarRoot
|
|
23
|
+
as-child
|
|
24
|
+
>
|
|
25
|
+
<component
|
|
26
|
+
:is="as"
|
|
27
|
+
:class="cn(
|
|
28
|
+
'avatar',
|
|
29
|
+
una?.avatarRoot,
|
|
30
|
+
props.class,
|
|
31
|
+
)"
|
|
32
|
+
:size
|
|
33
|
+
:rounded
|
|
34
|
+
:square
|
|
35
|
+
:avatar
|
|
36
|
+
v-bind="{ ..._avatarRoot, ...$attrs }"
|
|
37
|
+
>
|
|
38
|
+
<slot :props>
|
|
39
|
+
<AvatarImage
|
|
40
|
+
v-if="src"
|
|
41
|
+
:src
|
|
42
|
+
:una
|
|
43
|
+
v-bind="_avatarImage"
|
|
44
|
+
/>
|
|
45
|
+
</slot>
|
|
46
|
+
|
|
47
|
+
<AvatarFallback
|
|
48
|
+
:avatar
|
|
49
|
+
:label="label || alt?.split(' ').map(word => word[0]).join('').slice(0, 2)"
|
|
50
|
+
:icon
|
|
51
|
+
v-bind="_avatarFallback"
|
|
52
|
+
:una
|
|
53
|
+
>
|
|
54
|
+
<slot name="fallback" />
|
|
55
|
+
</AvatarFallback>
|
|
56
|
+
</component>
|
|
57
|
+
</AvatarRoot>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NAvatarAvatarFallbackProps } from '../../../types'
|
|
3
|
+
import { AvatarFallback } from 'radix-vue'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
import Icon from '../Icon.vue'
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<NAvatarAvatarFallbackProps>(), {
|
|
8
|
+
as: 'span',
|
|
9
|
+
})
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<AvatarFallback
|
|
14
|
+
as-child
|
|
15
|
+
>
|
|
16
|
+
<component
|
|
17
|
+
:is="as"
|
|
18
|
+
v-bind="props"
|
|
19
|
+
:class="cn(
|
|
20
|
+
'avatar-fallback',
|
|
21
|
+
una?.avatarFallback,
|
|
22
|
+
props.class,
|
|
23
|
+
)"
|
|
24
|
+
>
|
|
25
|
+
<slot>
|
|
26
|
+
<span
|
|
27
|
+
v-if="label && !icon"
|
|
28
|
+
:class="cn(
|
|
29
|
+
'avatar-label',
|
|
30
|
+
una?.avatarLabel,
|
|
31
|
+
)"
|
|
32
|
+
>
|
|
33
|
+
{{ label }}
|
|
34
|
+
</span>
|
|
35
|
+
<Icon
|
|
36
|
+
v-else-if="icon"
|
|
37
|
+
:class="cn(
|
|
38
|
+
'avatar-icon',
|
|
39
|
+
una?.avatarIcon,
|
|
40
|
+
)"
|
|
41
|
+
:name="label"
|
|
42
|
+
/>
|
|
43
|
+
</slot>
|
|
44
|
+
</component>
|
|
45
|
+
</AvatarFallback>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NAvatarImageProps } from '../../../types'
|
|
3
|
+
import { AvatarImage } from 'radix-vue'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<NAvatarImageProps>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<AvatarImage
|
|
11
|
+
v-bind="props"
|
|
12
|
+
:src="src!"
|
|
13
|
+
:class="cn(
|
|
14
|
+
'avatar-image',
|
|
15
|
+
una?.avatarImage,
|
|
16
|
+
props.class,
|
|
17
|
+
)"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
@@ -15,7 +15,7 @@ const forwardedProps = useForwardProps(delegatedProps)
|
|
|
15
15
|
<DialogDescription
|
|
16
16
|
v-bind="forwardedProps"
|
|
17
17
|
:class="cn(
|
|
18
|
-
'dialog-description',
|
|
18
|
+
'dialog-description data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-48% data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-48%',
|
|
19
19
|
props.una?.dialogDescription,
|
|
20
20
|
props.class,
|
|
21
21
|
)"
|
|
@@ -9,6 +9,7 @@ const props = defineProps<NDialogOverlayProps>()
|
|
|
9
9
|
<template>
|
|
10
10
|
<DialogOverlay
|
|
11
11
|
:class="cn(
|
|
12
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
12
13
|
!props.scrollable ? 'dialog-overlay' : 'dialog-scroll-overlay',
|
|
13
14
|
props.una?.dialogOverlay,
|
|
14
15
|
props.class,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { DropdownMenuContentEmits, DropdownMenuRootEmits } from 'radix-vue'
|
|
3
3
|
import type { NDropdownMenuProps } from '../../../types'
|
|
4
|
-
import { createReusableTemplate } from '@vueuse/core'
|
|
4
|
+
import { createReusableTemplate, reactivePick } from '@vueuse/core'
|
|
5
5
|
import { DropdownMenuPortal, useForwardPropsEmits } from 'radix-vue'
|
|
6
|
-
import { omitProps
|
|
6
|
+
import { omitProps } from '../../../utils'
|
|
7
7
|
import DropdownMenuContent from './DropdownMenuContent.vue'
|
|
8
8
|
import DropdownMenuGroup from './DropdownMenuGroup.vue'
|
|
9
9
|
import DropdownMenuItem from './DropdownMenuItem.vue'
|
|
@@ -24,88 +24,86 @@ const [DefineMenuSub, ReuseMenuSub] = createReusableTemplate<NDropdownMenuProps>
|
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
26
|
<DropdownMenuRoot
|
|
27
|
-
v-bind="
|
|
27
|
+
v-bind="reactivePick(forwarded, ['defaultOpen', 'open', 'modal', 'dir'])"
|
|
28
28
|
>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</slot>
|
|
29
|
+
<DropdownMenuTrigger
|
|
30
|
+
v-bind="omitProps({ ...forwarded, ...forwarded._dropdownMenuTrigger }, [
|
|
31
|
+
'dropdownMenuItem',
|
|
32
|
+
'items',
|
|
33
|
+
'menuLabel',
|
|
34
|
+
'_dropdownMenuItem',
|
|
35
|
+
'_dropdownMenuContent',
|
|
36
|
+
'_dropdownMenuLabel',
|
|
37
|
+
'_dropdownMenuSeparator',
|
|
38
|
+
'_dropdownMenuGroup',
|
|
39
|
+
'_dropdownMenuTrigger',
|
|
40
|
+
'_dropdownMenuSubTrigger',
|
|
41
|
+
'_dropdownMenuSubContent',
|
|
42
|
+
])"
|
|
43
|
+
>
|
|
44
|
+
<slot />
|
|
45
|
+
</DropdownMenuTrigger>
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
<DropdownMenuContent
|
|
48
|
+
v-bind="forwarded._dropdownMenuContent"
|
|
49
|
+
>
|
|
50
|
+
<slot name="content">
|
|
51
|
+
<template
|
|
52
|
+
v-if="menuLabel || $slots['menu-label']"
|
|
53
|
+
>
|
|
54
|
+
<DropdownMenuLabel
|
|
55
|
+
:size
|
|
56
|
+
:inset
|
|
57
|
+
:una="forwarded.una?.dropdownMenuLabel"
|
|
58
|
+
v-bind="forwarded._dropdownMenuLabel"
|
|
54
59
|
>
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</DropdownMenuLabel>
|
|
65
|
-
<DropdownMenuSeparator
|
|
66
|
-
:una="forwarded.una?.dropdownMenuSeparator"
|
|
67
|
-
v-bind="forwarded._dropdownMenuSeparator"
|
|
68
|
-
/>
|
|
69
|
-
</template>
|
|
60
|
+
<slot name="menu-label">
|
|
61
|
+
{{ menuLabel }}
|
|
62
|
+
</slot>
|
|
63
|
+
</DropdownMenuLabel>
|
|
64
|
+
<DropdownMenuSeparator
|
|
65
|
+
:una="forwarded.una?.dropdownMenuSeparator"
|
|
66
|
+
v-bind="forwarded._dropdownMenuSeparator"
|
|
67
|
+
/>
|
|
68
|
+
</template>
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
<slot name="items" :items>
|
|
71
|
+
<DropdownMenuGroup
|
|
72
|
+
:una="forwarded.una?.dropdownMenuGroup"
|
|
73
|
+
v-bind="forwarded._dropdownMenuGroup"
|
|
74
|
+
>
|
|
75
|
+
<template
|
|
76
|
+
v-for="item in items"
|
|
77
|
+
:key="item.label"
|
|
75
78
|
>
|
|
76
|
-
<
|
|
77
|
-
v-
|
|
78
|
-
:
|
|
79
|
+
<slot
|
|
80
|
+
v-if="!item.items && item.label"
|
|
81
|
+
:name="`item-${item.label}`"
|
|
79
82
|
>
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
:inset
|
|
87
|
-
:dropdown-menu-item
|
|
88
|
-
:una="forwarded.una?.dropdownMenuItem"
|
|
89
|
-
v-bind="{ ...item, ...forwarded._dropdownMenuItem, ...item._dropdownMenuItem }"
|
|
90
|
-
/>
|
|
91
|
-
</slot>
|
|
92
|
-
|
|
93
|
-
<DropdownMenuSeparator
|
|
94
|
-
v-else-if="!item.label && !item.items"
|
|
95
|
-
:una="forwarded.una?.dropdownMenuSeparator"
|
|
96
|
-
v-bind="{ ...forwarded._dropdownMenuSeparator, ...item._dropdownMenuSeparator }"
|
|
83
|
+
<DropdownMenuItem
|
|
84
|
+
:size
|
|
85
|
+
:inset
|
|
86
|
+
:dropdown-menu-item
|
|
87
|
+
:una="forwarded.una?.dropdownMenuItem"
|
|
88
|
+
v-bind="{ ...item, ...forwarded._dropdownMenuItem, ...item._dropdownMenuItem }"
|
|
97
89
|
/>
|
|
90
|
+
</slot>
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
<DropdownMenuSeparator
|
|
93
|
+
v-else-if="!item.label && !item.items"
|
|
94
|
+
:una="forwarded.una?.dropdownMenuSeparator"
|
|
95
|
+
v-bind="{ ...forwarded._dropdownMenuSeparator, ...item._dropdownMenuSeparator }"
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<ReuseMenuSub
|
|
99
|
+
v-else
|
|
100
|
+
v-bind="item"
|
|
101
|
+
/>
|
|
102
|
+
</template>
|
|
103
|
+
</DropdownMenuGroup>
|
|
106
104
|
</slot>
|
|
107
|
-
</
|
|
108
|
-
</
|
|
105
|
+
</slot>
|
|
106
|
+
</DropdownMenuContent>
|
|
109
107
|
</DropdownMenuRoot>
|
|
110
108
|
|
|
111
109
|
<DefineMenuSub
|
|
@@ -31,7 +31,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
|
31
31
|
<DropdownMenuContent
|
|
32
32
|
v-bind="forwarded"
|
|
33
33
|
:class="cn(
|
|
34
|
-
'dropdown-menu-content',
|
|
34
|
+
'dropdown-menu-content data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
35
35
|
props.class,
|
|
36
36
|
props.una?.dropdownMenuContent,
|
|
37
37
|
)"
|
|
@@ -24,7 +24,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
|
24
24
|
<DropdownMenuSubContent
|
|
25
25
|
v-bind="forwarded"
|
|
26
26
|
:class="cn(
|
|
27
|
-
'dropdown-menu-sub-content',
|
|
27
|
+
'dropdown-menu-sub-content data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
28
28
|
props.class,
|
|
29
29
|
forwarded.una?.dropdownMenuSubContent,
|
|
30
30
|
)"
|
|
@@ -25,25 +25,23 @@ const forwardedProps = useForwardProps(delegatedProps)
|
|
|
25
25
|
<DropdownMenuSubTrigger
|
|
26
26
|
as-child
|
|
27
27
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</template>
|
|
47
|
-
</Button>
|
|
28
|
+
<slot>
|
|
29
|
+
<Button
|
|
30
|
+
v-bind="forwardedProps"
|
|
31
|
+
:dropdown-menu-item
|
|
32
|
+
:class="cn(
|
|
33
|
+
'dropdown-menu-sub-trigger w-full justify-start font-normal rounded-sm px-2',
|
|
34
|
+
forwardedProps.inset && !(forwardedProps.leading || $slots.leading) && 'pl-8',
|
|
35
|
+
props.class,
|
|
36
|
+
)"
|
|
37
|
+
btn="~"
|
|
38
|
+
:una="{
|
|
39
|
+
btnLeading: cn('dropdown-menu-sub-trigger-leading', forwardedProps.una?.btnLeading),
|
|
40
|
+
btnTrailing: cn('dropdown-menu-sub-trigger-trailing', forwardedProps.una?.btnTrailing),
|
|
41
|
+
...forwardedProps.una,
|
|
42
|
+
}"
|
|
43
|
+
trailing="dropdown-menu-sub-trigger-trailing-icon"
|
|
44
|
+
/>
|
|
45
|
+
</slot>
|
|
48
46
|
</dropdownmenusubtrigger>
|
|
49
47
|
</template>
|
|
@@ -13,23 +13,21 @@ const forwardedProps = useForwardProps(props)
|
|
|
13
13
|
<DropdownMenuTrigger
|
|
14
14
|
as-child
|
|
15
15
|
>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</template>
|
|
33
|
-
</Button>
|
|
16
|
+
<slot>
|
|
17
|
+
<Button
|
|
18
|
+
v-bind="forwardedProps"
|
|
19
|
+
:id="randomId('dropdown-menu-trigger')"
|
|
20
|
+
:class="cn(
|
|
21
|
+
'dropdown-menu-trigger',
|
|
22
|
+
props.class,
|
|
23
|
+
)"
|
|
24
|
+
:una="{
|
|
25
|
+
btnDefaultVariant: 'dropdown-menu-default-variant',
|
|
26
|
+
btnLeading: cn('dropdown-menu-trigger-leading', forwardedProps.una?.btnLeading),
|
|
27
|
+
btnTrailing: cn('dropdown-menu-trigger-trailing', forwardedProps.una?.btnTrailing),
|
|
28
|
+
...props.una,
|
|
29
|
+
}"
|
|
30
|
+
/>
|
|
31
|
+
</slot>
|
|
34
32
|
</DropdownMenuTrigger>
|
|
35
33
|
</template>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { TooltipRootEmits } from 'radix-vue'
|
|
3
3
|
import type { NTooltipProps } from '../../../types'
|
|
4
|
+
import { reactivePick } from '@vueuse/core'
|
|
4
5
|
import { useForwardPropsEmits } from 'radix-vue'
|
|
5
|
-
|
|
6
6
|
import TooltipContent from './TooltipContent.vue'
|
|
7
7
|
import TooltipProvider from './TooltipProvider.vue'
|
|
8
8
|
import TooltipRoot from './TooltipRoot.vue'
|
|
@@ -14,17 +14,24 @@ defineOptions({
|
|
|
14
14
|
|
|
15
15
|
const props = defineProps<NTooltipProps>()
|
|
16
16
|
const emits = defineEmits<TooltipRootEmits>()
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const rootProps = reactivePick(props, [
|
|
18
|
+
'defaultOpen',
|
|
19
|
+
'delayDuration',
|
|
20
|
+
'disableClosingTrigger',
|
|
21
|
+
'disabled',
|
|
22
|
+
'disableHoverableContent',
|
|
23
|
+
'ignoreNonKeyboardFocus',
|
|
24
|
+
'open',
|
|
25
|
+
])
|
|
26
|
+
const forwarded = useForwardPropsEmits(rootProps, emits)
|
|
19
27
|
</script>
|
|
20
28
|
|
|
21
29
|
<template>
|
|
22
30
|
<TooltipProvider
|
|
23
31
|
v-bind="_tooltipProvider"
|
|
24
|
-
:disabled
|
|
25
32
|
>
|
|
26
33
|
<TooltipRoot
|
|
27
|
-
v-bind="
|
|
34
|
+
v-bind="forwarded"
|
|
28
35
|
>
|
|
29
36
|
<TooltipTrigger
|
|
30
37
|
as-child
|
|
@@ -35,11 +42,11 @@ const forwarded = useForwardPropsEmits(props, emits)
|
|
|
35
42
|
|
|
36
43
|
<TooltipContent
|
|
37
44
|
v-if="$slots.content || content"
|
|
38
|
-
v-bind="
|
|
45
|
+
v-bind="_tooltipContent"
|
|
39
46
|
:size
|
|
40
47
|
:tooltip
|
|
41
48
|
:disabled
|
|
42
|
-
:una="
|
|
49
|
+
:una="una?.tooltipContent"
|
|
43
50
|
>
|
|
44
51
|
<slot name="content">
|
|
45
52
|
{{ content }}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { CheckboxRootEmits } from 'radix-vue'
|
|
3
3
|
import type { NCheckboxProps } from '../../types'
|
|
4
|
+
import { reactivePick } from '@vueuse/core'
|
|
4
5
|
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from 'radix-vue'
|
|
5
6
|
import { computed } from 'vue'
|
|
6
7
|
import { cn, randomId } from '../../utils'
|
|
@@ -12,11 +13,16 @@ const props = withDefaults(defineProps<NCheckboxProps>(), {
|
|
|
12
13
|
})
|
|
13
14
|
const emits = defineEmits<CheckboxRootEmits>()
|
|
14
15
|
|
|
15
|
-
const delegatedProps =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const delegatedProps = reactivePick(props, [
|
|
17
|
+
'checked',
|
|
18
|
+
'defaultChecked',
|
|
19
|
+
'disabled',
|
|
20
|
+
'id',
|
|
21
|
+
'name',
|
|
22
|
+
'required',
|
|
23
|
+
'value',
|
|
24
|
+
'size',
|
|
25
|
+
])
|
|
20
26
|
|
|
21
27
|
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
22
28
|
|
|
@@ -25,13 +31,11 @@ const id = computed(() => props.id ?? randomId('checkbox'))
|
|
|
25
31
|
|
|
26
32
|
<template>
|
|
27
33
|
<div
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
:class="cn(
|
|
35
|
+
'checkbox-wrapper flex',
|
|
30
36
|
una?.checkboxWrapper,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
]"
|
|
37
|
+
reverse && 'checkbox-reverse',
|
|
38
|
+
)"
|
|
35
39
|
>
|
|
36
40
|
<CheckboxRoot
|
|
37
41
|
v-bind="forwarded"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { NInputProps } from '../../types'
|
|
3
3
|
import { computed, onMounted, ref } from 'vue'
|
|
4
|
-
import { randomId } from '../../utils'
|
|
4
|
+
import { cn, randomId } from '../../utils'
|
|
5
5
|
import NIcon from '../elements/Icon.vue'
|
|
6
6
|
|
|
7
7
|
defineOptions({
|
|
@@ -143,11 +143,12 @@ onMounted(() => {
|
|
|
143
143
|
:value="modelValue"
|
|
144
144
|
:type="props.type !== 'textarea' ? props.type : undefined"
|
|
145
145
|
class="input"
|
|
146
|
-
:class="
|
|
146
|
+
:class="cn(
|
|
147
|
+
type === 'textarea' ? 'input-textarea' : 'input-input',
|
|
147
148
|
statusClassVariants.input,
|
|
148
149
|
reverseClassVariants.input,
|
|
149
150
|
una?.input,
|
|
150
|
-
|
|
151
|
+
)"
|
|
151
152
|
:input="input"
|
|
152
153
|
:resize="type === 'textarea' ? resize : undefined"
|
|
153
154
|
:rows="type === 'textarea' ? rows : undefined"
|
|
@@ -158,11 +159,11 @@ onMounted(() => {
|
|
|
158
159
|
|
|
159
160
|
<div
|
|
160
161
|
v-if="isTrailing"
|
|
161
|
-
:class="
|
|
162
|
+
:class="cn(
|
|
162
163
|
una?.inputTrailingWrapper,
|
|
163
164
|
reverseClassVariants.trailingWrapper,
|
|
164
165
|
statusClassVariants.text,
|
|
165
|
-
|
|
166
|
+
)"
|
|
166
167
|
>
|
|
167
168
|
<NIcon
|
|
168
169
|
v-if="loading"
|
|
@@ -5,7 +5,9 @@ import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits
|
|
|
5
5
|
import { computed } from 'vue'
|
|
6
6
|
import { cn } from '../../utils'
|
|
7
7
|
|
|
8
|
-
const props = defineProps<NSliderProps>()
|
|
8
|
+
const props = withDefaults(defineProps<NSliderProps>(), {
|
|
9
|
+
slider: 'primary',
|
|
10
|
+
})
|
|
9
11
|
const emits = defineEmits<SliderRootEmits>()
|
|
10
12
|
const delegatedProps = computed(() => {
|
|
11
13
|
const { class: _, ...delegated } = props
|
|
@@ -26,6 +28,7 @@ const isVertical = computed(() => props.orientation === 'vertical')
|
|
|
26
28
|
disabled && 'slider-disabled',
|
|
27
29
|
)"
|
|
28
30
|
v-bind="forwarded"
|
|
31
|
+
:slider="slider"
|
|
29
32
|
>
|
|
30
33
|
<slot name="slider-track">
|
|
31
34
|
<SliderTrack
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { NSwitchProps } from '../../types'
|
|
3
|
+
import { reactivePick } from '@vueuse/core'
|
|
3
4
|
import {
|
|
4
5
|
SwitchRoot,
|
|
5
6
|
type SwitchRootEmits,
|
|
@@ -11,19 +12,19 @@ import NIcon from '../elements/Icon.vue'
|
|
|
11
12
|
|
|
12
13
|
const props = withDefaults(defineProps<NSwitchProps>(), {
|
|
13
14
|
size: 'md',
|
|
14
|
-
switchChecked: '
|
|
15
|
-
switchUnchecked: '
|
|
15
|
+
switchChecked: '~',
|
|
16
|
+
switchUnchecked: '~',
|
|
16
17
|
})
|
|
17
18
|
|
|
18
19
|
const emit = defineEmits<SwitchRootEmits>()
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
+
const rootPropsEmits = useForwardPropsEmits(reactivePick(props, 'as', 'asChild', 'checked', 'defaultChecked', 'disabled', 'id', 'name', 'required', 'value'), emit)
|
|
21
22
|
</script>
|
|
22
23
|
|
|
23
24
|
<template>
|
|
24
25
|
<SwitchRoot
|
|
25
26
|
v-slot="{ checked }"
|
|
26
|
-
v-bind="
|
|
27
|
+
v-bind="rootPropsEmits"
|
|
27
28
|
:class="cn(
|
|
28
29
|
'peer switch',
|
|
29
30
|
una?.switch,
|
|
@@ -32,8 +33,8 @@ const forwarded = useForwardPropsEmits(props, emit)
|
|
|
32
33
|
: una?.switchUnchecked,
|
|
33
34
|
)"
|
|
34
35
|
:disabled="disabled || loading"
|
|
35
|
-
:switch-unchecked
|
|
36
36
|
:switch-checked
|
|
37
|
+
:switch-unchecked
|
|
37
38
|
:size
|
|
38
39
|
>
|
|
39
40
|
<SwitchThumb
|
|
@@ -47,7 +47,7 @@ provide('selectModelValue', modelValue)
|
|
|
47
47
|
|
|
48
48
|
<template>
|
|
49
49
|
<SelectRoot
|
|
50
|
-
v-bind="omitProps(forwarded, ['items', '
|
|
50
|
+
v-bind="omitProps(forwarded, ['items', 'groupItems', 'itemAttribute', 'placeholder', 'label', 'id', 'select'])"
|
|
51
51
|
:model-value="transformerValue"
|
|
52
52
|
>
|
|
53
53
|
<SelectTrigger
|
|
@@ -62,7 +62,7 @@ provide('selectModelValue', modelValue)
|
|
|
62
62
|
v-bind="forwarded._selectValue"
|
|
63
63
|
:placeholder="forwarded._selectValue?.placeholder || forwarded.placeholder"
|
|
64
64
|
>
|
|
65
|
-
<slot :value="modelValue">
|
|
65
|
+
<slot name="value" :value="modelValue">
|
|
66
66
|
{{ transformerValue }}
|
|
67
67
|
</slot>
|
|
68
68
|
</SelectValue>
|
|
@@ -80,7 +80,7 @@ provide('selectModelValue', modelValue)
|
|
|
80
80
|
>
|
|
81
81
|
<slot name="content" :items="forwarded.items">
|
|
82
82
|
<!-- single-group -->
|
|
83
|
-
<template v-if="!
|
|
83
|
+
<template v-if="!groupItems">
|
|
84
84
|
<SelectLabel
|
|
85
85
|
v-if="forwarded.label"
|
|
86
86
|
v-bind="forwarded._selectLabel"
|
|
@@ -115,18 +115,18 @@ provide('selectModelValue', modelValue)
|
|
|
115
115
|
<SelectGroup
|
|
116
116
|
v-for="(groupItems, i) in items"
|
|
117
117
|
:key="i"
|
|
118
|
-
v-bind="
|
|
118
|
+
v-bind="props._selectGroup"
|
|
119
119
|
>
|
|
120
120
|
<SelectSeparator
|
|
121
121
|
v-if="i > 0"
|
|
122
|
-
v-bind="
|
|
122
|
+
v-bind="props._selectSeparator"
|
|
123
123
|
/>
|
|
124
124
|
|
|
125
125
|
<slot name="group" :items="groupItems">
|
|
126
126
|
<SelectLabel
|
|
127
127
|
v-if="groupItems.label"
|
|
128
|
-
:size
|
|
129
|
-
v-bind="{ ...
|
|
128
|
+
:size
|
|
129
|
+
v-bind="{ ...props._selectLabel, ...groupItems._selectLabel }"
|
|
130
130
|
>
|
|
131
131
|
<slot name="label" :label="groupItems.label">
|
|
132
132
|
{{ groupItems.label }}
|
|
@@ -138,8 +138,8 @@ provide('selectModelValue', modelValue)
|
|
|
138
138
|
:key="groupItem"
|
|
139
139
|
>
|
|
140
140
|
<SelectItem
|
|
141
|
-
:value="groupItem
|
|
142
|
-
:size
|
|
141
|
+
:value="groupItem"
|
|
142
|
+
:size
|
|
143
143
|
v-bind="{ ...forwarded._selectItem, ...groupItems?._selectItem, ...groupItem._selectItem }"
|
|
144
144
|
:is-selected="groupItem === transformerValue"
|
|
145
145
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useColorMode } from '#imports'
|
|
3
3
|
import { useToggle } from '@vueuse/core'
|
|
4
|
-
import { computed } from 'vue'
|
|
4
|
+
import { capitalize, computed } from 'vue'
|
|
5
5
|
import { useUnaSettings } from '../../composables/useUnaSettings'
|
|
6
6
|
import { useUnaThemes } from '../../composables/useUnaThemes'
|
|
7
7
|
import { RADIUS } from '../../constants'
|
|
@@ -48,7 +48,7 @@ function shuffleTheme(): void {
|
|
|
48
48
|
</script>
|
|
49
49
|
|
|
50
50
|
<template>
|
|
51
|
-
<Popover :_popover-content="{ align: 'end', class: '
|
|
51
|
+
<Popover :_popover-content="{ align: 'end', class: 'w-73 bg-muted' }">
|
|
52
52
|
<template #trigger>
|
|
53
53
|
<slot name="trigger">
|
|
54
54
|
<Button
|
|
@@ -79,11 +79,14 @@ function shuffleTheme(): void {
|
|
|
79
79
|
<button
|
|
80
80
|
v-for="[key, theme] in primaryThemes"
|
|
81
81
|
:key="key"
|
|
82
|
+
:title="capitalize(key)"
|
|
82
83
|
:style="{ background: theme['--una-primary-hex'] }"
|
|
83
|
-
class="
|
|
84
|
+
class="transition-all"
|
|
85
|
+
rounded="full"
|
|
86
|
+
square="6.5"
|
|
84
87
|
:class="[currentPrimaryThemeName === key ? 'ring-2' : 'scale-93']"
|
|
85
88
|
ring="primary offset-4 offset-base"
|
|
86
|
-
aria-label="Primary Color"
|
|
89
|
+
:aria-label="`Primary Color: ${key}`"
|
|
87
90
|
@click="updatePrimaryTheme(key)"
|
|
88
91
|
/>
|
|
89
92
|
</div>
|
|
@@ -97,10 +100,13 @@ function shuffleTheme(): void {
|
|
|
97
100
|
<button
|
|
98
101
|
v-for="[key, theme] in grayThemes"
|
|
99
102
|
:key="key"
|
|
103
|
+
:title="capitalize(key)"
|
|
100
104
|
:style="{ background: theme['--una-gray-hex'] }"
|
|
101
105
|
:class="currentGrayThemeName === key ? 'ring-2' : 'scale-93'"
|
|
102
|
-
class="
|
|
103
|
-
|
|
106
|
+
class="transition-all"
|
|
107
|
+
rounded="full"
|
|
108
|
+
square="6.5"
|
|
109
|
+
:aria-label="`Gray Color: ${key}`"
|
|
104
110
|
ring="gray offset-4 offset-base"
|
|
105
111
|
@click="updateGrayTheme(key)"
|
|
106
112
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneVNode, computed, defineComponent, h } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import Avatar from "../elements/avatar/Avatar.vue";
|
|
3
3
|
export default defineComponent({
|
|
4
4
|
props: {
|
|
5
5
|
max: {
|
|
@@ -29,7 +29,7 @@ export default defineComponent({
|
|
|
29
29
|
const label = computed(() => {
|
|
30
30
|
if (countChildren.value <= props.max)
|
|
31
31
|
return null;
|
|
32
|
-
return h(
|
|
32
|
+
return h(Avatar, {
|
|
33
33
|
// TODO: add `more` configuration
|
|
34
34
|
class: "avatar-(soft group-margin)",
|
|
35
35
|
label: `+${countChildren.value - props.max}`,
|
|
@@ -1,75 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AvatarFallbackProps, AvatarImageProps, AvatarRootProps } from 'radix-vue';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
interface BaseProps {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Think of it as a shortcut for adding options or variants to the preset if available.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/avatar.ts
|
|
7
|
-
* @example
|
|
8
|
-
* avatar="solid-green"
|
|
9
|
-
*/
|
|
10
|
-
avatar?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Add icon instead of image.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* icon="i-heroicons-information-circle"
|
|
16
|
-
*/
|
|
17
|
-
icon?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Add a label to the avatar.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* label="PR"
|
|
6
|
+
* Set the size of the avatar.
|
|
23
7
|
*/
|
|
24
|
-
|
|
8
|
+
size?: HTMLAttributes['class'];
|
|
25
9
|
/**
|
|
26
|
-
* Set the
|
|
10
|
+
* Set the height and width of the avatar.
|
|
27
11
|
*/
|
|
28
|
-
|
|
12
|
+
square?: HTMLAttributes['class'];
|
|
29
13
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* src="https://i.pravatar.cc/300"
|
|
14
|
+
* Set the border radius of the avatar.
|
|
34
15
|
*/
|
|
35
|
-
|
|
16
|
+
rounded?: HTMLAttributes['class'];
|
|
17
|
+
}
|
|
18
|
+
export interface NAvatarProps extends BaseProps, NAvatarRootProps, NAvatarAvatarFallbackProps, NAvatarImageProps {
|
|
19
|
+
_avatarRoot?: NAvatarRootProps;
|
|
20
|
+
_avatarImage?: NAvatarImageProps;
|
|
21
|
+
_avatarFallback?: NAvatarAvatarFallbackProps;
|
|
36
22
|
/**
|
|
37
|
-
*
|
|
23
|
+
* `UnaUI` preset configuration
|
|
38
24
|
*
|
|
39
|
-
* @
|
|
40
|
-
* alt="Profile"
|
|
25
|
+
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/avatar.ts
|
|
41
26
|
*/
|
|
42
|
-
|
|
27
|
+
una?: NAvatarUnaProps;
|
|
28
|
+
}
|
|
29
|
+
export interface NAvatarRootProps extends AvatarRootProps, BaseProps {
|
|
43
30
|
/**
|
|
44
|
-
*
|
|
31
|
+
* Allows you to add `UnaUI` avatar preset properties,
|
|
32
|
+
* Think of it as a shortcut for adding options or variants to the preset if available.
|
|
45
33
|
*
|
|
34
|
+
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/avatar.ts
|
|
46
35
|
* @example
|
|
47
|
-
*
|
|
36
|
+
* avatar="solid-green"
|
|
48
37
|
*/
|
|
49
|
-
|
|
38
|
+
avatar?: HTMLAttributes['class'];
|
|
39
|
+
una?: NAvatarUnaProps['avatarRoot'];
|
|
40
|
+
}
|
|
41
|
+
export interface NAvatarAvatarFallbackProps extends AvatarFallbackProps, BaseProps {
|
|
50
42
|
/**
|
|
51
|
-
* Add a
|
|
52
|
-
*
|
|
53
|
-
* @default 0
|
|
43
|
+
* Add a label to the fallback.
|
|
54
44
|
*/
|
|
55
|
-
|
|
45
|
+
label?: string;
|
|
56
46
|
/**
|
|
57
|
-
*
|
|
47
|
+
* Convert `label` prop to icon component.
|
|
58
48
|
*
|
|
59
49
|
* @default false
|
|
50
|
+
* @example
|
|
51
|
+
* icon
|
|
52
|
+
* label="i-lucide-user"
|
|
60
53
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
una?:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
icon?: boolean;
|
|
55
|
+
una?: NAvatarUnaProps['avatarFallback'];
|
|
56
|
+
}
|
|
57
|
+
export interface NAvatarImageProps extends Omit<AvatarImageProps, 'src'>, BaseProps {
|
|
58
|
+
src?: string;
|
|
59
|
+
alt?: string;
|
|
60
|
+
una?: NAvatarUnaProps['avatarImage'];
|
|
61
|
+
}
|
|
62
|
+
export interface NAvatarUnaProps {
|
|
63
|
+
avatarRoot?: HTMLAttributes['class'];
|
|
64
|
+
avatarImage?: HTMLAttributes['class'];
|
|
65
|
+
avatarFallback?: HTMLAttributes['class'];
|
|
66
|
+
avatarLabel?: HTMLAttributes['class'];
|
|
67
|
+
avatarIcon?: HTMLAttributes['class'];
|
|
75
68
|
}
|
|
69
|
+
export {};
|
|
@@ -51,6 +51,12 @@ export interface NButtonProps extends BaseExtensionProps {
|
|
|
51
51
|
* @default false
|
|
52
52
|
*/
|
|
53
53
|
loading?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Make the button full width.
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
block?: boolean;
|
|
54
60
|
/**
|
|
55
61
|
* Change the button tag to `NuxtLink` component,
|
|
56
62
|
* This allows you to use `NuxtLink` available props.
|
|
@@ -5,32 +5,11 @@ interface BaseExtensions {
|
|
|
5
5
|
class?: HTMLAttributes['class'];
|
|
6
6
|
}
|
|
7
7
|
export interface NCheckboxProps extends CheckboxRootProps, NLabelProps, BaseExtensions {
|
|
8
|
-
/**
|
|
9
|
-
* Disable the checkbox.
|
|
10
|
-
*/
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Switch the position of label and checkbox.
|
|
14
|
-
*/
|
|
15
|
-
reverse?: boolean;
|
|
16
8
|
/**
|
|
17
9
|
* Allows you to add `UnaUI` checkbox preset properties,
|
|
18
10
|
* Think of it as a shortcut for adding options or variants to the preset if available.
|
|
19
11
|
*/
|
|
20
12
|
checkbox?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Add name attribute to the checkbox.
|
|
23
|
-
*
|
|
24
|
-
* @default null
|
|
25
|
-
*/
|
|
26
|
-
name?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Manually set the id attribute.
|
|
29
|
-
* By default, the id attribute is generated randomly for accessibility reasons.
|
|
30
|
-
*
|
|
31
|
-
* @default randomId
|
|
32
|
-
*/
|
|
33
|
-
id?: string;
|
|
34
13
|
/**
|
|
35
14
|
* Display label text.
|
|
36
15
|
*
|
|
@@ -46,6 +25,10 @@ export interface NCheckboxProps extends CheckboxRootProps, NLabelProps, BaseExte
|
|
|
46
25
|
* size="sm" | size="2cm" | size="2rem" | size="2px"
|
|
47
26
|
*/
|
|
48
27
|
size?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Switch the position of label and checkbox.
|
|
30
|
+
*/
|
|
31
|
+
reverse?: boolean;
|
|
49
32
|
/**
|
|
50
33
|
* `UnaUI` preset configuration
|
|
51
34
|
*
|
|
@@ -22,12 +22,6 @@ export interface NSelectProps extends SelectExtensions {
|
|
|
22
22
|
* The unique id of the select.
|
|
23
23
|
*/
|
|
24
24
|
id?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Enable multiple group items.
|
|
27
|
-
*
|
|
28
|
-
* @default false
|
|
29
|
-
*/
|
|
30
|
-
multipleGroup?: boolean;
|
|
31
25
|
/**
|
|
32
26
|
* The attribute name to use to display in the select items.
|
|
33
27
|
*
|
|
@@ -51,10 +45,21 @@ export interface NSelectProps extends SelectExtensions {
|
|
|
51
45
|
* @default []
|
|
52
46
|
*/
|
|
53
47
|
items: any[];
|
|
48
|
+
/**
|
|
49
|
+
* Allows for multiple groups within the select.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
* @example
|
|
53
|
+
* items: [
|
|
54
|
+
* { label: 'Group 1', items: [1, 2, 3] },
|
|
55
|
+
* ]
|
|
56
|
+
*/
|
|
57
|
+
groupItems?: boolean;
|
|
54
58
|
_selectScrollUpButton?: Partial<NSelectScrollUpButtonProps>;
|
|
55
59
|
_selectItemText?: Partial<NSelectItemTextProps>;
|
|
56
60
|
_selectScrollDownButton?: Partial<NSelectScrollDownButtonProps>;
|
|
57
61
|
_selectGroup?: Partial<NSelectGroupProps>;
|
|
62
|
+
_selectSeparator?: Partial<NSelectSeparator>;
|
|
58
63
|
_selectContent?: Partial<NSelectContentProps>;
|
|
59
64
|
_selectValue?: Partial<NSelectValueProps>;
|
|
60
65
|
_selectTrigger?: Partial<NSelectTriggerProps>;
|
|
@@ -13,7 +13,7 @@ export interface NSeparatorProps extends Extensions {
|
|
|
13
13
|
* @example
|
|
14
14
|
* separator="solid-green"
|
|
15
15
|
*/
|
|
16
|
-
separator?:
|
|
16
|
+
separator?: HTMLAttributes['class'];
|
|
17
17
|
/**
|
|
18
18
|
* Allows you to change the orientation and position of the separator.
|
|
19
19
|
*
|
|
@@ -28,7 +28,7 @@ export interface NSeparatorProps extends Extensions {
|
|
|
28
28
|
* @example
|
|
29
29
|
* size="sm" | size="2cm" | size="2rem" | size="2px"
|
|
30
30
|
*/
|
|
31
|
-
size?:
|
|
31
|
+
size?: HTMLAttributes['class'];
|
|
32
32
|
/**
|
|
33
33
|
* `UnaUI` preset configuration
|
|
34
34
|
*
|
|
@@ -11,7 +11,7 @@ export interface NSkeletonProps extends Extensions {
|
|
|
11
11
|
* @example
|
|
12
12
|
* skeleton="green""
|
|
13
13
|
*/
|
|
14
|
-
skeleton?:
|
|
14
|
+
skeleton?: HTMLAttributes['class'];
|
|
15
15
|
/**
|
|
16
16
|
* Allows you to change the size of the skeleton.
|
|
17
17
|
*
|
|
@@ -20,7 +20,15 @@ export interface NSkeletonProps extends Extensions {
|
|
|
20
20
|
* @example
|
|
21
21
|
* size="sm" | size="2cm" | size="2rem" | size="2px"
|
|
22
22
|
*/
|
|
23
|
-
size?:
|
|
23
|
+
size?: HTMLAttributes['class'];
|
|
24
|
+
/**
|
|
25
|
+
* Allows you to change the shape of the skeleton.
|
|
26
|
+
* @default rounded
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* rounded="none" | rounded="sm" | rounded="md" | rounded="lg" | rounded="full"
|
|
30
|
+
*/
|
|
31
|
+
rounded?: HTMLAttributes['class'];
|
|
24
32
|
/**
|
|
25
33
|
* `UnaUI` preset configuration
|
|
26
34
|
*
|
|
@@ -7,11 +7,7 @@ interface BaseExtensions {
|
|
|
7
7
|
}
|
|
8
8
|
type TriggerExtensions = NButtonProps & TooltipTriggerProps;
|
|
9
9
|
type ContentExtensions = BaseExtensions & TooltipContentProps;
|
|
10
|
-
export interface NTooltipProps extends BaseExtensions {
|
|
11
|
-
/**
|
|
12
|
-
* Disable the tooltip.
|
|
13
|
-
*/
|
|
14
|
-
disabled?: boolean;
|
|
10
|
+
export interface NTooltipProps extends BaseExtensions, TooltipRootProps {
|
|
15
11
|
/**
|
|
16
12
|
* Add a content of the tooltip.
|
|
17
13
|
*/
|
|
@@ -26,16 +22,14 @@ export interface NTooltipProps extends BaseExtensions {
|
|
|
26
22
|
*/
|
|
27
23
|
tooltip?: HTMLAttributes['class'];
|
|
28
24
|
_tooltipProvider?: Partial<NTooltipProviderProps>;
|
|
29
|
-
_tooltipRoot?: Partial<NTooltipRootProps>;
|
|
30
25
|
_tooltipTrigger?: Partial<NTooltipTriggerProps>;
|
|
31
26
|
_tooltipContent?: Partial<NTooltipContentProps>;
|
|
32
27
|
una?: NTooltipUnaProps;
|
|
33
28
|
}
|
|
34
|
-
export interface NTooltipRootProps extends TooltipRootProps {
|
|
35
|
-
'onUpdate:open'?: (value: boolean) => void;
|
|
36
|
-
}
|
|
37
29
|
export interface NTooltipProviderProps extends TooltipProviderProps {
|
|
38
30
|
}
|
|
31
|
+
export interface NTooltipRootProps extends TooltipRootProps {
|
|
32
|
+
}
|
|
39
33
|
export interface NTooltipTriggerProps extends TriggerExtensions {
|
|
40
34
|
}
|
|
41
35
|
export interface NTooltipContentProps extends ContentExtensions {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@una-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.29.0-beta.1",
|
|
5
5
|
"description": "Nuxt module for @una-ui",
|
|
6
6
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,33 +28,33 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@headlessui/vue": "^1.7.23",
|
|
30
30
|
"@iconify-json/heroicons": "^1.2.1",
|
|
31
|
-
"@iconify-json/lucide": "^1.2.
|
|
31
|
+
"@iconify-json/lucide": "^1.2.15",
|
|
32
32
|
"@iconify-json/radix-icons": "^1.2.1",
|
|
33
|
-
"@iconify-json/tabler": "^1.2.
|
|
34
|
-
"@nuxt/kit": "^3.
|
|
35
|
-
"@nuxtjs/color-mode": "^3.5.
|
|
33
|
+
"@iconify-json/tabler": "^1.2.8",
|
|
34
|
+
"@nuxt/kit": "^3.14.159",
|
|
35
|
+
"@nuxtjs/color-mode": "^3.5.2",
|
|
36
36
|
"@tanstack/vue-table": "^8.20.5",
|
|
37
|
-
"@unocss/core": "^0.63.
|
|
38
|
-
"@unocss/nuxt": "^0.63.
|
|
39
|
-
"@unocss/preset-attributify": "^0.63.
|
|
40
|
-
"@unocss/preset-icons": "^0.63.
|
|
41
|
-
"@vueuse/core": "^11.
|
|
42
|
-
"@vueuse/integrations": "^11.
|
|
43
|
-
"@vueuse/nuxt": "^11.
|
|
37
|
+
"@unocss/core": "^0.63.6",
|
|
38
|
+
"@unocss/nuxt": "^0.63.6",
|
|
39
|
+
"@unocss/preset-attributify": "^0.63.6",
|
|
40
|
+
"@unocss/preset-icons": "^0.63.6",
|
|
41
|
+
"@vueuse/core": "^11.3.0",
|
|
42
|
+
"@vueuse/integrations": "^11.3.0",
|
|
43
|
+
"@vueuse/nuxt": "^11.3.0",
|
|
44
44
|
"clsx": "^2.1.1",
|
|
45
45
|
"ohash": "^1.1.4",
|
|
46
46
|
"radix-vue": "^1.9.7",
|
|
47
|
-
"tailwind-merge": "^2.5.
|
|
47
|
+
"tailwind-merge": "^2.5.4",
|
|
48
48
|
"typescript": "^5.6.3",
|
|
49
|
-
"unocss": "^0.63.
|
|
49
|
+
"unocss": "^0.63.6",
|
|
50
50
|
"unocss-preset-animations": "^1.1.0",
|
|
51
|
-
"@una-ui/extractor-vue-script": "^0.
|
|
52
|
-
"@una-ui/preset": "^0.
|
|
51
|
+
"@una-ui/extractor-vue-script": "^0.29.0-beta.1",
|
|
52
|
+
"@una-ui/preset": "^0.29.0-beta.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@nuxt/module-builder": "^0.8.4",
|
|
56
|
-
"@nuxt/schema": "^3.
|
|
57
|
-
"nuxt": "^3.
|
|
56
|
+
"@nuxt/schema": "^3.14.159",
|
|
57
|
+
"nuxt": "^3.14.159"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { NAvatarProps } from '../../types'
|
|
3
|
-
import { useImage } from '@vueuse/core'
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
import NIcon from './Icon.vue'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(defineProps<NAvatarProps>(), {
|
|
8
|
-
delay: 0,
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
const { isLoading, error, isReady } = useImage({ src: props?.src ?? '' }, { delay: props.delay })
|
|
12
|
-
|
|
13
|
-
// TODO: sync with NAvatarProps
|
|
14
|
-
const avatarVariants = ['solid', 'soft', 'outline'] as const
|
|
15
|
-
const hasVariant = computed(() => avatarVariants.some(avatarVariants => props.avatar?.includes(avatarVariants)))
|
|
16
|
-
const isBaseVariant = computed(() => props.avatar?.includes('~'))
|
|
17
|
-
|
|
18
|
-
const placeholder = computed(() => {
|
|
19
|
-
if (props.label)
|
|
20
|
-
return props.label
|
|
21
|
-
|
|
22
|
-
return props.alt?.split(' ').map(word => word[0]).join('').slice(0, 2)
|
|
23
|
-
})
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
<span
|
|
28
|
-
:avatar="avatar"
|
|
29
|
-
:size="size"
|
|
30
|
-
class="avatar"
|
|
31
|
-
:class="[
|
|
32
|
-
{ 'avatar-default-variant': !hasVariant && !isBaseVariant },
|
|
33
|
-
{ 'animate-pulse': isLoading && skeleton && src },
|
|
34
|
-
una?.avatar,
|
|
35
|
-
]"
|
|
36
|
-
>
|
|
37
|
-
<template v-if="!icon">
|
|
38
|
-
<slot
|
|
39
|
-
v-if="!skeleton"
|
|
40
|
-
v-bind="{ isLoading, error, isReady, ...props }"
|
|
41
|
-
>
|
|
42
|
-
<img
|
|
43
|
-
v-if="isReady && !error"
|
|
44
|
-
avatar="src"
|
|
45
|
-
:src="src"
|
|
46
|
-
:alt="alt"
|
|
47
|
-
:class="una?.avatarSrc"
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
<img
|
|
51
|
-
v-else-if="fallback"
|
|
52
|
-
avatar="src"
|
|
53
|
-
:src="fallback"
|
|
54
|
-
:alt="alt ?? 'avatar'"
|
|
55
|
-
:class="una?.avatarFallback"
|
|
56
|
-
>
|
|
57
|
-
|
|
58
|
-
<span
|
|
59
|
-
v-else-if="placeholder"
|
|
60
|
-
avatar="label"
|
|
61
|
-
:class="una?.avatarLabel"
|
|
62
|
-
>
|
|
63
|
-
{{ placeholder }}
|
|
64
|
-
</span>
|
|
65
|
-
|
|
66
|
-
<NIcon
|
|
67
|
-
v-else
|
|
68
|
-
avatar="fallback-icon-base"
|
|
69
|
-
:name="una?.avatarFallbackIcon ?? 'avatar-fallback-icon'"
|
|
70
|
-
:class="una?.avatarFallbackIcon"
|
|
71
|
-
/>
|
|
72
|
-
</slot>
|
|
73
|
-
</template>
|
|
74
|
-
|
|
75
|
-
<template v-else>
|
|
76
|
-
<NIcon
|
|
77
|
-
avatar="icon-base"
|
|
78
|
-
:class="una?.avatarIconBase"
|
|
79
|
-
:name="icon"
|
|
80
|
-
/>
|
|
81
|
-
</template>
|
|
82
|
-
</span>
|
|
83
|
-
</template>
|