@ncino/web-components 14.1.0 → 14.2.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
class
|
|
1
|
+
class a{findToaster(){const t=document.querySelectorAll("ngc-toaster");for(const r of t)if(r.checkVisibility())return r;return null}createToast(t){const r=this.findToaster();if(!r)return console.warn("[ToasterService] No <ngc-toaster> found in the DOM. Make sure to add <ngc-toaster> to your application."),null;const{sticky:e,...s}=t,o=e?{duration:0,dismissible:!0,...s}:s;return r.addToast(o)}success(t,r,e){return this.createToast({...e,title:t,subtitle:r,variant:"success"})}error(t,r,e){return this.createToast({...e,title:t,subtitle:r,variant:"error"})}warning(t,r,e){return this.createToast({...e,title:t,subtitle:r,variant:"warning"})}info(t,r,e){return this.createToast({...e,title:t,subtitle:r,variant:"info"})}removeToast(t){const r=this.findToaster();r&&r.removeToast(t)}clearAll(){const t=this.findToaster();t&&t.clearAll()}}const i=new a;export{i as toasterService};
|
|
@@ -2,7 +2,14 @@ import { DefaultToastOptions } from '../components/toaster/gator/toaster.gator.j
|
|
|
2
2
|
export type ToastCreateOptions = Partial<DefaultToastOptions> & {
|
|
3
3
|
title?: string;
|
|
4
4
|
subtitle?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Shorthand for a non-auto-dismissing, user-dismissible toast.
|
|
7
|
+
* Equivalent to `{ duration: 0, dismissible: true }`. Explicit `duration`/`dismissible`
|
|
8
|
+
* values in the same options object take precedence over this shorthand.
|
|
9
|
+
*/
|
|
10
|
+
sticky?: boolean;
|
|
5
11
|
};
|
|
12
|
+
type ToastConvenienceOptions = Omit<ToastCreateOptions, 'title' | 'subtitle' | 'variant'>;
|
|
6
13
|
declare class ToasterService {
|
|
7
14
|
/**
|
|
8
15
|
* Find the toaster component in the DOM
|
|
@@ -58,9 +65,12 @@ declare class ToasterService {
|
|
|
58
65
|
*
|
|
59
66
|
* // With custom options
|
|
60
67
|
* toasterService.success('Saved!', 'File saved', { duration: 2000 });
|
|
68
|
+
*
|
|
69
|
+
* // Sticky (no auto-dismiss, user-dismissible)
|
|
70
|
+
* toasterService.success('Saved!', 'File saved', { sticky: true });
|
|
61
71
|
* ```
|
|
62
72
|
*/
|
|
63
|
-
success(title: string, subtitle?: string, options?:
|
|
73
|
+
success(title: string, subtitle?: string, options?: ToastConvenienceOptions): string | null;
|
|
64
74
|
/**
|
|
65
75
|
* Create an error toast with red styling
|
|
66
76
|
* @param title - The main title text for the toast
|
|
@@ -72,10 +82,10 @@ declare class ToasterService {
|
|
|
72
82
|
* toasterService.error('Failed to Save', 'Please check your connection and try again');
|
|
73
83
|
*
|
|
74
84
|
* // Sticky error that doesn't auto-dismiss
|
|
75
|
-
* toasterService.error('Critical Error', 'System malfunction detected', {
|
|
85
|
+
* toasterService.error('Critical Error', 'System malfunction detected', { sticky: true });
|
|
76
86
|
* ```
|
|
77
87
|
*/
|
|
78
|
-
error(title: string, subtitle?: string, options?:
|
|
88
|
+
error(title: string, subtitle?: string, options?: ToastConvenienceOptions): string | null;
|
|
79
89
|
/**
|
|
80
90
|
* Create a warning toast with yellow/orange styling
|
|
81
91
|
* @param title - The main title text for the toast
|
|
@@ -90,7 +100,7 @@ declare class ToasterService {
|
|
|
90
100
|
* toasterService.warning('Low Storage', 'Running low on space', { dismissible: false });
|
|
91
101
|
* ```
|
|
92
102
|
*/
|
|
93
|
-
warning(title: string, subtitle?: string, options?:
|
|
103
|
+
warning(title: string, subtitle?: string, options?: ToastConvenienceOptions): string | null;
|
|
94
104
|
/**
|
|
95
105
|
* Create an info toast with blue styling (default variant)
|
|
96
106
|
* @param title - The main title text for the toast
|
|
@@ -105,7 +115,7 @@ declare class ToasterService {
|
|
|
105
115
|
* toasterService.info('Tip', 'Use Ctrl+S to save', { duration: 15000 });
|
|
106
116
|
* ```
|
|
107
117
|
*/
|
|
108
|
-
info(title: string, subtitle?: string, options?:
|
|
118
|
+
info(title: string, subtitle?: string, options?: ToastConvenienceOptions): string | null;
|
|
109
119
|
/**
|
|
110
120
|
* Remove a specific toast by its ID
|
|
111
121
|
* @param id - The unique ID of the toast to remove (returned from createToast methods)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ncino/web-components",
|
|
3
3
|
"author": "nCino",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.2.0",
|
|
5
5
|
"license": "(c) Copyright 2023 nCino, Inc., all rights reserved",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"vite-plugin-static-copy": "^3.3.0",
|
|
101
101
|
"vitest": "^4.1.0",
|
|
102
102
|
"yaml-eslint-parser": "^2.0.0",
|
|
103
|
-
"@ncino/styles": "14.
|
|
103
|
+
"@ncino/styles": "14.2.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@ncino/styles": "14.
|
|
106
|
+
"@ncino/styles": "14.2.0"
|
|
107
107
|
},
|
|
108
108
|
"bugs": {
|
|
109
109
|
"url": "https://github.com/ncino/force-sdk-web-components/issues"
|
package/web-types.json
CHANGED