sit-onyx 1.0.0-beta.185 → 1.0.0-beta.186
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/components/OnyxInfoCard/types.d.ts +1 -1
- package/dist/components/OnyxNotificationMessage/OnyxNotificationMessage.vue.d.ts +25 -0
- package/dist/components/OnyxNotificationMessage/types.d.ts +17 -0
- package/dist/components/OnyxNotifications/OnyxNotifications.vue.d.ts +2 -0
- package/dist/components/OnyxNotifications/examples/DefaultExample.vue.d.ts +2 -0
- package/dist/components/OnyxNotifications/useNotification.d.ts +60 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1579 -1463
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { OnyxNotificationMessageProps } from "./types";
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/**
|
|
4
|
+
* Description/preview of the notification content.
|
|
5
|
+
*/
|
|
6
|
+
default(): unknown;
|
|
7
|
+
/**
|
|
8
|
+
* Slot to provide optional buttons/actions.
|
|
9
|
+
*/
|
|
10
|
+
buttons?(): unknown;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<OnyxNotificationMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
close: () => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<OnyxNotificationMessageProps> & Readonly<{
|
|
15
|
+
onClose?: (() => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
duration: number;
|
|
18
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type OnyxNotificationMessageProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Notification headline/title.
|
|
4
|
+
*/
|
|
5
|
+
headline: string;
|
|
6
|
+
/**
|
|
7
|
+
* Duration in milliseconds for the notification to close automatically.
|
|
8
|
+
* Timer will be paused when hovering the toast.
|
|
9
|
+
*
|
|
10
|
+
* Can be set to `0` to disable the auto closing.
|
|
11
|
+
*/
|
|
12
|
+
duration?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Optional icon to display.
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ComputedRef, type InjectionKey } from "vue";
|
|
2
|
+
import type { OnyxButtonProps } from "../OnyxButton/types";
|
|
3
|
+
import type { OnyxNotificationMessageProps } from "../OnyxNotificationMessage/types";
|
|
4
|
+
export type NotificationsProvider = {
|
|
5
|
+
/**
|
|
6
|
+
* Readonly list of currently active notifications.
|
|
7
|
+
*/
|
|
8
|
+
notifications: ComputedRef<ProvidedNotification[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Shows a single notification.
|
|
11
|
+
*/
|
|
12
|
+
show: (notification: ShowNotificationOptions) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Removes the notification with the given `id`.
|
|
15
|
+
*/
|
|
16
|
+
remove: (id: ProvidedNotification["id"]) => void;
|
|
17
|
+
};
|
|
18
|
+
export type ProvidedNotification = ShowNotificationOptions & {
|
|
19
|
+
/**
|
|
20
|
+
* Unique notification id used to identify the notification.
|
|
21
|
+
*/
|
|
22
|
+
id: number;
|
|
23
|
+
/**
|
|
24
|
+
* Handler that should remove the notification. Will be called when the notification closes.
|
|
25
|
+
* Is only used for internal onyx usage.
|
|
26
|
+
*/
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
};
|
|
29
|
+
export type ShowNotificationOptions = OnyxNotificationMessageProps & {
|
|
30
|
+
/**
|
|
31
|
+
* Description/preview of the notification content.
|
|
32
|
+
*/
|
|
33
|
+
description: string;
|
|
34
|
+
/**
|
|
35
|
+
* Slot to provide optional buttons/actions.
|
|
36
|
+
*/
|
|
37
|
+
buttons?: (OnyxButtonProps & {
|
|
38
|
+
/**
|
|
39
|
+
* Callback that is called when the button is clicked.
|
|
40
|
+
*/
|
|
41
|
+
onClick?: () => void;
|
|
42
|
+
})[];
|
|
43
|
+
};
|
|
44
|
+
export declare const NOTIFICATIONS_PROVIDER_INJECTION_KEY: InjectionKey<NotificationsProvider>;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new notifications provider that can be used with `useNotification()`.
|
|
47
|
+
* Should be provided once on global app level with:
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { createNotificationsProvider, NOTIFICATIONS_PROVIDER_INJECTION_KEY } from "sit-onyx";
|
|
52
|
+
*
|
|
53
|
+
* app.provide(NOTIFICATIONS_PROVIDER_INJECTION_KEY, createNotificationsProvider());
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const createNotificationsProvider: () => NotificationsProvider;
|
|
57
|
+
/**
|
|
58
|
+
* Composable for showing notifications.
|
|
59
|
+
*/
|
|
60
|
+
export declare const useNotification: () => NotificationsProvider;
|