nuance-ui 0.1.33 → 0.1.35
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/breadcrumbs.d.vue.ts +14 -9
- package/dist/runtime/components/breadcrumbs.vue +20 -18
- package/dist/runtime/components/breadcrumbs.vue.d.ts +14 -9
- package/dist/runtime/components/file-upload.d.vue.ts +44 -0
- package/dist/runtime/components/file-upload.vue +59 -0
- package/dist/runtime/components/file-upload.vue.d.ts +44 -0
- package/dist/runtime/components/index.d.ts +1 -0
- package/dist/runtime/components/index.js +1 -0
- package/dist/runtime/components/roving-focus/_lib/context.d.ts +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NuanceSpacing } from '@nui/types';
|
|
2
2
|
import type { MaybeRef } from 'vue';
|
|
3
3
|
import type { BoxProps } from './box.vue.js';
|
|
4
|
+
import type { ButtonProps } from './button/button.vue.js';
|
|
4
5
|
import type { LinkProps } from './link/index.js';
|
|
5
|
-
import type { TextProps } from './text.vue.js';
|
|
6
6
|
export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
|
|
7
7
|
active?: boolean;
|
|
8
8
|
label: string;
|
|
@@ -17,20 +17,25 @@ export interface BreadcrumbsProps extends BoxProps {
|
|
|
17
17
|
separator?: string;
|
|
18
18
|
/** Controls spacing between separator and breadcrumb @default `'xs'` */
|
|
19
19
|
spacing?: NuanceSpacing;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
variant?: ButtonProps['variant'];
|
|
21
|
+
color?: ButtonProps['color'];
|
|
22
|
+
size?: ButtonProps['size'];
|
|
22
23
|
}
|
|
23
|
-
declare var
|
|
24
|
+
declare var __VLS_7: string, __VLS_8: {
|
|
24
25
|
item: BreadcrumbsItem;
|
|
25
26
|
ix: number;
|
|
26
27
|
active: boolean;
|
|
27
|
-
},
|
|
28
|
+
}, __VLS_23: {};
|
|
28
29
|
type __VLS_Slots = {} & {
|
|
29
|
-
[K in NonNullable<typeof
|
|
30
|
+
[K in NonNullable<typeof __VLS_7>]?: (props: typeof __VLS_8) => any;
|
|
30
31
|
} & {
|
|
31
|
-
separator?: (props: typeof
|
|
32
|
+
separator?: (props: typeof __VLS_23) => any;
|
|
32
33
|
};
|
|
33
|
-
declare const __VLS_base: import("vue").DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
declare const __VLS_base: import("vue").DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
35
|
+
click: (item: BreadcrumbsItem) => any;
|
|
36
|
+
}, string, import("vue").PublicProps, Readonly<BreadcrumbsProps> & Readonly<{
|
|
37
|
+
onClick?: ((item: BreadcrumbsItem) => any) | undefined;
|
|
38
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
39
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
40
|
declare const _default: typeof __VLS_export;
|
|
36
41
|
export default _default;
|
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useTheme } from "@nui/composals";
|
|
2
3
|
import { getSpacing } from "@nui/utils";
|
|
3
4
|
import { computed, unref } from "vue";
|
|
4
5
|
import Box from "./box.vue";
|
|
5
|
-
import
|
|
6
|
-
import Link from "./link/link.vue";
|
|
7
|
-
import Text from "./text.vue";
|
|
6
|
+
import Button from "./button/button.vue";
|
|
8
7
|
const {
|
|
9
8
|
is = "ol",
|
|
10
9
|
mod,
|
|
11
10
|
spacing,
|
|
12
11
|
separator = "gravity-ui:chevron-right",
|
|
13
12
|
color = "primary",
|
|
14
|
-
|
|
13
|
+
variant = "subtle",
|
|
14
|
+
size = "compact-sm",
|
|
15
15
|
items
|
|
16
16
|
} = defineProps({
|
|
17
17
|
items: { type: null, required: false },
|
|
18
18
|
separator: { type: String, required: false },
|
|
19
19
|
spacing: { type: [String, Number], required: false },
|
|
20
|
+
variant: { type: String, required: false },
|
|
20
21
|
color: { type: null, required: false },
|
|
21
22
|
size: { type: null, required: false },
|
|
22
23
|
is: { type: null, required: false },
|
|
23
24
|
mod: { type: [Object, Array, null], required: false }
|
|
24
25
|
});
|
|
26
|
+
defineEmits(["click"]);
|
|
25
27
|
const style = computed(() => ({
|
|
26
28
|
"--bc-spacing": getSpacing(spacing)
|
|
27
29
|
}));
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
const inactive = computed(() => theme.value === "dark" ? "gray" : "dark");
|
|
28
32
|
const breadcrumbs = computed(() => unref(items) ?? []);
|
|
29
33
|
</script>
|
|
30
34
|
|
|
31
35
|
<template>
|
|
32
36
|
<Box :is :mod :style :class='$style.root' aria-label='breadcrumb'>
|
|
33
37
|
<template v-for='(item, ix) in breadcrumbs' :key='item.to'>
|
|
34
|
-
<
|
|
38
|
+
<li :class='$style.breadcrumb' role='presentation' aria-hidden='true'>
|
|
35
39
|
<slot
|
|
36
40
|
:name='item.slot ?? "item"'
|
|
37
41
|
:item='item'
|
|
38
42
|
:ix='ix'
|
|
39
43
|
:active='item.active ?? ix === breadcrumbs.length - 1'
|
|
40
44
|
>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
<Button
|
|
46
|
+
:size
|
|
47
|
+
:variant
|
|
44
48
|
:class='$style.item'
|
|
45
49
|
:mod='{ active: item.active ?? ix === breadcrumbs.length - 1 }'
|
|
50
|
+
:color='item.active ?? ix === breadcrumbs.length - 1 ? color : inactive'
|
|
51
|
+
@click.stop.prevent='$emit("click", item)'
|
|
46
52
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</
|
|
53
|
+
<template v-if='item?.icon' #leftSection>
|
|
54
|
+
<Icon :name='item.icon' :class='$style.icon' />
|
|
55
|
+
</template>
|
|
56
|
+
{{ item.label }}
|
|
57
|
+
</Button>
|
|
52
58
|
</slot>
|
|
53
|
-
</
|
|
59
|
+
</li>
|
|
54
60
|
<li v-if='ix < breadcrumbs.length - 1' role='presentation' aria-hidden='true' :class='$style.separator'>
|
|
55
61
|
<slot name='separator'>
|
|
56
62
|
<Icon :name='separator' />
|
|
@@ -86,10 +92,6 @@ const breadcrumbs = computed(() => unref(items) ?? []);
|
|
|
86
92
|
text-transform: capitalize;
|
|
87
93
|
|
|
88
94
|
font-weight: 600;
|
|
89
|
-
|
|
90
|
-
&:where([data-active]) {
|
|
91
|
-
color: var(--text-color);
|
|
92
|
-
}
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
.icon {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NuanceSpacing } from '@nui/types';
|
|
2
2
|
import type { MaybeRef } from 'vue';
|
|
3
3
|
import type { BoxProps } from './box.vue.js';
|
|
4
|
+
import type { ButtonProps } from './button/button.vue.js';
|
|
4
5
|
import type { LinkProps } from './link/index.js';
|
|
5
|
-
import type { TextProps } from './text.vue.js';
|
|
6
6
|
export interface BreadcrumbsItem extends Omit<LinkProps, 'mod'> {
|
|
7
7
|
active?: boolean;
|
|
8
8
|
label: string;
|
|
@@ -17,20 +17,25 @@ export interface BreadcrumbsProps extends BoxProps {
|
|
|
17
17
|
separator?: string;
|
|
18
18
|
/** Controls spacing between separator and breadcrumb @default `'xs'` */
|
|
19
19
|
spacing?: NuanceSpacing;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
variant?: ButtonProps['variant'];
|
|
21
|
+
color?: ButtonProps['color'];
|
|
22
|
+
size?: ButtonProps['size'];
|
|
22
23
|
}
|
|
23
|
-
declare var
|
|
24
|
+
declare var __VLS_7: string, __VLS_8: {
|
|
24
25
|
item: BreadcrumbsItem;
|
|
25
26
|
ix: number;
|
|
26
27
|
active: boolean;
|
|
27
|
-
},
|
|
28
|
+
}, __VLS_23: {};
|
|
28
29
|
type __VLS_Slots = {} & {
|
|
29
|
-
[K in NonNullable<typeof
|
|
30
|
+
[K in NonNullable<typeof __VLS_7>]?: (props: typeof __VLS_8) => any;
|
|
30
31
|
} & {
|
|
31
|
-
separator?: (props: typeof
|
|
32
|
+
separator?: (props: typeof __VLS_23) => any;
|
|
32
33
|
};
|
|
33
|
-
declare const __VLS_base: import("vue").DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
declare const __VLS_base: import("vue").DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
35
|
+
click: (item: BreadcrumbsItem) => any;
|
|
36
|
+
}, string, import("vue").PublicProps, Readonly<BreadcrumbsProps> & Readonly<{
|
|
37
|
+
onClick?: ((item: BreadcrumbsItem) => any) | undefined;
|
|
38
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
39
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
40
|
declare const _default: typeof __VLS_export;
|
|
36
41
|
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { UseFileDialogOptions } from '@vueuse/core';
|
|
2
|
+
import type { MaybeRef } from 'vue';
|
|
3
|
+
import type { ActionIconProps } from './action-icon/action-icon.vue.js';
|
|
4
|
+
export interface FileUploadProps<M extends boolean> extends ActionIconProps, UseFileDialogOptions {
|
|
5
|
+
/**
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
multiple?: MaybeRef<M>;
|
|
9
|
+
/**
|
|
10
|
+
* @default '*'
|
|
11
|
+
*/
|
|
12
|
+
accept?: MaybeRef<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Reset when open file dialog.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
reset?: MaybeRef<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Select directories instead of files.
|
|
20
|
+
* @see [HTMLInputElement webkitdirectory](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
directory?: MaybeRef<boolean>;
|
|
24
|
+
}
|
|
25
|
+
declare const __VLS_export: <Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
26
|
+
props: __VLS_PrettifyLocal<FileUploadProps<Multiple> & {
|
|
27
|
+
onCancel?: (() => any) | undefined;
|
|
28
|
+
onChange?: ((files: (Multiple extends true ? File[] : File) | null) => any) | undefined;
|
|
29
|
+
}> & import("vue").PublicProps;
|
|
30
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
31
|
+
files: import("vue").Ref<FileList | null, FileList | null>;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
}>) => void;
|
|
34
|
+
attrs: any;
|
|
35
|
+
slots: {};
|
|
36
|
+
emit: ((evt: "cancel") => void) & ((evt: "change", files: (Multiple extends true ? File[] : File) | null) => void);
|
|
37
|
+
}>) => import("vue").VNode & {
|
|
38
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
39
|
+
};
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_PrettifyLocal<T> = {
|
|
43
|
+
[K in keyof T as K]: T[K];
|
|
44
|
+
} & {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFileDialog } from "@vueuse/core";
|
|
3
|
+
import { computed, toValue } from "vue";
|
|
4
|
+
import ActionIcon from "./action-icon/action-icon.vue";
|
|
5
|
+
const {
|
|
6
|
+
multiple,
|
|
7
|
+
accept,
|
|
8
|
+
reset: _reset,
|
|
9
|
+
directory,
|
|
10
|
+
icon = "gravity-ui:arrow-shape-up-from-line",
|
|
11
|
+
...props
|
|
12
|
+
} = defineProps({
|
|
13
|
+
multiple: { type: null, required: false },
|
|
14
|
+
accept: { type: null, required: false },
|
|
15
|
+
reset: { type: null, required: false },
|
|
16
|
+
directory: { type: null, required: false },
|
|
17
|
+
size: { type: null, required: false },
|
|
18
|
+
variant: { type: String, required: false },
|
|
19
|
+
gradient: { type: Object, required: false },
|
|
20
|
+
loading: { type: Boolean, required: false },
|
|
21
|
+
color: { type: null, required: false },
|
|
22
|
+
radius: { type: [String, Number], required: false },
|
|
23
|
+
classes: { type: Object, required: false },
|
|
24
|
+
mod: { type: [Object, Array, null], required: false },
|
|
25
|
+
icon: { type: String, required: false },
|
|
26
|
+
disabled: { type: Boolean, required: false },
|
|
27
|
+
capture: { type: null, required: false },
|
|
28
|
+
initialFiles: { type: null, required: false },
|
|
29
|
+
input: { type: null, required: false },
|
|
30
|
+
document: { type: null, required: false }
|
|
31
|
+
});
|
|
32
|
+
const emit = defineEmits(["change", "cancel"]);
|
|
33
|
+
const isMultiple = computed(() => {
|
|
34
|
+
const val = toValue(multiple);
|
|
35
|
+
return val === true || val === "" || val === "true";
|
|
36
|
+
});
|
|
37
|
+
const { files, open, onChange, onCancel, reset } = useFileDialog({
|
|
38
|
+
multiple: isMultiple,
|
|
39
|
+
accept,
|
|
40
|
+
reset: _reset,
|
|
41
|
+
directory
|
|
42
|
+
});
|
|
43
|
+
onChange((fileList) => {
|
|
44
|
+
if (!fileList)
|
|
45
|
+
return emit("change", null);
|
|
46
|
+
const filesArray = Array.from(fileList);
|
|
47
|
+
if (isMultiple.value) {
|
|
48
|
+
emit("change", filesArray);
|
|
49
|
+
} else {
|
|
50
|
+
emit("change", filesArray[0] || null);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
onCancel(() => emit("cancel"));
|
|
54
|
+
defineExpose({ files, reset });
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<ActionIcon :icon v-bind='props' @click='open' />
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { UseFileDialogOptions } from '@vueuse/core';
|
|
2
|
+
import type { MaybeRef } from 'vue';
|
|
3
|
+
import type { ActionIconProps } from './action-icon/action-icon.vue.js';
|
|
4
|
+
export interface FileUploadProps<M extends boolean> extends ActionIconProps, UseFileDialogOptions {
|
|
5
|
+
/**
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
multiple?: MaybeRef<M>;
|
|
9
|
+
/**
|
|
10
|
+
* @default '*'
|
|
11
|
+
*/
|
|
12
|
+
accept?: MaybeRef<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Reset when open file dialog.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
reset?: MaybeRef<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Select directories instead of files.
|
|
20
|
+
* @see [HTMLInputElement webkitdirectory](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
directory?: MaybeRef<boolean>;
|
|
24
|
+
}
|
|
25
|
+
declare const __VLS_export: <Multiple extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
26
|
+
props: __VLS_PrettifyLocal<FileUploadProps<Multiple> & {
|
|
27
|
+
onCancel?: (() => any) | undefined;
|
|
28
|
+
onChange?: ((files: (Multiple extends true ? File[] : File) | null) => any) | undefined;
|
|
29
|
+
}> & import("vue").PublicProps;
|
|
30
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
31
|
+
files: import("vue").Ref<FileList | null, FileList | null>;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
}>) => void;
|
|
34
|
+
attrs: any;
|
|
35
|
+
slots: {};
|
|
36
|
+
emit: ((evt: "cancel") => void) & ((evt: "change", files: (Multiple extends true ? File[] : File) | null) => void);
|
|
37
|
+
}>) => import("vue").VNode & {
|
|
38
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
39
|
+
};
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_PrettifyLocal<T> = {
|
|
43
|
+
[K in keyof T as K]: T[K];
|
|
44
|
+
} & {};
|
|
@@ -12,6 +12,7 @@ export * from './combobox/index.js';
|
|
|
12
12
|
export * from './container.vue.js';
|
|
13
13
|
export * from './dialog/index.js';
|
|
14
14
|
export * from './drawer/index.js';
|
|
15
|
+
export * from './file-upload.vue.js';
|
|
15
16
|
export * from './input/index.js';
|
|
16
17
|
export * from './link/index.js';
|
|
17
18
|
export * from './loader/index.js';
|
|
@@ -11,6 +11,7 @@ export * from "./combobox/index.js";
|
|
|
11
11
|
export * from "./container.vue";
|
|
12
12
|
export * from "./dialog/index.js";
|
|
13
13
|
export * from "./drawer/index.js";
|
|
14
|
+
export * from "./file-upload.vue";
|
|
14
15
|
export * from "./input/index.js";
|
|
15
16
|
export * from "./link/index.js";
|
|
16
17
|
export * from "./loader/index.js";
|
|
@@ -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: "both" | "horizontal" | "vertical" | 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: "both" | "horizontal" | "vertical" | undefined;
|
|
42
42
|
init: () => number;
|
|
43
43
|
focus: {
|
|
44
44
|
(dir: "first" | "last"): void;
|