nuance-ui 0.1.13 → 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.module.css +1 -1
- package/dist/runtime/components/action-icon/action-icon.vue +8 -7
- package/dist/runtime/components/action-icon/action-icon.vue.d.ts +1 -0
- package/dist/runtime/components/app-shell/app-shell-main.vue +0 -2
- package/dist/runtime/components/breadcrumbs.d.vue.ts +39 -0
- package/dist/runtime/components/breadcrumbs.vue +113 -0
- package/dist/runtime/components/breadcrumbs.vue.d.ts +39 -0
- package/dist/runtime/components/button/button.module.css +1 -1
- 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/index.d.ts +1 -0
- package/dist/runtime/components/link/index.d.ts +1 -1
- package/dist/runtime/components/link/index.js +1 -1
- package/dist/runtime/components/link/lib.d.ts +8 -3
- package/dist/runtime/components/link/lib.js +7 -2
- package/dist/runtime/components/link/link-button.vue +13 -12
- package/dist/runtime/components/link/link.vue +9 -12
- 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/components/nav-link/nav-link.vue +21 -35
- package/dist/runtime/components/roving-focus/_lib/context.d.ts +2 -2
- package/dist/runtime/components/text.vue +14 -14
- package/dist/runtime/types/theme.d.ts +2 -2
- package/dist/runtime/utils/vars-resolver/create-variant-color-resolver.js +4 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{--ai-size-xs:rem(18px);--ai-size-sm:rem(22px);--ai-size-md:rem(28px);--ai-size-lg:rem(34px);--ai-size-xl:rem(44px);--ai-size-input-xs:rem(30px);--ai-size-input-sm:rem(36px);--ai-size-input-md:rem(42px);--ai-size-input-lg:rem(50px);--ai-size-input-xl:rem(60px);--ai-size:var(--ai-size-md);--ai-color:var(--color-white);--ai-radius:var(--radius-default);--ai-bg:var(--color-primary-filled);--ai-hover:var(--color-primary-filled-hover);align-items:center;background:var(--ai-bg,var(--color-primary-filled));border:var(--ai-bd,rem(1px) solid transparent);border-radius:var(--ai-radius,var(--radius-default));color:var(--ai-color,var(--color-white));cursor:pointer;display:inline-flex;height:var(--ai-size);justify-content:center;line-height:1;min-height:var(--ai-size);min-width:var(--ai-size);overflow:hidden;padding:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ai-size)}.root[data-loading]{cursor:not-allowed}.root[data-loading] .icon{opacity:0;transform:translateY(100%)}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){border:1px solid transparent;cursor:not-allowed}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-light{background-color:var(--color-gray-1);color:var(--color-gray-5)}}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-dark{background-color:var(--color-dark-6);color:var(--color-dark-3)}}.root
|
|
1
|
+
.root{--ai-size-xs:rem(18px);--ai-size-sm:rem(22px);--ai-size-md:rem(28px);--ai-size-lg:rem(34px);--ai-size-xl:rem(44px);--ai-size-input-xs:rem(30px);--ai-size-input-sm:rem(36px);--ai-size-input-md:rem(42px);--ai-size-input-lg:rem(50px);--ai-size-input-xl:rem(60px);--ai-size:var(--ai-size-md);--ai-color:var(--color-white);--ai-radius:var(--radius-default);--ai-bg:var(--color-primary-filled);--ai-hover:var(--color-primary-filled-hover);align-items:center;background:var(--ai-bg,var(--color-primary-filled));border:var(--ai-bd,rem(1px) solid transparent);border-radius:var(--ai-radius,var(--radius-default));color:var(--ai-color,var(--color-white));cursor:pointer;display:inline-flex;height:var(--ai-size);justify-content:center;line-height:1;min-height:var(--ai-size);min-width:var(--ai-size);overflow:hidden;padding:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ai-size)}.root[data-loading]{cursor:not-allowed}.root[data-loading] .icon{opacity:0;transform:translateY(100%)}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){border:1px solid transparent;cursor:not-allowed}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-light{background-color:var(--color-gray-1);color:var(--color-gray-5)}}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-dark{background-color:var(--color-dark-6);color:var(--color-dark-3)}}.root:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover);color:var(--ai-color)}.loader{align-items:center;border-radius:var(--ai-radius,var(--radius-default));display:flex;justify-content:center;left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2);@mixin where-light{background-color:hsla(0,0%,100%,.15)}@mixin where-dark{background-color:rgba(0,0,0,.15)}}.icon{align-items:center;display:flex;height:100%;justify-content:center;transition:transform .15s ease,opacity .1s ease;width:100%}.icon-element{height:80%;width:80%}.group{--ai-border-width:1px;display:flex}.group :where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal] .groupSection:not(:only-child):first-child,.group[data-orientation=horizontal] .root:not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--ai-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):last-child,.group[data-orientation=horizontal] .root:not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--ai-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=horizontal] .root:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--ai-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical] .groupSection:not(:only-child):first-child,.group[data-orientation=vertical] .root:not(:only-child):first-child{border-bottom-width:calc(var(--ai-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical] .groupSection:not(:only-child):last-child,.group[data-orientation=vertical] .root:not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.group[data-orientation=vertical] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=vertical] .root:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--ai-border-width)/2);border-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.section{--section-height-xs:var(--ai-size-xs);--section-height-sm:var(--ai-size-sm);--section-height-md:var(--ai-size-md);--section-height-lg:var(--ai-size-lg);--section-height-xl:var(--ai-size-xl);--section-height-input-xs:var(--ai-size-input-xs);--section-height-input-sm:var(--ai-size-input-sm);--section-height-input-md:var(--ai-size-input-md);--section-height-input-lg:var(--ai-size-input-lg);--section-height-input-xl:var(--ai-size-input-xl);--section-padding-x-xs:rem(6px);--section-padding-x-sm:rem(8px);--section-padding-x-md:rem(10px);--section-padding-x-lg:rem(12px);--section-padding-x-xl:rem(16px);--section-height:var(--section-height-sm);--section-padding-x:var(--section-padding-x-sm);--section-color:var(--color-white);align-items:center;background:var(--section-bg,var(--color-primary-filled));border:var(--section-bd,rem(1px) solid transparent);border-radius:var(--section-radius,var(--mantine-radius-default));color:var(--section-color,var(--color-white));display:inline-flex;font-size:var(--section-fz,var(--mantine-font-size-sm));font-weight:600;height:var(--section-height,var(--section-height-sm));justify-content:center;line-height:1;padding-inline:var(--section-padding-x,var(--section-padding-x-sm));vertical-align:middle;width:auto}
|
|
@@ -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
|
|
@@ -64,7 +65,7 @@ const _mod = computed(() => [{ loading }, mod]);
|
|
|
64
65
|
|
|
65
66
|
<span :class='[css.icon, classes?.icon]'>
|
|
66
67
|
<slot>
|
|
67
|
-
<Icon v-if='icon' :name='icon' />
|
|
68
|
+
<Icon v-if='icon' :name='icon' :class='css["icon-element"]' />
|
|
68
69
|
</slot>
|
|
69
70
|
</span>
|
|
70
71
|
</Box>
|
|
@@ -14,8 +14,6 @@ const { mod } = defineProps({
|
|
|
14
14
|
|
|
15
15
|
<style module lang="postcss">
|
|
16
16
|
.root {
|
|
17
|
-
display: grid;
|
|
18
|
-
|
|
19
17
|
min-height: 100dvh;
|
|
20
18
|
padding-top: calc(var(--app-shell-header-offset, 0rem) + var(--app-shell-padding));
|
|
21
19
|
padding-bottom: calc(var(--app-shell-footer-offset, 0rem) + var(--app-shell-padding));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NuanceColor, NuanceSpacing } from '@nui/types';
|
|
2
|
+
import type { MaybeRef } from 'vue';
|
|
3
|
+
import type { BoxProps } from './box.vue.js';
|
|
4
|
+
import type { LinkProps } from './link/index.js';
|
|
5
|
+
import type { TextProps } from './text.vue.js';
|
|
6
|
+
export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
slot?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BreadcrumbsProps extends BoxProps {
|
|
13
|
+
items?: MaybeRef<BreadcrumbsItem[]>;
|
|
14
|
+
/** Separator icon between items @default `'gravity-ui:chevron-right'` */
|
|
15
|
+
separator?: string;
|
|
16
|
+
/** Controls spacing between separator and breadcrumb @default `'xs'` */
|
|
17
|
+
spacing?: NuanceSpacing;
|
|
18
|
+
color?: NuanceColor;
|
|
19
|
+
size?: TextProps['fz'];
|
|
20
|
+
}
|
|
21
|
+
declare var __VLS_16: string, __VLS_17: {
|
|
22
|
+
item: BreadcrumbsItem;
|
|
23
|
+
ix: number;
|
|
24
|
+
active: any;
|
|
25
|
+
}, __VLS_32: {};
|
|
26
|
+
type __VLS_Slots = {} & {
|
|
27
|
+
[K in NonNullable<typeof __VLS_16>]?: (props: typeof __VLS_17) => any;
|
|
28
|
+
} & {
|
|
29
|
+
separator?: (props: typeof __VLS_32) => any;
|
|
30
|
+
};
|
|
31
|
+
declare const __VLS_base: import("vue").DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BreadcrumbsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getSpacing } from "@nui/utils";
|
|
3
|
+
import { computed, unref } from "vue";
|
|
4
|
+
import Box from "./box.vue";
|
|
5
|
+
import { pickLinkProps } from "./link";
|
|
6
|
+
import Link from "./link/link.vue";
|
|
7
|
+
import Text from "./text.vue";
|
|
8
|
+
const {
|
|
9
|
+
is = "ol",
|
|
10
|
+
mod,
|
|
11
|
+
spacing,
|
|
12
|
+
separator = "gravity-ui:chevron-right",
|
|
13
|
+
color = "primary",
|
|
14
|
+
size
|
|
15
|
+
} = defineProps({
|
|
16
|
+
items: { type: null, required: false },
|
|
17
|
+
separator: { type: String, required: false },
|
|
18
|
+
spacing: { type: [String, Number], required: false },
|
|
19
|
+
color: { type: null, required: false },
|
|
20
|
+
size: { type: null, required: false },
|
|
21
|
+
is: { type: null, required: false },
|
|
22
|
+
mod: { type: [Object, Array, null], required: false }
|
|
23
|
+
});
|
|
24
|
+
const style = computed(() => ({
|
|
25
|
+
"--bc-spacing": getSpacing(spacing)
|
|
26
|
+
}));
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<Box :is :mod :style :class='$style.root' aria-label='breadcrumb'>
|
|
31
|
+
<template v-for='(item, ix) in unref(items)' :key='ix'>
|
|
32
|
+
<Text
|
|
33
|
+
is='li'
|
|
34
|
+
:c='color'
|
|
35
|
+
:fz='size'
|
|
36
|
+
:class='$style.breadcrumb'
|
|
37
|
+
role='presentation'
|
|
38
|
+
aria-hidden='true'
|
|
39
|
+
>
|
|
40
|
+
<NuxtLink v-slot='{ isActive }' v-bind='pickLinkProps(item).link' custom>
|
|
41
|
+
<slot :name='item.slot ?? "item"' :item='item' :ix='ix' :active='isActive'>
|
|
42
|
+
<Link v-bind='pickLinkProps(item).link' inherit :class='$style.item' :mod='{ active: isActive }'>
|
|
43
|
+
<Icon v-if='item?.icon' :name='item.icon' :class='$style.icon' />
|
|
44
|
+
<Text is='span' inherit truncate>
|
|
45
|
+
{{ item.label }}
|
|
46
|
+
</Text>
|
|
47
|
+
</Link>
|
|
48
|
+
</slot>
|
|
49
|
+
</NuxtLink>
|
|
50
|
+
</Text>
|
|
51
|
+
<li v-if='ix < unref(items).length - 1' role='presentation' aria-hidden='true' :class='$style.separator'>
|
|
52
|
+
<slot name='separator'>
|
|
53
|
+
<Icon :name='separator' />
|
|
54
|
+
</slot>
|
|
55
|
+
</li>
|
|
56
|
+
</template>
|
|
57
|
+
</Box>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<style module lang="postcss">
|
|
61
|
+
.root {
|
|
62
|
+
--bc-spacing: var(--spacing-xs);
|
|
63
|
+
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
gap: var(--bc-spacing);
|
|
67
|
+
align-items: center;
|
|
68
|
+
|
|
69
|
+
list-style: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.breadcrumb {
|
|
73
|
+
line-height: 1;
|
|
74
|
+
|
|
75
|
+
color: var(--color-text);
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
-webkit-tap-highlight-color: transparent;
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.item {
|
|
82
|
+
display: flex;
|
|
83
|
+
gap: .25rem;
|
|
84
|
+
align-items: center;
|
|
85
|
+
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
|
|
88
|
+
&:where([data-active]) {
|
|
89
|
+
color: var(--text-color);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.icon {
|
|
94
|
+
width: 1.2em;
|
|
95
|
+
height: 1.2em;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.separator {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
|
|
103
|
+
line-height: 1;
|
|
104
|
+
|
|
105
|
+
@mixin where-light {
|
|
106
|
+
color: var(--color-gray-7);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@mixin where-dark {
|
|
110
|
+
color: var(--color-dark-2);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NuanceColor, NuanceSpacing } from '@nui/types';
|
|
2
|
+
import type { MaybeRef } from 'vue';
|
|
3
|
+
import type { BoxProps } from './box.vue.js';
|
|
4
|
+
import type { LinkProps } from './link/index.js';
|
|
5
|
+
import type { TextProps } from './text.vue.js';
|
|
6
|
+
export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
slot?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BreadcrumbsProps extends BoxProps {
|
|
13
|
+
items?: MaybeRef<BreadcrumbsItem[]>;
|
|
14
|
+
/** Separator icon between items @default `'gravity-ui:chevron-right'` */
|
|
15
|
+
separator?: string;
|
|
16
|
+
/** Controls spacing between separator and breadcrumb @default `'xs'` */
|
|
17
|
+
spacing?: NuanceSpacing;
|
|
18
|
+
color?: NuanceColor;
|
|
19
|
+
size?: TextProps['fz'];
|
|
20
|
+
}
|
|
21
|
+
declare var __VLS_16: string, __VLS_17: {
|
|
22
|
+
item: BreadcrumbsItem;
|
|
23
|
+
ix: number;
|
|
24
|
+
active: any;
|
|
25
|
+
}, __VLS_32: {};
|
|
26
|
+
type __VLS_Slots = {} & {
|
|
27
|
+
[K in NonNullable<typeof __VLS_16>]?: (props: typeof __VLS_17) => any;
|
|
28
|
+
} & {
|
|
29
|
+
separator?: (props: typeof __VLS_32) => any;
|
|
30
|
+
};
|
|
31
|
+
declare const __VLS_base: import("vue").DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BreadcrumbsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.root{--button-height-xs:rem(30px);--button-height-sm:rem(36px);--button-height-md:rem(42px);--button-height-lg:rem(50px);--button-height-xl:rem(60px);--button-height-compact-xs:rem(22px);--button-height-compact-sm:rem(26px);--button-height-compact-md:rem(30px);--button-height-compact-lg:rem(34px);--button-height-compact-xl:rem(40px);--button-padding-x-xs:rem(14px);--button-padding-x-sm:rem(18px);--button-padding-x-md:rem(22px);--button-padding-x-lg:rem(26px);--button-padding-x-xl:rem(32px);--button-padding-x-compact-xs:rem(7px);--button-padding-x-compact-sm:rem(8px);--button-padding-x-compact-md:rem(10px);--button-padding-x-compact-lg:rem(12px);--button-padding-x-compact-xl:rem(14px);--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--color-white);--button-fz:var(--font-size-sm);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);background:var(--button-bg);border:var(--button-bd,rem(1px) solid transparent);border-radius:var(--button-radius);color:var(--button-color,var(--color-white));cursor:pointer;display:inline-block;font-size:var(--button-fz);font-weight:600;height:var(--button-height,var(--button-height-sm));line-height:1;overflow:hidden;padding-inline:var(--button-padding-x,var(--button-padding-x-sm));position:relative;text-align:center;transition:background-color .2s ease-in,color .2s ease-in;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:auto}.root:where([data-with-left-section]){padding-inline-start:calc(var(--button-padding-x)/1.5)}.root:where([data-with-right-section]){padding-inline-end:calc(var(--button-padding-x)/1.5)}.root:where([data-variant=gradient-outline]){background-clip:padding-box,border-box;background-origin:border-box}.root:where(:disabled:not([data-loading])){background:var(--color-disabled);border:1px solid transparent;color:var(--color-disabled);cursor:not-allowed;transform:none}.root:before{border-radius:var(--button-radius,var(--radius-default));content:"";filter:blur(12px);inset:-1px;opacity:0;pointer-events:none;position:absolute;transform:translateY(-100%);transition:transform .15s ease,opacity .1s ease;@mixin where-light{background:var(--color-gray-1);color:var(--color-gray-5)}@mixin where-dark{background:var(--color-dark-6);color:var(--color-dark-3)}}.root:where([data-loading]){cursor:not-allowed;transform:none}.root:where([data-loading]):before{opacity:1;transform:translateY(0)}.root:where([data-loading]) .inner{opacity:0;transform:translateY(100%)}.root
|
|
1
|
+
.root{--button-height-xs:rem(30px);--button-height-sm:rem(36px);--button-height-md:rem(42px);--button-height-lg:rem(50px);--button-height-xl:rem(60px);--button-height-compact-xs:rem(22px);--button-height-compact-sm:rem(26px);--button-height-compact-md:rem(30px);--button-height-compact-lg:rem(34px);--button-height-compact-xl:rem(40px);--button-padding-x-xs:rem(14px);--button-padding-x-sm:rem(18px);--button-padding-x-md:rem(22px);--button-padding-x-lg:rem(26px);--button-padding-x-xl:rem(32px);--button-padding-x-compact-xs:rem(7px);--button-padding-x-compact-sm:rem(8px);--button-padding-x-compact-md:rem(10px);--button-padding-x-compact-lg:rem(12px);--button-padding-x-compact-xl:rem(14px);--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--color-white);--button-fz:var(--font-size-sm);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);background:var(--button-bg);border:var(--button-bd,rem(1px) solid transparent);border-radius:var(--button-radius);color:var(--button-color,var(--color-white));cursor:pointer;display:inline-block;font-size:var(--button-fz);font-weight:600;height:var(--button-height,var(--button-height-sm));line-height:1;overflow:hidden;padding-inline:var(--button-padding-x,var(--button-padding-x-sm));position:relative;text-align:center;transition:background-color .2s ease-in,color .2s ease-in;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:auto}.root:where([data-with-left-section]){padding-inline-start:calc(var(--button-padding-x)/1.5)}.root:where([data-with-right-section]){padding-inline-end:calc(var(--button-padding-x)/1.5)}.root:where([data-variant=gradient-outline]){background-clip:padding-box,border-box;background-origin:border-box}.root:where(:disabled:not([data-loading])){background:var(--color-disabled);border:1px solid transparent;color:var(--color-disabled);cursor:not-allowed;transform:none}.root:before{border-radius:var(--button-radius,var(--radius-default));content:"";filter:blur(12px);inset:-1px;opacity:0;pointer-events:none;position:absolute;transform:translateY(-100%);transition:transform .15s ease,opacity .1s ease;@mixin where-light{background:var(--color-gray-1);color:var(--color-gray-5)}@mixin where-dark{background:var(--color-dark-6);color:var(--color-dark-3)}}.root:where([data-loading]){cursor:not-allowed;transform:none}.root:where([data-loading]):before{opacity:1;transform:translateY(0)}.root:where([data-loading]) .inner{opacity:0;transform:translateY(100%)}.root:hover:where(:not([data-loading],:disabled)){background:var(--button-hover);color:var(--button-color)}.root:hover:where(:not([data-loading],:disabled)):where([data-variant=gradient-outline]){color:#fff}.inner{justify-content:center;overflow:visible;transition:transform .15s ease,opacity .1s ease}.inner,.label{align-items:center;display:flex;height:100%}.label{opacity:1;overflow:hidden;white-space:nowrap}.label:where([data-loading]){opacity:.2}.section{--section-pointer-events:none;align-items:center;display:flex;pointer-events:var(--section-pointer-events)}.section:where([data-position=left]){margin-inline-end:var(--spacing-xs)}.section:where([data-position=right]){margin-inline-start:var(--spacing-xs)}.loader{left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2)}.group{--button-border-width:1px;display:flex}.group :where(.root):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal] .root:not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--button-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal] .root:not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--button-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal] .root:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--button-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical] .root:not(:only-child):first-child{border-bottom-width:calc(var(--button-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical] .root:not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--button-border-width)/2)}.group[data-orientation=vertical] .root:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--button-border-width)/2);border-radius:0;border-top-width:calc(var(--button-border-width)/2)}
|
|
@@ -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
|
|
|
@@ -3,6 +3,7 @@ export * from './app-shell/index.js';
|
|
|
3
3
|
export * from './avatar/index.js';
|
|
4
4
|
export * from './background-image.vue.js';
|
|
5
5
|
export * from './box.vue.js';
|
|
6
|
+
export type { BreadcrumbsItem, BreadcrumbsProps } from './breadcrumbs.vue.js';
|
|
6
7
|
export * from './button/index.js';
|
|
7
8
|
export * from './card/index.js';
|
|
8
9
|
export * from './checkbox/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { pickLinkProps } from "./lib.js";
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { NuxtLinkProps } from '#app';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function pickLinkProps<T extends NuxtLinkProps>(props: T): {
|
|
3
3
|
link: {
|
|
4
4
|
prefetch: NonNullable<import("vue").UnwrapRef<T["prefetch"]>> | undefined;
|
|
5
5
|
noPrefetch: NonNullable<import("vue").UnwrapRef<T["noPrefetch"]>> | undefined;
|
|
6
6
|
to?: import("vue").UnwrapRef<T["to"]> | undefined;
|
|
7
7
|
target?: import("vue").UnwrapRef<T["target"]> | undefined;
|
|
8
|
-
replace?: import("vue").UnwrapRef<T["replace"]> | undefined;
|
|
9
8
|
external?: import("vue").UnwrapRef<T["external"]> | undefined;
|
|
10
9
|
rel?: import("vue").UnwrapRef<T["rel"]> | undefined;
|
|
11
10
|
noRel?: import("vue").UnwrapRef<T["noRel"]> | undefined;
|
|
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<"
|
|
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,9 +9,14 @@ 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
|
-
export function
|
|
19
|
+
export function pickLinkProps(props) {
|
|
15
20
|
const link = reactivePick(props, ...linkProps);
|
|
16
21
|
const rest = reactiveOmit(props, ...linkProps);
|
|
17
22
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import Button from "../button/button.vue";
|
|
3
|
-
import {
|
|
3
|
+
import { pickLinkProps } from "./lib";
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
to: { type: null, required: false },
|
|
6
6
|
external: { type: Boolean, required: false },
|
|
@@ -31,27 +31,28 @@ const props = defineProps({
|
|
|
31
31
|
is: { type: null, required: false },
|
|
32
32
|
mod: { type: [Object, Array, null], required: false }
|
|
33
33
|
});
|
|
34
|
-
const { link, rest } =
|
|
34
|
+
const { link, rest } = pickLinkProps(props);
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<template>
|
|
38
|
-
|
|
39
|
-
<NuxtLink
|
|
40
|
-
v-slot='{ href, navigate, rel, target }'
|
|
41
|
-
v-bind='link'
|
|
42
|
-
custom
|
|
43
|
-
>
|
|
38
|
+
<NuxtLink v-slot='{ href, navigate, ...linkProps }' v-bind='link' custom>
|
|
44
39
|
<Button
|
|
45
|
-
v-bind='{
|
|
46
|
-
|
|
40
|
+
v-bind='{
|
|
41
|
+
...rest,
|
|
42
|
+
is: rest?.is || "a",
|
|
43
|
+
href,
|
|
44
|
+
rel: "rel" in linkProps ? linkProps.rel : void 0,
|
|
45
|
+
target: "target" in linkProps ? linkProps.target : void 0
|
|
46
|
+
}'
|
|
47
|
+
@click='navigate'
|
|
47
48
|
>
|
|
48
|
-
<template #leftSection>
|
|
49
|
+
<template v-if='$slots.leftSection' #leftSection>
|
|
49
50
|
<slot name='leftSection' />
|
|
50
51
|
</template>
|
|
51
52
|
|
|
52
53
|
<slot />
|
|
53
54
|
|
|
54
|
-
<template #rightSection>
|
|
55
|
+
<template v-if='$slots.rightSection' #rightSection>
|
|
55
56
|
<slot name='rightSection' />
|
|
56
57
|
</template>
|
|
57
58
|
</Button>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { NuxtLink } from "#components";
|
|
3
3
|
import Text from "../text.vue";
|
|
4
|
-
import {
|
|
4
|
+
import { pickLinkProps } from "./lib";
|
|
5
|
+
defineOptions({ inheritAttrs: false });
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
underline: { type: Boolean, required: false },
|
|
7
8
|
to: { type: null, required: false },
|
|
@@ -32,26 +33,22 @@ const props = defineProps({
|
|
|
32
33
|
c: { type: null, required: false },
|
|
33
34
|
mod: { type: [Object, Array, null], required: false }
|
|
34
35
|
});
|
|
35
|
-
const { link, rest } =
|
|
36
|
+
const { link, rest: { underline, ...rest } } = pickLinkProps(props);
|
|
36
37
|
</script>
|
|
37
38
|
|
|
38
39
|
<template>
|
|
39
|
-
|
|
40
|
-
<NuxtLink
|
|
41
|
-
v-slot='{ href, navigate, rel, target }'
|
|
42
|
-
v-bind='link'
|
|
43
|
-
custom
|
|
44
|
-
>
|
|
40
|
+
<NuxtLink v-slot='{ href, navigate, ...linkProps }' v-bind='link' custom>
|
|
45
41
|
<Text
|
|
46
42
|
is='a'
|
|
47
|
-
:class='[$style.root, { [$style.underline]:
|
|
43
|
+
:class='[$style.root, { [$style.underline]: underline }]'
|
|
48
44
|
v-bind='{
|
|
49
45
|
...rest,
|
|
46
|
+
...$attrs,
|
|
50
47
|
href,
|
|
51
|
-
rel,
|
|
52
|
-
target
|
|
48
|
+
rel: "rel" in linkProps ? linkProps.rel : void 0,
|
|
49
|
+
target: "target" in linkProps ? linkProps.target : void 0
|
|
53
50
|
}'
|
|
54
|
-
@click='
|
|
51
|
+
@click='navigate'
|
|
55
52
|
>
|
|
56
53
|
<slot />
|
|
57
54
|
</Text>
|
|
@@ -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
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useStyleResolver } from "@nui/composals";
|
|
3
3
|
import { createVariantColorResolver } from "@nui/utils";
|
|
4
4
|
import { computed } from "vue";
|
|
5
5
|
import Box from "../box.vue";
|
|
6
6
|
import UnstyledButton from "../button/unstyled-button.vue";
|
|
7
|
-
import {
|
|
7
|
+
import { pickLinkProps } from "../link";
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
description: { type: String, required: false },
|
|
10
10
|
active: { type: Boolean, required: false },
|
|
@@ -34,47 +34,37 @@ const {
|
|
|
34
34
|
link,
|
|
35
35
|
rest: {
|
|
36
36
|
disabled,
|
|
37
|
-
mod
|
|
37
|
+
mod,
|
|
38
38
|
variant = "filled",
|
|
39
39
|
color,
|
|
40
40
|
noWrap,
|
|
41
41
|
description
|
|
42
42
|
}
|
|
43
|
-
} =
|
|
44
|
-
const
|
|
45
|
-
const mod = computed(() => [{ active: active.value, disabled }, _mod]);
|
|
46
|
-
const style = useStyleResolver((theme) => {
|
|
43
|
+
} = pickLinkProps(props);
|
|
44
|
+
const style = computed(() => useStyleResolver((theme) => {
|
|
47
45
|
const { background, hover, text } = createVariantColorResolver({ variant, color, theme });
|
|
48
46
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"--nl-color": variant ? text : void 0
|
|
53
|
-
}
|
|
47
|
+
"--nl-bg": variant ? background : void 0,
|
|
48
|
+
"--nl-hover": variant ? hover : void 0,
|
|
49
|
+
"--nl-color": variant ? text : void 0
|
|
54
50
|
};
|
|
55
|
-
});
|
|
51
|
+
}));
|
|
56
52
|
</script>
|
|
57
53
|
|
|
58
54
|
<template>
|
|
59
|
-
|
|
60
|
-
<NuxtLink
|
|
61
|
-
v-slot='{ href, navigate }'
|
|
62
|
-
v-bind='link'
|
|
63
|
-
custom
|
|
64
|
-
>
|
|
55
|
+
<NuxtLink v-slot='{ href, navigate, isActive, ...linkProps }' v-bind='link' custom>
|
|
65
56
|
<UnstyledButton
|
|
66
57
|
is='a'
|
|
67
|
-
:class='$style.root'
|
|
68
|
-
:style='style.root'
|
|
69
|
-
:mod
|
|
70
58
|
:href
|
|
71
|
-
|
|
59
|
+
:style
|
|
60
|
+
:class='$style.root'
|
|
61
|
+
:mod='[{ active: isActive, disabled }, mod]'
|
|
62
|
+
:aria-current="isActive ? 'page' : void 0"
|
|
63
|
+
:rel='"rel" in linkProps ? linkProps?.rel : void 0'
|
|
64
|
+
:target='"target" in linkProps ? linkProps?.target : void 0'
|
|
65
|
+
@click='navigate'
|
|
72
66
|
>
|
|
73
|
-
<span
|
|
74
|
-
v-if='$slots.leftSection'
|
|
75
|
-
:class='$style.section'
|
|
76
|
-
data-position='left'
|
|
77
|
-
>
|
|
67
|
+
<span v-if='$slots.leftSection' :class='$style.section' data-position='left'>
|
|
78
68
|
<slot name='leftSection' />
|
|
79
69
|
</span>
|
|
80
70
|
|
|
@@ -89,11 +79,7 @@ const style = useStyleResolver((theme) => {
|
|
|
89
79
|
</Box>
|
|
90
80
|
</Box>
|
|
91
81
|
|
|
92
|
-
<span
|
|
93
|
-
v-if='$slots.rightSection'
|
|
94
|
-
:class='$style.section'
|
|
95
|
-
data-position='right'
|
|
96
|
-
>
|
|
82
|
+
<span v-if='$slots.rightSection' :class='$style.section' data-position='right'>
|
|
97
83
|
<slot name='rightSection' />
|
|
98
84
|
</span>
|
|
99
85
|
</UnstyledButton>
|
|
@@ -131,7 +117,7 @@ const style = useStyleResolver((theme) => {
|
|
|
131
117
|
}
|
|
132
118
|
}
|
|
133
119
|
|
|
134
|
-
&:where([data-active]
|
|
120
|
+
&:where([data-active]) {
|
|
135
121
|
color: var(--nl-color);
|
|
136
122
|
|
|
137
123
|
background-color: var(--nl-bg);
|
|
@@ -141,7 +127,7 @@ const style = useStyleResolver((theme) => {
|
|
|
141
127
|
--description-color: var(--nl-color);
|
|
142
128
|
}
|
|
143
129
|
|
|
144
|
-
|
|
130
|
+
&:hover {
|
|
145
131
|
background-color: var(--nl-hover);
|
|
146
132
|
}
|
|
147
133
|
}
|
|
@@ -20,7 +20,7 @@ export declare const useProvideRovingFocus: (args_0: State) => {
|
|
|
20
20
|
attr: string;
|
|
21
21
|
list: Readonly<ShallowRef<HTMLElement | null>>;
|
|
22
22
|
loop: boolean | undefined;
|
|
23
|
-
orientation: "
|
|
23
|
+
orientation: "horizontal" | "vertical" | "both" | undefined;
|
|
24
24
|
init: () => number;
|
|
25
25
|
focus: {
|
|
26
26
|
(dir: "first" | "last"): void;
|
|
@@ -38,7 +38,7 @@ export declare const useRovingFocus: () => {
|
|
|
38
38
|
attr: string;
|
|
39
39
|
list: Readonly<ShallowRef<HTMLElement | null>>;
|
|
40
40
|
loop: boolean | undefined;
|
|
41
|
-
orientation: "
|
|
41
|
+
orientation: "horizontal" | "vertical" | "both" | undefined;
|
|
42
42
|
init: () => number;
|
|
43
43
|
focus: {
|
|
44
44
|
(dir: "first" | "last"): void;
|
|
@@ -10,13 +10,13 @@ const {
|
|
|
10
10
|
inline,
|
|
11
11
|
inherit,
|
|
12
12
|
mod,
|
|
13
|
-
variant
|
|
13
|
+
variant,
|
|
14
14
|
gradient,
|
|
15
15
|
fz,
|
|
16
16
|
fw,
|
|
17
17
|
lh,
|
|
18
18
|
c,
|
|
19
|
-
size
|
|
19
|
+
size,
|
|
20
20
|
...rest
|
|
21
21
|
} = defineProps({
|
|
22
22
|
size: { type: null, required: false },
|
|
@@ -33,16 +33,13 @@ const {
|
|
|
33
33
|
is: { type: null, required: false },
|
|
34
34
|
mod: { type: [Object, Array, null], required: false }
|
|
35
35
|
});
|
|
36
|
-
const _mod = computed(() => [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
mod
|
|
45
|
-
]);
|
|
36
|
+
const _mod = computed(() => [{
|
|
37
|
+
truncate,
|
|
38
|
+
"line-clamp": lineClamp,
|
|
39
|
+
inline,
|
|
40
|
+
inherit,
|
|
41
|
+
variant
|
|
42
|
+
}, mod]);
|
|
46
43
|
const style = computed(() => useStyleResolver((theme) => ({
|
|
47
44
|
"--text-fz": getFontSize(fz || size),
|
|
48
45
|
"--text-fw": fw,
|
|
@@ -61,10 +58,12 @@ const style = computed(() => useStyleResolver((theme) => ({
|
|
|
61
58
|
|
|
62
59
|
<style module lang="postcss">
|
|
63
60
|
.root {
|
|
64
|
-
--text-fz: var(--font-size-
|
|
65
|
-
--text-lh: var(--line-height-
|
|
61
|
+
--text-fz: var(--font-size-sm);
|
|
62
|
+
--text-lh: var(--line-height-sm);
|
|
66
63
|
--text-color: inherit;
|
|
67
64
|
--text-fw: normal;
|
|
65
|
+
--text-gradient: none;
|
|
66
|
+
--text-line-clamp: none;
|
|
68
67
|
|
|
69
68
|
margin: 0;
|
|
70
69
|
padding: 0;
|
|
@@ -115,6 +114,7 @@ const style = computed(() => useStyleResolver((theme) => ({
|
|
|
115
114
|
font-size: inherit;
|
|
116
115
|
font-weight: inherit;
|
|
117
116
|
line-height: inherit;
|
|
117
|
+
color: inherit;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
&:where([data-inline]) {
|
|
@@ -12,8 +12,8 @@ export type NuanceSpacing = keyof NuanceSpacingValues | number;
|
|
|
12
12
|
export type NuanceShadow = keyof NuanceShadowsValues;
|
|
13
13
|
export type NuanceLineHeight = keyof NuanceLineHeightValues;
|
|
14
14
|
export type NuanceColorShade = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
15
|
-
type ShadedColor = `dark.${NuanceColorShade}` | `slate.${NuanceColorShade}` | `gray.${NuanceColorShade}` | `red.${NuanceColorShade}` | `pink.${NuanceColorShade}` | `grape.${NuanceColorShade}` | `violet.${NuanceColorShade}` | `indigo.${NuanceColorShade}` | `blue.${NuanceColorShade}` | `cyan.${NuanceColorShade}` | `green.${NuanceColorShade}` | `lime.${NuanceColorShade}` | `yellow.${NuanceColorShade}` | `orange.${NuanceColorShade}` | `teal.${NuanceColorShade}`;
|
|
16
|
-
export type NuanceDefaultThemeColor = 'dark' | 'slate' | 'gray' | 'red' | 'pink' | 'grape' | 'violet' | 'indigo' | 'blue' | 'cyan' | 'green' | 'lime' | 'yellow' | 'orange' | 'teal' | 'black' | 'white';
|
|
15
|
+
type ShadedColor = `dark.${NuanceColorShade}` | `slate.${NuanceColorShade}` | `gray.${NuanceColorShade}` | `red.${NuanceColorShade}` | `pink.${NuanceColorShade}` | `grape.${NuanceColorShade}` | `violet.${NuanceColorShade}` | `indigo.${NuanceColorShade}` | `blue.${NuanceColorShade}` | `cyan.${NuanceColorShade}` | `green.${NuanceColorShade}` | `lime.${NuanceColorShade}` | `yellow.${NuanceColorShade}` | `orange.${NuanceColorShade}` | `teal.${NuanceColorShade}` | `primary.${NuanceColorShade}`;
|
|
16
|
+
export type NuanceDefaultThemeColor = 'dark' | 'slate' | 'gray' | 'red' | 'pink' | 'grape' | 'violet' | 'indigo' | 'blue' | 'cyan' | 'green' | 'lime' | 'yellow' | 'orange' | 'teal' | 'black' | 'white' | 'primary';
|
|
17
17
|
export type NuanceColor = NuanceDefaultThemeColor | ShadedColor;
|
|
18
18
|
export type NuanceTheme = 'light' | 'dark';
|
|
19
19
|
export interface NuanceGradient {
|
|
@@ -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") {
|