@spteck/react-controls-v2 2.6.0 → 2.6.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.
@@ -2,10 +2,11 @@ export * from './useLogging';
2
2
  export * from './useGraphAPI';
3
3
  export * from './useIndexedDB';
4
4
  export * from './usePolling';
5
- export * from './useTimeZone';
5
+ export * from './useTimeZoneHelper';
6
6
  export * from './useAIAssistantParser';
7
7
  export * from './useAIAssistant';
8
8
  export * from './useLocalizationStrings';
9
9
  export * from './useBrandCenterFonts';
10
10
  export * from './useFluentEmoji';
11
+ export * from './useAppToast';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,47 @@
1
+ import { IToastContent } from '../models/IToastContent';
2
+ import { IToastOptions } from '../models/IToastOptions';
3
+ import * as React from "react";
4
+ export declare const toasterId = "app-toaster";
5
+ export interface IAppToasterConfig {
6
+ toasterId?: string;
7
+ position?: "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
8
+ dir?: "ltr" | "rtl";
9
+ pauseOnHover?: boolean;
10
+ pauseOnWindowBlur?: boolean;
11
+ }
12
+ /**
13
+ * Consolidated toast hook that provides both toast functionality and the ToasterProvider component.
14
+ * This follows React best practices by consolidating all toast-related logic in one place.
15
+ *
16
+ * @param config - Optional configuration for toast positioning and behavior
17
+ * @returns Object containing toast methods and the ToasterProvider component
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const { showSuccessToast, showErrorToast, ToasterProvider } = useAppToast({
22
+ * position: "top-end"
23
+ * });
24
+ *
25
+ * // In your component JSX:
26
+ * return (
27
+ * <div>
28
+ * <YourContent />
29
+ * <ToasterProvider />
30
+ * </div>
31
+ * );
32
+ * ```
33
+ */
34
+ export declare const useAppToast: (config?: IAppToasterConfig) => {
35
+ showToast: (content: IToastContent, options?: IToastOptions) => string;
36
+ showSuccessToast: (title: string | React.ReactNode, body?: string | React.ReactNode, options?: Omit<IToastOptions, "intent">) => string;
37
+ showErrorToast: (title: string | React.ReactNode, body?: string | React.ReactNode, options?: Omit<IToastOptions, "intent">) => string;
38
+ showWarningToast: (title: string | React.ReactNode, body?: string | React.ReactNode, options?: Omit<IToastOptions, "intent">) => string;
39
+ showInfoToast: (title: string | React.ReactNode, body?: string | React.ReactNode, options?: Omit<IToastOptions, "intent">) => string;
40
+ dismissToast: (toastId: string) => void;
41
+ dismissAllToasts: () => void;
42
+ updateToast: (toastId: string, content: Partial<IToastContent>, options?: Partial<IToastOptions>) => void;
43
+ playToast: (toastId: string) => void;
44
+ pauseToast: (toastId: string) => void;
45
+ ToasterProvider: React.ComponentType;
46
+ };
47
+ //# sourceMappingURL=useAppToast.d.ts.map
@@ -1,11 +1,20 @@
1
1
  /**
2
- * Hook for time zone and date/time formatting operations
2
+ * Unified hook for timezone conversions and locale-aware date/time formatting.
3
3
  *
4
- * @param timezone - Optional timezone string (e.g., 'America/New_York')
5
- * @param locale - Optional locale string (e.g., 'en-US')
6
- * @returns Object with date formatting functions
4
+ * Combines DST-safe conversions (date-fns-tz) with locale-aware relative/absolute
5
+ * formatting (date-fns). Optionally reads the user timezone from the application
6
+ * context when running inside a UniversalProvider.
7
+ *
8
+ * @param timezone - Optional timezone string (e.g. 'America/New_York').
9
+ * Falls back to the browser timezone when omitted.
10
+ * @param locale - Optional locale code (e.g. 'en-US'). Defaults to 'en-US'.
7
11
  */
8
12
  export declare const useTimeZoneHelper: (timezone?: string, locale?: string) => {
13
+ timeZone: string;
14
+ convertToUserTimeZone: (date: Date, targetTimeZone?: string) => Date;
15
+ convertFromUserTimeZone: (date: Date, sourceTimeZone?: string) => Date;
16
+ formatInTimeZone: (date: Date, formatStr: string, targetTimeZone?: string) => string;
17
+ getUserTimeZone: () => string;
9
18
  getFormatRelative: (date: Date | string) => string;
10
19
  convertDateToUTC: (date: Date | string) => Date;
11
20
  formatDate: (date: Date | string, formatString?: string) => string;