nuance-ui 0.1.14 → 0.1.15
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/runtime/components/action-icon/action-icon.d.vue.ts +1 -0
- package/dist/runtime/components/action-icon/action-icon.vue +7 -6
- package/dist/runtime/components/action-icon/action-icon.vue.d.ts +1 -0
- package/dist/runtime/components/dialog/dialog-close-button.vue +2 -1
- package/dist/runtime/components/drawer/drawer-close-button.vue +2 -1
- package/dist/runtime/components/link/lib.d.ts +6 -1
- package/dist/runtime/components/link/lib.js +6 -1
- package/dist/runtime/components/modal/modal-close-button.vue +2 -1
- package/dist/runtime/components/nav-link/nav-icon-link.d.vue.ts +27 -0
- package/dist/runtime/components/nav-link/nav-icon-link.vue +58 -0
- package/dist/runtime/components/nav-link/nav-icon-link.vue.d.ts +27 -0
- package/dist/runtime/utils/vars-resolver/create-variant-color-resolver.js +4 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -7,14 +7,15 @@ import Loader from "../loader/loader.vue";
|
|
|
7
7
|
import css from "./action-icon.module.css";
|
|
8
8
|
const {
|
|
9
9
|
color,
|
|
10
|
-
size
|
|
10
|
+
size,
|
|
11
11
|
variant = "default",
|
|
12
12
|
gradient,
|
|
13
13
|
loading,
|
|
14
14
|
classes,
|
|
15
15
|
radius,
|
|
16
16
|
mod,
|
|
17
|
-
icon
|
|
17
|
+
icon,
|
|
18
|
+
disabled
|
|
18
19
|
} = defineProps({
|
|
19
20
|
size: { type: null, required: false },
|
|
20
21
|
variant: { type: String, required: false },
|
|
@@ -24,7 +25,8 @@ const {
|
|
|
24
25
|
radius: { type: [String, Number], required: false },
|
|
25
26
|
classes: { type: Object, required: false },
|
|
26
27
|
mod: { type: [Object, Array, null], required: false },
|
|
27
|
-
icon: { type: String, required: false }
|
|
28
|
+
icon: { type: String, required: false },
|
|
29
|
+
disabled: { type: Boolean, required: false }
|
|
28
30
|
});
|
|
29
31
|
const style = computed(() => useStyleResolver((theme) => {
|
|
30
32
|
const {
|
|
@@ -42,16 +44,15 @@ const style = computed(() => useStyleResolver((theme) => {
|
|
|
42
44
|
"--ai-bd": border
|
|
43
45
|
};
|
|
44
46
|
}));
|
|
45
|
-
const _mod = computed(() => [{ loading }, mod]);
|
|
46
47
|
</script>
|
|
47
48
|
|
|
48
49
|
<template>
|
|
49
50
|
<Box
|
|
50
51
|
is='button'
|
|
51
|
-
:mod='
|
|
52
|
+
:mod='[{ loading }, mod]'
|
|
52
53
|
:style
|
|
53
54
|
:class='[css.root, classes?.root]'
|
|
54
|
-
:disabled='loading'
|
|
55
|
+
:disabled='(!disabled ? loading : disabled) || void 0'
|
|
55
56
|
>
|
|
56
57
|
<Transition name='slide-down'>
|
|
57
58
|
<Loader
|
|
@@ -10,7 +10,8 @@ const { variant = "subtle", icon = "gravity-ui:xmark", ...props } = defineProps(
|
|
|
10
10
|
radius: { type: [String, Number], required: false },
|
|
11
11
|
classes: { type: Object, required: false },
|
|
12
12
|
mod: { type: [Object, Array, null], required: false },
|
|
13
|
-
icon: { type: String, required: false }
|
|
13
|
+
icon: { type: String, required: false },
|
|
14
|
+
disabled: { type: Boolean, required: false }
|
|
14
15
|
});
|
|
15
16
|
const close = useDialogState();
|
|
16
17
|
</script>
|
|
@@ -9,7 +9,8 @@ const props = defineProps({
|
|
|
9
9
|
radius: { type: [String, Number], required: false },
|
|
10
10
|
classes: { type: Object, required: false },
|
|
11
11
|
mod: { type: [Object, Array, null], required: false },
|
|
12
|
-
icon: { type: String, required: false }
|
|
12
|
+
icon: { type: String, required: false },
|
|
13
|
+
disabled: { type: Boolean, required: false }
|
|
13
14
|
});
|
|
14
15
|
</script>
|
|
15
16
|
|
|
@@ -11,6 +11,11 @@ export declare function pickLinkProps<T extends NuxtLinkProps>(props: T): {
|
|
|
11
11
|
replace?: import("vue").UnwrapRef<T["replace"]> | undefined;
|
|
12
12
|
prefetchOn?: import("vue").UnwrapRef<T["prefetchOn"]> | undefined;
|
|
13
13
|
trailingSlash?: import("vue").UnwrapRef<T["trailingSlash"]> | undefined;
|
|
14
|
+
activeClass?: import("vue").UnwrapRef<T["activeClass"]> | undefined;
|
|
15
|
+
ariaCurrentValue?: import("vue").UnwrapRef<T["ariaCurrentValue"]> | undefined;
|
|
16
|
+
exactActiveClass?: import("vue").UnwrapRef<T["exactActiveClass"]> | undefined;
|
|
17
|
+
prefetchedClass?: import("vue").UnwrapRef<T["prefetchedClass"]> | undefined;
|
|
18
|
+
viewTransition?: import("vue").UnwrapRef<T["viewTransition"]> | undefined;
|
|
14
19
|
};
|
|
15
|
-
rest: Omit<T, Extract<"to", keyof T> | Extract<"target", keyof T> | Extract<"external", keyof T> | Extract<"rel", keyof T> | Extract<"noRel", keyof T> | Extract<"prefetch", keyof T> | Extract<"noPrefetch", keyof T> | Extract<"replace", keyof T> | Extract<"prefetchOn", keyof T> | Extract<"trailingSlash", keyof T>>;
|
|
20
|
+
rest: Omit<T, Extract<"to", keyof T> | Extract<"target", keyof T> | Extract<"external", keyof T> | Extract<"rel", keyof T> | Extract<"noRel", keyof T> | Extract<"prefetch", keyof T> | Extract<"noPrefetch", keyof T> | Extract<"replace", keyof T> | Extract<"prefetchOn", keyof T> | Extract<"trailingSlash", keyof T> | Extract<"activeClass", keyof T> | Extract<"ariaCurrentValue", keyof T> | Extract<"exactActiveClass", keyof T> | Extract<"prefetchedClass", keyof T> | Extract<"viewTransition", keyof T>>;
|
|
16
21
|
};
|
|
@@ -9,7 +9,12 @@ const linkProps = [
|
|
|
9
9
|
"noPrefetch",
|
|
10
10
|
"replace",
|
|
11
11
|
"prefetchOn",
|
|
12
|
-
"trailingSlash"
|
|
12
|
+
"trailingSlash",
|
|
13
|
+
"activeClass",
|
|
14
|
+
"ariaCurrentValue",
|
|
15
|
+
"exactActiveClass",
|
|
16
|
+
"prefetchedClass",
|
|
17
|
+
"viewTransition"
|
|
13
18
|
];
|
|
14
19
|
export function pickLinkProps(props) {
|
|
15
20
|
const link = reactivePick(props, ...linkProps);
|
|
@@ -9,7 +9,8 @@ const props = defineProps({
|
|
|
9
9
|
radius: { type: [String, Number], required: false },
|
|
10
10
|
classes: { type: Object, required: false },
|
|
11
11
|
mod: { type: [Object, Array, null], required: false },
|
|
12
|
-
icon: { type: String, required: false }
|
|
12
|
+
icon: { type: String, required: false },
|
|
13
|
+
disabled: { type: Boolean, required: false }
|
|
13
14
|
});
|
|
14
15
|
</script>
|
|
15
16
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ActionIconProps } from '@nui/components';
|
|
2
|
+
import type { NuanceColor } from '@nui/types';
|
|
3
|
+
import type { NuxtLinkProps } from 'nuxt/app';
|
|
4
|
+
export interface NavIconLinkProps extends ActionIconProps, Omit<NuxtLinkProps, 'href' | 'custom'> {
|
|
5
|
+
to: NuxtLinkProps['to'];
|
|
6
|
+
/** Key of `theme.colors` of any valid CSS color to control active styles @default `theme.primaryColor` */
|
|
7
|
+
color?: NuanceColor;
|
|
8
|
+
/** Shorthand for passing icon */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** Variant for active state @default `filled` */
|
|
11
|
+
active?: ActionIconProps['variant'];
|
|
12
|
+
/** Variant for not active state @default `filled` */
|
|
13
|
+
notActive?: ActionIconProps['variant'];
|
|
14
|
+
}
|
|
15
|
+
declare var __VLS_14: {};
|
|
16
|
+
type __VLS_Slots = {} & {
|
|
17
|
+
default?: (props: typeof __VLS_14) => any;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<NavIconLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NavIconLinkProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ActionIcon from "../action-icon/action-icon.vue";
|
|
3
|
+
import { pickLinkProps } from "../link";
|
|
4
|
+
defineOptions({ inheritAttrs: false });
|
|
5
|
+
const {
|
|
6
|
+
active = "filled",
|
|
7
|
+
notActive = "default",
|
|
8
|
+
mod,
|
|
9
|
+
...etc
|
|
10
|
+
} = defineProps({
|
|
11
|
+
to: { type: null, required: true },
|
|
12
|
+
color: { type: null, required: false },
|
|
13
|
+
icon: { type: String, required: false },
|
|
14
|
+
active: { type: String, required: false },
|
|
15
|
+
notActive: { type: String, required: false },
|
|
16
|
+
size: { type: null, required: false },
|
|
17
|
+
variant: { type: String, required: false },
|
|
18
|
+
gradient: { type: Object, required: false },
|
|
19
|
+
loading: { type: Boolean, required: false },
|
|
20
|
+
radius: { type: [String, Number], required: false },
|
|
21
|
+
classes: { type: Object, required: false },
|
|
22
|
+
mod: { type: [Object, Array, null], required: false },
|
|
23
|
+
disabled: { type: Boolean, required: false },
|
|
24
|
+
external: { type: Boolean, required: false },
|
|
25
|
+
target: { type: [String, Object, null], required: false },
|
|
26
|
+
rel: { type: [String, Object, null], required: false },
|
|
27
|
+
noRel: { type: Boolean, required: false },
|
|
28
|
+
prefetchedClass: { type: String, required: false },
|
|
29
|
+
prefetch: { type: Boolean, required: false },
|
|
30
|
+
prefetchOn: { type: [String, Object], required: false },
|
|
31
|
+
noPrefetch: { type: Boolean, required: false },
|
|
32
|
+
trailingSlash: { type: String, required: false },
|
|
33
|
+
activeClass: { type: String, required: false },
|
|
34
|
+
exactActiveClass: { type: String, required: false },
|
|
35
|
+
ariaCurrentValue: { type: String, required: false },
|
|
36
|
+
viewTransition: { type: Boolean, required: false },
|
|
37
|
+
replace: { type: Boolean, required: false }
|
|
38
|
+
});
|
|
39
|
+
const { link, rest } = pickLinkProps(etc);
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<NuxtLink v-slot='{ href, navigate, isActive, ...linkProps }' v-bind='link' custom>
|
|
44
|
+
<ActionIcon
|
|
45
|
+
is='a'
|
|
46
|
+
v-bind='rest'
|
|
47
|
+
:href
|
|
48
|
+
:variant='isActive ? active : notActive'
|
|
49
|
+
:mod='[{ active: isActive }, mod]'
|
|
50
|
+
:aria-current="isActive ? 'page' : void 0"
|
|
51
|
+
:rel='"rel" in linkProps ? linkProps?.rel : void 0'
|
|
52
|
+
:target='"target" in linkProps ? linkProps?.target : void 0'
|
|
53
|
+
@click='navigate'
|
|
54
|
+
>
|
|
55
|
+
<slot />
|
|
56
|
+
</ActionIcon>
|
|
57
|
+
</NuxtLink>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ActionIconProps } from '@nui/components';
|
|
2
|
+
import type { NuanceColor } from '@nui/types';
|
|
3
|
+
import type { NuxtLinkProps } from 'nuxt/app';
|
|
4
|
+
export interface NavIconLinkProps extends ActionIconProps, Omit<NuxtLinkProps, 'href' | 'custom'> {
|
|
5
|
+
to: NuxtLinkProps['to'];
|
|
6
|
+
/** Key of `theme.colors` of any valid CSS color to control active styles @default `theme.primaryColor` */
|
|
7
|
+
color?: NuanceColor;
|
|
8
|
+
/** Shorthand for passing icon */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** Variant for active state @default `filled` */
|
|
11
|
+
active?: ActionIconProps['variant'];
|
|
12
|
+
/** Variant for not active state @default `filled` */
|
|
13
|
+
notActive?: ActionIconProps['variant'];
|
|
14
|
+
}
|
|
15
|
+
declare var __VLS_14: {};
|
|
16
|
+
type __VLS_Slots = {} & {
|
|
17
|
+
default?: (props: typeof __VLS_14) => any;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<NavIconLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NavIconLinkProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -15,7 +15,7 @@ export function createVariantColorResolver({
|
|
|
15
15
|
background: `var(--color-${color}-filled)`,
|
|
16
16
|
hover: `var(--color-${color}-filled-hover)`,
|
|
17
17
|
text,
|
|
18
|
-
border: "1px solid transparent
|
|
18
|
+
border: "1px solid transparent"
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
@@ -31,14 +31,14 @@ export function createVariantColorResolver({
|
|
|
31
31
|
background: `var(--color-${color}-light)`,
|
|
32
32
|
hover: `var(--color-${color}-light-hover)`,
|
|
33
33
|
text: `var(--color-${color}-light-color)`,
|
|
34
|
-
border: "1px solid transparent
|
|
34
|
+
border: "1px solid transparent"
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
return {
|
|
38
38
|
background: `color-mix(var(--color-${parsed.color}-${parsed.shade}), .1)`,
|
|
39
39
|
hover: `color-mix(var(--color-${parsed.color}-${parsed.shade}), .12)`,
|
|
40
40
|
text: `var(--color-${parsed.color}-${Math.min(parsed.shade, 6)})`,
|
|
41
|
-
border: "1px solid transparent
|
|
41
|
+
border: "1px solid transparent"
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
if (variant === "outline") {
|
|
@@ -82,7 +82,7 @@ export function createVariantColorResolver({
|
|
|
82
82
|
deg: gradient?.deg
|
|
83
83
|
}, theme),
|
|
84
84
|
text: "var(--color-white)",
|
|
85
|
-
border: "
|
|
85
|
+
border: "1px solid transparent"
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
if (variant === "gradient-outline") {
|