@una-ui/nuxt 1.0.0-alpha.10 → 1.0.0-alpha.11
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/combobox/Combobox.vue +1 -0
- package/dist/runtime/components/elements/accordion/Accordion.vue +86 -0
- package/dist/runtime/components/elements/accordion/Accordion.vue.d.ts +71 -0
- package/dist/runtime/components/elements/accordion/AccordionContent.vue +24 -0
- package/dist/runtime/components/elements/accordion/AccordionContent.vue.d.ts +13 -0
- package/dist/runtime/components/elements/accordion/AccordionHeader.vue +17 -0
- package/dist/runtime/components/elements/accordion/AccordionHeader.vue.d.ts +13 -0
- package/dist/runtime/components/elements/accordion/AccordionItem.vue +59 -0
- package/dist/runtime/components/elements/accordion/AccordionItem.vue.d.ts +27 -0
- package/dist/runtime/components/elements/accordion/AccordionTrigger.vue +56 -0
- package/dist/runtime/components/elements/accordion/AccordionTrigger.vue.d.ts +16 -0
- package/dist/runtime/components/elements/avatar/Avatar.vue.d.ts +1 -1
- package/dist/runtime/components/forms/select/Select.vue +2 -18
- package/dist/runtime/components/forms/select/SelectItem.vue +0 -2
- package/dist/runtime/components/forms/select/SelectItemIndicator.vue +7 -6
- package/dist/runtime/components/forms/select/SelectItemIndicator.vue.d.ts +1 -3
- package/dist/runtime/components/navigation-menu/NavigationMenuLink.vue.d.ts +1 -1
- package/dist/runtime/components/navigation-menu/NavigationMenuTrigger.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Toaster.vue +1 -0
- package/dist/runtime/components/overlays/toast/ToastProvider.vue +1 -0
- package/dist/runtime/components/sidebar/SidebarProvider.vue +7 -2
- package/dist/runtime/components/sidebar/SidebarProvider.vue.d.ts +1 -1
- package/dist/runtime/components/toggle-group/ToggleGroupItem.vue.d.ts +1 -1
- package/dist/runtime/composables/useUnaSettings.d.ts +2 -2
- package/dist/runtime/composables/useUnaSettings.js +1 -2
- package/dist/runtime/plugins/theme.client.js +3 -2
- package/dist/runtime/plugins/theme.server.js +4 -2
- package/dist/runtime/types/accordion.d.ts +36 -91
- package/dist/runtime/types/select.d.ts +1 -2
- package/dist/runtime/types/sidebar.d.ts +5 -0
- package/dist/runtime/utils/index.d.ts +1 -1
- package/package.json +13 -14
- package/dist/runtime/components/elements/Accordion.vue +0 -212
- package/dist/runtime/components/elements/Accordion.vue.d.ts +0 -28
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -48,6 +48,7 @@ const props = defineProps({
|
|
|
48
48
|
openOnFocus: { type: Boolean, required: false },
|
|
49
49
|
openOnClick: { type: Boolean, required: false },
|
|
50
50
|
ignoreFilter: { type: Boolean, required: false },
|
|
51
|
+
resetModelValueOnClear: { type: Boolean, required: false },
|
|
51
52
|
defaultValue: { type: null, required: false },
|
|
52
53
|
dir: { type: String, required: false },
|
|
53
54
|
disabled: { type: Boolean, required: false },
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { defu } from "defu";
|
|
4
|
+
import { AccordionRoot, useForwardPropsEmits } from "reka-ui";
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
import { cn } from "../../../utils";
|
|
7
|
+
import NAccordionItem from "./AccordionItem.vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
accordion: { type: String, required: false, default: "divider border" },
|
|
10
|
+
items: { type: Array, required: false },
|
|
11
|
+
una: { type: Object, required: false },
|
|
12
|
+
_accordionItem: { type: Object, required: false },
|
|
13
|
+
_accordionHeader: { type: Object, required: false },
|
|
14
|
+
_accordionTrigger: { type: Object, required: false },
|
|
15
|
+
_accordionContent: { type: Object, required: false },
|
|
16
|
+
collapsible: { type: Boolean, required: false, default: true },
|
|
17
|
+
disabled: { type: Boolean, required: false },
|
|
18
|
+
dir: { type: String, required: false },
|
|
19
|
+
orientation: { type: String, required: false },
|
|
20
|
+
unmountOnHide: { type: Boolean, required: false },
|
|
21
|
+
asChild: { type: Boolean, required: false },
|
|
22
|
+
as: { type: null, required: false },
|
|
23
|
+
type: { type: String, required: false, default: "single" },
|
|
24
|
+
modelValue: { type: null, required: false },
|
|
25
|
+
defaultValue: { type: null, required: false }
|
|
26
|
+
});
|
|
27
|
+
const emits = defineEmits(["update:modelValue"]);
|
|
28
|
+
const rootProps = useForwardPropsEmits(reactiveOmit(props, ["una", "items", "_accordionTrigger", "_accordionContent", "_accordionHeader", "_accordionItem"]), emits);
|
|
29
|
+
const items = computed(() => {
|
|
30
|
+
if (import.meta.dev) {
|
|
31
|
+
const reservedValues = ["header", "trigger", "content", "item", "default"];
|
|
32
|
+
for (const item of props.items ?? []) {
|
|
33
|
+
if (reservedValues.includes(item.value)) {
|
|
34
|
+
console.warn(`[AccordionItem]: The value '${item.value}' is reserved and may cause unexpected behavior. Please choose a different value.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return props.items;
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<AccordionRoot
|
|
44
|
+
v-slot="{ modelValue }"
|
|
45
|
+
v-bind="rootProps"
|
|
46
|
+
:class="cn(
|
|
47
|
+
una?.accordion
|
|
48
|
+
)"
|
|
49
|
+
>
|
|
50
|
+
<slot :model-value>
|
|
51
|
+
<NAccordionItem
|
|
52
|
+
v-for="(item, index) in items"
|
|
53
|
+
:key="item.value"
|
|
54
|
+
v-bind="defu(item, _accordionItem)"
|
|
55
|
+
:_accordion-trigger="defu(item._accordionTrigger, _accordionTrigger)"
|
|
56
|
+
:_accordion-content="defu(item._accordionContent, _accordionContent)"
|
|
57
|
+
:_accordion-header="defu(item._accordionHeader, _accordionHeader)"
|
|
58
|
+
:una="defu(item.una, una)"
|
|
59
|
+
>
|
|
60
|
+
<template #default="{ open }">
|
|
61
|
+
<slot :name="`${item.value}-item`" :open :item :index>
|
|
62
|
+
<slot name="item" :open :item :index />
|
|
63
|
+
</slot>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<template #header="{ open }">
|
|
67
|
+
<slot :name="`${item.value}-header`" :open :item :index>
|
|
68
|
+
<slot name="header" :open :item :index />
|
|
69
|
+
</slot>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<template #trigger="{ open }">
|
|
73
|
+
<slot :name="`${item.value}-trigger`" :open :item :index>
|
|
74
|
+
<slot name="trigger" :open :item :index />
|
|
75
|
+
</slot>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<template #content="{ open }">
|
|
79
|
+
<slot :name="`${item.value}-content`" :open :item :index>
|
|
80
|
+
<slot name="content" :open :item :index />
|
|
81
|
+
</slot>
|
|
82
|
+
</template>
|
|
83
|
+
</NAccordionItem>
|
|
84
|
+
</slot>
|
|
85
|
+
</AccordionRoot>
|
|
86
|
+
</template>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { NAccordionProps } from '../../../types/index.js';
|
|
2
|
+
declare var __VLS_6: {
|
|
3
|
+
modelValue: any;
|
|
4
|
+
}, __VLS_12: any, __VLS_13: {
|
|
5
|
+
open: any;
|
|
6
|
+
item: any;
|
|
7
|
+
index: any;
|
|
8
|
+
}, __VLS_15: {
|
|
9
|
+
open: any;
|
|
10
|
+
item: any;
|
|
11
|
+
index: any;
|
|
12
|
+
}, __VLS_18: any, __VLS_19: {
|
|
13
|
+
open: any;
|
|
14
|
+
item: any;
|
|
15
|
+
index: any;
|
|
16
|
+
}, __VLS_21: {
|
|
17
|
+
open: any;
|
|
18
|
+
item: any;
|
|
19
|
+
index: any;
|
|
20
|
+
}, __VLS_24: any, __VLS_25: {
|
|
21
|
+
open: any;
|
|
22
|
+
item: any;
|
|
23
|
+
index: any;
|
|
24
|
+
}, __VLS_27: {
|
|
25
|
+
open: any;
|
|
26
|
+
item: any;
|
|
27
|
+
index: any;
|
|
28
|
+
}, __VLS_30: any, __VLS_31: {
|
|
29
|
+
open: any;
|
|
30
|
+
item: any;
|
|
31
|
+
index: any;
|
|
32
|
+
}, __VLS_33: {
|
|
33
|
+
open: any;
|
|
34
|
+
item: any;
|
|
35
|
+
index: any;
|
|
36
|
+
};
|
|
37
|
+
type __VLS_Slots = {} & {
|
|
38
|
+
[K in NonNullable<typeof __VLS_12>]?: (props: typeof __VLS_13) => any;
|
|
39
|
+
} & {
|
|
40
|
+
[K in NonNullable<typeof __VLS_18>]?: (props: typeof __VLS_19) => any;
|
|
41
|
+
} & {
|
|
42
|
+
[K in NonNullable<typeof __VLS_24>]?: (props: typeof __VLS_25) => any;
|
|
43
|
+
} & {
|
|
44
|
+
[K in NonNullable<typeof __VLS_30>]?: (props: typeof __VLS_31) => any;
|
|
45
|
+
} & {
|
|
46
|
+
default?: (props: typeof __VLS_6) => any;
|
|
47
|
+
} & {
|
|
48
|
+
item?: (props: typeof __VLS_15) => any;
|
|
49
|
+
} & {
|
|
50
|
+
header?: (props: typeof __VLS_21) => any;
|
|
51
|
+
} & {
|
|
52
|
+
trigger?: (props: typeof __VLS_27) => any;
|
|
53
|
+
} & {
|
|
54
|
+
content?: (props: typeof __VLS_33) => any;
|
|
55
|
+
};
|
|
56
|
+
declare const __VLS_component: import("vue").DefineComponent<NAccordionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
57
|
+
"update:modelValue": (value: string | string[] | undefined) => any;
|
|
58
|
+
}, string, import("vue").PublicProps, Readonly<NAccordionProps> & Readonly<{
|
|
59
|
+
"onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
|
|
60
|
+
}>, {
|
|
61
|
+
type: "multiple" | "single";
|
|
62
|
+
accordion: string;
|
|
63
|
+
collapsible: boolean;
|
|
64
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
65
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
68
|
+
new (): {
|
|
69
|
+
$slots: S;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { AccordionContent, useForwardProps } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../utils";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
una: { type: Object, required: false },
|
|
7
|
+
forceMount: { type: Boolean, required: false },
|
|
8
|
+
asChild: { type: Boolean, required: false },
|
|
9
|
+
as: { type: null, required: false }
|
|
10
|
+
});
|
|
11
|
+
const forwardProps = useForwardProps(reactiveOmit(props, ["una"]));
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<AccordionContent v-bind="forwardProps" :class="cn('accordion-content group/accordion-content', una?.accordionContent)">
|
|
16
|
+
<div :class="cn('accordion-panel', una?.accordionPanel)">
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</AccordionContent>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<style scoped>
|
|
23
|
+
.accordion-content[data-state=open]{animation:accordionIn .3s cubic-bezier(.86,0,.07,1)}.accordion-content[data-state=closed]{animation:accordionOut .3s cubic-bezier(.86,0,.07,1)}@keyframes accordionIn{0%{height:0}to{height:var(--reka-accordion-content-height)}}@keyframes accordionOut{0%{height:var(--reka-accordion-content-height)}to{height:0}}
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NAccordionContentProps } from '../../../types/accordion.js';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<NAccordionContentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NAccordionContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { AccordionHeader, useForwardProps } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../utils";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
una: { type: Object, required: false },
|
|
7
|
+
asChild: { type: Boolean, required: false },
|
|
8
|
+
as: { type: null, required: false }
|
|
9
|
+
});
|
|
10
|
+
const forwardProps = useForwardProps(reactiveOmit(props, ["una"]));
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<AccordionHeader v-bind="forwardProps" :class="cn('accordion-header', una?.accordionHeader)">
|
|
15
|
+
<slot />
|
|
16
|
+
</AccordionHeader>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NAccordionHeaderProps } from '../../../types/accordion.js';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<NAccordionHeaderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NAccordionHeaderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { AccordionItem, Primitive, useForwardProps } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../utils";
|
|
5
|
+
import NAccordionContent from "./AccordionContent.vue";
|
|
6
|
+
import NAccordionHeader from "./AccordionHeader.vue";
|
|
7
|
+
import NAccordionTrigger from "./AccordionTrigger.vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
label: { type: String, required: false },
|
|
10
|
+
content: { type: String, required: false },
|
|
11
|
+
una: { type: Object, required: false },
|
|
12
|
+
_accordionHeader: { type: Object, required: false },
|
|
13
|
+
_accordionTrigger: { type: Object, required: false },
|
|
14
|
+
_accordionContent: { type: Object, required: false },
|
|
15
|
+
disabled: { type: Boolean, required: false },
|
|
16
|
+
value: { type: String, required: true },
|
|
17
|
+
unmountOnHide: { type: Boolean, required: false },
|
|
18
|
+
asChild: { type: Boolean, required: false },
|
|
19
|
+
as: { type: null, required: false }
|
|
20
|
+
});
|
|
21
|
+
const forwardProps = useForwardProps(reactiveOmit(props, ["una", "label", "content", "_accordionContent", "_accordionHeader", "_accordionTrigger"]));
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<AccordionItem
|
|
26
|
+
v-slot="{ open }"
|
|
27
|
+
v-bind="forwardProps"
|
|
28
|
+
:class="cn('accordion-item', una?.accordionItem)"
|
|
29
|
+
>
|
|
30
|
+
<slot :open>
|
|
31
|
+
<NAccordionHeader :una v-bind="_accordionHeader">
|
|
32
|
+
<Primitive
|
|
33
|
+
as-child
|
|
34
|
+
:label
|
|
35
|
+
v-bind="_accordionTrigger"
|
|
36
|
+
:una="{
|
|
37
|
+
btnLeading: cn('accordion-leading', una?.accordionLeading),
|
|
38
|
+
btnTrailing: cn(
|
|
39
|
+
'accordion-trailing',
|
|
40
|
+
una?.accordionTrailing,
|
|
41
|
+
open ? una?.accordionTrailingOpen : una?.accordionTrailingClose
|
|
42
|
+
)
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
<slot name="header" :open>
|
|
46
|
+
<NAccordionTrigger>
|
|
47
|
+
<slot name="trigger" :open />
|
|
48
|
+
</NAccordionTrigger>
|
|
49
|
+
</slot>
|
|
50
|
+
</Primitive>
|
|
51
|
+
</NAccordionHeader>
|
|
52
|
+
<NAccordionContent :una v-bind="_accordionContent">
|
|
53
|
+
<slot name="content" :open>
|
|
54
|
+
{{ content }}
|
|
55
|
+
</slot>
|
|
56
|
+
</NAccordionContent>
|
|
57
|
+
</slot>
|
|
58
|
+
</AccordionItem>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { NAccordionItemProps } from '../../../types/accordion.js';
|
|
2
|
+
declare var __VLS_6: {
|
|
3
|
+
open: any;
|
|
4
|
+
}, __VLS_15: {
|
|
5
|
+
open: any;
|
|
6
|
+
}, __VLS_20: {
|
|
7
|
+
open: any;
|
|
8
|
+
}, __VLS_25: {
|
|
9
|
+
open: any;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_Slots = {} & {
|
|
12
|
+
default?: (props: typeof __VLS_6) => any;
|
|
13
|
+
} & {
|
|
14
|
+
header?: (props: typeof __VLS_15) => any;
|
|
15
|
+
} & {
|
|
16
|
+
trigger?: (props: typeof __VLS_20) => any;
|
|
17
|
+
} & {
|
|
18
|
+
content?: (props: typeof __VLS_25) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_component: import("vue").DefineComponent<NAccordionItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NAccordionItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { AccordionTrigger, useForwardProps } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../utils";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
una: { type: Object, required: false },
|
|
7
|
+
asChild: { type: Boolean, required: false },
|
|
8
|
+
as: { type: null, required: false },
|
|
9
|
+
type: { type: String, required: false },
|
|
10
|
+
loadingPlacement: { type: String, required: false },
|
|
11
|
+
icon: { type: Boolean, required: false },
|
|
12
|
+
disabled: { type: Boolean, required: false },
|
|
13
|
+
reverse: { type: Boolean, required: false },
|
|
14
|
+
loading: { type: Boolean, required: false },
|
|
15
|
+
block: { type: Boolean, required: false },
|
|
16
|
+
to: { type: null, required: false },
|
|
17
|
+
label: { type: String, required: false },
|
|
18
|
+
btn: { type: String, required: false, default: "~ text" },
|
|
19
|
+
leading: { type: String, required: false },
|
|
20
|
+
trailing: { type: String, required: false, default: "accordion-trailing-icon" },
|
|
21
|
+
size: { type: String, required: false },
|
|
22
|
+
square: { type: null, required: false },
|
|
23
|
+
rounded: { type: null, required: false },
|
|
24
|
+
class: { type: null, required: false },
|
|
25
|
+
breadcrumbActive: { type: String, required: false },
|
|
26
|
+
breadcrumbInactive: { type: String, required: false },
|
|
27
|
+
paginationSelected: { type: String, required: false },
|
|
28
|
+
paginationUnselected: { type: String, required: false },
|
|
29
|
+
dropdownMenu: { type: String, required: false },
|
|
30
|
+
toggleOn: { type: String, required: false },
|
|
31
|
+
toggleOff: { type: String, required: false },
|
|
32
|
+
tabsActive: { type: String, required: false },
|
|
33
|
+
tabsInactive: { type: String, required: false },
|
|
34
|
+
navigationMenu: { type: String, required: false },
|
|
35
|
+
navigationMenuLink: { type: String, required: false },
|
|
36
|
+
ariaLabel: { type: String, required: false }
|
|
37
|
+
});
|
|
38
|
+
const forwardProps = useForwardProps(reactiveOmit(props, ["una"]));
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<AccordionTrigger
|
|
43
|
+
class="group/accordion-trigger accordion-trigger"
|
|
44
|
+
v-bind="forwardProps"
|
|
45
|
+
as-child
|
|
46
|
+
:una="{
|
|
47
|
+
...una,
|
|
48
|
+
btn: cn('accordion-trigger-padding', una?.btn),
|
|
49
|
+
btnLabel: cn('accordion-trigger-label', una?.btnLabel)
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<slot>
|
|
53
|
+
<NButton />
|
|
54
|
+
</slot>
|
|
55
|
+
</AccordionTrigger>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NAccordionTriggerProps } from '../../../types/accordion.js';
|
|
2
|
+
declare var __VLS_6: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_6) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<NAccordionTriggerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NAccordionTriggerProps> & Readonly<{}>, {
|
|
7
|
+
btn: string;
|
|
8
|
+
trailing: string;
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -9,9 +9,9 @@ type __VLS_Slots = {} & {
|
|
|
9
9
|
};
|
|
10
10
|
declare const __VLS_component: import("vue").DefineComponent<NAvatarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NAvatarProps> & Readonly<{}>, {
|
|
11
11
|
size: import("vue").HTMLAttributes["class"];
|
|
12
|
+
as: import("reka-ui").AsTag | import("vue").Component;
|
|
12
13
|
square: import("vue").HTMLAttributes["class"];
|
|
13
14
|
rounded: import("vue").HTMLAttributes["class"];
|
|
14
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
15
15
|
avatar: import("vue").HTMLAttributes["class"];
|
|
16
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -4,7 +4,7 @@ import { computed } from "vue";
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { SelectRoot, useForwardPropsEmits } from "reka-ui";
|
|
7
|
-
import { cn
|
|
7
|
+
import { cn } from "../../../utils";
|
|
8
8
|
import SelectContent from "./SelectContent.vue";
|
|
9
9
|
import SelectGroup from "./SelectGroup.vue";
|
|
10
10
|
import SelectItem from "./SelectItem.vue";
|
|
@@ -13,7 +13,7 @@ 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: null, required:
|
|
16
|
+
items: { type: null, required: false },
|
|
17
17
|
itemKey: { type: null, required: false },
|
|
18
18
|
valueKey: { type: null, required: false },
|
|
19
19
|
label: { type: String, required: false },
|
|
@@ -69,20 +69,6 @@ function formatSelectedValue(value) {
|
|
|
69
69
|
}
|
|
70
70
|
return value;
|
|
71
71
|
}
|
|
72
|
-
function isItemSelected(item, modelValue) {
|
|
73
|
-
if (!modelValue)
|
|
74
|
-
return false;
|
|
75
|
-
if (props.multiple && Array.isArray(modelValue)) {
|
|
76
|
-
return modelValue.some((val) => {
|
|
77
|
-
const valObj = typeof val === "object" && val ? val : { value: val };
|
|
78
|
-
const itemObj2 = typeof item === "object" && item ? item : { value: item };
|
|
79
|
-
return isEqualObject(valObj, itemObj2);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
const modelObj = typeof modelValue === "object" && modelValue ? modelValue : { value: modelValue };
|
|
83
|
-
const itemObj = typeof item === "object" && item ? item : { value: item };
|
|
84
|
-
return isEqualObject(modelObj, itemObj);
|
|
85
|
-
}
|
|
86
72
|
</script>
|
|
87
73
|
|
|
88
74
|
<template>
|
|
@@ -149,7 +135,6 @@ function isItemSelected(item, modelValue) {
|
|
|
149
135
|
:size
|
|
150
136
|
:select-item
|
|
151
137
|
v-bind="props._selectItem"
|
|
152
|
-
:is-selected="isItemSelected(item, modelValue)"
|
|
153
138
|
:una
|
|
154
139
|
>
|
|
155
140
|
<slot name="item" :item="item">
|
|
@@ -196,7 +181,6 @@ function isItemSelected(item, modelValue) {
|
|
|
196
181
|
:size
|
|
197
182
|
:select-item
|
|
198
183
|
v-bind="{ ..._selectItem, ...group._selectItem }"
|
|
199
|
-
:is-selected="isItemSelected(item, modelValue)"
|
|
200
184
|
:una
|
|
201
185
|
>
|
|
202
186
|
<slot name="item" :item="item">
|
|
@@ -9,7 +9,6 @@ import SelectItemIndicator from "./SelectItemIndicator.vue";
|
|
|
9
9
|
import SelectItemText from "./SelectItemText.vue";
|
|
10
10
|
const props = defineProps({
|
|
11
11
|
selectItem: { type: null, required: false, default: "gray" },
|
|
12
|
-
isSelected: { type: Boolean, required: false },
|
|
13
12
|
_selectItemText: { type: Object, required: false },
|
|
14
13
|
_selectItemIndicator: { type: Object, required: false },
|
|
15
14
|
una: { type: Object, required: false },
|
|
@@ -38,7 +37,6 @@ const forwardedProps = useForwardProps(delegatedProps);
|
|
|
38
37
|
:select-item
|
|
39
38
|
>
|
|
40
39
|
<SelectItemIndicator
|
|
41
|
-
v-if="isSelected"
|
|
42
40
|
:una
|
|
43
41
|
v-bind="props._selectItemIndicator"
|
|
44
42
|
>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { SelectItemIndicator, useForwardProps } from "reka-ui";
|
|
3
4
|
import { cn } from "../../../utils";
|
|
4
5
|
import Icon from "../../elements/Icon.vue";
|
|
5
6
|
const props = defineProps({
|
|
@@ -7,14 +8,14 @@ const props = defineProps({
|
|
|
7
8
|
class: { type: null, required: false },
|
|
8
9
|
una: { type: Object, required: false },
|
|
9
10
|
asChild: { type: Boolean, required: false },
|
|
10
|
-
as: { type: null, required: false
|
|
11
|
+
as: { type: null, required: false }
|
|
11
12
|
});
|
|
13
|
+
const forwardProps = useForwardProps(reactiveOmit(props, ["icon", "una"]));
|
|
12
14
|
</script>
|
|
13
15
|
|
|
14
16
|
<template>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
v-bind="props"
|
|
17
|
+
<SelectItemIndicator
|
|
18
|
+
v-bind="forwardProps"
|
|
18
19
|
:class="cn(
|
|
19
20
|
'select-item-indicator',
|
|
20
21
|
props.una?.selectItemIndicator,
|
|
@@ -29,5 +30,5 @@ const props = defineProps({
|
|
|
29
30
|
)"
|
|
30
31
|
/>
|
|
31
32
|
</slot>
|
|
32
|
-
</
|
|
33
|
+
</SelectItemIndicator>
|
|
33
34
|
</template>
|
|
@@ -3,9 +3,7 @@ declare var __VLS_6: {};
|
|
|
3
3
|
type __VLS_Slots = {} & {
|
|
4
4
|
default?: (props: typeof __VLS_6) => any;
|
|
5
5
|
};
|
|
6
|
-
declare const __VLS_component: import("vue").DefineComponent<NSelectItemIndicatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NSelectItemIndicatorProps> & Readonly<{}>, {
|
|
7
|
-
as: import("reka-ui").AsTag | import("vue").Component;
|
|
8
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<NSelectItemIndicatorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NSelectItemIndicatorProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
7
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
10
8
|
export default _default;
|
|
11
9
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -15,8 +15,8 @@ declare const __VLS_component: import("vue").DefineComponent<NNavigationMenuLink
|
|
|
15
15
|
}>) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
17
|
btn: string;
|
|
18
|
-
navigationMenuLink: string;
|
|
19
18
|
as: import("reka-ui").AsTag | import("vue").Component;
|
|
19
|
+
navigationMenuLink: string;
|
|
20
20
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
21
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
22
22
|
export default _default;
|
|
@@ -6,8 +6,8 @@ type __VLS_Slots = {} & {
|
|
|
6
6
|
declare const __VLS_component: import("vue").DefineComponent<NNavigationMenuTriggerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NNavigationMenuTriggerProps> & Readonly<{}>, {
|
|
7
7
|
btn: string;
|
|
8
8
|
trailing: string;
|
|
9
|
-
navigationMenu: string;
|
|
10
9
|
as: import("reka-ui").AsTag | import("vue").Component;
|
|
10
|
+
navigationMenu: string;
|
|
11
11
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
13
13
|
export default _default;
|
|
@@ -13,6 +13,7 @@ const props = defineProps({
|
|
|
13
13
|
class: { type: null, required: false },
|
|
14
14
|
label: { type: String, required: false },
|
|
15
15
|
duration: { type: Number, required: false },
|
|
16
|
+
disableSwipe: { type: Boolean, required: false },
|
|
16
17
|
swipeDirection: { type: String, required: false },
|
|
17
18
|
swipeThreshold: { type: Number, required: false }
|
|
18
19
|
});
|
|
@@ -3,6 +3,7 @@ import { ToastProvider } from "reka-ui";
|
|
|
3
3
|
const props = defineProps({
|
|
4
4
|
label: { type: String, required: false },
|
|
5
5
|
duration: { type: Number, required: false, default: 5e3 },
|
|
6
|
+
disableSwipe: { type: Boolean, required: false },
|
|
6
7
|
swipeDirection: { type: String, required: false },
|
|
7
8
|
swipeThreshold: { type: Number, required: false }
|
|
8
9
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useCookie } from "#app";
|
|
2
3
|
import { useEventListener, useMediaQuery, useVModel } from "@vueuse/core";
|
|
3
4
|
import { TooltipProvider } from "reka-ui";
|
|
4
5
|
import { computed, ref } from "vue";
|
|
@@ -13,13 +14,17 @@ const props = defineProps({
|
|
|
13
14
|
const emits = defineEmits(["update:open"]);
|
|
14
15
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
15
16
|
const openMobile = ref(false);
|
|
17
|
+
const openCookie = useCookie(SIDEBAR_COOKIE_NAME, {
|
|
18
|
+
maxAge: SIDEBAR_COOKIE_MAX_AGE,
|
|
19
|
+
default: () => props.defaultOpen ?? false
|
|
20
|
+
});
|
|
16
21
|
const open = useVModel(props, "open", emits, {
|
|
17
|
-
defaultValue:
|
|
22
|
+
defaultValue: openCookie.value,
|
|
18
23
|
passive: props.open === void 0
|
|
19
24
|
});
|
|
20
25
|
function setOpen(value) {
|
|
21
26
|
open.value = value;
|
|
22
|
-
|
|
27
|
+
openCookie.value = open.value;
|
|
23
28
|
}
|
|
24
29
|
function setOpenMobile(value) {
|
|
25
30
|
openMobile.value = value;
|
|
@@ -8,8 +8,8 @@ declare const __VLS_component: import("vue").DefineComponent<NSidebarProviderPro
|
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<NSidebarProviderProps> & Readonly<{
|
|
9
9
|
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
10
10
|
}>, {
|
|
11
|
-
defaultOpen: boolean;
|
|
12
11
|
open: boolean;
|
|
12
|
+
defaultOpen: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
15
15
|
export default _default;
|
|
@@ -5,8 +5,8 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<NToggleGro
|
|
|
5
5
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
6
6
|
}>, {
|
|
7
7
|
icon: boolean;
|
|
8
|
-
square: import("vue").HTMLAttributes["class"];
|
|
9
8
|
as: import("reka-ui").AsTag | import("vue").Component;
|
|
9
|
+
square: import("vue").HTMLAttributes["class"];
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
11
11
|
default?: (props: any) => any;
|
|
12
12
|
}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { UnaSettings } from '../types/index.js';
|
|
3
3
|
export interface UseUnaSettingsReturn {
|
|
4
|
-
defaultSettings: UnaSettings
|
|
5
|
-
settings: Ref<UnaSettings
|
|
4
|
+
defaultSettings: Omit<UnaSettings, 'themes'>;
|
|
5
|
+
settings: Ref<Omit<UnaSettings, 'themes'>>;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
}
|
|
8
8
|
export declare function useUnaSettings(): UseUnaSettingsReturn;
|
|
@@ -12,8 +12,7 @@ export function useUnaSettings() {
|
|
|
12
12
|
gray: una.gray,
|
|
13
13
|
radius: una.radius,
|
|
14
14
|
fontSize: una.fontSize,
|
|
15
|
-
theme: una.theme
|
|
16
|
-
themes: una.themes
|
|
15
|
+
theme: una.theme
|
|
17
16
|
};
|
|
18
17
|
const settings = useStorage("una-settings", defaultSettings, void 0, {
|
|
19
18
|
mergeDefaults: defu
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from "#app";
|
|
1
|
+
import { defineNuxtPlugin, useAppConfig } from "#app";
|
|
2
2
|
import { computed, watchEffect } from "vue";
|
|
3
3
|
import { useUnaSettings } from "../composables/useUnaSettings.js";
|
|
4
4
|
let unaUIStyle;
|
|
5
5
|
export default defineNuxtPlugin(() => {
|
|
6
|
+
const { una: { themes } } = useAppConfig();
|
|
6
7
|
const { settings } = useUnaSettings();
|
|
7
8
|
unaUIStyle = document.createElement("style");
|
|
8
9
|
unaUIStyle.id = "una-ui-theme";
|
|
@@ -10,7 +11,7 @@ export default defineNuxtPlugin(() => {
|
|
|
10
11
|
const html = document.documentElement;
|
|
11
12
|
html.removeAttribute("style");
|
|
12
13
|
const computedStyles = computed(() => {
|
|
13
|
-
const theme =
|
|
14
|
+
const theme = themes.find((t) => t.name === settings.value.theme);
|
|
14
15
|
if (settings.value.theme && theme) {
|
|
15
16
|
return `
|
|
16
17
|
:root {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useHead } from "#app";
|
|
1
|
+
import { defineNuxtPlugin, useAppConfig, useHead } from "#app";
|
|
2
2
|
import { useUnaSettings } from "../composables/useUnaSettings.js";
|
|
3
3
|
export default defineNuxtPlugin(() => {
|
|
4
|
+
const { una: { themes } } = useAppConfig();
|
|
4
5
|
const { defaultSettings } = useUnaSettings();
|
|
5
6
|
useHead({
|
|
6
7
|
script: [
|
|
7
8
|
{
|
|
8
9
|
innerHTML: `
|
|
9
10
|
;(function() {
|
|
11
|
+
const themes = ${JSON.stringify(themes)}
|
|
10
12
|
let settings = JSON.parse(localStorage.getItem('una-settings'))
|
|
11
13
|
|
|
12
14
|
if (!settings) {
|
|
@@ -17,7 +19,7 @@ export default defineNuxtPlugin(() => {
|
|
|
17
19
|
${process.dev ? "console.log({ settings })" : ""}
|
|
18
20
|
|
|
19
21
|
if (settings.theme) {
|
|
20
|
-
const theme =
|
|
22
|
+
const theme = themes.find(t => t.name === settings.theme)
|
|
21
23
|
if (theme) {
|
|
22
24
|
Object.entries(theme.cssVars.light).map(i => html.style.setProperty(i[0], i[1]))
|
|
23
25
|
Object.entries(theme.cssVars.dark).map(i => html.style.setProperty(i[0], i[1]))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { AccordionContentProps, AccordionHeaderProps, AccordionItemProps, AccordionRootProps, AccordionTriggerProps } from 'reka-ui';
|
|
1
2
|
import type { NButtonProps } from './button.js';
|
|
2
|
-
export interface NAccordionProps extends
|
|
3
|
+
export interface NAccordionProps extends AccordionRootProps {
|
|
3
4
|
/**
|
|
4
5
|
* Allows you to add `UnaUI` accordion preset properties,
|
|
5
6
|
* Think of it as a shortcut for adding options or variants to the preset if available.
|
|
@@ -8,110 +9,54 @@ export interface NAccordionProps extends Omit<NButtonProps, 'una'> {
|
|
|
8
9
|
* But you can add your own in the configuration file.
|
|
9
10
|
*/
|
|
10
11
|
accordion?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Update leading icon when accordion button item is open,
|
|
13
|
-
* Accepts icon name and utility classes
|
|
14
|
-
*/
|
|
15
|
-
trailingOpen?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Update leading icon when accordion button item is closed,
|
|
18
|
-
* Accepts icon name and utility classes
|
|
19
|
-
*/
|
|
20
|
-
trailingClose?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Allow multiple accordion items to be open at the same time
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
multiple?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Allow accordion item to be open by default
|
|
29
|
-
*
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
defaultOpen?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Removes border and divider from accordion
|
|
35
|
-
*
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
unstyle?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* By default, the accordion is unmounted for performance reasons,
|
|
41
|
-
* This means that the accordion will not be rendered until it is opened,
|
|
42
|
-
* If you want to render the accordion when the page loads, you can use the `mounted` prop.
|
|
43
|
-
*
|
|
44
|
-
* @default false
|
|
45
|
-
*/
|
|
46
|
-
mounted?: boolean;
|
|
47
12
|
/**
|
|
48
13
|
* List of items to be rendered,
|
|
49
14
|
* It extends the `NButtonProps` interface
|
|
50
15
|
*
|
|
51
16
|
* @see https://github.com/una-ui/una-ui/blob/main/packages/nuxt/src/runtime/types/button.ts
|
|
52
17
|
*/
|
|
53
|
-
items
|
|
18
|
+
items?: NAccordionItemProps[];
|
|
54
19
|
/**
|
|
55
20
|
* `UnaUI` preset configuration
|
|
56
21
|
*
|
|
57
22
|
* @see https://github.com/una-ui/una-ui/blob/main/packages/preset/src/_shortcuts/accordion.ts
|
|
58
23
|
*/
|
|
59
|
-
una?:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} & NButtonProps['una'];
|
|
24
|
+
una?: NAccordionUnaProps & NButtonProps['una'];
|
|
25
|
+
_accordionItem?: Omit<NAccordionItemProps, 'una' | 'value'>;
|
|
26
|
+
_accordionHeader?: Omit<NAccordionHeaderProps, 'una'>;
|
|
27
|
+
_accordionTrigger?: Omit<NButtonProps, 'una'>;
|
|
28
|
+
_accordionContent?: Omit<NAccordionContentProps, 'una'>;
|
|
29
|
+
}
|
|
30
|
+
export interface NAccordionContentProps extends AccordionContentProps {
|
|
31
|
+
una?: Pick<NAccordionUnaProps, 'accordionContent' | 'accordionPanel'>;
|
|
32
|
+
}
|
|
33
|
+
export interface NAccordionHeaderProps extends AccordionHeaderProps {
|
|
34
|
+
una?: Pick<NAccordionUnaProps, 'accordionHeader' | 'accordionTrigger' | 'accordionTrailing' | 'accordionTrailingClose' | 'accordionTrailingOpen' | 'accordionLeading'>;
|
|
71
35
|
}
|
|
72
|
-
export interface
|
|
36
|
+
export interface NAccordionTriggerProps extends AccordionTriggerProps, NButtonProps {
|
|
37
|
+
una?: Pick<NAccordionUnaProps, 'accordionTrigger' | 'accordionTrailing' | 'accordionTrailingClose' | 'accordionTrailingOpen' | 'accordionLeading'> & NButtonProps['una'];
|
|
38
|
+
}
|
|
39
|
+
export interface NAccordionItemProps extends AccordionItemProps {
|
|
40
|
+
label?: string;
|
|
73
41
|
/**
|
|
74
42
|
* Accordion item content
|
|
75
43
|
*/
|
|
76
44
|
content?: string;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Allow accordion item to be open by default
|
|
95
|
-
*
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
defaultOpen?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Close other accordion items when item is open
|
|
101
|
-
*
|
|
102
|
-
* @default false
|
|
103
|
-
*/
|
|
104
|
-
closeOthers?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* By default, all the accordion item is unmounted for performance reasons,
|
|
107
|
-
* You can use the `mounted` prop to render the accordion specific on item.
|
|
108
|
-
*
|
|
109
|
-
* @default false
|
|
110
|
-
*/
|
|
111
|
-
mounted?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Allow dynamic attributes to be added to the accordion item,
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
[key: string]: any;
|
|
45
|
+
una?: Omit<NAccordionUnaProps, 'accordion'> & NButtonProps['una'];
|
|
46
|
+
_accordionHeader?: Omit<NAccordionHeaderProps, 'una'>;
|
|
47
|
+
_accordionTrigger?: Omit<NAccordionTriggerProps, 'una'>;
|
|
48
|
+
_accordionContent?: Omit<NAccordionContentProps, 'una'>;
|
|
49
|
+
}
|
|
50
|
+
interface NAccordionUnaProps {
|
|
51
|
+
accordion?: string;
|
|
52
|
+
accordionItem?: string;
|
|
53
|
+
accordionTrailing?: string;
|
|
54
|
+
accordionTrailingOpen?: string;
|
|
55
|
+
accordionTrailingClose?: string;
|
|
56
|
+
accordionLeading?: string;
|
|
57
|
+
accordionHeader?: string;
|
|
58
|
+
accordionTrigger?: string;
|
|
59
|
+
accordionContent?: string;
|
|
60
|
+
accordionPanel?: string;
|
|
117
61
|
}
|
|
62
|
+
export {};
|
|
@@ -26,7 +26,7 @@ export interface NSelectProps<T extends AcceptableValue, Items extends Array<T |
|
|
|
26
26
|
/**
|
|
27
27
|
* The items to display in the select.
|
|
28
28
|
*/
|
|
29
|
-
items
|
|
29
|
+
items?: Items;
|
|
30
30
|
/**
|
|
31
31
|
* The key name to use to display in the select items.
|
|
32
32
|
*/
|
|
@@ -110,7 +110,6 @@ export interface NSelectItemIndicatorProps extends SelectItemIndicatorProps {
|
|
|
110
110
|
}
|
|
111
111
|
export interface NSelectItemProps extends ItemExtensions {
|
|
112
112
|
selectItem?: HTMLAttributes['class'];
|
|
113
|
-
isSelected?: boolean;
|
|
114
113
|
_selectItemText?: NSelectItemTextProps;
|
|
115
114
|
_selectItemIndicator?: NSelectItemIndicatorProps;
|
|
116
115
|
una?: Pick<NSelectUnaProps, 'selectItem' | 'selectItemIndicator'>;
|
|
@@ -56,6 +56,11 @@ export interface NSidebarProviderProps {
|
|
|
56
56
|
/**
|
|
57
57
|
* Default open state.
|
|
58
58
|
*
|
|
59
|
+
* Sets the initial sidebar state when no persisted value exists.
|
|
60
|
+
*
|
|
61
|
+
* The sidebar state is automatically persisted in a cookie. On subsequent loads,
|
|
62
|
+
* the persisted cookie value takes precedence over this prop.
|
|
63
|
+
*
|
|
59
64
|
* @default true
|
|
60
65
|
*/
|
|
61
66
|
defaultOpen?: boolean;
|
|
@@ -2,7 +2,7 @@ export * from './cn.js';
|
|
|
2
2
|
export declare function rgbToHex(r: number, g: number, b: number): string;
|
|
3
3
|
export declare function hexToRgb(hex: string): [number, number, number];
|
|
4
4
|
export declare function randomId(prefix: string): string;
|
|
5
|
-
export declare function omitProps<T extends Record<string, any
|
|
5
|
+
export declare function omitProps<T extends Record<string, any>, K extends keyof T>(obj: T, propsToOmit: Array<K>): Omit<T, K>;
|
|
6
6
|
export declare function pickProps<T extends Record<string, any>>(obj: T, propsToPick: Array<keyof T>): Partial<T>;
|
|
7
7
|
/**
|
|
8
8
|
* We want to get the first non-undefined value,
|
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.11",
|
|
5
5
|
"description": "Nuxt module for @una-ui",
|
|
6
6
|
"author": "Phojie Rengel <phojrengel@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -36,16 +36,15 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@headlessui/vue": "^1.7.23",
|
|
40
39
|
"@iconify/utils": "^2.3.0",
|
|
41
40
|
"@nuxt/kit": "^3.19.2",
|
|
42
41
|
"@nuxtjs/color-mode": "^3.5.2",
|
|
43
42
|
"@tanstack/vue-table": "^8.21.3",
|
|
44
|
-
"@unocss/core": "^66.5.
|
|
45
|
-
"@unocss/nuxt": "^66.5.
|
|
46
|
-
"@unocss/preset-attributify": "^66.5.
|
|
47
|
-
"@unocss/preset-icons": "^66.5.
|
|
48
|
-
"@unocss/reset": "^66.5.
|
|
43
|
+
"@unocss/core": "^66.5.4",
|
|
44
|
+
"@unocss/nuxt": "^66.5.4",
|
|
45
|
+
"@unocss/preset-attributify": "^66.5.4",
|
|
46
|
+
"@unocss/preset-icons": "^66.5.4",
|
|
47
|
+
"@unocss/reset": "^66.5.4",
|
|
49
48
|
"@vee-validate/nuxt": "^4.15.1",
|
|
50
49
|
"@vee-validate/zod": "^4.15.1",
|
|
51
50
|
"@vueuse/core": "^12.8.2",
|
|
@@ -54,16 +53,16 @@
|
|
|
54
53
|
"class-variance-authority": "^0.7.1",
|
|
55
54
|
"clsx": "^2.1.1",
|
|
56
55
|
"ohash": "^1.1.6",
|
|
57
|
-
"reka-ui": "^2.
|
|
58
|
-
"tailwind-merge": "^3.
|
|
59
|
-
"unocss": "^66.5.
|
|
60
|
-
"unocss-preset-animations": "^1.
|
|
56
|
+
"reka-ui": "^2.6.0",
|
|
57
|
+
"tailwind-merge": "^3.4.0",
|
|
58
|
+
"unocss": "^66.5.4",
|
|
59
|
+
"unocss-preset-animations": "^1.3.0",
|
|
61
60
|
"vaul-vue": "^0.4.1",
|
|
62
|
-
"@una-ui/extractor-vue-script": "^1.0.0-alpha.
|
|
63
|
-
"@una-ui/preset": "^1.0.0-alpha.
|
|
61
|
+
"@una-ui/extractor-vue-script": "^1.0.0-alpha.11",
|
|
62
|
+
"@una-ui/preset": "^1.0.0-alpha.11"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
|
-
"@iconify-json/lucide": "^1.2.
|
|
65
|
+
"@iconify-json/lucide": "^1.2.73",
|
|
67
66
|
"@iconify-json/radix-icons": "^1.2.5",
|
|
68
67
|
"@iconify-json/tabler": "^1.2.23",
|
|
69
68
|
"@nuxt/module-builder": "^1.0.2",
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
Disclosure,
|
|
4
|
-
DisclosureButton,
|
|
5
|
-
DisclosurePanel
|
|
6
|
-
} from "@headlessui/vue";
|
|
7
|
-
import { createReusableTemplate } from "@vueuse/core";
|
|
8
|
-
import { computed, ref } from "vue";
|
|
9
|
-
import { pickProps } from "../../utils";
|
|
10
|
-
import NButton from "./Button.vue";
|
|
11
|
-
import NIcon from "./Icon.vue";
|
|
12
|
-
const props = defineProps({
|
|
13
|
-
accordion: { type: String, required: false },
|
|
14
|
-
trailingOpen: { type: String, required: false, default: "accordion-trailing-icon" },
|
|
15
|
-
trailingClose: { type: String, required: false },
|
|
16
|
-
multiple: { type: Boolean, required: false },
|
|
17
|
-
defaultOpen: { type: Boolean, required: false },
|
|
18
|
-
unstyle: { type: Boolean, required: false },
|
|
19
|
-
mounted: { type: Boolean, required: false },
|
|
20
|
-
items: { type: Array, required: true },
|
|
21
|
-
una: { type: Object, required: false },
|
|
22
|
-
type: { type: String, required: false },
|
|
23
|
-
loadingPlacement: { type: String, required: false, default: "trailing" },
|
|
24
|
-
icon: { type: Boolean, required: false },
|
|
25
|
-
disabled: { type: Boolean, required: false },
|
|
26
|
-
reverse: { type: Boolean, required: false },
|
|
27
|
-
loading: { type: Boolean, required: false },
|
|
28
|
-
block: { type: Boolean, required: false },
|
|
29
|
-
to: { type: null, required: false },
|
|
30
|
-
label: { type: String, required: false },
|
|
31
|
-
btn: { type: String, required: false },
|
|
32
|
-
leading: { type: String, required: false },
|
|
33
|
-
trailing: { type: String, required: false },
|
|
34
|
-
size: { type: String, required: false },
|
|
35
|
-
square: { type: null, required: false },
|
|
36
|
-
rounded: { type: null, required: false },
|
|
37
|
-
class: { type: null, required: false },
|
|
38
|
-
breadcrumbActive: { type: String, required: false },
|
|
39
|
-
breadcrumbInactive: { type: String, required: false },
|
|
40
|
-
paginationSelected: { type: String, required: false },
|
|
41
|
-
paginationUnselected: { type: String, required: false },
|
|
42
|
-
dropdownMenu: { type: String, required: false },
|
|
43
|
-
toggleOn: { type: String, required: false },
|
|
44
|
-
toggleOff: { type: String, required: false },
|
|
45
|
-
tabsActive: { type: String, required: false },
|
|
46
|
-
tabsInactive: { type: String, required: false },
|
|
47
|
-
navigationMenu: { type: String, required: false },
|
|
48
|
-
navigationMenuLink: { type: String, required: false },
|
|
49
|
-
ariaLabel: { type: String, required: false }
|
|
50
|
-
});
|
|
51
|
-
const buttonRefs = ref([]);
|
|
52
|
-
function closeOthers(index) {
|
|
53
|
-
if (props.multiple && props.items[index] && !props.items[index].closeOthers)
|
|
54
|
-
return;
|
|
55
|
-
buttonRefs.value.filter((_, i) => i !== index).forEach((close) => close());
|
|
56
|
-
}
|
|
57
|
-
function onEnter(element, done) {
|
|
58
|
-
const el = element;
|
|
59
|
-
el.style.height = "0";
|
|
60
|
-
el.style.height = `${element.scrollHeight}px`;
|
|
61
|
-
el.addEventListener("transitionend", done, { once: true });
|
|
62
|
-
}
|
|
63
|
-
function onAfterEnter(element) {
|
|
64
|
-
const el = element;
|
|
65
|
-
el.style.height = "auto";
|
|
66
|
-
}
|
|
67
|
-
function onBeforeLeave(element) {
|
|
68
|
-
const el = element;
|
|
69
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
70
|
-
}
|
|
71
|
-
function onLeave(element, done) {
|
|
72
|
-
const el = element;
|
|
73
|
-
el.style.height = "0";
|
|
74
|
-
el.addEventListener("transitionend", done, { once: true });
|
|
75
|
-
}
|
|
76
|
-
const [DefineTemplate, ReuseTemplate] = createReusableTemplate();
|
|
77
|
-
const pickedProps = pickProps(props, ["reverse", "icon", "btn", "label", "leading", "loading", "loadingPlacement", "una", "trailing", "leading", "to", "type", "disabled"]);
|
|
78
|
-
function mergedProps(itemProps) {
|
|
79
|
-
return Object.assign(pickedProps, itemProps);
|
|
80
|
-
}
|
|
81
|
-
const btnVariants = ["solid", "outline", "soft", "ghost", "link", "text"];
|
|
82
|
-
const hasVariant = computed(() => btnVariants.some((btnVariants2) => props.btn?.includes(btnVariants2)));
|
|
83
|
-
const isBaseVariant = computed(() => props.btn?.includes("~"));
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<template>
|
|
87
|
-
<div
|
|
88
|
-
:accordion="accordion"
|
|
89
|
-
class="accordion"
|
|
90
|
-
:class="[
|
|
91
|
-
unstyle ? 'space-y-3' : 'accordion-(border divider)',
|
|
92
|
-
una?.accordion
|
|
93
|
-
]"
|
|
94
|
-
>
|
|
95
|
-
<DefineTemplate v-slot="{ item, close, index, open }">
|
|
96
|
-
<slot
|
|
97
|
-
:name="item.content ? 'content' : index"
|
|
98
|
-
:item="item" :index="index" :open="open" :close="close"
|
|
99
|
-
>
|
|
100
|
-
<div
|
|
101
|
-
accordion="panel"
|
|
102
|
-
:class="[
|
|
103
|
-
una?.accordionPanel,
|
|
104
|
-
{ 'border-t-0': unstyle }
|
|
105
|
-
]"
|
|
106
|
-
>
|
|
107
|
-
{{ item.content }}
|
|
108
|
-
</div>
|
|
109
|
-
</slot>
|
|
110
|
-
</DefineTemplate>
|
|
111
|
-
|
|
112
|
-
<Disclosure
|
|
113
|
-
v-for="(item, i) in items"
|
|
114
|
-
:key="i"
|
|
115
|
-
v-slot="{ open, close }"
|
|
116
|
-
as="div"
|
|
117
|
-
accordion="item"
|
|
118
|
-
:default-open="item.defaultOpen || defaultOpen"
|
|
119
|
-
:class="una?.accordionItem"
|
|
120
|
-
>
|
|
121
|
-
<DisclosureButton
|
|
122
|
-
:ref="() => buttonRefs[i] = close"
|
|
123
|
-
as="template"
|
|
124
|
-
:disabled="item.disabled || disabled"
|
|
125
|
-
@click="closeOthers(i)"
|
|
126
|
-
>
|
|
127
|
-
<slot name="label" :item="item" :index="i" :open="open" :close="close">
|
|
128
|
-
<NButton
|
|
129
|
-
v-bind="mergedProps(item)"
|
|
130
|
-
:btn="`~ block ${btn || ''}`"
|
|
131
|
-
:class="[
|
|
132
|
-
{ 'accordion-button-default-variant': !hasVariant && !isBaseVariant },
|
|
133
|
-
{ 'accordion-button-padding': !unstyle },
|
|
134
|
-
una?.accordionButton
|
|
135
|
-
]"
|
|
136
|
-
:una="{
|
|
137
|
-
btn: 'h-auto accordion-button',
|
|
138
|
-
btnLabel: 'accordion-label'
|
|
139
|
-
}"
|
|
140
|
-
>
|
|
141
|
-
<template #leading>
|
|
142
|
-
<!-- TODO: fix conditional statement -->
|
|
143
|
-
<NIcon
|
|
144
|
-
v-if="leading || item.leading"
|
|
145
|
-
accordion="leading"
|
|
146
|
-
:class="una?.accordionLeading"
|
|
147
|
-
:name="item.leading || leading || ''"
|
|
148
|
-
aria-hidden="true"
|
|
149
|
-
/>
|
|
150
|
-
</template>
|
|
151
|
-
|
|
152
|
-
<template #trailing>
|
|
153
|
-
<span
|
|
154
|
-
v-if="trailingOpen || trailingClose"
|
|
155
|
-
accordion="trailing"
|
|
156
|
-
:class="[
|
|
157
|
-
trailingClose || !trailingClose && open ? una?.accordionTrailingClose || 'accordion-trailing-close' : una?.accordionTrailingOpen || 'accordion-trailing-open',
|
|
158
|
-
una?.accordionTrailing
|
|
159
|
-
]"
|
|
160
|
-
>
|
|
161
|
-
<NIcon
|
|
162
|
-
v-if="(open || !trailingClose) && trailingOpen"
|
|
163
|
-
:name="trailingOpen"
|
|
164
|
-
aria-hidden="true"
|
|
165
|
-
/>
|
|
166
|
-
<NIcon
|
|
167
|
-
v-else-if="!open && trailingClose"
|
|
168
|
-
:name="trailingClose"
|
|
169
|
-
aria-hidden="true"
|
|
170
|
-
/>
|
|
171
|
-
</span>
|
|
172
|
-
</template>
|
|
173
|
-
</NButton>
|
|
174
|
-
</slot>
|
|
175
|
-
</DisclosureButton>
|
|
176
|
-
|
|
177
|
-
<Transition
|
|
178
|
-
:enter-active-class="una?.accordionLeaveActive || 'accordion-leave-active'"
|
|
179
|
-
:leave-active-class="una?.accordionEnterActive || 'accordion-enter-active'"
|
|
180
|
-
@enter="onEnter"
|
|
181
|
-
@after-enter="onAfterEnter"
|
|
182
|
-
@before-leave="onBeforeLeave"
|
|
183
|
-
@leave="onLeave"
|
|
184
|
-
>
|
|
185
|
-
<DisclosurePanel v-if="!item.mounted || !mounted">
|
|
186
|
-
<ReuseTemplate
|
|
187
|
-
v-bind="{
|
|
188
|
-
item,
|
|
189
|
-
index: i,
|
|
190
|
-
open,
|
|
191
|
-
close
|
|
192
|
-
}"
|
|
193
|
-
/>
|
|
194
|
-
</DisclosurePanel>
|
|
195
|
-
<DisclosurePanel
|
|
196
|
-
v-else
|
|
197
|
-
v-show="open"
|
|
198
|
-
static
|
|
199
|
-
>
|
|
200
|
-
<ReuseTemplate
|
|
201
|
-
v-bind="{
|
|
202
|
-
item,
|
|
203
|
-
index: i,
|
|
204
|
-
open,
|
|
205
|
-
close
|
|
206
|
-
}"
|
|
207
|
-
/>
|
|
208
|
-
</DisclosurePanel>
|
|
209
|
-
</Transition>
|
|
210
|
-
</Disclosure>
|
|
211
|
-
</div>
|
|
212
|
-
</template>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { NAccordionProps } from '../../types/index.js';
|
|
2
|
-
declare var __VLS_6: any, __VLS_7: {
|
|
3
|
-
item: any;
|
|
4
|
-
index: any;
|
|
5
|
-
open: any;
|
|
6
|
-
close: any;
|
|
7
|
-
}, __VLS_21: {
|
|
8
|
-
item: any;
|
|
9
|
-
index: any;
|
|
10
|
-
open: any;
|
|
11
|
-
close: any;
|
|
12
|
-
};
|
|
13
|
-
type __VLS_Slots = {} & {
|
|
14
|
-
[K in NonNullable<typeof __VLS_6>]?: (props: typeof __VLS_7) => any;
|
|
15
|
-
} & {
|
|
16
|
-
label?: (props: typeof __VLS_21) => any;
|
|
17
|
-
};
|
|
18
|
-
declare const __VLS_component: import("vue").DefineComponent<NAccordionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NAccordionProps> & Readonly<{}>, {
|
|
19
|
-
loadingPlacement: "leading" | "trailing" | "label";
|
|
20
|
-
trailingOpen: string;
|
|
21
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
-
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
23
|
-
export default _default;
|
|
24
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
-
new (): {
|
|
26
|
-
$slots: S;
|
|
27
|
-
};
|
|
28
|
-
};
|