@una-ui/nuxt 0.7.0-beta.1 → 0.8.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 +10 -2
- package/dist/runtime/components/elements/Button.vue +7 -4
- package/dist/runtime/components/forms/Slider.vue +0 -1
- package/dist/runtime/components/forms/select/Select.vue +152 -0
- package/dist/runtime/components/forms/select/SelectContent.vue +64 -0
- package/dist/runtime/components/forms/select/SelectGroup.vue +20 -0
- package/dist/runtime/components/forms/select/SelectItem.vue +57 -0
- package/dist/runtime/components/forms/select/SelectItemIndicator.vue +31 -0
- package/dist/runtime/components/forms/select/SelectItemText.vue +12 -0
- package/dist/runtime/components/forms/select/SelectLabel.vue +13 -0
- package/dist/runtime/components/forms/select/SelectRoot.vue +24 -0
- package/dist/runtime/components/forms/select/SelectScrollDownButton.vue +27 -0
- package/dist/runtime/components/forms/select/SelectScrollUpButton.vue +27 -0
- package/dist/runtime/components/forms/select/SelectSeparator.vue +18 -0
- package/dist/runtime/components/forms/select/SelectTrigger.vue +82 -0
- package/dist/runtime/components/forms/select/SelectValue.vue +15 -0
- package/dist/runtime/types/button.d.ts +15 -1
- package/dist/runtime/types/icon.d.ts +2 -1
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/select.d.ts +150 -0
- package/dist/runtime/types/select.js +0 -0
- package/dist/runtime/types/skeleton.d.ts +5 -5
- package/dist/runtime/utils/index.d.ts +10 -0
- package/dist/runtime/utils/index.js +7 -0
- package/dist/una.config.mjs +2 -0
- package/package.json +4 -3
- package/playground/.nuxt/components.d.ts +1244 -0
- package/playground/.nuxt/imports.d.ts +1 -1
- package/playground/.nuxt/nuxt.d.ts +1 -1
- package/playground/.nuxt/types/imports.d.ts +3 -3
- package/playground/.nuxt/types/plugins.d.ts +2 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponentsDir, addPlugin,
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponentsDir, addPlugin, addImportsDir, installModule } from '@nuxt/kit';
|
|
2
2
|
import extendUnocssOptions from './una.config.mjs';
|
|
3
3
|
import 'unocss';
|
|
4
|
+
import 'unocss-preset-animations';
|
|
4
5
|
import '@una-ui/preset';
|
|
5
6
|
import '@una-ui/preset/prefixes';
|
|
6
7
|
import '@una-ui/extractor-vue-script';
|
|
7
8
|
|
|
8
9
|
const name = "@una-ui/nuxt";
|
|
9
|
-
const version = "0.
|
|
10
|
+
const version = "0.8.0-beta.1";
|
|
10
11
|
|
|
11
12
|
const module = defineNuxtModule({
|
|
12
13
|
meta: {
|
|
@@ -45,6 +46,12 @@ const module = defineNuxtModule({
|
|
|
45
46
|
global: options.global,
|
|
46
47
|
watch: nuxt.options.dev
|
|
47
48
|
});
|
|
49
|
+
addComponentsDir({
|
|
50
|
+
path: resolve(runtimeDir, "components/forms", "select"),
|
|
51
|
+
prefix: options.prefix,
|
|
52
|
+
global: options.global,
|
|
53
|
+
watch: nuxt.options.dev
|
|
54
|
+
});
|
|
48
55
|
addComponentsDir({
|
|
49
56
|
path: resolve(runtimeDir, "components", "misc"),
|
|
50
57
|
prefix: options.prefix,
|
|
@@ -63,6 +70,7 @@ const module = defineNuxtModule({
|
|
|
63
70
|
}
|
|
64
71
|
if (!options.dev)
|
|
65
72
|
nuxt.options.unocss = extendUnocssOptions(nuxt.options.unocss);
|
|
73
|
+
addImportsDir(resolve(runtimeDir, "utils", "cn"));
|
|
66
74
|
await installModule("radix-vue/nuxt");
|
|
67
75
|
await installModule("@unocss/nuxt");
|
|
68
76
|
await installModule("@nuxtjs/color-mode", {
|
|
@@ -4,6 +4,7 @@ import { createReusableTemplate } from '@vueuse/core'
|
|
|
4
4
|
import NIcon from '../elements/Icon.vue'
|
|
5
5
|
import type { NButtonProps } from '../../types'
|
|
6
6
|
import NLink from '../elements/Link.vue'
|
|
7
|
+
import { cn } from '../../utils'
|
|
7
8
|
|
|
8
9
|
defineOptions({
|
|
9
10
|
inheritAttrs: false,
|
|
@@ -29,16 +30,18 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
|
|
|
29
30
|
:is="to ? NLink : 'button'"
|
|
30
31
|
:to="to"
|
|
31
32
|
:type="to ? null : type"
|
|
32
|
-
class="
|
|
33
|
-
:class="[
|
|
33
|
+
:class="cn(
|
|
34
34
|
!hasVariant && !isBaseVariant ? una?.btnDefaultVariant : null,
|
|
35
|
+
'btn',
|
|
35
36
|
{ 'btn-reverse': reverse },
|
|
37
|
+
props.class,
|
|
36
38
|
una?.btn,
|
|
37
|
-
|
|
39
|
+
)"
|
|
38
40
|
:disabled="to ? null : disabled || loading"
|
|
39
41
|
:btn="btn"
|
|
40
42
|
:aria-label="icon ? label : null"
|
|
41
43
|
v-bind="$attrs"
|
|
44
|
+
:size="size"
|
|
42
45
|
>
|
|
43
46
|
<DefineTemplate v-if="loading">
|
|
44
47
|
<slot name="loading">
|
|
@@ -89,8 +92,8 @@ const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
|
|
|
89
92
|
<NIcon
|
|
90
93
|
v-if="trailing"
|
|
91
94
|
:name="trailing"
|
|
92
|
-
:class="una?.btnTrailing"
|
|
93
95
|
btn="trailing"
|
|
96
|
+
:class="una?.btnTrailing"
|
|
94
97
|
/>
|
|
95
98
|
</slot>
|
|
96
99
|
</Component>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, provide } from 'vue'
|
|
3
|
+
import type { SelectRootEmits } from 'radix-vue'
|
|
4
|
+
import {
|
|
5
|
+
useForwardPropsEmits,
|
|
6
|
+
} from 'radix-vue'
|
|
7
|
+
import type { NSelectProps } from '../../../types'
|
|
8
|
+
import { isEqualObject, omitProps } from '../../../utils'
|
|
9
|
+
import SelectRoot from './SelectRoot.vue'
|
|
10
|
+
import SelectTrigger from './SelectTrigger.vue'
|
|
11
|
+
import SelectGroup from './SelectGroup.vue'
|
|
12
|
+
import SelectItem from './SelectItem.vue'
|
|
13
|
+
import SelectLabel from './SelectLabel.vue'
|
|
14
|
+
import SelectContent from './SelectContent.vue'
|
|
15
|
+
import SelectValue from './SelectValue.vue'
|
|
16
|
+
import SelectSeparator from './SelectSeparator.vue'
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(defineProps<NSelectProps>(), {
|
|
19
|
+
size: 'sm',
|
|
20
|
+
})
|
|
21
|
+
const emits = defineEmits<SelectRootEmits>()
|
|
22
|
+
|
|
23
|
+
const delegatedProps = computed(() => {
|
|
24
|
+
const { class: _, ...delegated } = props
|
|
25
|
+
|
|
26
|
+
return delegated
|
|
27
|
+
})
|
|
28
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
29
|
+
|
|
30
|
+
const transformerValue = computed(() => {
|
|
31
|
+
if (typeof forwarded.value.modelValue === 'object') {
|
|
32
|
+
if (forwarded.value.valueAttribute)
|
|
33
|
+
return forwarded.value.modelValue[forwarded.value.valueAttribute]
|
|
34
|
+
|
|
35
|
+
if (forwarded.value.itemAttribute)
|
|
36
|
+
return forwarded.value.modelValue[forwarded.value.itemAttribute]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return forwarded.value.modelValue
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
provide('selectModelValue', forwarded.value.modelValue)
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<SelectRoot
|
|
47
|
+
v-bind="omitProps(forwarded, ['items', 'multipleGroup', 'itemAttribute', 'placeholder', 'label', 'id'])"
|
|
48
|
+
>
|
|
49
|
+
<SelectTrigger
|
|
50
|
+
:id="forwarded.id"
|
|
51
|
+
:size="forwarded.size"
|
|
52
|
+
:status="forwarded.status"
|
|
53
|
+
v-bind="forwarded._selectTrigger"
|
|
54
|
+
>
|
|
55
|
+
<slot name="trigger" :value="forwarded.modelValue">
|
|
56
|
+
<SelectValue
|
|
57
|
+
v-bind="forwarded._selectValue"
|
|
58
|
+
:placeholder="forwarded._selectValue?.placeholder || forwarded.placeholder"
|
|
59
|
+
>
|
|
60
|
+
<slot :value="forwarded.modelValue">
|
|
61
|
+
{{ transformerValue }}
|
|
62
|
+
</slot>
|
|
63
|
+
</SelectValue>
|
|
64
|
+
</slot>
|
|
65
|
+
</SelectTrigger>
|
|
66
|
+
|
|
67
|
+
<SelectContent
|
|
68
|
+
:size="forwarded.size"
|
|
69
|
+
v-bind="{
|
|
70
|
+
...forwarded._selectContent,
|
|
71
|
+
_selectScrollDownButton: forwarded._selectScrollDownButton,
|
|
72
|
+
_selectScrollUpButton: forwarded._selectScrollUpButton,
|
|
73
|
+
_selectViewport: forwarded._selectViewport,
|
|
74
|
+
}"
|
|
75
|
+
>
|
|
76
|
+
<slot name="content" :items="forwarded.items">
|
|
77
|
+
<!-- single-group -->
|
|
78
|
+
<template v-if="!forwarded.multipleGroup">
|
|
79
|
+
<SelectLabel
|
|
80
|
+
v-if="forwarded.label"
|
|
81
|
+
v-bind="forwarded._selectLabel"
|
|
82
|
+
>
|
|
83
|
+
<slot name="label" :label="forwarded.label">
|
|
84
|
+
{{ forwarded.label }}
|
|
85
|
+
</slot>
|
|
86
|
+
</SelectLabel>
|
|
87
|
+
|
|
88
|
+
<template
|
|
89
|
+
v-for="item in items"
|
|
90
|
+
:key="item"
|
|
91
|
+
>
|
|
92
|
+
<SelectItem
|
|
93
|
+
:value="item"
|
|
94
|
+
:size="forwarded.size"
|
|
95
|
+
v-bind="{ ...forwarded._selectItem, ...item._selectItem }"
|
|
96
|
+
:is-selected="isEqualObject(item, forwarded.modelValue)"
|
|
97
|
+
>
|
|
98
|
+
<slot name="item" :item="item">
|
|
99
|
+
{{ props.itemAttribute ? item[props.itemAttribute] : item }}
|
|
100
|
+
</slot>
|
|
101
|
+
</SelectItem>
|
|
102
|
+
</template>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<!-- multiple-group -->
|
|
106
|
+
<template
|
|
107
|
+
v-else
|
|
108
|
+
>
|
|
109
|
+
<SelectGroup
|
|
110
|
+
v-for="(groupItems, i) in items"
|
|
111
|
+
:key="i"
|
|
112
|
+
v-bind="forwarded._selectGroup"
|
|
113
|
+
>
|
|
114
|
+
<SelectSeparator
|
|
115
|
+
v-if="i > 0"
|
|
116
|
+
v-bind="forwarded._selectSeparator"
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
<slot name="group" :items="groupItems">
|
|
120
|
+
<SelectLabel
|
|
121
|
+
v-if="groupItems.label"
|
|
122
|
+
:size="forwarded.size"
|
|
123
|
+
v-bind="{ ...forwarded._selectLabel, ...groupItems._selectLabel }"
|
|
124
|
+
>
|
|
125
|
+
<slot name="label" :label="groupItems.label">
|
|
126
|
+
{{ groupItems.label }}
|
|
127
|
+
</slot>
|
|
128
|
+
</SelectLabel>
|
|
129
|
+
|
|
130
|
+
<template
|
|
131
|
+
v-for="groupItem in groupItems.items"
|
|
132
|
+
:key="groupItem"
|
|
133
|
+
>
|
|
134
|
+
<SelectItem
|
|
135
|
+
:value="groupItem "
|
|
136
|
+
:size="forwarded.size"
|
|
137
|
+
v-bind="{ ...forwarded._selectItem, ...groupItems?._selectItem, ...groupItem._selectItem }"
|
|
138
|
+
:is-selected="groupItem === transformerValue"
|
|
139
|
+
>
|
|
140
|
+
<slot name="item" :item="groupItem">
|
|
141
|
+
{{ props.itemAttribute ? groupItem[props.itemAttribute] : groupItem }}
|
|
142
|
+
</slot>
|
|
143
|
+
</SelectItem>
|
|
144
|
+
</template>
|
|
145
|
+
</slot>
|
|
146
|
+
</SelectGroup>
|
|
147
|
+
</template>
|
|
148
|
+
<slot />
|
|
149
|
+
</slot>
|
|
150
|
+
</SelectContent>
|
|
151
|
+
</SelectRoot>
|
|
152
|
+
</template>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
SelectContent,
|
|
5
|
+
type SelectContentEmits,
|
|
6
|
+
SelectPortal,
|
|
7
|
+
SelectViewport,
|
|
8
|
+
useForwardPropsEmits,
|
|
9
|
+
} from 'radix-vue'
|
|
10
|
+
import { cn } from '../../../utils'
|
|
11
|
+
import type { NSelectContentProps } from '../../../types'
|
|
12
|
+
import SelectScrollDownButton from './SelectScrollDownButton.vue'
|
|
13
|
+
import SelectScrollUpButton from './SelectScrollUpButton.vue'
|
|
14
|
+
|
|
15
|
+
defineOptions({
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(
|
|
20
|
+
defineProps<NSelectContentProps>(),
|
|
21
|
+
{
|
|
22
|
+
position: 'popper',
|
|
23
|
+
},
|
|
24
|
+
)
|
|
25
|
+
const emits = defineEmits<SelectContentEmits>()
|
|
26
|
+
|
|
27
|
+
const delegatedProps = computed(() => {
|
|
28
|
+
const { class: _, ...delegated } = props
|
|
29
|
+
|
|
30
|
+
return delegated
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<SelectPortal>
|
|
38
|
+
<SelectContent
|
|
39
|
+
v-bind="{ ...forwarded, ...$attrs }"
|
|
40
|
+
:class="cn(
|
|
41
|
+
'select-content',
|
|
42
|
+
position === 'popper'
|
|
43
|
+
&& 'select-content-popper',
|
|
44
|
+
props.class,
|
|
45
|
+
)
|
|
46
|
+
"
|
|
47
|
+
>
|
|
48
|
+
<SelectScrollUpButton
|
|
49
|
+
v-bind="forwarded._selectScrollUpButton"
|
|
50
|
+
/>
|
|
51
|
+
<SelectViewport
|
|
52
|
+
:class="cn(
|
|
53
|
+
'select-viewport',
|
|
54
|
+
position === 'popper' && 'select-viewport-popper')"
|
|
55
|
+
v-bind="forwarded._selectViewport"
|
|
56
|
+
>
|
|
57
|
+
<slot />
|
|
58
|
+
</SelectViewport>
|
|
59
|
+
<SelectScrollDownButton
|
|
60
|
+
v-bind="forwarded._selectScrollDownButton"
|
|
61
|
+
/>
|
|
62
|
+
</SelectContent>
|
|
63
|
+
</SelectPortal>
|
|
64
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { SelectGroup } from 'radix-vue'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
import type { NSelectGroupProps } from '../../../types'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<NSelectGroupProps>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<SelectGroup :class="cn('select-group', props.class)" v-bind="delegatedProps">
|
|
18
|
+
<slot />
|
|
19
|
+
</SelectGroup>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
SelectItem,
|
|
5
|
+
useForwardProps,
|
|
6
|
+
} from 'radix-vue'
|
|
7
|
+
import { cn } from '../../../utils'
|
|
8
|
+
import type { NSelectItemProps, NSelectProps } from '../../../types'
|
|
9
|
+
import SelectItemText from './SelectItemText.vue'
|
|
10
|
+
import SelectItemIndicator from './SelectItemIndicator.vue'
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<NSelectItemProps>(), {})
|
|
13
|
+
|
|
14
|
+
const delegatedProps = computed(() => {
|
|
15
|
+
const { class: _, ...delegated } = props
|
|
16
|
+
|
|
17
|
+
return delegated
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
21
|
+
const modelValue = inject<NSelectProps>('selectModelValue')
|
|
22
|
+
|
|
23
|
+
const isSelected = computed(() => {
|
|
24
|
+
return props.isSelected || modelValue === props.value
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<SelectItem
|
|
30
|
+
v-bind="forwardedProps"
|
|
31
|
+
:class="
|
|
32
|
+
cn(
|
|
33
|
+
'select-item',
|
|
34
|
+
props.class,
|
|
35
|
+
props.una?.selectItem,
|
|
36
|
+
)
|
|
37
|
+
"
|
|
38
|
+
:select-item="selectItem"
|
|
39
|
+
:aria-selected="isSelected"
|
|
40
|
+
:aria-checked="isSelected"
|
|
41
|
+
:is-selected="isSelected"
|
|
42
|
+
:data-state="true ? 'checked' : 'unchecked'"
|
|
43
|
+
>
|
|
44
|
+
<SelectItemIndicator
|
|
45
|
+
v-if="isSelected"
|
|
46
|
+
v-bind="forwardedProps._selectItemIndicator"
|
|
47
|
+
>
|
|
48
|
+
<slot name="item-indicator" />
|
|
49
|
+
</SelectItemIndicator>
|
|
50
|
+
|
|
51
|
+
<SelectItemText
|
|
52
|
+
v-bind="forwardedProps._selectItemText"
|
|
53
|
+
>
|
|
54
|
+
<slot />
|
|
55
|
+
</SelectItemText>
|
|
56
|
+
</SelectItem>
|
|
57
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Primitive } from 'radix-vue'
|
|
3
|
+
import type { NSelectItemIndicatorProps } from '../../../types'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
import Icon from '../../elements/Icon.vue'
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<NSelectItemIndicatorProps>(), {
|
|
8
|
+
as: 'span',
|
|
9
|
+
})
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<Primitive
|
|
14
|
+
aria-hidden
|
|
15
|
+
v-bind="props"
|
|
16
|
+
:class="cn(
|
|
17
|
+
'select-item-indicator',
|
|
18
|
+
props.class,
|
|
19
|
+
props.una?.selectItemIndicator,
|
|
20
|
+
)"
|
|
21
|
+
>
|
|
22
|
+
<slot>
|
|
23
|
+
<Icon
|
|
24
|
+
:name="props.icon ?? 'select-item-indicator-icon'"
|
|
25
|
+
:class="cn(
|
|
26
|
+
props.una?.selectItemIndicatorIcon,
|
|
27
|
+
)"
|
|
28
|
+
/>
|
|
29
|
+
</slot>
|
|
30
|
+
</Primitive>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { SelectItemText } from 'radix-vue'
|
|
3
|
+
import type { NSelectItemTextProps } from '../../../types'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<NSelectItemTextProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<SelectItemText v-bind="props">
|
|
10
|
+
<slot />
|
|
11
|
+
</SelectItemText>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { SelectLabel } from 'radix-vue'
|
|
3
|
+
import { cn } from '../../../utils'
|
|
4
|
+
import type { NSelectLabelProps } from '../../../types'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<NSelectLabelProps>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<SelectLabel :class="cn('select-label', props.class)">
|
|
11
|
+
<slot />
|
|
12
|
+
</SelectLabel>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectRootEmits } from 'radix-vue'
|
|
3
|
+
import { SelectRoot, useForwardPropsEmits } from 'radix-vue'
|
|
4
|
+
import type { NSelectRootProps } from '../../../types'
|
|
5
|
+
import { cn } from '../../../utils'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<NSelectRootProps>()
|
|
8
|
+
const emits = defineEmits<SelectRootEmits>()
|
|
9
|
+
|
|
10
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<SelectRoot
|
|
15
|
+
:class="cn(
|
|
16
|
+
'select-root',
|
|
17
|
+
props.class,
|
|
18
|
+
props.una?.selectRoot,
|
|
19
|
+
)"
|
|
20
|
+
v-bind="forwarded"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</SelectRoot>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { SelectScrollDownButton, useForwardProps } from 'radix-vue'
|
|
4
|
+
import Icon from '../../elements/Icon.vue'
|
|
5
|
+
import { cn } from '../../../utils'
|
|
6
|
+
import type { NSelectScrollDownButtonProps } from '../../../types'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<NSelectScrollDownButtonProps>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = computed(() => {
|
|
11
|
+
const { class: _, ...delegated } = props
|
|
12
|
+
|
|
13
|
+
return delegated
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<SelectScrollDownButton v-bind="forwardedProps" :class="cn('select-scroll-down-button', props.class)">
|
|
21
|
+
<slot>
|
|
22
|
+
<Icon
|
|
23
|
+
:name="forwardedProps?.una?.selectScrollDownButtonIcon || 'select-scroll-down-button-icon'"
|
|
24
|
+
/>
|
|
25
|
+
</slot>
|
|
26
|
+
</SelectScrollDownButton>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { SelectScrollUpButton, useForwardProps } from 'radix-vue'
|
|
4
|
+
import Icon from '../../elements/Icon.vue'
|
|
5
|
+
import { cn } from '../../../utils'
|
|
6
|
+
import type { NSelectScrollUpButtonProps } from '../../../types'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<NSelectScrollUpButtonProps>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = computed(() => {
|
|
11
|
+
const { class: _, ...delegated } = props
|
|
12
|
+
|
|
13
|
+
return delegated
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<SelectScrollUpButton v-bind="forwardedProps" :class="cn('select-scroll-up-button', props.class)">
|
|
21
|
+
<slot>
|
|
22
|
+
<Icon
|
|
23
|
+
:name="forwardedProps?.una?.selectScrollUpButtonIcon || 'select-scroll-up-button-icon'"
|
|
24
|
+
/>
|
|
25
|
+
</slot>
|
|
26
|
+
</SelectScrollUpButton>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { SelectSeparator } from 'radix-vue'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
import type { NSelectSeparator } from '../../../types'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<NSelectSeparator>()
|
|
8
|
+
|
|
9
|
+
const delegatedProps = computed(() => {
|
|
10
|
+
const { class: _, ...delegated } = props
|
|
11
|
+
|
|
12
|
+
return delegated
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<SelectSeparator v-bind="delegatedProps" :class="cn('select-separator', props.class)" />
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { SelectTrigger, useForwardProps } from 'radix-vue'
|
|
4
|
+
import { cn } from '../../../utils'
|
|
5
|
+
import type { NSelectTriggerProps } from '../../../types'
|
|
6
|
+
import Button from '../../elements/Button.vue'
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<NSelectTriggerProps>(), {
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const delegatedProps = computed(() => {
|
|
12
|
+
const { class: _, ...delegated } = props
|
|
13
|
+
|
|
14
|
+
return delegated
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
18
|
+
|
|
19
|
+
const statusClassVariants = computed(() => {
|
|
20
|
+
const btn = {
|
|
21
|
+
info: 'btn-outline-info',
|
|
22
|
+
success: 'btn-outline-success',
|
|
23
|
+
warning: 'btn-outline-warning',
|
|
24
|
+
error: 'btn-outline-error',
|
|
25
|
+
default: props?.una?.btnDefaultVariant ?? 'btn-outline-white',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const text = {
|
|
29
|
+
info: 'text-info',
|
|
30
|
+
success: 'text-success',
|
|
31
|
+
warning: 'text-warning',
|
|
32
|
+
error: 'text-error',
|
|
33
|
+
default: 'text-muted',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const icon = {
|
|
37
|
+
info: props.una?.selectTriggerInfoIcon ?? 'select-trigger-info-icon',
|
|
38
|
+
success: props.una?.selectTriggerSuccessIcon ?? 'select-trigger-success-icon',
|
|
39
|
+
warning: props.una?.selectTriggerWarningIcon ?? 'select-trigger-warning-icon',
|
|
40
|
+
error: props.una?.selectTriggerErrorIcon ?? 'select-trigger-error-icon',
|
|
41
|
+
default: 'select-trigger-trailing-icon',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
btn: btn[props.status ?? 'default'],
|
|
46
|
+
text: text[props.status ?? 'default'],
|
|
47
|
+
icon: icon[props.status ?? 'default'],
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<SelectTrigger
|
|
54
|
+
as-child
|
|
55
|
+
>
|
|
56
|
+
<Button
|
|
57
|
+
v-bind="forwardedProps"
|
|
58
|
+
:class="cn(
|
|
59
|
+
'select-trigger justify-between font-normal',
|
|
60
|
+
props.class,
|
|
61
|
+
)"
|
|
62
|
+
:trailing="statusClassVariants.icon"
|
|
63
|
+
:una="{
|
|
64
|
+
...props.una,
|
|
65
|
+
...{
|
|
66
|
+
btnLeading: cn(
|
|
67
|
+
'select-trigger-leading',
|
|
68
|
+
props.una?.btnLeading,
|
|
69
|
+
),
|
|
70
|
+
btnTrailing: cn(
|
|
71
|
+
'select-trigger-trailing',
|
|
72
|
+
props.una?.btnTrailing,
|
|
73
|
+
statusClassVariants.text,
|
|
74
|
+
),
|
|
75
|
+
btnDefaultVariant: statusClassVariants.btn,
|
|
76
|
+
},
|
|
77
|
+
}"
|
|
78
|
+
>
|
|
79
|
+
<slot />
|
|
80
|
+
</Button>
|
|
81
|
+
</SelectTrigger>
|
|
82
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { SelectValue } from 'radix-vue'
|
|
3
|
+
import type { NSelectValueProps } from '../../../types'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<NSelectValueProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<SelectValue
|
|
10
|
+
:class="{ 'select-value': !props.placeholder }"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</SelectValue>
|
|
15
|
+
</template>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
interface Extensions {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
}
|
|
5
|
+
export interface NButtonProps extends Extensions {
|
|
2
6
|
/**
|
|
3
7
|
* Change the button type.
|
|
4
8
|
*
|
|
@@ -78,6 +82,15 @@ export interface NButtonProps {
|
|
|
78
82
|
* trailing="i-heroicons-information-circle text-green-500 dark:text-green-400 text-2xl"
|
|
79
83
|
*/
|
|
80
84
|
trailing?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Allows you to change the size of the input.
|
|
87
|
+
*
|
|
88
|
+
* @default sm
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* size="sm" | size="2cm" | size="2rem" | size="2px"
|
|
92
|
+
*/
|
|
93
|
+
size?: string;
|
|
81
94
|
/**
|
|
82
95
|
* `UnaUI` preset configuration
|
|
83
96
|
*
|
|
@@ -94,3 +107,4 @@ export interface NButtonProps {
|
|
|
94
107
|
btnLoadingIcon?: string;
|
|
95
108
|
};
|
|
96
109
|
}
|
|
110
|
+
export {};
|