@abpjs/theme-shared 1.0.0 → 2.0.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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Common types for theme-shared module.
3
+ * Translated from @abp/ng.theme.shared/lib/models/common.ts
4
+ * @since 1.1.0
5
+ */
6
+ import type { ComponentType } from 'react';
7
+ /**
8
+ * Root parameters for ThemeSharedModule configuration.
9
+ * @since 1.1.0
10
+ */
11
+ export interface RootParams {
12
+ httpErrorConfig?: HttpErrorConfig;
13
+ }
14
+ /**
15
+ * Error screen error codes that can be customized.
16
+ * @since 1.1.0
17
+ */
18
+ export type ErrorScreenErrorCodes = 401 | 403 | 404 | 500;
19
+ /**
20
+ * Configuration for HTTP error handling.
21
+ * @since 1.1.0
22
+ */
23
+ export interface HttpErrorConfig {
24
+ /**
25
+ * Custom error screen configuration.
26
+ */
27
+ errorScreen?: {
28
+ /**
29
+ * Custom React component to render for errors.
30
+ */
31
+ component: ComponentType<any>;
32
+ /**
33
+ * Which error codes to show the custom component for.
34
+ * Defaults to all error codes if not specified.
35
+ */
36
+ forWhichErrors?: [ErrorScreenErrorCodes] | [ErrorScreenErrorCodes, ErrorScreenErrorCodes] | [ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes] | [ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes];
37
+ /**
38
+ * Whether to hide the close icon on the error screen.
39
+ */
40
+ hideCloseIcon?: boolean;
41
+ };
42
+ }
@@ -1,21 +1,54 @@
1
1
  /**
2
2
  * Confirmation namespace containing types for confirmation dialogs.
3
3
  * Translated from @abp/ng.theme.shared/lib/models/confirmation.ts
4
+ *
5
+ * @since 2.0.0 - Major changes:
6
+ * - Options no longer extends Toaster.Options
7
+ * - Added DialogData interface
8
+ * - Added Severity type
9
+ * - Removed deprecated cancelCopy/yesCopy
4
10
  */
