nuance-ui 0.1.24 → 0.1.26
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/app-shell/app-shell.vue +29 -12
- package/dist/runtime/components/breadcrumbs.d.vue.ts +3 -0
- package/dist/runtime/components/breadcrumbs.vue +17 -6
- package/dist/runtime/components/breadcrumbs.vue.d.ts +3 -0
- package/dist/runtime/components/link/lib.d.ts +16 -16
- package/dist/runtime/components/link/lib.js +11 -5
- package/dist/runtime/components/tree/_ui/tree-item.vue +0 -2
- package/dist/runtime/components/tree/_ui/tree-root.vue +0 -2
- package/dist/runtime/styles/baseline.css +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
3
|
import Box from "../box.vue";
|
|
4
4
|
import { useProvideAppShell } from "./context";
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
is,
|
|
7
|
+
mod,
|
|
8
|
+
layout = "default",
|
|
9
|
+
withBorder = false,
|
|
10
|
+
aside: _aside,
|
|
11
|
+
footer: _footer,
|
|
12
|
+
header: _header,
|
|
13
|
+
navbar: _navbar
|
|
14
|
+
} = defineProps({
|
|
6
15
|
navbar: { type: Boolean, required: false },
|
|
7
16
|
aside: { type: Boolean, required: false },
|
|
8
17
|
header: { type: Boolean, required: false },
|
|
@@ -12,17 +21,25 @@ const { is, mod, layout = "default", withBorder = false, ...rest } = defineProps
|
|
|
12
21
|
is: { type: null, required: false },
|
|
13
22
|
mod: { type: [Object, Array, null], required: false }
|
|
14
23
|
});
|
|
15
|
-
const
|
|
16
|
-
|
|
24
|
+
const aside = ref(_aside ?? false);
|
|
25
|
+
const footer = ref(_footer ?? false);
|
|
26
|
+
const header = ref(_header ?? false);
|
|
27
|
+
const navbar = ref(_navbar ?? false);
|
|
28
|
+
useProvideAppShell({
|
|
29
|
+
aside,
|
|
30
|
+
footer,
|
|
31
|
+
header,
|
|
32
|
+
navbar
|
|
33
|
+
});
|
|
17
34
|
const style = computed(() => ({
|
|
18
|
-
"--app-shell-navbar-transform":
|
|
19
|
-
"--app-shell-navbar-offset":
|
|
20
|
-
"--app-shell-aside-transform":
|
|
21
|
-
"--app-shell-aside-offset":
|
|
22
|
-
"--app-shell-header-transform":
|
|
23
|
-
"--app-shell-header-offset":
|
|
24
|
-
"--app-shell-footer-transform":
|
|
25
|
-
"--app-shell-footer-offset":
|
|
35
|
+
"--app-shell-navbar-transform": navbar.value ? "translateX(calc(-1 * var(--app-shell-navbar-width)))" : void 0,
|
|
36
|
+
"--app-shell-navbar-offset": navbar.value ? "0rem" : void 0,
|
|
37
|
+
"--app-shell-aside-transform": aside.value ? "translateX(var(--app-shell-aside-width))" : void 0,
|
|
38
|
+
"--app-shell-aside-offset": aside.value ? "0rem" : void 0,
|
|
39
|
+
"--app-shell-header-transform": header.value ? "translateY(calc(-1 * var(--app-shell-header-height)))" : void 0,
|
|
40
|
+
"--app-shell-header-offset": header.value ? "0rem" : void 0,
|
|
41
|
+
"--app-shell-footer-transform": footer.value ? "translateY(var(--app-shell-footer-height))" : void 0,
|
|
42
|
+
"--app-shell-footer-offset": footer.value ? "0rem" : void 0
|
|
26
43
|
}));
|
|
27
44
|
</script>
|
|
28
45
|
|
|
@@ -10,11 +10,14 @@ export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
|
|
|
10
10
|
slot?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface BreadcrumbsProps extends BoxProps {
|
|
13
|
+
/** Manual items array */
|
|
13
14
|
items?: MaybeRef<BreadcrumbsItem[]>;
|
|
14
15
|
/** Separator icon between items @default `'gravity-ui:chevron-right'` */
|
|
15
16
|
separator?: string;
|
|
16
17
|
/** Controls spacing between separator and breadcrumb @default `'xs'` */
|
|
17
18
|
spacing?: NuanceSpacing;
|
|
19
|
+
/** Function to determine if an item is active */
|
|
20
|
+
activeItem?: (item: BreadcrumbsItem) => boolean;
|
|
18
21
|
color?: NuanceColor;
|
|
19
22
|
size?: TextProps['fz'];
|
|
20
23
|
}
|
|
@@ -11,11 +11,13 @@ const {
|
|
|
11
11
|
spacing,
|
|
12
12
|
separator = "gravity-ui:chevron-right",
|
|
13
13
|
color = "primary",
|
|
14
|
-
size
|
|
14
|
+
size,
|
|
15
|
+
items
|
|
15
16
|
} = defineProps({
|
|
16
17
|
items: { type: null, required: false },
|
|
17
18
|
separator: { type: String, required: false },
|
|
18
19
|
spacing: { type: [String, Number], required: false },
|
|
20
|
+
activeItem: { type: Function, required: false },
|
|
19
21
|
color: { type: null, required: false },
|
|
20
22
|
size: { type: null, required: false },
|
|
21
23
|
is: { type: null, required: false },
|
|
@@ -27,7 +29,7 @@ const style = computed(() => ({
|
|
|
27
29
|
</script>
|
|
28
30
|
|
|
29
31
|
<template>
|
|
30
|
-
<Box :is :mod :style
|
|
32
|
+
<Box :is :mod :style :class='$style.root' aria-label='breadcrumb'>
|
|
31
33
|
<template v-for='(item, ix) in unref(items)' :key='ix'>
|
|
32
34
|
<Text
|
|
33
35
|
is='li'
|
|
@@ -38,8 +40,18 @@ const style = computed(() => ({
|
|
|
38
40
|
aria-hidden='true'
|
|
39
41
|
>
|
|
40
42
|
<NuxtLink v-slot='{ isActive }' v-bind='pickLinkProps(item).link' custom>
|
|
41
|
-
<slot
|
|
42
|
-
|
|
43
|
+
<slot
|
|
44
|
+
:name='item.slot ?? "item"'
|
|
45
|
+
:item='item'
|
|
46
|
+
:ix='ix'
|
|
47
|
+
:active='activeItem ? activeItem(item) : isActive'
|
|
48
|
+
>
|
|
49
|
+
<Link
|
|
50
|
+
v-bind='pickLinkProps(item).link'
|
|
51
|
+
inherit
|
|
52
|
+
:class='$style.item'
|
|
53
|
+
:mod='{ active: activeItem ? activeItem(item) : isActive }'
|
|
54
|
+
>
|
|
43
55
|
<Icon v-if='item?.icon' :name='item.icon' :class='$style.icon' />
|
|
44
56
|
<Text is='span' inherit truncate>
|
|
45
57
|
{{ item.label }}
|
|
@@ -65,8 +77,6 @@ const style = computed(() => ({
|
|
|
65
77
|
flex-wrap: wrap;
|
|
66
78
|
gap: var(--bc-spacing);
|
|
67
79
|
align-items: center;
|
|
68
|
-
|
|
69
|
-
list-style: none;
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
.breadcrumb {
|
|
@@ -82,6 +92,7 @@ const style = computed(() => ({
|
|
|
82
92
|
display: flex;
|
|
83
93
|
gap: .25rem;
|
|
84
94
|
align-items: center;
|
|
95
|
+
text-transform: capitalize;
|
|
85
96
|
|
|
86
97
|
font-weight: 600;
|
|
87
98
|
|
|
@@ -10,11 +10,14 @@ export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
|
|
|
10
10
|
slot?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface BreadcrumbsProps extends BoxProps {
|
|
13
|
+
/** Manual items array */
|
|
13
14
|
items?: MaybeRef<BreadcrumbsItem[]>;
|
|
14
15
|
/** Separator icon between items @default `'gravity-ui:chevron-right'` */
|
|
15
16
|
separator?: string;
|
|
16
17
|
/** Controls spacing between separator and breadcrumb @default `'xs'` */
|
|
17
18
|
spacing?: NuanceSpacing;
|
|
19
|
+
/** Function to determine if an item is active */
|
|
20
|
+
activeItem?: (item: BreadcrumbsItem) => boolean;
|
|
18
21
|
color?: NuanceColor;
|
|
19
22
|
size?: TextProps['fz'];
|
|
20
23
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { NuxtLinkProps } from '#app';
|
|
2
2
|
export declare function pickLinkProps<T extends NuxtLinkProps>(props: T): {
|
|
3
3
|
link: {
|
|
4
|
-
prefetch: NonNullable<
|
|
5
|
-
noPrefetch: NonNullable<
|
|
6
|
-
to?:
|
|
7
|
-
target?:
|
|
8
|
-
external?:
|
|
9
|
-
rel?:
|
|
10
|
-
noRel?:
|
|
11
|
-
replace?:
|
|
12
|
-
prefetchOn?:
|
|
13
|
-
trailingSlash?:
|
|
14
|
-
activeClass?:
|
|
15
|
-
ariaCurrentValue?:
|
|
16
|
-
exactActiveClass?:
|
|
17
|
-
prefetchedClass?:
|
|
18
|
-
viewTransition?:
|
|
4
|
+
prefetch: NonNullable<T["prefetch"]> | undefined;
|
|
5
|
+
noPrefetch: NonNullable<T["noPrefetch"]> | undefined;
|
|
6
|
+
to?: T["to"] | undefined;
|
|
7
|
+
target?: T["target"] | undefined;
|
|
8
|
+
external?: T["external"] | undefined;
|
|
9
|
+
rel?: T["rel"] | undefined;
|
|
10
|
+
noRel?: T["noRel"] | undefined;
|
|
11
|
+
replace?: T["replace"] | undefined;
|
|
12
|
+
prefetchOn?: T["prefetchOn"] | undefined;
|
|
13
|
+
trailingSlash?: T["trailingSlash"] | undefined;
|
|
14
|
+
activeClass?: T["activeClass"] | undefined;
|
|
15
|
+
ariaCurrentValue?: T["ariaCurrentValue"] | undefined;
|
|
16
|
+
exactActiveClass?: T["exactActiveClass"] | undefined;
|
|
17
|
+
prefetchedClass?: T["prefetchedClass"] | undefined;
|
|
18
|
+
viewTransition?: T["viewTransition"] | undefined;
|
|
19
19
|
};
|
|
20
|
-
rest: Omit<T,
|
|
20
|
+
rest: Omit<T, "to" | "target" | "external" | "rel" | "noRel" | "prefetch" | "noPrefetch" | "replace" | "prefetchOn" | "trailingSlash" | "activeClass" | "ariaCurrentValue" | "exactActiveClass" | "prefetchedClass" | "viewTransition">;
|
|
21
21
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { reactiveOmit, reactivePick } from "@vueuse/core";
|
|
2
1
|
const linkProps = [
|
|
3
2
|
"to",
|
|
4
3
|
"target",
|
|
@@ -17,13 +16,20 @@ const linkProps = [
|
|
|
17
16
|
"viewTransition"
|
|
18
17
|
];
|
|
19
18
|
export function pickLinkProps(props) {
|
|
20
|
-
const link =
|
|
21
|
-
const rest =
|
|
19
|
+
const link = {};
|
|
20
|
+
const rest = {};
|
|
21
|
+
for (const key in props) {
|
|
22
|
+
if (linkProps.includes(key)) {
|
|
23
|
+
link[key] = props[key];
|
|
24
|
+
} else {
|
|
25
|
+
rest[key] = props[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
22
28
|
return {
|
|
23
29
|
link: {
|
|
24
30
|
...link,
|
|
25
|
-
prefetch: link?.prefetch
|
|
26
|
-
noPrefetch: link?.noPrefetch
|
|
31
|
+
prefetch: link?.prefetch ?? void 0,
|
|
32
|
+
noPrefetch: link?.noPrefetch ?? void 0
|
|
27
33
|
},
|
|
28
34
|
rest
|
|
29
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
*,:after,:before{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion:no-preference){html{interpolate-size:allow-keywords}}body{background-color:var(--color-body);color:var(--color-text);font-family:var(--font-family),sans-serif;font-size:var(--font-size-md);line-height:var(--line-height);margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media screen and (max-device-width:em(500px)){body{-webkit-text-size-adjust:100%}}body:has(dialog[data-modal][open]){overflow:hidden}canvas,img,picture,svg,video{display:block;max-width:100%}button,input,select,textarea{font:inherit}button{border:0}button,select{text-transform:none}h1,h2,h3,h4,h5,h6,p{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}
|
|
1
|
+
*,:after,:before{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion:no-preference){html{interpolate-size:allow-keywords}}body{background-color:var(--color-body);color:var(--color-text);font-family:var(--font-family),sans-serif;font-size:var(--font-size-md);line-height:var(--line-height);margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media screen and (max-device-width:em(500px)){body{-webkit-text-size-adjust:100%}}body:has(dialog[data-modal][open]){overflow:hidden}canvas,img,picture,svg,video{display:block;max-width:100%}button,input,select,textarea{font:inherit}button{border:0}button,select{text-transform:none}h1,h2,h3,h4,h5,h6,p{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}ol,ul{list-style:none;margin:0;padding:0}
|