@nuxt/ui 3.1.1 → 3.1.2
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/.nuxt/ui/alert.ts +0 -5
- package/.nuxt/ui/badge.ts +30 -7
- package/.nuxt/ui/button-group.ts +0 -13
- package/.nuxt/ui/button.ts +2 -7
- package/.nuxt/ui/calendar.ts +1 -1
- package/.nuxt/ui/carousel.ts +0 -5
- package/.nuxt/ui/checkbox-group.ts +144 -1
- package/.nuxt/ui/color-picker.ts +2 -2
- package/.nuxt/ui/input-menu.ts +2 -11
- package/.nuxt/ui/input-number.ts +10 -0
- package/.nuxt/ui/input.ts +2 -11
- package/.nuxt/ui/link.ts +12 -5
- package/.nuxt/ui/select-menu.ts +2 -11
- package/.nuxt/ui/select.ts +2 -11
- package/.nuxt/ui/tabs.ts +4 -3
- package/.nuxt/ui/textarea.ts +2 -11
- package/.nuxt/ui/toast.ts +0 -5
- package/cli/templates.mjs +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +14 -5
- package/dist/runtime/components/Accordion.vue +9 -9
- package/dist/runtime/components/Accordion.vue.d.ts +2 -0
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Avatar.vue +2 -2
- package/dist/runtime/components/AvatarGroup.vue +1 -1
- package/dist/runtime/components/Badge.vue +5 -3
- package/dist/runtime/components/Badge.vue.d.ts +2 -0
- package/dist/runtime/components/Breadcrumb.vue +8 -8
- package/dist/runtime/components/Breadcrumb.vue.d.ts +2 -0
- package/dist/runtime/components/Button.vue +2 -3
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +2 -1
- package/dist/runtime/components/Card.vue +1 -1
- package/dist/runtime/components/Carousel.vue +5 -2
- package/dist/runtime/components/Carousel.vue.d.ts +6 -1
- package/dist/runtime/components/Checkbox.vue +2 -2
- package/dist/runtime/components/CheckboxGroup.vue +8 -5
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +7 -1
- package/dist/runtime/components/Chip.vue +1 -1
- package/dist/runtime/components/Collapsible.vue +1 -1
- package/dist/runtime/components/ColorPicker.vue +1 -1
- package/dist/runtime/components/CommandPalette.vue +17 -17
- package/dist/runtime/components/CommandPalette.vue.d.ts +2 -0
- package/dist/runtime/components/ContextMenu.vue.d.ts +2 -0
- package/dist/runtime/components/ContextMenuContent.vue +15 -15
- package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
- package/dist/runtime/components/DropdownMenuContent.vue +15 -15
- package/dist/runtime/components/FormField.vue +5 -5
- package/dist/runtime/components/Input.vue +2 -2
- package/dist/runtime/components/Input.vue.d.ts +23 -29
- package/dist/runtime/components/InputMenu.vue +17 -17
- package/dist/runtime/components/InputMenu.vue.d.ts +210 -0
- package/dist/runtime/components/InputNumber.vue +13 -7
- package/dist/runtime/components/InputNumber.vue.d.ts +78 -0
- package/dist/runtime/components/Link.vue +5 -14
- package/dist/runtime/components/NavigationMenu.vue +35 -28
- package/dist/runtime/components/NavigationMenu.vue.d.ts +20 -2
- package/dist/runtime/components/Pagination.vue +1 -1
- package/dist/runtime/components/PinInput.vue +1 -1
- package/dist/runtime/components/Progress.vue +1 -1
- package/dist/runtime/components/RadioGroup.vue +8 -8
- package/dist/runtime/components/RadioGroup.vue.d.ts +2 -0
- package/dist/runtime/components/Select.vue +12 -12
- package/dist/runtime/components/Select.vue.d.ts +3 -1
- package/dist/runtime/components/SelectMenu.vue +13 -13
- package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
- package/dist/runtime/components/Separator.vue +1 -1
- package/dist/runtime/components/Slider.vue +16 -4
- package/dist/runtime/components/Slider.vue.d.ts +26 -20
- package/dist/runtime/components/Stepper.vue +10 -10
- package/dist/runtime/components/Stepper.vue.d.ts +2 -0
- package/dist/runtime/components/Switch.vue +1 -1
- package/dist/runtime/components/Table.vue +2 -2
- package/dist/runtime/components/Tabs.vue +6 -6
- package/dist/runtime/components/Tabs.vue.d.ts +2 -0
- package/dist/runtime/components/Textarea.vue +3 -3
- package/dist/runtime/components/Textarea.vue.d.ts +23 -30
- package/dist/runtime/components/Toast.vue +3 -2
- package/dist/runtime/components/Toast.vue.d.ts +6 -0
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Toaster.vue.d.ts +6 -0
- package/dist/runtime/components/Tree.vue +10 -10
- package/dist/runtime/components/Tree.vue.d.ts +2 -0
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/inertia/components/Link.vue +46 -60
- package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
- package/dist/runtime/inertia/components/LinkBase.vue +68 -0
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/inertia/stubs.js +1 -1
- package/dist/runtime/locale/index.d.ts +1 -0
- package/dist/runtime/locale/index.js +1 -0
- package/dist/runtime/locale/sl.d.ts +3 -0
- package/dist/runtime/locale/sl.js +54 -0
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +12 -0
- package/dist/runtime/vue/components/Link.vue +27 -40
- package/dist/runtime/vue/composables/useAppConfig.js +3 -1
- package/dist/runtime/vue/stubs.d.ts +1 -1
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{ui.CbtTMMzt.mjs → ui.BvUP-pSb.mjs} +103 -16
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +21 -21
|
@@ -61,7 +61,7 @@ const defaultExpanded = computed(
|
|
|
61
61
|
<li
|
|
62
62
|
v-for="(item, index) in items"
|
|
63
63
|
:key="`${level}-${index}`"
|
|
64
|
-
:class="level > 0 ? ui.itemWithChildren({ class: props.ui?.itemWithChildren }) : ui.item({ class: props.ui?.item })"
|
|
64
|
+
:class="level > 0 ? ui.itemWithChildren({ class: [props.ui?.itemWithChildren, item.ui?.itemWithChildren] }) : ui.item({ class: [props.ui?.item, item.ui?.item] })"
|
|
65
65
|
>
|
|
66
66
|
<TreeItem
|
|
67
67
|
v-slot="{ isExpanded, isSelected }"
|
|
@@ -71,37 +71,37 @@ const defaultExpanded = computed(
|
|
|
71
71
|
@toggle="item.onToggle"
|
|
72
72
|
@select="item.onSelect"
|
|
73
73
|
>
|
|
74
|
-
<button :disabled="item.disabled || disabled" :class="ui.link({ class: props.ui?.link, selected: isSelected, disabled: item.disabled || disabled })">
|
|
74
|
+
<button :disabled="item.disabled || disabled" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], selected: isSelected, disabled: item.disabled || disabled })">
|
|
75
75
|
<slot :name="item.slot || 'item'" v-bind="{ index, level, expanded: isExpanded, selected: isSelected }" :item="item">
|
|
76
76
|
<slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" v-bind="{ index, level, expanded: isExpanded, selected: isSelected }" :item="item">
|
|
77
77
|
<UIcon
|
|
78
78
|
v-if="item.icon"
|
|
79
79
|
:name="item.icon"
|
|
80
|
-
:class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon })"
|
|
80
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon] })"
|
|
81
81
|
/>
|
|
82
82
|
<UIcon
|
|
83
83
|
v-else-if="item.children?.length"
|
|
84
84
|
:name="isExpanded ? expandedIcon ?? appConfig.ui.icons.folderOpen : collapsedIcon ?? appConfig.ui.icons.folder"
|
|
85
|
-
:class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon })"
|
|
85
|
+
:class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon] })"
|
|
86
86
|
/>
|
|
87
87
|
</slot>
|
|
88
88
|
|
|
89
|
-
<span v-if="getItemLabel(item) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
|
89
|
+
<span v-if="getItemLabel(item) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })">
|
|
90
90
|
<slot :name="item.slot ? `${item.slot}-label` : 'item-label'" v-bind="{ item, index, level, expanded: isExpanded, selected: isSelected }" :item="item">
|
|
91
91
|
{{ getItemLabel(item) }}
|
|
92
92
|
</slot>
|
|
93
93
|
</span>
|
|
94
94
|
|
|
95
|
-
<span v-if="item.trailingIcon || item.children?.length || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: props.ui?.linkTrailing })">
|
|
95
|
+
<span v-if="item.trailingIcon || item.children?.length || !!slots[item.slot ? `${item.slot}-trailing` : 'item-trailing']" :class="ui.linkTrailing({ class: [props.ui?.linkTrailing, item.ui?.linkTrailing] })">
|
|
96
96
|
<slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" v-bind="{ item, index, level, expanded: isExpanded, selected: isSelected }" :item="item">
|
|
97
|
-
<UIcon v-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon })" />
|
|
98
|
-
<UIcon v-else-if="item.children?.length" :name="trailingIcon ?? appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: props.ui?.linkTrailingIcon })" />
|
|
97
|
+
<UIcon v-if="item.trailingIcon" :name="item.trailingIcon" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon] })" />
|
|
98
|
+
<UIcon v-else-if="item.children?.length" :name="trailingIcon ?? appConfig.ui.icons.chevronDown" :class="ui.linkTrailingIcon({ class: [props.ui?.linkTrailingIcon, item.ui?.linkTrailingIcon] })" />
|
|
99
99
|
</slot>
|
|
100
100
|
</span>
|
|
101
101
|
</slot>
|
|
102
102
|
</button>
|
|
103
103
|
|
|
104
|
-
<ul v-if="item.children?.length && isExpanded" :class="ui.listWithChildren({ class: props.ui?.listWithChildren })">
|
|
104
|
+
<ul v-if="item.children?.length && isExpanded" :class="ui.listWithChildren({ class: [props.ui?.listWithChildren, item.ui?.listWithChildren] })">
|
|
105
105
|
<ReuseTreeTemplate :items="item.children" :level="level + 1" />
|
|
106
106
|
</ul>
|
|
107
107
|
</TreeItem>
|
|
@@ -110,7 +110,7 @@ const defaultExpanded = computed(
|
|
|
110
110
|
|
|
111
111
|
<TreeRoot
|
|
112
112
|
v-bind="rootProps"
|
|
113
|
-
:class="ui.root({ class: [props.
|
|
113
|
+
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
114
114
|
:get-key="getItemValue"
|
|
115
115
|
:default-expanded="defaultExpanded"
|
|
116
116
|
:selection-behavior="selectionBehavior"
|
|
@@ -20,6 +20,8 @@ export type TreeItem = {
|
|
|
20
20
|
children?: TreeItem[];
|
|
21
21
|
onToggle?(e: Event): void;
|
|
22
22
|
onSelect?(e?: Event): void;
|
|
23
|
+
class?: any;
|
|
24
|
+
ui?: Pick<Tree['slots'], 'item' | 'itemWithChildren' | 'link' | 'linkLeadingIcon' | 'linkLabel' | 'linkTrailing' | 'linkTrailingIcon' | 'listWithChildren'>;
|
|
23
25
|
[key: string]: any;
|
|
24
26
|
};
|
|
25
27
|
export interface TreeProps<T extends TreeItem[] = TreeItem[], VK extends GetItemKeys<T> = 'value', M extends boolean = false> extends Pick<TreeRootProps<T>, 'expanded' | 'defaultExpanded' | 'selectionBehavior' | 'propagateSelect' | 'disabled'> {
|
|
@@ -13,7 +13,7 @@ type Props<T> = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const formOptionsInjectionKey: InjectionKey<ComputedRef<FormInjectedOptions>>;
|
|
15
15
|
export declare const formBusInjectionKey: InjectionKey<UseEventBusReturn<FormEvent<any>, string>>;
|
|
16
|
-
export declare const formFieldInjectionKey: InjectionKey<ComputedRef<FormFieldInjectedOptions<FormFieldProps
|
|
16
|
+
export declare const formFieldInjectionKey: InjectionKey<ComputedRef<FormFieldInjectedOptions<FormFieldProps>> | undefined>;
|
|
17
17
|
export declare const inputIdInjectionKey: InjectionKey<Ref<string | undefined>>;
|
|
18
18
|
export declare const formInputsInjectionKey: InjectionKey<Ref<Record<string, {
|
|
19
19
|
id?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, computed } from "vue";
|
|
1
|
+
import { inject, computed, provide } from "vue";
|
|
2
2
|
import { useDebounceFn } from "@vueuse/core";
|
|
3
3
|
export const formOptionsInjectionKey = Symbol("nuxt-ui.form-options");
|
|
4
4
|
export const formBusInjectionKey = Symbol("nuxt-ui.form-events");
|
|
@@ -12,6 +12,7 @@ export function useFormField(props, opts) {
|
|
|
12
12
|
const formField = inject(formFieldInjectionKey, void 0);
|
|
13
13
|
const formInputs = inject(formInputsInjectionKey, void 0);
|
|
14
14
|
const inputId = inject(inputIdInjectionKey, void 0);
|
|
15
|
+
provide(formFieldInjectionKey, void 0);
|
|
15
16
|
if (formField && inputId) {
|
|
16
17
|
if (opts?.bind === false) {
|
|
17
18
|
inputId.value = void 0;
|
|
@@ -7,10 +7,11 @@ import { computed } from "vue";
|
|
|
7
7
|
import { defu } from "defu";
|
|
8
8
|
import { useForwardProps } from "reka-ui";
|
|
9
9
|
import { reactiveOmit } from "@vueuse/core";
|
|
10
|
-
import { usePage
|
|
10
|
+
import { usePage } from "@inertiajs/vue3";
|
|
11
11
|
import { hasProtocol } from "ufo";
|
|
12
12
|
import { useAppConfig } from "#imports";
|
|
13
13
|
import { tv } from "../../utils/tv";
|
|
14
|
+
import ULinkBase from "../../components/LinkBase.vue";
|
|
14
15
|
defineOptions({ inheritAttrs: false });
|
|
15
16
|
const props = defineProps({
|
|
16
17
|
as: { type: null, required: false, default: "button" },
|
|
@@ -31,7 +32,6 @@ const props = defineProps({
|
|
|
31
32
|
data: { type: Object, required: false },
|
|
32
33
|
method: { type: String, required: false },
|
|
33
34
|
headers: { type: Object, required: false },
|
|
34
|
-
onClick: { type: Function, required: false },
|
|
35
35
|
preserveScroll: { type: [Boolean, String, Function], required: false },
|
|
36
36
|
preserveState: { type: [Boolean, String, Function], required: false },
|
|
37
37
|
replace: { type: Boolean, required: false },
|
|
@@ -51,8 +51,9 @@ const props = defineProps({
|
|
|
51
51
|
cacheFor: { type: [Number, String, Array], required: false }
|
|
52
52
|
});
|
|
53
53
|
defineSlots();
|
|
54
|
+
const page = usePage();
|
|
54
55
|
const appConfig = useAppConfig();
|
|
55
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "raw", "class"));
|
|
56
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
56
57
|
const ui = computed(() => tv({
|
|
57
58
|
extend: tv(theme),
|
|
58
59
|
...defu({
|
|
@@ -64,83 +65,68 @@ const ui = computed(() => tv({
|
|
|
64
65
|
}
|
|
65
66
|
}, appConfig.ui?.link || {})
|
|
66
67
|
}));
|
|
68
|
+
const href = computed(() => props.to ?? props.href);
|
|
67
69
|
const isExternal = computed(() => {
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
+
if (props.external) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (!href.value) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return typeof href.value === "string" && hasProtocol(href.value, { acceptRelative: true });
|
|
77
|
+
});
|
|
78
|
+
const isLinkActive = computed(() => {
|
|
79
|
+
if (props.active !== void 0) {
|
|
80
|
+
return props.active;
|
|
81
|
+
}
|
|
82
|
+
if (!href.value) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (props.exact && page.url === href.value) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
if (!props.exact && page.url.startsWith(href.value)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
70
92
|
});
|
|
71
93
|
const linkClass = computed(() => {
|
|
72
|
-
const active =
|
|
94
|
+
const active = isLinkActive.value;
|
|
73
95
|
if (props.raw) {
|
|
74
96
|
return [props.class, active ? props.activeClass : props.inactiveClass];
|
|
75
97
|
}
|
|
76
98
|
return ui.value({ class: props.class, active, disabled: props.disabled });
|
|
77
99
|
});
|
|
78
|
-
const page = usePage();
|
|
79
|
-
const url = computed(() => props.to ?? props.href ?? "#");
|
|
80
|
-
const isActive = computed(() => props.active || (props.exact ? url.value === props.href : page?.url.startsWith(url.value)));
|
|
81
100
|
</script>
|
|
82
101
|
|
|
83
102
|
<template>
|
|
84
|
-
<template v-if="
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
<slot
|
|
88
|
-
v-bind="{
|
|
89
|
-
...$attrs,
|
|
90
|
-
as,
|
|
91
|
-
type,
|
|
92
|
-
disabled,
|
|
93
|
-
href: url,
|
|
94
|
-
active: isActive
|
|
95
|
-
}"
|
|
96
|
-
/>
|
|
97
|
-
</template>
|
|
98
|
-
<ULinkBase
|
|
99
|
-
v-else
|
|
100
|
-
v-bind="{
|
|
103
|
+
<template v-if="custom">
|
|
104
|
+
<slot
|
|
105
|
+
v-bind="{
|
|
101
106
|
...$attrs,
|
|
107
|
+
...routerLinkProps,
|
|
102
108
|
as,
|
|
103
109
|
type,
|
|
104
110
|
disabled,
|
|
105
|
-
href
|
|
106
|
-
active:
|
|
111
|
+
href,
|
|
112
|
+
active: isLinkActive,
|
|
113
|
+
isExternal
|
|
107
114
|
}"
|
|
108
|
-
|
|
109
|
-
>
|
|
110
|
-
<slot :active="isActive" />
|
|
111
|
-
</ULinkBase>
|
|
112
|
-
</InertiaLink>
|
|
115
|
+
/>
|
|
113
116
|
</template>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<slot
|
|
118
|
-
v-bind="{
|
|
117
|
+
<ULinkBase
|
|
118
|
+
v-else
|
|
119
|
+
v-bind="{
|
|
119
120
|
...$attrs,
|
|
121
|
+
...routerLinkProps,
|
|
120
122
|
as,
|
|
121
123
|
type,
|
|
122
124
|
disabled,
|
|
123
|
-
href
|
|
124
|
-
|
|
125
|
-
active: isActive
|
|
125
|
+
href,
|
|
126
|
+
isExternal
|
|
126
127
|
}"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
v-bind="{
|
|
132
|
-
...$attrs,
|
|
133
|
-
as,
|
|
134
|
-
type,
|
|
135
|
-
disabled,
|
|
136
|
-
href: url,
|
|
137
|
-
target: isExternal ? '_blank' : void 0,
|
|
138
|
-
active: isActive
|
|
139
|
-
}"
|
|
140
|
-
:is-external="isExternal"
|
|
141
|
-
:class="linkClass"
|
|
142
|
-
>
|
|
143
|
-
<slot :active="isActive" />
|
|
144
|
-
</ULinkBase>
|
|
145
|
-
</template>
|
|
128
|
+
:class="linkClass"
|
|
129
|
+
>
|
|
130
|
+
<slot :active="isLinkActive" />
|
|
131
|
+
</ULinkBase>
|
|
146
132
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'vue';
|
|
2
2
|
import type { InertiaLinkProps } from '@inertiajs/vue3';
|
|
3
|
-
interface NuxtLinkProps extends Omit<InertiaLinkProps, 'href'> {
|
|
3
|
+
interface NuxtLinkProps extends Omit<InertiaLinkProps, 'href' | 'onClick'> {
|
|
4
4
|
activeClass?: string;
|
|
5
5
|
/**
|
|
6
6
|
* Route Location the link should navigate to when clicked on.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { Primitive } from "reka-ui";
|
|
7
|
+
import { Link as InertiaLink } from "@inertiajs/vue3";
|
|
8
|
+
defineOptions({ inheritAttrs: false });
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
as: { type: String, required: false, default: "button" },
|
|
11
|
+
type: { type: String, required: false, default: "button" },
|
|
12
|
+
disabled: { type: Boolean, required: false },
|
|
13
|
+
onClick: { type: [Function, Array], required: false },
|
|
14
|
+
href: { type: String, required: false },
|
|
15
|
+
target: { type: [String, Object, null], required: false },
|
|
16
|
+
active: { type: Boolean, required: false },
|
|
17
|
+
isExternal: { type: Boolean, required: false }
|
|
18
|
+
});
|
|
19
|
+
function onClickWrapper(e) {
|
|
20
|
+
if (props.disabled) {
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (props.onClick) {
|
|
26
|
+
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick]) {
|
|
27
|
+
onClick(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<InertiaLink
|
|
35
|
+
v-if="!!href && !isExternal && !disabled"
|
|
36
|
+
:href="href"
|
|
37
|
+
v-bind="{
|
|
38
|
+
target: target || (isExternal ? '_blank' : void 0),
|
|
39
|
+
...$attrs
|
|
40
|
+
}"
|
|
41
|
+
@click="onClickWrapper"
|
|
42
|
+
>
|
|
43
|
+
<slot />
|
|
44
|
+
</InertiaLink>
|
|
45
|
+
<Primitive
|
|
46
|
+
v-else
|
|
47
|
+
v-bind="href ? {
|
|
48
|
+
'as': 'a',
|
|
49
|
+
'href': disabled ? void 0 : href,
|
|
50
|
+
'aria-disabled': disabled ? 'true' : void 0,
|
|
51
|
+
'role': disabled ? 'link' : void 0,
|
|
52
|
+
'tabindex': disabled ? -1 : void 0,
|
|
53
|
+
'target': target || (isExternal ? '_blank' : void 0),
|
|
54
|
+
...$attrs
|
|
55
|
+
} : as === 'button' ? {
|
|
56
|
+
as,
|
|
57
|
+
type,
|
|
58
|
+
disabled,
|
|
59
|
+
...$attrs
|
|
60
|
+
} : {
|
|
61
|
+
as,
|
|
62
|
+
...$attrs
|
|
63
|
+
}"
|
|
64
|
+
@click="onClickWrapper"
|
|
65
|
+
>
|
|
66
|
+
<slot />
|
|
67
|
+
</Primitive>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LinkProps } from '../../types';
|
|
2
|
+
export interface LinkBaseProps {
|
|
3
|
+
as?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: ((e: MouseEvent) => void | Promise<void>) | Array<((e: MouseEvent) => void | Promise<void>)>;
|
|
7
|
+
href?: string;
|
|
8
|
+
target?: LinkProps['target'];
|
|
9
|
+
active?: boolean;
|
|
10
|
+
isExternal?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<LinkBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinkBaseProps> & Readonly<{}>, {
|
|
13
|
+
type: string;
|
|
14
|
+
as: string;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
16
|
+
default?: (props: {}) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: {}) => any;
|
|
19
|
+
}>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
3
|
export { useHead } from '@unhead/vue';
|
|
4
|
+
export { useAppConfig } from '../vue/composables/useAppConfig';
|
|
4
5
|
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
5
6
|
export { defineLocale } from '../composables/defineLocale';
|
|
6
7
|
export { useLocale } from '../composables/useLocale';
|
|
@@ -17,7 +18,6 @@ export declare const useColorMode: () => {
|
|
|
17
18
|
readonly value: import("@vueuse/core").BasicColorMode;
|
|
18
19
|
forced: boolean;
|
|
19
20
|
};
|
|
20
|
-
export declare const useAppConfig: () => any;
|
|
21
21
|
export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
|
|
22
22
|
value: Ref<T, T>;
|
|
23
23
|
get: () => T;
|
|
@@ -4,6 +4,7 @@ import appConfig from "#build/app.config";
|
|
|
4
4
|
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
5
5
|
import { usePage } from "@inertiajs/vue3";
|
|
6
6
|
export { useHead } from "@unhead/vue";
|
|
7
|
+
export { useAppConfig } from "../vue/composables/useAppConfig.js";
|
|
7
8
|
export { defineShortcuts } from "../composables/defineShortcuts.js";
|
|
8
9
|
export { defineLocale } from "../composables/defineLocale.js";
|
|
9
10
|
export { useLocale } from "../composables/useLocale.js";
|
|
@@ -35,7 +36,6 @@ export const useColorMode = () => {
|
|
|
35
36
|
forced: false
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
|
-
export const useAppConfig = () => appConfig;
|
|
39
39
|
export const useCookie = (_name, _options = {}) => {
|
|
40
40
|
const value = ref(null);
|
|
41
41
|
return {
|
|
@@ -32,6 +32,7 @@ export { default as pt_br } from './pt_br';
|
|
|
32
32
|
export { default as ro } from './ro';
|
|
33
33
|
export { default as ru } from './ru';
|
|
34
34
|
export { default as sk } from './sk';
|
|
35
|
+
export { default as sl } from './sl';
|
|
35
36
|
export { default as sv } from './sv';
|
|
36
37
|
export { default as th } from './th';
|
|
37
38
|
export { default as tj } from './tj';
|
|
@@ -32,6 +32,7 @@ export { default as pt_br } from "./pt_br.js";
|
|
|
32
32
|
export { default as ro } from "./ro.js";
|
|
33
33
|
export { default as ru } from "./ru.js";
|
|
34
34
|
export { default as sk } from "./sk.js";
|
|
35
|
+
export { default as sl } from "./sl.js";
|
|
35
36
|
export { default as sv } from "./sv.js";
|
|
36
37
|
export { default as th } from "./th.js";
|
|
37
38
|
export { default as tj } from "./tj.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineLocale } from "../composables/defineLocale.js";
|
|
2
|
+
export default defineLocale({
|
|
3
|
+
name: "Sloven\u0161\u010Dina",
|
|
4
|
+
code: "sl",
|
|
5
|
+
messages: {
|
|
6
|
+
inputMenu: {
|
|
7
|
+
noMatch: "Ni ujemanj",
|
|
8
|
+
noData: "Ni podatkov",
|
|
9
|
+
create: 'Ustvari "{label}"'
|
|
10
|
+
},
|
|
11
|
+
calendar: {
|
|
12
|
+
prevYear: "Prej\u0161nje leto",
|
|
13
|
+
nextYear: "Naslednje leto",
|
|
14
|
+
prevMonth: "Prej\u0161nji mesec",
|
|
15
|
+
nextMonth: "Naslednji mesec"
|
|
16
|
+
},
|
|
17
|
+
inputNumber: {
|
|
18
|
+
increment: "Povi\u0161aj",
|
|
19
|
+
decrement: "Zmanj\u0161aj"
|
|
20
|
+
},
|
|
21
|
+
commandPalette: {
|
|
22
|
+
placeholder: "Vpi\u0161i ukaz ali i\u0161\u010Di...",
|
|
23
|
+
noMatch: "Ni ujemanj",
|
|
24
|
+
noData: "Ni podatkov",
|
|
25
|
+
close: "Zapri"
|
|
26
|
+
},
|
|
27
|
+
selectMenu: {
|
|
28
|
+
noMatch: "Ni ujemanj",
|
|
29
|
+
noData: "Ni podatkov",
|
|
30
|
+
create: 'Ustvari "{label}"',
|
|
31
|
+
search: "I\u0161\u010Di..."
|
|
32
|
+
},
|
|
33
|
+
toast: {
|
|
34
|
+
close: "Zapri"
|
|
35
|
+
},
|
|
36
|
+
carousel: {
|
|
37
|
+
prev: "Nazaj",
|
|
38
|
+
next: "Naprej",
|
|
39
|
+
goto: "Pojdi na {slide}"
|
|
40
|
+
},
|
|
41
|
+
modal: {
|
|
42
|
+
close: "Zapri"
|
|
43
|
+
},
|
|
44
|
+
slideover: {
|
|
45
|
+
close: "Zapri"
|
|
46
|
+
},
|
|
47
|
+
alert: {
|
|
48
|
+
close: "Zapri"
|
|
49
|
+
},
|
|
50
|
+
table: {
|
|
51
|
+
noData: "Ni podatkov"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
|
+
import { isEqual, diff } from "ohash/utils";
|
|
2
3
|
export function pickLinkProps(link) {
|
|
3
4
|
const keys = Object.keys(link);
|
|
4
5
|
const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
|
|
@@ -33,3 +34,14 @@ export function pickLinkProps(link) {
|
|
|
33
34
|
];
|
|
34
35
|
return reactivePick(link, ...propsToInclude);
|
|
35
36
|
}
|
|
37
|
+
export function isPartiallyEqual(item1, item2) {
|
|
38
|
+
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
39
|
+
if (q.type === "added") {
|
|
40
|
+
filtered.add(q.key);
|
|
41
|
+
}
|
|
42
|
+
return filtered;
|
|
43
|
+
}, /* @__PURE__ */ new Set());
|
|
44
|
+
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
45
|
+
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
46
|
+
return isEqual(item1Filtered, item2Filtered);
|
|
47
|
+
}
|
|
@@ -3,15 +3,17 @@ import theme from "#build/ui/link";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed
|
|
6
|
+
import { computed } from "vue";
|
|
7
7
|
import { defu } from "defu";
|
|
8
|
-
import { isEqual
|
|
8
|
+
import { isEqual } from "ohash/utils";
|
|
9
9
|
import { useForwardProps } from "reka-ui";
|
|
10
10
|
import { reactiveOmit } from "@vueuse/core";
|
|
11
11
|
import { hasProtocol } from "ufo";
|
|
12
12
|
import { useRoute, RouterLink } from "vue-router";
|
|
13
13
|
import { useAppConfig } from "#imports";
|
|
14
14
|
import { tv } from "../../utils/tv";
|
|
15
|
+
import { isPartiallyEqual } from "../../utils/link";
|
|
16
|
+
import ULinkBase from "../../components/LinkBase.vue";
|
|
15
17
|
defineOptions({ inheritAttrs: false });
|
|
16
18
|
const props = defineProps({
|
|
17
19
|
as: { type: null, required: false, default: "button" },
|
|
@@ -42,20 +44,9 @@ const props = defineProps({
|
|
|
42
44
|
replace: { type: Boolean, required: false }
|
|
43
45
|
});
|
|
44
46
|
defineSlots();
|
|
45
|
-
const
|
|
46
|
-
const app = getCurrentInstance()?.appContext.app;
|
|
47
|
-
return !!app?.config?.globalProperties?.$router;
|
|
48
|
-
});
|
|
49
|
-
const route = computed(() => {
|
|
50
|
-
if (!hasRouter.value) return null;
|
|
51
|
-
try {
|
|
52
|
-
return useRoute();
|
|
53
|
-
} catch {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
47
|
+
const route = useRoute();
|
|
57
48
|
const appConfig = useAppConfig();
|
|
58
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "raw", "class"));
|
|
49
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
59
50
|
const ui = computed(() => tv({
|
|
60
51
|
extend: tv(theme),
|
|
61
52
|
...defu({
|
|
@@ -67,34 +58,29 @@ const ui = computed(() => tv({
|
|
|
67
58
|
}
|
|
68
59
|
}, appConfig.ui?.link || {})
|
|
69
60
|
}));
|
|
70
|
-
|
|
71
|
-
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
72
|
-
if (q.type === "added") {
|
|
73
|
-
filtered.add(q.key);
|
|
74
|
-
}
|
|
75
|
-
return filtered;
|
|
76
|
-
}, /* @__PURE__ */ new Set());
|
|
77
|
-
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
78
|
-
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
79
|
-
return isEqual(item1Filtered, item2Filtered);
|
|
80
|
-
}
|
|
61
|
+
const to = computed(() => props.to ?? props.href);
|
|
81
62
|
const isExternal = computed(() => {
|
|
82
|
-
if (
|
|
83
|
-
|
|
63
|
+
if (props.external) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
if (!to.value) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return typeof to.value === "string" && hasProtocol(to.value, { acceptRelative: true });
|
|
84
70
|
});
|
|
85
71
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
86
72
|
if (props.active !== void 0) {
|
|
87
73
|
return props.active;
|
|
88
74
|
}
|
|
89
|
-
if (!
|
|
75
|
+
if (!to.value) {
|
|
90
76
|
return false;
|
|
91
77
|
}
|
|
92
78
|
if (props.exactQuery === "partial") {
|
|
93
|
-
if (!isPartiallyEqual(linkRoute.query, route.
|
|
79
|
+
if (!isPartiallyEqual(linkRoute.query, route.query)) return false;
|
|
94
80
|
} else if (props.exactQuery === true) {
|
|
95
|
-
if (!isEqual(linkRoute.query, route.
|
|
81
|
+
if (!isEqual(linkRoute.query, route.query)) return false;
|
|
96
82
|
}
|
|
97
|
-
if (props.exactHash && linkRoute.hash !== route.
|
|
83
|
+
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
98
84
|
return false;
|
|
99
85
|
}
|
|
100
86
|
if (props.exact && isExactActive) {
|
|
@@ -115,8 +101,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
115
101
|
</script>
|
|
116
102
|
|
|
117
103
|
<template>
|
|
118
|
-
<template v-if="
|
|
119
|
-
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to
|
|
104
|
+
<template v-if="!isExternal && !!to">
|
|
105
|
+
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to" custom>
|
|
120
106
|
<template v-if="custom">
|
|
121
107
|
<slot
|
|
122
108
|
v-bind="{
|
|
@@ -125,7 +111,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
125
111
|
as,
|
|
126
112
|
type,
|
|
127
113
|
disabled,
|
|
128
|
-
href
|
|
114
|
+
href,
|
|
129
115
|
navigate,
|
|
130
116
|
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
131
117
|
}"
|
|
@@ -139,7 +125,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
139
125
|
as,
|
|
140
126
|
type,
|
|
141
127
|
disabled,
|
|
142
|
-
href
|
|
128
|
+
href,
|
|
143
129
|
navigate
|
|
144
130
|
}"
|
|
145
131
|
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
@@ -159,7 +145,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
159
145
|
disabled,
|
|
160
146
|
href: to,
|
|
161
147
|
target: isExternal ? '_blank' : void 0,
|
|
162
|
-
active
|
|
148
|
+
active,
|
|
149
|
+
isExternal
|
|
163
150
|
}"
|
|
164
151
|
/>
|
|
165
152
|
</template>
|
|
@@ -171,12 +158,12 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
171
158
|
type,
|
|
172
159
|
disabled,
|
|
173
160
|
href: to,
|
|
174
|
-
target: isExternal ? '_blank' : void 0
|
|
161
|
+
target: isExternal ? '_blank' : void 0,
|
|
162
|
+
isExternal
|
|
175
163
|
}"
|
|
176
|
-
:is-external="isExternal"
|
|
177
164
|
:class="resolveLinkClass()"
|
|
178
165
|
>
|
|
179
|
-
<slot :active="
|
|
166
|
+
<slot :active="active" />
|
|
180
167
|
</ULinkBase>
|
|
181
168
|
</template>
|
|
182
169
|
</template>
|
|
@@ -2,6 +2,7 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
3
|
export { useHead } from '@unhead/vue';
|
|
4
4
|
export { useRoute, useRouter } from 'vue-router';
|
|
5
|
+
export { useAppConfig } from './composables/useAppConfig';
|
|
5
6
|
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
6
7
|
export { defineLocale } from '../composables/defineLocale';
|
|
7
8
|
export { useLocale } from '../composables/useLocale';
|
|
@@ -14,7 +15,6 @@ export declare const useColorMode: () => {
|
|
|
14
15
|
readonly value: import("@vueuse/core").BasicColorMode;
|
|
15
16
|
forced: boolean;
|
|
16
17
|
};
|
|
17
|
-
export declare const useAppConfig: () => any;
|
|
18
18
|
export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
|
|
19
19
|
value: Ref<T, T>;
|
|
20
20
|
get: () => T;
|