nuance-ui 0.3.1 → 0.3.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/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/components/dialog/ui/dialog-root.d.vue.ts +1 -1
- package/dist/runtime/components/dialog/ui/dialog-root.vue +1 -1
- package/dist/runtime/components/dialog/ui/dialog-root.vue.d.ts +1 -1
- package/dist/runtime/components/index.d.ts +3 -1
- package/dist/runtime/components/index.js +1 -0
- package/dist/runtime/components/kbd.d.vue.ts +25 -0
- package/dist/runtime/components/kbd.vue +28 -0
- package/dist/runtime/components/kbd.vue.d.ts +25 -0
- package/dist/runtime/components/notification.d.vue.ts +82 -0
- package/dist/runtime/components/notification.vue +144 -0
- package/dist/runtime/components/notification.vue.d.ts +82 -0
- package/dist/runtime/components/transition/index.d.ts +2 -0
- package/dist/runtime/components/transition/index.js +0 -0
- package/dist/runtime/components/transition/transition-group.d.vue.ts +35 -0
- package/dist/runtime/components/transition/transition-group.vue +32 -0
- package/dist/runtime/components/transition/transition-group.vue.d.ts +35 -0
- package/dist/runtime/components/transition/transition.vue +33 -0
- package/dist/runtime/components/tree/_ui/tree-item.vue +3 -3
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/use-countdown.d.ts +19 -0
- package/dist/runtime/composables/use-countdown.js +30 -0
- package/dist/runtime/notifications/index.d.ts +4 -0
- package/dist/runtime/notifications/index.js +3 -0
- package/dist/runtime/notifications/lib.d.ts +4 -0
- package/dist/runtime/notifications/lib.js +14 -0
- package/dist/runtime/notifications/notification-container.d.vue.ts +20 -0
- package/dist/runtime/notifications/notification-container.vue +35 -0
- package/dist/runtime/notifications/notification-container.vue.d.ts +20 -0
- package/dist/runtime/notifications/notifications-provider.d.vue.ts +22 -0
- package/dist/runtime/notifications/notifications-provider.vue +117 -0
- package/dist/runtime/notifications/notifications-provider.vue.d.ts +22 -0
- package/dist/runtime/notifications/notifications-store.d.ts +25 -0
- package/dist/runtime/notifications/notifications-store.js +80 -0
- package/dist/runtime/notifications/types.d.ts +50 -0
- package/dist/runtime/notifications/types.js +0 -0
- package/dist/runtime/notifications/use-notifications.d.ts +7 -0
- package/dist/runtime/notifications/use-notifications.js +10 -0
- package/dist/runtime/styles/global.css +1 -1
- package/dist/runtime/styles/transitions.css +1 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/package.json +9 -5
- package/dist/runtime/components/transition.vue +0 -42
- /package/dist/runtime/components/{transition.d.vue.ts → transition/transition.d.vue.ts} +0 -0
- /package/dist/runtime/components/{transition.vue.d.ts → transition/transition.vue.d.ts} +0 -0
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -108,7 +108,8 @@ const module$1 = defineNuxtModule({
|
|
|
108
108
|
form: resolve("./runtime/form"),
|
|
109
109
|
utils: resolve("./runtime/utils"),
|
|
110
110
|
types: resolve("./runtime/types"),
|
|
111
|
-
modals: resolve("./runtime/modals")
|
|
111
|
+
modals: resolve("./runtime/modals"),
|
|
112
|
+
notifications: resolve("./runtime/notifications")
|
|
112
113
|
};
|
|
113
114
|
for (const key in aliases) {
|
|
114
115
|
nuxt.options.alias[`@nui/${key}`] = aliases[key];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Classes, NuanceRadius, NuanceShadow, NuanceSize, NuanceSpacing } from '@nui/types';
|
|
2
2
|
import type { CSSProperties, RendererElement } from 'vue';
|
|
3
3
|
import type { BoxProps } from '../../box.vue.js';
|
|
4
|
-
import type { TransitionName } from '../../transition.vue.js';
|
|
4
|
+
import type { TransitionName } from '../../transition/transition.vue.js';
|
|
5
5
|
import type { DialogModel } from '../types.js';
|
|
6
6
|
interface StyleProps {
|
|
7
7
|
/** Top/bottom modal offset @default `5dvh` */
|
|
@@ -3,7 +3,7 @@ import { getRadius, getShadow, getSize, getSpacing, rem } from "@nui/utils";
|
|
|
3
3
|
import { unrefElement } from "@vueuse/core";
|
|
4
4
|
import { computed, shallowRef, watch } from "vue";
|
|
5
5
|
import Box from "../../box.vue";
|
|
6
|
-
import NTransition from "../../transition.vue";
|
|
6
|
+
import NTransition from "../../transition/transition.vue";
|
|
7
7
|
import { useProvideDialogState } from "../lib";
|
|
8
8
|
import css from "./dialog.module.css";
|
|
9
9
|
defineOptions({ inheritAttrs: false });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Classes, NuanceRadius, NuanceShadow, NuanceSize, NuanceSpacing } from '@nui/types';
|
|
2
2
|
import type { CSSProperties, RendererElement } from 'vue';
|
|
3
3
|
import type { BoxProps } from '../../box.vue.js';
|
|
4
|
-
import type { TransitionName } from '../../transition.vue.js';
|
|
4
|
+
import type { TransitionName } from '../../transition/transition.vue.js';
|
|
5
5
|
import type { DialogModel } from '../types.js';
|
|
6
6
|
interface StyleProps {
|
|
7
7
|
/** Top/bottom modal offset @default `5dvh` */
|
|
@@ -21,10 +21,12 @@ export * from './drawer/index.js';
|
|
|
21
21
|
export * from './files/index.js';
|
|
22
22
|
export type * from './floating-indicator.vue';
|
|
23
23
|
export * from './input/index.js';
|
|
24
|
+
export type * from './kbd.vue';
|
|
24
25
|
export * from './link/index.js';
|
|
25
26
|
export * from './loader/index.js';
|
|
26
27
|
export * from './modal/index.js';
|
|
27
28
|
export * from './nav-link/index.js';
|
|
29
|
+
export type * from './notification.vue';
|
|
28
30
|
export type * from './paper.vue';
|
|
29
31
|
export * from './popover/index.js';
|
|
30
32
|
export * from './progress/index.js';
|
|
@@ -39,6 +41,6 @@ export type * from './textarea.vue';
|
|
|
39
41
|
export * from './time-picker/index.js';
|
|
40
42
|
export type * from './timeline.vue';
|
|
41
43
|
export type * from './title.vue';
|
|
42
|
-
export
|
|
44
|
+
export * from './transition/index.js';
|
|
43
45
|
export * from './tree/index.js';
|
|
44
46
|
export * from './visually-hidden/index.js';
|
|
@@ -23,5 +23,6 @@ export * from "./switch/index.js";
|
|
|
23
23
|
export * from "./table/index.js";
|
|
24
24
|
export * from "./tabs/index.js";
|
|
25
25
|
export * from "./time-picker/index.js";
|
|
26
|
+
export * from "./transition/index.js";
|
|
26
27
|
export * from "./tree/index.js";
|
|
27
28
|
export * from "./visually-hidden/index.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AnyString, NuanceSize } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export interface KbdVars {
|
|
4
|
+
root: '--kbd-fz';
|
|
5
|
+
}
|
|
6
|
+
export interface KbdProps extends BoxProps {
|
|
7
|
+
/**
|
|
8
|
+
* Controls `font-size` and `padding`
|
|
9
|
+
* @default `'sm'`
|
|
10
|
+
*/
|
|
11
|
+
size?: NuanceSize | AnyString;
|
|
12
|
+
}
|
|
13
|
+
declare var __VLS_8: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_8) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<KbdProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KbdProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useVarsResolver } from "@nui/composables";
|
|
3
|
+
import { getSize } from "@nui/utils";
|
|
4
|
+
import Box from "./box.vue";
|
|
5
|
+
const { size } = defineProps({
|
|
6
|
+
size: { type: [String, Object], required: false },
|
|
7
|
+
is: { type: null, required: false },
|
|
8
|
+
mod: { type: [Object, Array, null], required: false }
|
|
9
|
+
});
|
|
10
|
+
const style = useVarsResolver(() => ({
|
|
11
|
+
root: { "--kbd-fz": getSize(size, "kbd-fz") }
|
|
12
|
+
}));
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<Box
|
|
17
|
+
is='kbd'
|
|
18
|
+
:style='style.root'
|
|
19
|
+
:class='$style.root'
|
|
20
|
+
:mod
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</Box>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style module>
|
|
27
|
+
.root{--kbd-fz-xs:10px;--kbd-fz-sm:12px;--kbd-fz-md:14px;--kbd-fz-lg:16px;--kbd-fz-xl:20px;--kbd-fz:var(--kbd-fz-sm);border:solid;border-radius:var(--radius-sm);border-width:1px 1px 3px;font-family:var(--font-family-monospace);font-size:var(--kbd-fz);font-weight:var(--font-weight-bold);line-height:var(--line-height);padding:.12em .45em;text-align:center;unicode-bidi:embed;@mixin where-light{background-color:var(--color-gray-0);border-color:var(--color-gray-3);color:var(--color-gray-7)}@mixin where-dark{background-color:var(--color-dark-6);border-color:var(--color-dark-4);color:var(--color-dark-0)}}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AnyString, NuanceSize } from '@nui/types';
|
|
2
|
+
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export interface KbdVars {
|
|
4
|
+
root: '--kbd-fz';
|
|
5
|
+
}
|
|
6
|
+
export interface KbdProps extends BoxProps {
|
|
7
|
+
/**
|
|
8
|
+
* Controls `font-size` and `padding`
|
|
9
|
+
* @default `'sm'`
|
|
10
|
+
*/
|
|
11
|
+
size?: NuanceSize | AnyString;
|
|
12
|
+
}
|
|
13
|
+
declare var __VLS_8: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_8) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<KbdProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KbdProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import type { Classes, NuanceColor, NuanceRadius, StringOrVNode } from '../types/index.js';
|
|
3
|
+
import type { ActionIconProps } from './action-icon/action-icon.vue.js';
|
|
4
|
+
import type { BoxProps } from './box.vue.js';
|
|
5
|
+
import type { ButtonProps } from './button/button.vue.js';
|
|
6
|
+
import type { LoaderProps } from './loader/index.js';
|
|
7
|
+
export type NotificationOrientation = 'vertical' | 'horizontal';
|
|
8
|
+
export interface NotificationAction extends ButtonProps {
|
|
9
|
+
/** Button label */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Click handler */
|
|
12
|
+
onClick?: (event: MouseEvent) => void;
|
|
13
|
+
}
|
|
14
|
+
type NotificationClasses = 'root' | 'icon' | 'loader' | 'body' | 'title' | 'description' | 'actions' | 'closeButton';
|
|
15
|
+
export interface NotificationProps extends BoxProps {
|
|
16
|
+
/**
|
|
17
|
+
* Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color.
|
|
18
|
+
* When `icon` is provided, sets the icon background color.
|
|
19
|
+
* When no icon is provided, sets the colored accent line on the left.
|
|
20
|
+
* @default theme.primaryColor
|
|
21
|
+
*/
|
|
22
|
+
color?: NuanceColor;
|
|
23
|
+
/**
|
|
24
|
+
* Key of `theme.radius` or any valid CSS value to set `border-radius`
|
|
25
|
+
* @default theme.defaultRadius
|
|
26
|
+
*/
|
|
27
|
+
radius?: NuanceRadius;
|
|
28
|
+
/** Notification icon, replaces color line */
|
|
29
|
+
icon?: string;
|
|
30
|
+
/** Notification title, displayed above the message body */
|
|
31
|
+
title?: StringOrVNode;
|
|
32
|
+
/** Notification body. When no title is provided, this is the main message. */
|
|
33
|
+
message?: StringOrVNode;
|
|
34
|
+
/** Action buttons */
|
|
35
|
+
actions?: NotificationAction[];
|
|
36
|
+
/** Actions/close layout @default 'vertical' */
|
|
37
|
+
orientation?: NotificationOrientation;
|
|
38
|
+
/** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
/** Shows the auto-close progress bar @default false */
|
|
41
|
+
withProgress?: boolean;
|
|
42
|
+
/** Adds border to the root element */
|
|
43
|
+
withBorder?: boolean;
|
|
44
|
+
/** If set, the close button is visible @default true */
|
|
45
|
+
withCloseButton?: boolean;
|
|
46
|
+
/** Props passed down to the close button */
|
|
47
|
+
closeButtonProps?: ActionIconProps;
|
|
48
|
+
/** Props passed down to the `Loader` component */
|
|
49
|
+
loaderProps?: LoaderProps & HTMLAttributes;
|
|
50
|
+
role?: string;
|
|
51
|
+
classes?: Classes<NotificationClasses>;
|
|
52
|
+
}
|
|
53
|
+
type __VLS_Props = NotificationProps;
|
|
54
|
+
type __VLS_ModelProps = {
|
|
55
|
+
'progress'?: number;
|
|
56
|
+
};
|
|
57
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
58
|
+
declare var __VLS_8: {}, __VLS_20: {}, __VLS_38: {}, __VLS_61: {};
|
|
59
|
+
type __VLS_Slots = {} & {
|
|
60
|
+
icon?: (props: typeof __VLS_8) => any;
|
|
61
|
+
} & {
|
|
62
|
+
title?: (props: typeof __VLS_20) => any;
|
|
63
|
+
} & {
|
|
64
|
+
default?: (props: typeof __VLS_38) => any;
|
|
65
|
+
} & {
|
|
66
|
+
actions?: (props: typeof __VLS_61) => any;
|
|
67
|
+
};
|
|
68
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
69
|
+
close: () => any;
|
|
70
|
+
"update:progress": (value: number) => any;
|
|
71
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
72
|
+
onClose?: (() => any) | undefined;
|
|
73
|
+
"onUpdate:progress"?: ((value: number) => any) | undefined;
|
|
74
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
75
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
76
|
+
declare const _default: typeof __VLS_export;
|
|
77
|
+
export default _default;
|
|
78
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
79
|
+
new (): {
|
|
80
|
+
$slots: S;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getRadius, getThemeColor, useVarsResolver } from "#imports";
|
|
3
|
+
import ActionIcon from "./action-icon/action-icon.vue";
|
|
4
|
+
import Box from "./box.vue";
|
|
5
|
+
import Button from "./button/button.vue";
|
|
6
|
+
import Loader from "./loader/loader.vue";
|
|
7
|
+
import Progress from "./progress/progress.vue";
|
|
8
|
+
const {
|
|
9
|
+
withCloseButton = true,
|
|
10
|
+
radius,
|
|
11
|
+
color,
|
|
12
|
+
mod,
|
|
13
|
+
loading,
|
|
14
|
+
withBorder,
|
|
15
|
+
role = "alert",
|
|
16
|
+
icon,
|
|
17
|
+
loaderProps,
|
|
18
|
+
title,
|
|
19
|
+
message,
|
|
20
|
+
actions,
|
|
21
|
+
orientation = "horizontal",
|
|
22
|
+
closeButtonProps,
|
|
23
|
+
classes,
|
|
24
|
+
withProgress = false
|
|
25
|
+
} = defineProps({
|
|
26
|
+
color: { type: null, required: false },
|
|
27
|
+
radius: { type: [String, Number], required: false },
|
|
28
|
+
icon: { type: String, required: false },
|
|
29
|
+
title: { type: [String, Object, Function], required: false },
|
|
30
|
+
message: { type: [String, Object, Function], required: false },
|
|
31
|
+
actions: { type: Array, required: false },
|
|
32
|
+
orientation: { type: String, required: false },
|
|
33
|
+
loading: { type: Boolean, required: false },
|
|
34
|
+
withProgress: { type: Boolean, required: false },
|
|
35
|
+
withBorder: { type: Boolean, required: false },
|
|
36
|
+
withCloseButton: { type: Boolean, required: false },
|
|
37
|
+
closeButtonProps: { type: Object, required: false },
|
|
38
|
+
loaderProps: { type: Object, required: false },
|
|
39
|
+
role: { type: String, required: false },
|
|
40
|
+
classes: { type: Object, required: false },
|
|
41
|
+
is: { type: null, required: false },
|
|
42
|
+
mod: { type: [Object, Array, null], required: false }
|
|
43
|
+
});
|
|
44
|
+
defineEmits(["close"]);
|
|
45
|
+
const progress = defineModel("progress", { type: Number, ...{ default: 0 } });
|
|
46
|
+
const style = useVarsResolver((theme) => ({
|
|
47
|
+
root: {
|
|
48
|
+
"--notification-radius": radius === void 0 ? void 0 : getRadius(radius),
|
|
49
|
+
"--notification-color": color ? getThemeColor(color, theme) : void 0
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<Box
|
|
56
|
+
:style='style.root'
|
|
57
|
+
:class='[$style.root, classes?.root]'
|
|
58
|
+
:role
|
|
59
|
+
:mod='[{
|
|
60
|
+
"with-icon": !!icon || !!$slots.icon || loading,
|
|
61
|
+
"with-border": withBorder,
|
|
62
|
+
orientation
|
|
63
|
+
}, mod]'
|
|
64
|
+
>
|
|
65
|
+
<div v-if='icon && !loading' :class='[$style.icon, classes?.icon]'>
|
|
66
|
+
<slot name='icon'>
|
|
67
|
+
<Icon :name='icon' />
|
|
68
|
+
</slot>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<Loader
|
|
72
|
+
v-if='loading'
|
|
73
|
+
size='28px'
|
|
74
|
+
:color
|
|
75
|
+
v-bind='loaderProps'
|
|
76
|
+
:class='[$style.loader, loaderProps?.class, classes?.loader]'
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<div :class='[$style.body, classes?.body]'>
|
|
80
|
+
<div v-if='title || $slots.title' :class='[$style.title, classes?.title]'>
|
|
81
|
+
<slot name='title'>
|
|
82
|
+
<component :is='title()' v-if='typeof title === "function"' />
|
|
83
|
+
<component :is='title' v-else-if='title && typeof title === "object"' />
|
|
84
|
+
<template v-else>
|
|
85
|
+
{{ title }}
|
|
86
|
+
</template>
|
|
87
|
+
</slot>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<Box
|
|
91
|
+
:class='[$style.description, classes?.description]'
|
|
92
|
+
:mod='{ "with-title": !!title || !!$slots.title }'
|
|
93
|
+
>
|
|
94
|
+
<slot>
|
|
95
|
+
<component :is='message()' v-if='typeof message === "function"' />
|
|
96
|
+
<component :is='message' v-else-if='message && typeof message === "object"' />
|
|
97
|
+
<template v-else>
|
|
98
|
+
{{ message }}
|
|
99
|
+
</template>
|
|
100
|
+
</slot>
|
|
101
|
+
</Box>
|
|
102
|
+
|
|
103
|
+
<div v-if='withProgress' :class='$style.progress'>
|
|
104
|
+
<Progress
|
|
105
|
+
v-model='progress'
|
|
106
|
+
:class='$style.progressInput'
|
|
107
|
+
:color
|
|
108
|
+
size='4px'
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<Box
|
|
113
|
+
v-if='actions?.length || $slots.actions'
|
|
114
|
+
:class='[$style.actions, classes?.actions]'
|
|
115
|
+
:mod='{ orientation }'
|
|
116
|
+
>
|
|
117
|
+
<slot name='actions'>
|
|
118
|
+
<Button
|
|
119
|
+
v-for='({ label, ...action }, index) in actions'
|
|
120
|
+
:key='index'
|
|
121
|
+
size='compact-sm'
|
|
122
|
+
:color
|
|
123
|
+
v-bind='action'
|
|
124
|
+
>
|
|
125
|
+
{{ label }}
|
|
126
|
+
</Button>
|
|
127
|
+
</slot>
|
|
128
|
+
</Box>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<ActionIcon
|
|
132
|
+
v-if='withCloseButton'
|
|
133
|
+
icon='lucide:x'
|
|
134
|
+
variant='subtle'
|
|
135
|
+
:class='[$style.closeButton, classes?.closeButton]'
|
|
136
|
+
v-bind='closeButtonProps'
|
|
137
|
+
@click='$emit("close")'
|
|
138
|
+
/>
|
|
139
|
+
</Box>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<style module>
|
|
143
|
+
.root{--notification-radius:var(--radius-default);--notification-color:var(--color-primary-filled);align-items:center;box-shadow:var(--shadow-lg);box-sizing:border-box;display:flex;overflow:hidden;padding-bottom:var(--spacing-xs);padding-inline-end:var(--spacing-xs);padding-top:var(--spacing-xs);padding-inline-start:22px;position:relative}.root,.root:before{border-radius:var(--notification-radius)}.root:before{background-color:var(--notification-color);bottom:var(--notification-radius);content:"";display:block;inset-inline-start:4px;position:absolute;top:var(--notification-radius);width:6px}.root{@mixin where-light{background-color:var(--color-white)}}.root{@mixin where-dark{background-color:var(--color-dark-6)}}.root:where([data-with-icon]):before{display:none}.root:where([data-with-border]){@mixin where-light{border-bottom-color:var(--color-gray-3);border-bottom-style:solid;border-bottom-width:1px;border-left-color:var(--color-gray-3);border-left-style:solid;border-left-width:1px;border-right-color:var(--color-gray-3);border-right-style:solid;border-right-width:1px;border-top-color:var(--color-gray-3);border-top-style:solid;border-top-width:1px}@mixin where-dark{border-bottom-color:var(--color-dark-4);border-bottom-style:solid;border-bottom-width:1px;border-left-color:var(--color-dark-4);border-left-style:solid;border-left-width:1px;border-right-color:var(--color-dark-4);border-right-style:solid;border-right-width:1px;border-top-color:var(--color-dark-4);border-top-style:solid;border-top-width:1px}}.icon{align-items:center;background-color:var(--notification-color);border-radius:28px;box-sizing:border-box;color:var(--color-white);display:flex;height:28px;justify-content:center;width:28px}.icon,.loader{margin-inline-end:var(--spacing-md)}.body{flex:1;margin-inline-end:var(--spacing-xs);overflow:hidden}.title{font-size:var(--font-size-sm);font-weight:500;line-height:var(--line-height-sm);margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;@mixin where-light{color:var(--color-gray-9)}@mixin where-dark{color:var(--color-white)}}.description{font-size:var(--font-size-sm);line-height:var(--line-height-sm);overflow:hidden;text-overflow:ellipsis;@mixin where-light{color:var(--color-black)}@mixin where-dark{color:var(--color-dark-0)}}.description:where([data-with-title]){@mixin where-light{color:var(--color-gray-6)}@mixin where-dark{color:var(--color-dark-2)}}.actions{align-items:center;display:flex;gap:var(--spacing-xs);margin-top:var(--spacing-xs)}.actions[data-orientation=horizontal],.closeButton{margin-inline-start:var(--spacing-xs)}.progress{bottom:0;left:0;position:absolute;right:0}.progress .progressInput{border-radius:0 0 var(--radius-md) var(--radius-md)}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import type { Classes, NuanceColor, NuanceRadius, StringOrVNode } from '../types/index.js';
|
|
3
|
+
import type { ActionIconProps } from './action-icon/action-icon.vue.js';
|
|
4
|
+
import type { BoxProps } from './box.vue.js';
|
|
5
|
+
import type { ButtonProps } from './button/button.vue.js';
|
|
6
|
+
import type { LoaderProps } from './loader/index.js';
|
|
7
|
+
export type NotificationOrientation = 'vertical' | 'horizontal';
|
|
8
|
+
export interface NotificationAction extends ButtonProps {
|
|
9
|
+
/** Button label */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Click handler */
|
|
12
|
+
onClick?: (event: MouseEvent) => void;
|
|
13
|
+
}
|
|
14
|
+
type NotificationClasses = 'root' | 'icon' | 'loader' | 'body' | 'title' | 'description' | 'actions' | 'closeButton';
|
|
15
|
+
export interface NotificationProps extends BoxProps {
|
|
16
|
+
/**
|
|
17
|
+
* Controls icon background color or notification accent line color, key of `theme.colors` or any valid CSS color.
|
|
18
|
+
* When `icon` is provided, sets the icon background color.
|
|
19
|
+
* When no icon is provided, sets the colored accent line on the left.
|
|
20
|
+
* @default theme.primaryColor
|
|
21
|
+
*/
|
|
22
|
+
color?: NuanceColor;
|
|
23
|
+
/**
|
|
24
|
+
* Key of `theme.radius` or any valid CSS value to set `border-radius`
|
|
25
|
+
* @default theme.defaultRadius
|
|
26
|
+
*/
|
|
27
|
+
radius?: NuanceRadius;
|
|
28
|
+
/** Notification icon, replaces color line */
|
|
29
|
+
icon?: string;
|
|
30
|
+
/** Notification title, displayed above the message body */
|
|
31
|
+
title?: StringOrVNode;
|
|
32
|
+
/** Notification body. When no title is provided, this is the main message. */
|
|
33
|
+
message?: StringOrVNode;
|
|
34
|
+
/** Action buttons */
|
|
35
|
+
actions?: NotificationAction[];
|
|
36
|
+
/** Actions/close layout @default 'vertical' */
|
|
37
|
+
orientation?: NotificationOrientation;
|
|
38
|
+
/** If set, displays a `Loader` component instead of the icon. Takes precedence over the `icon` prop if both are provided. */
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
/** Shows the auto-close progress bar @default false */
|
|
41
|
+
withProgress?: boolean;
|
|
42
|
+
/** Adds border to the root element */
|
|
43
|
+
withBorder?: boolean;
|
|
44
|
+
/** If set, the close button is visible @default true */
|
|
45
|
+
withCloseButton?: boolean;
|
|
46
|
+
/** Props passed down to the close button */
|
|
47
|
+
closeButtonProps?: ActionIconProps;
|
|
48
|
+
/** Props passed down to the `Loader` component */
|
|
49
|
+
loaderProps?: LoaderProps & HTMLAttributes;
|
|
50
|
+
role?: string;
|
|
51
|
+
classes?: Classes<NotificationClasses>;
|
|
52
|
+
}
|
|
53
|
+
type __VLS_Props = NotificationProps;
|
|
54
|
+
type __VLS_ModelProps = {
|
|
55
|
+
'progress'?: number;
|
|
56
|
+
};
|
|
57
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
58
|
+
declare var __VLS_8: {}, __VLS_20: {}, __VLS_38: {}, __VLS_61: {};
|
|
59
|
+
type __VLS_Slots = {} & {
|
|
60
|
+
icon?: (props: typeof __VLS_8) => any;
|
|
61
|
+
} & {
|
|
62
|
+
title?: (props: typeof __VLS_20) => any;
|
|
63
|
+
} & {
|
|
64
|
+
default?: (props: typeof __VLS_38) => any;
|
|
65
|
+
} & {
|
|
66
|
+
actions?: (props: typeof __VLS_61) => any;
|
|
67
|
+
};
|
|
68
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
69
|
+
close: () => any;
|
|
70
|
+
"update:progress": (value: number) => any;
|
|
71
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
72
|
+
onClose?: (() => any) | undefined;
|
|
73
|
+
"onUpdate:progress"?: ((value: number) => any) | undefined;
|
|
74
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
75
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
76
|
+
declare const _default: typeof __VLS_export;
|
|
77
|
+
export default _default;
|
|
78
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
79
|
+
new (): {
|
|
80
|
+
$slots: S;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TransitionName } from './transition.vue.js';
|
|
2
|
+
export interface TransitionGroupProps {
|
|
3
|
+
/**
|
|
4
|
+
* Transition animation name
|
|
5
|
+
* @default `'pop-bottom-left'`
|
|
6
|
+
*/
|
|
7
|
+
name?: TransitionName;
|
|
8
|
+
/**
|
|
9
|
+
* Transition duration in ms
|
|
10
|
+
* @default `250`
|
|
11
|
+
*/
|
|
12
|
+
duration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Transition delay in ms
|
|
15
|
+
* @default `0`
|
|
16
|
+
*/
|
|
17
|
+
delay?: number;
|
|
18
|
+
/** Wrapper element/component rendered around the list @default `'div'` */
|
|
19
|
+
tag?: string;
|
|
20
|
+
/** Whether to apply transition on initial render @default `false` */
|
|
21
|
+
appear?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare var __VLS_8: {};
|
|
24
|
+
type __VLS_Slots = {} & {
|
|
25
|
+
default?: (props: typeof __VLS_8) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<TransitionGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const {
|
|
4
|
+
name = "pop-bottom-left",
|
|
5
|
+
duration = 250,
|
|
6
|
+
delay,
|
|
7
|
+
tag = "div",
|
|
8
|
+
appear
|
|
9
|
+
} = defineProps({
|
|
10
|
+
name: { type: String, required: false },
|
|
11
|
+
duration: { type: Number, required: false },
|
|
12
|
+
delay: { type: Number, required: false },
|
|
13
|
+
tag: { type: String, required: false },
|
|
14
|
+
appear: { type: Boolean, required: false }
|
|
15
|
+
});
|
|
16
|
+
const style = computed(() => ({
|
|
17
|
+
"--transition-duration": `${duration}ms`,
|
|
18
|
+
"--transition-delay": delay ? `${delay}ms` : void 0
|
|
19
|
+
}));
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<TransitionGroup
|
|
24
|
+
:style
|
|
25
|
+
:name
|
|
26
|
+
:tag
|
|
27
|
+
:appear
|
|
28
|
+
move-class='transition-move'
|
|
29
|
+
>
|
|
30
|
+
<slot />
|
|
31
|
+
</TransitionGroup>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TransitionName } from './transition.vue.js';
|
|
2
|
+
export interface TransitionGroupProps {
|
|
3
|
+
/**
|
|
4
|
+
* Transition animation name
|
|
5
|
+
* @default `'pop-bottom-left'`
|
|
6
|
+
*/
|
|
7
|
+
name?: TransitionName;
|
|
8
|
+
/**
|
|
9
|
+
* Transition duration in ms
|
|
10
|
+
* @default `250`
|
|
11
|
+
*/
|
|
12
|
+
duration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Transition delay in ms
|
|
15
|
+
* @default `0`
|
|
16
|
+
*/
|
|
17
|
+
delay?: number;
|
|
18
|
+
/** Wrapper element/component rendered around the list @default `'div'` */
|
|
19
|
+
tag?: string;
|
|
20
|
+
/** Whether to apply transition on initial render @default `false` */
|
|
21
|
+
appear?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare var __VLS_8: {};
|
|
24
|
+
type __VLS_Slots = {} & {
|
|
25
|
+
default?: (props: typeof __VLS_8) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<TransitionGroupProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TransitionGroupProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
const {
|
|
4
|
+
name = "pop-bottom-left",
|
|
5
|
+
duration = 250,
|
|
6
|
+
delay,
|
|
7
|
+
appear,
|
|
8
|
+
mode
|
|
9
|
+
} = defineProps({
|
|
10
|
+
name: { type: String, required: false },
|
|
11
|
+
duration: { type: Number, required: false },
|
|
12
|
+
delay: { type: Number, required: false },
|
|
13
|
+
mode: { type: String, required: false },
|
|
14
|
+
appear: { type: Boolean, required: false }
|
|
15
|
+
});
|
|
16
|
+
const emit = defineEmits(["afterLeave"]);
|
|
17
|
+
const style = computed(() => ({
|
|
18
|
+
"--transition-duration": `${duration}ms`,
|
|
19
|
+
"--transition-delay": delay ? `${delay}ms` : void 0
|
|
20
|
+
}));
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<Transition
|
|
25
|
+
:style
|
|
26
|
+
:name
|
|
27
|
+
:mode
|
|
28
|
+
:appear
|
|
29
|
+
@after-leave='() => emit("afterLeave")'
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
</Transition>
|
|
33
|
+
</template>
|
|
@@ -6,7 +6,7 @@ import ActionIcon from "../../action-icon/action-icon.vue";
|
|
|
6
6
|
import Button from "../../button/button.vue";
|
|
7
7
|
import Loader from "../../loader/loader.vue";
|
|
8
8
|
import RovingFocusItem from "../../roving-focus/roving-focus-item.vue";
|
|
9
|
-
import
|
|
9
|
+
import NTransition from "../../transition/transition.vue";
|
|
10
10
|
import { useTreeState } from "../lib/context";
|
|
11
11
|
import { filterTreeItems } from "../lib/filter-tree-items";
|
|
12
12
|
import { useTreeItemHandlers } from "../lib/item-handlers";
|
|
@@ -106,7 +106,7 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
|
|
|
106
106
|
</Button>
|
|
107
107
|
</RovingFocusItem>
|
|
108
108
|
|
|
109
|
-
<
|
|
109
|
+
<NTransition name='scale-y'>
|
|
110
110
|
<ul
|
|
111
111
|
v-if='expanded && data && data.length > 0'
|
|
112
112
|
:class='$style.list'
|
|
@@ -120,7 +120,7 @@ const { handleClick, handleKeyDown } = useTreeItemHandlers(path, isFolder, expan
|
|
|
120
120
|
:level='level + 1'
|
|
121
121
|
/>
|
|
122
122
|
</ul>
|
|
123
|
-
</
|
|
123
|
+
</NTransition>
|
|
124
124
|
</li>
|
|
125
125
|
</template>
|
|
126
126
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './create-strict-injection.js';
|
|
2
2
|
export * from './use-active-link.js';
|
|
3
3
|
export * from './use-config.js';
|
|
4
|
+
export * from './use-countdown.js';
|
|
4
5
|
export * from './use-date-config.js';
|
|
5
6
|
export * from './use-floating-indicator.js';
|
|
6
7
|
export * from './use-selectable-group.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./create-strict-injection.js";
|
|
2
2
|
export * from "./use-active-link.js";
|
|
3
3
|
export * from "./use-config.js";
|
|
4
|
+
export * from "./use-countdown.js";
|
|
4
5
|
export * from "./use-date-config.js";
|
|
5
6
|
export * from "./use-floating-indicator.js";
|
|
6
7
|
export * from "./use-selectable-group.js";
|