@una-ui/nuxt 1.0.0-alpha.5 → 1.0.0-alpha.6
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
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,11 +13,14 @@ import SelectSeparator from "./SelectSeparator.vue";
|
|
|
13
13
|
import SelectTrigger from "./SelectTrigger.vue";
|
|
14
14
|
import SelectValue from "./SelectValue.vue";
|
|
15
15
|
const props = defineProps({
|
|
16
|
-
items: { type:
|
|
16
|
+
items: { type: null, required: true },
|
|
17
17
|
itemKey: { type: null, required: false },
|
|
18
18
|
valueKey: { type: null, required: false },
|
|
19
19
|
label: { type: String, required: false },
|
|
20
20
|
groupSeparator: { type: Boolean, required: false },
|
|
21
|
+
defaultValue: { type: null, required: false },
|
|
22
|
+
modelValue: { type: null, required: false },
|
|
23
|
+
multiple: { type: null, required: false },
|
|
21
24
|
_selectScrollUpButton: { type: Object, required: false },
|
|
22
25
|
_selectItemText: { type: Object, required: false },
|
|
23
26
|
_selectScrollDownButton: { type: Object, required: false },
|
|
@@ -31,11 +34,8 @@ const props = defineProps({
|
|
|
31
34
|
una: { type: Object, required: false },
|
|
32
35
|
open: { type: Boolean, required: false },
|
|
33
36
|
defaultOpen: { type: Boolean, required: false },
|
|
34
|
-
defaultValue: { type: null, required: false },
|
|
35
|
-
modelValue: { type: null, required: false },
|
|
36
37
|
by: { type: [String, Function], required: false },
|
|
37
38
|
dir: { type: String, required: false },
|
|
38
|
-
multiple: { type: Boolean, required: false },
|
|
39
39
|
autocomplete: { type: String, required: false },
|
|
40
40
|
disabled: { type: Boolean, required: false },
|
|
41
41
|
name: { type: String, required: false },
|
|
@@ -49,6 +49,7 @@ const props = defineProps({
|
|
|
49
49
|
id: { type: String, required: false }
|
|
50
50
|
});
|
|
51
51
|
const emits = defineEmits(["update:modelValue", "update:open"]);
|
|
52
|
+
defineSlots();
|
|
52
53
|
const hasGroups = computed(() => {
|
|
53
54
|
return Array.isArray(props.items) && props.items.length > 0 && typeof props.items[0] === "object" && "items" in props.items[0];
|
|
54
55
|
});
|
|
@@ -94,8 +95,8 @@ function isItemSelected(item, modelValue) {
|
|
|
94
95
|
)"
|
|
95
96
|
v-bind="forwarded"
|
|
96
97
|
>
|
|
97
|
-
<slot :model-value :open>
|
|
98
|
-
<slot name="trigger-wrapper" :model-value :open>
|
|
98
|
+
<slot :model-value="modelValue" :open>
|
|
99
|
+
<slot name="trigger-wrapper" :model-value="modelValue" :open>
|
|
99
100
|
<SelectTrigger
|
|
100
101
|
:id
|
|
101
102
|
:size
|
|
@@ -104,7 +105,7 @@ function isItemSelected(item, modelValue) {
|
|
|
104
105
|
v-bind="props._selectTrigger"
|
|
105
106
|
:una
|
|
106
107
|
>
|
|
107
|
-
<slot name="trigger" :model-value :open="open">
|
|
108
|
+
<slot name="trigger" :model-value="modelValue" :open="open">
|
|
108
109
|
<SelectValue
|
|
109
110
|
:placeholder="props.placeholder"
|
|
110
111
|
v-bind="props._selectValue"
|
|
@@ -112,7 +113,7 @@ function isItemSelected(item, modelValue) {
|
|
|
112
113
|
:data-status="status"
|
|
113
114
|
:una
|
|
114
115
|
>
|
|
115
|
-
<slot name="value" :model-value :open>
|
|
116
|
+
<slot name="value" :model-value="modelValue" :open>
|
|
116
117
|
{{ formatSelectedValue(modelValue) || props.placeholder }}
|
|
117
118
|
</slot>
|
|
118
119
|
</SelectValue>
|
|
@@ -211,7 +212,6 @@ function isItemSelected(item, modelValue) {
|
|
|
211
212
|
</slot>
|
|
212
213
|
</SelectGroup>
|
|
213
214
|
</template>
|
|
214
|
-
<slot />
|
|
215
215
|
</slot>
|
|
216
216
|
</SelectContent>
|
|
217
217
|
</slot>
|
|
@@ -1,67 +1,13 @@
|
|
|
1
1
|
import type { AcceptableValue } from 'reka-ui';
|
|
2
|
-
import type { NSelectProps, SelectGroup as SelectGroupType } from '../../../types/index.js';
|
|
3
|
-
declare const _default: <T extends AcceptableValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
|
+
import type { NSelectProps, NSelectSlots, SelectGroup as SelectGroupType } from '../../../types/index.js';
|
|
3
|
+
declare const _default: <T extends AcceptableValue, I extends Array<T | SelectGroupType<T>>, M extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
5
|
readonly "onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
6
6
|
readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
7
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:open"> & NSelectProps<T> & Partial<{}>> & import("vue").PublicProps;
|
|
7
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue" | "onUpdate:open"> & NSelectProps<T, I, M> & Partial<{}>> & import("vue").PublicProps;
|
|
8
8
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
9
9
|
attrs: any;
|
|
10
|
-
slots:
|
|
11
|
-
default?: (props: {
|
|
12
|
-
modelValue: any;
|
|
13
|
-
open: any;
|
|
14
|
-
}) => any;
|
|
15
|
-
} & {
|
|
16
|
-
'trigger-wrapper'?: (props: {
|
|
17
|
-
modelValue: any;
|
|
18
|
-
open: any;
|
|
19
|
-
}) => any;
|
|
20
|
-
} & {
|
|
21
|
-
trigger?: (props: {
|
|
22
|
-
modelValue: any;
|
|
23
|
-
open: any;
|
|
24
|
-
}) => any;
|
|
25
|
-
} & {
|
|
26
|
-
value?: (props: {
|
|
27
|
-
modelValue: any;
|
|
28
|
-
open: any;
|
|
29
|
-
}) => any;
|
|
30
|
-
} & {
|
|
31
|
-
content?: (props: {
|
|
32
|
-
items: T[] | SelectGroupType<T>[];
|
|
33
|
-
}) => any;
|
|
34
|
-
} & {
|
|
35
|
-
label?: (props: {
|
|
36
|
-
label: string;
|
|
37
|
-
}) => any;
|
|
38
|
-
} & {
|
|
39
|
-
item?: (props: {
|
|
40
|
-
item: T | SelectGroupType<T>;
|
|
41
|
-
}) => any;
|
|
42
|
-
} & {
|
|
43
|
-
indicator?: (props: {
|
|
44
|
-
item: T | SelectGroupType<T>;
|
|
45
|
-
}) => any;
|
|
46
|
-
} & {
|
|
47
|
-
group?: (props: {
|
|
48
|
-
items: SelectGroupType<T>;
|
|
49
|
-
}) => any;
|
|
50
|
-
} & {
|
|
51
|
-
label?: (props: {
|
|
52
|
-
label: string;
|
|
53
|
-
}) => any;
|
|
54
|
-
} & {
|
|
55
|
-
item?: (props: {
|
|
56
|
-
item: T;
|
|
57
|
-
}) => any;
|
|
58
|
-
} & {
|
|
59
|
-
indicator?: (props: {
|
|
60
|
-
item: T;
|
|
61
|
-
}) => any;
|
|
62
|
-
} & {
|
|
63
|
-
default?: (props: {}) => any;
|
|
64
|
-
};
|
|
10
|
+
slots: NSelectSlots<T, I, M>;
|
|
65
11
|
emit: ((evt: "update:modelValue", value: T) => void) & ((evt: "update:open", value: boolean) => void);
|
|
66
12
|
}>) => import("vue").VNode & {
|
|
67
13
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
@@ -15,18 +15,19 @@ type ItemTextExtensions = SelectItemTextProps & BaseExtensions;
|
|
|
15
15
|
type GroupExtensions = SelectGroupProps & BaseExtensions;
|
|
16
16
|
type LabelExtensions = SelectLabelProps & BaseExtensions;
|
|
17
17
|
type SeparatorExtensions = SelectSeparatorProps & BaseExtensions;
|
|
18
|
-
type SelectExtensions = SelectRootProps & BaseExtensions & Pick<NSelectValueProps, 'placeholder'> & Pick<NSelectItemProps, 'selectItem'> & Pick<NSelectTriggerProps, 'status' | 'select' | 'id'>;
|
|
18
|
+
type SelectExtensions<T extends AcceptableValue> = SelectRootProps<T> & BaseExtensions & Pick<NSelectValueProps, 'placeholder'> & Pick<NSelectItemProps, 'selectItem'> & Pick<NSelectTriggerProps, 'status' | 'select' | 'id'>;
|
|
19
19
|
export interface SelectGroup<T extends AcceptableValue> {
|
|
20
20
|
label?: string;
|
|
21
21
|
items: T[];
|
|
22
22
|
_selectLabel?: Partial<NSelectLabelProps>;
|
|
23
23
|
_selectItem?: Partial<NSelectItemProps>;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
type SelectModelType<T extends AcceptableValue, M extends boolean> = true extends M ? T[] : T;
|
|
26
|
+
export interface NSelectProps<T extends AcceptableValue, Items extends Array<T | SelectGroup<T>>, M extends boolean = false> extends SelectExtensions<T> {
|
|
26
27
|
/**
|
|
27
28
|
* The items to display in the select.
|
|
28
29
|
*/
|
|
29
|
-
items:
|
|
30
|
+
items: Items;
|
|
30
31
|
/**
|
|
31
32
|
* The key name to use to display in the select items.
|
|
32
33
|
*/
|
|
@@ -45,6 +46,9 @@ export interface NSelectProps<T extends AcceptableValue> extends SelectExtension
|
|
|
45
46
|
* @default false
|
|
46
47
|
*/
|
|
47
48
|
groupSeparator?: boolean;
|
|
49
|
+
defaultValue?: SelectModelType<T, M>;
|
|
50
|
+
modelValue?: SelectModelType<T, M>;
|
|
51
|
+
multiple?: M;
|
|
48
52
|
/**
|
|
49
53
|
* Sub-component configurations
|
|
50
54
|
*/
|
|
@@ -60,6 +64,33 @@ export interface NSelectProps<T extends AcceptableValue> extends SelectExtension
|
|
|
60
64
|
_selectLabel?: Partial<NSelectLabelProps>;
|
|
61
65
|
una?: NSelectUnaProps;
|
|
62
66
|
}
|
|
67
|
+
interface SelectModelSlotProps<T extends AcceptableValue, M extends boolean> {
|
|
68
|
+
modelValue: SelectModelType<T, M> | null | undefined;
|
|
69
|
+
open: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface SelectContentSlotProps<T extends AcceptableValue, I extends Array<T | SelectGroup<T>>> {
|
|
72
|
+
items: I;
|
|
73
|
+
}
|
|
74
|
+
interface SelectLabelSlotProps {
|
|
75
|
+
label: string | undefined;
|
|
76
|
+
}
|
|
77
|
+
interface SelectItemSlotProps<T extends AcceptableValue, I extends Array<T | SelectGroup<T>>> {
|
|
78
|
+
item: I[number];
|
|
79
|
+
}
|
|
80
|
+
interface SelectGroupSlotProps<T extends AcceptableValue> {
|
|
81
|
+
items: SelectGroup<T>;
|
|
82
|
+
}
|
|
83
|
+
export interface NSelectSlots<T extends AcceptableValue, I extends Array<T | SelectGroup<T>>, M extends boolean = false> {
|
|
84
|
+
'default': (props: SelectModelSlotProps<T, M>) => any;
|
|
85
|
+
'trigger-wrapper': (props: SelectModelSlotProps<T, M>) => any;
|
|
86
|
+
'trigger': (props: SelectModelSlotProps<T, M>) => any;
|
|
87
|
+
'value': (props: SelectModelSlotProps<T, M>) => any;
|
|
88
|
+
'content': (props: SelectContentSlotProps<T, I>) => any;
|
|
89
|
+
'label': (props: SelectLabelSlotProps) => any;
|
|
90
|
+
'item': (props: SelectItemSlotProps<T, I>) => any;
|
|
91
|
+
'indicator': (props: SelectItemSlotProps<T, I>) => any;
|
|
92
|
+
'group': (props: SelectGroupSlotProps<T>) => any;
|
|
93
|
+
}
|
|
63
94
|
export interface NSelectTriggerProps extends TriggerExtensions {
|
|
64
95
|
/**
|
|
65
96
|
* The unique id of the select trigger to be used for the form field.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@una-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.6",
|
|
5
5
|
"description": "Nuxt module for @una-ui",
|
|
6
6
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"unocss": "^66.2.0",
|
|
59
59
|
"unocss-preset-animations": "^1.2.1",
|
|
60
60
|
"vaul-vue": "^0.4.1",
|
|
61
|
-
"@una-ui/
|
|
62
|
-
"@una-ui/
|
|
61
|
+
"@una-ui/extractor-vue-script": "^1.0.0-alpha.6",
|
|
62
|
+
"@una-ui/preset": "^1.0.0-alpha.6"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@iconify-json/lucide": "^1.2.57",
|