@ixon-cdk/types 1.13.0-next.3 → 1.13.1
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.
|
@@ -8,11 +8,13 @@ import type { ComponentContextAppData } from './app-data';
|
|
|
8
8
|
import type { ActionBottomSheetOptions, ActionBottomSheetResult } from './bottom-sheet';
|
|
9
9
|
import type { AlertDialogOptions, ConfirmDialogOptions, ContentDialogOptions, FormDialogOptions, FormDialogResult } from './dialog';
|
|
10
10
|
import type { ActionMenuOptions, ActionMenuResult } from './menu';
|
|
11
|
+
import type { ToastOptions } from './toast';
|
|
11
12
|
import type { Tooltip, TooltipOptions } from './tooltip';
|
|
12
13
|
export type { ComponentContextAppData } from './app-data';
|
|
13
14
|
export type { ActionBottomSheetAction, ActionBottomSheetOptions, ActionBottomSheetResult } from './bottom-sheet';
|
|
14
15
|
export type { AlertDialogOptions, ConfirmDialogOptions, ContentDialogOptions, FormDialogOptions, FormDialogResult, } from './dialog';
|
|
15
16
|
export type { ActionMenuAction, ActionMenuOptions, ActionMenuResult } from './menu';
|
|
17
|
+
export type { ToastOptions } from './toast';
|
|
16
18
|
export type { Tooltip, TooltipOptions } from './tooltip';
|
|
17
19
|
export * from './input';
|
|
18
20
|
/**
|
|
@@ -175,6 +177,41 @@ export interface ComponentContext<ComponentContextInputs extends object = {
|
|
|
175
177
|
* @param options configures the form dialog
|
|
176
178
|
*/
|
|
177
179
|
openFormDialog(options: FormDialogOptions): Promise<FormDialogResult | false | undefined>;
|
|
180
|
+
/**
|
|
181
|
+
* Opens a toast notification.
|
|
182
|
+
*
|
|
183
|
+
* @param options - Options to configure the toast.
|
|
184
|
+
* @returns A promise that resolves to `true` if the action was triggered, or `undefined` otherwise.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* // Default auto-close behavior (true)
|
|
188
|
+
* context.openToast({ message: 'Changes saved' });
|
|
189
|
+
*
|
|
190
|
+
* // Default auto-close behavior when actionButtonText is set (false)
|
|
191
|
+
* context.openToast({ message: 'Connection timed out', actionButtonText: 'Retry' });
|
|
192
|
+
*
|
|
193
|
+
* // Overrides default auto-close behavior, despite actionButtonText being set.
|
|
194
|
+
* context.openToast({ message: 'Email archived', actionButtonText: 'Undo', autoClose: true });
|
|
195
|
+
*/
|
|
196
|
+
openToast(options: ToastOptions): Promise<true | undefined>;
|
|
197
|
+
/**
|
|
198
|
+
* Opens a toast notification with a simple message and additional options.
|
|
199
|
+
*
|
|
200
|
+
* @param message - The message to display in the toast.
|
|
201
|
+
* @param options - Additional options to configure the toast.
|
|
202
|
+
* @returns A promise that resolves to `true` if the action was triggered, or `undefined` otherwise.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* // Default auto-close behavior (true)
|
|
206
|
+
* context.openToast('Changes saved');
|
|
207
|
+
*
|
|
208
|
+
* // Default auto-close behavior when actionButtonText is set (false)
|
|
209
|
+
* context.openToast('Connection timed out', { actionButtonText: 'Retry' });
|
|
210
|
+
*
|
|
211
|
+
* // Overrides default auto-close behavior, despite actionButtonText being set.
|
|
212
|
+
* context.openToast('Email archived', { actionButtonText: 'Undo', autoClose: true });
|
|
213
|
+
*/
|
|
214
|
+
openToast(message: string, options?: Omit<ToastOptions, 'message'>): Promise<true | undefined>;
|
|
178
215
|
/**
|
|
179
216
|
* Helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing the passed HTML, removing any potentially unsafe content.
|
|
180
217
|
*
|
|
@@ -223,9 +260,9 @@ export interface ComponentContext<ComponentContextInputs extends object = {
|
|
|
223
260
|
* @param interpolateParams
|
|
224
261
|
* @param options
|
|
225
262
|
*/
|
|
226
|
-
translate(key: string, interpolateParams?:
|
|
227
|
-
translate<T extends string>(key: T[], interpolateParams?:
|
|
228
|
-
translate<T extends string>(key: string | T[], interpolateParams?:
|
|
263
|
+
translate(key: string, interpolateParams?: object, options?: TranslateOptions): string;
|
|
264
|
+
translate<T extends string>(key: T[], interpolateParams?: object, options?: TranslateOptions): Record<T, string>;
|
|
265
|
+
translate<T extends string>(key: string | T[], interpolateParams?: object, options?: TranslateOptions): string | Record<T, string>;
|
|
229
266
|
}
|
|
230
267
|
export interface TranslateOptions {
|
|
231
268
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ToastOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Text for an optional action button. If provided, `autoClose` defaults to false.
|
|
4
|
+
*/
|
|
5
|
+
actionButtonText?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Whether the toast automatically closes. Defaults to true, unless `actionButtonText` is set.
|
|
8
|
+
*/
|
|
9
|
+
autoClose?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The message to display in the toast.
|
|
12
|
+
*/
|
|
13
|
+
message: string;
|
|
14
|
+
}
|