5
- import { Toaster } from './toaster';
11
+ import type { Config } from '@abpjs/core';
6
12
  export declare namespace Confirmation {
7
13
  /**
8
14
  * Options for configuring a confirmation dialog.
9
- * Extends Toaster.Options with confirmation-specific properties.
15
+ * @since 2.0.0 - No longer extends Toaster.Options
10
16
  */
11
- interface Options extends Toaster.Options {
17
+ interface Options {
18
+ /** Unique identifier for the confirmation */
19
+ id?: string | number;
20
+ /** Whether the confirmation can be closed by clicking outside or pressing escape */
21
+ closable?: boolean;
22
+ /** Parameters for localizing the message */
23
+ messageLocalizationParams?: string[];
24
+ /** Parameters for localizing the title */
25
+ titleLocalizationParams?: string[];
12
26
  /** Hide the cancel button */
13
27
  hideCancelBtn?: boolean;
14
28
  /** Hide the yes/confirm button */
15
29
  hideYesBtn?: boolean;
16
- /** Custom text for the cancel button (localization key) */
17
- cancelCopy?: string;
18
- /** Custom text for the yes button (localization key) */
19
- yesCopy?: string;
30
+ /** Custom text for the cancel button */
31
+ cancelText?: Config.LocalizationParam;
32
+ /** Custom text for the yes button */
33
+ yesText?: Config.LocalizationParam;
20
34
  }
35
+ /**
36
+ * Dialog data structure for confirmation dialogs.
37
+ * @since 2.0.0
38
+ */
39
+ interface DialogData {
40
+ /** The message content */
41
+ message: Config.LocalizationParam;
42
+ /** The title */
43
+ title?: Config.LocalizationParam;
44
+ /** Severity level affects the styling */
45
+ severity?: Severity;
46
+ /** Options for the confirmation */
47
+ options?: Partial<Options>;
48
+ }
49
+ /**
50
+ * Severity levels for confirmation dialogs.
51
+ * @since 2.0.0
52
+ */
53
+ type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error';
21
54
  }
@@ -1,3 +1,4 @@
1
+ export * from './common';
1
2
  export * from './toaster';
2
3
  export * from './confirmation';
3
4
  export * from './setting-management';
@@ -1,31 +1,56 @@
1
+ import type { Config } from '@abpjs/core';
1
2
  /**
2
3
  * Toaster namespace containing types and interfaces for toast notifications.
3
4
  * Translated from @abp/ng.theme.shared/lib/models/toaster.ts
5
+ *
6
+ * @since 2.0.0 - Major changes:
7
+ * - `Options` renamed to `ToastOptions`
8
+ * - New `Toast` interface
9
+ * - `Severity` type changed: 'warn' → 'warning', added 'neutral'
10
+ * - ToasterService methods now return number (toast ID) instead of Observable
4
11
  */
5
12
  export declare namespace Toaster {
6
13
  /**
7
14
  * Options for configuring a toast notification.
15
+ * @since 2.0.0 - Renamed from Options, restructured properties
8
16
  */
9
- interface Options {
10
- /** Unique identifier for the toast */
11
- id?: string;
12
- /** Whether the toast can be manually closed */
13
- closable?: boolean;
14
- /** Duration in milliseconds before auto-dismiss (default varies by implementation) */
17
+ interface ToastOptions {
18
+ /** Duration in milliseconds before auto-dismiss */
15
19
  life?: number;
16
20
  /** If true, toast won't auto-dismiss */
17
21
  sticky?: boolean;
18
- /** Custom data to attach to the toast */
19
- data?: unknown;
22
+ /** Whether the toast can be manually closed */
23
+ closable?: boolean;
24
+ /** Whether tapping the toast dismisses it */
25
+ tapToDismiss?: boolean;
20
26
  /** Parameters for localizing the message */
21
27
  messageLocalizationParams?: string[];
22
28
  /** Parameters for localizing the title */
23
29
  titleLocalizationParams?: string[];
30
+ /** Unique identifier for the toast */
31
+ id: number | string;
32
+ /** Container key for positioning toasts in specific containers */
33
+ containerKey?: string;
34
+ }
35
+ /**
36
+ * Complete toast structure.
37
+ * @since 2.0.0
38
+ */
39
+ interface Toast {
40
+ /** The message content (can be a localization key) */
41
+ message: Config.LocalizationParam;
42
+ /** The title (can be a localization key) */
43
+ title?: Config.LocalizationParam;
44
+ /** Severity level of the toast */
45
+ severity?: string;
46
+ /** Options for the toast */
47
+ options?: ToastOptions;
24
48
  }
25
49
  /**
26
50
  * Severity levels for toast notifications.
51
+ * @since 2.0.0 - Changed 'warn' to 'warning', added 'neutral'
27
52
  */
28
- type Severity = 'success' | 'info' | 'warn' | 'error';
53
+ type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error';
29
54
  /**
30
55
  * Status values for toast/confirmation interactions.
31
56
  */
@@ -35,7 +60,28 @@ export declare namespace Toaster {
35
60
  dismiss = "dismiss"
36
61
  }
37
62
  /**
38
- * Complete message structure for a toast notification.
63
+ * @deprecated Use ToastOptions instead. Scheduled for removal in v3.0.0
64
+ * Preserved for backward compatibility.
65
+ */
66
+ interface Options {
67
+ /** Unique identifier for the toast */
68
+ id?: string;
69
+ /** Whether the toast can be manually closed */
70
+ closable?: boolean;
71
+ /** Duration in milliseconds before auto-dismiss (default varies by implementation) */
72
+ life?: number;
73
+ /** If true, toast won't auto-dismiss */
74
+ sticky?: boolean;
75
+ /** Custom data to attach to the toast */
76
+ data?: unknown;
77
+ /** Parameters for localizing the message */
78
+ messageLocalizationParams?: string[];
79
+ /** Parameters for localizing the title */
80
+ titleLocalizationParams?: string[];
81
+ }
82
+ /**
83
+ * @deprecated Use Toast instead. Scheduled for removal in v3.0.0
84
+ * Preserved for backward compatibility.
39
85
  */
40
86
  interface Message extends Options {
41
87
  /** The message content (can be a localization key) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/theme-shared",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "ABP Framework Theme Shared components for React - translated from @abp/ng.theme.shared",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,11 +27,11 @@
27
27
  "next-themes": "^0.4.6",
28
28
  "react-hook-form": "^7.48.0",
29
29
  "react-icons": "^5.5.0",
30
- "@abpjs/core": "1.0.0"
30
+ "@abpjs/core": "2.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@abp/ng.theme.shared": "1.0.0",
34
- "@vitest/coverage-v8": "^1.6.1"
33
+ "@abp/ng.theme.shared": "2.0.0",
34
+ "@vitest/coverage-v8": "^3.2.0"
35
35
  },
36
36
  "author": "tekthar.com",
37
37
  "license": "LGPL-3.0",
@@ -40,7 +40,8 @@
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",
43
- "url": "https://github.com/abpjs/abp-react"
43
+ "url": "https://github.com/abpjs/abp-react",
44
+ "directory": "packages/theme-shared"
44
45
  },
45
46
  "homepage": "https://docs.abpjs.io/docs/packages/theme-shared/overview",
46
47
  "bugs": {