@temboplus/frontend-react-core 0.1.3-beta.2 → 0.1.3-beta.20

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.
Files changed (81) hide show
  1. package/dist/CloseCircleOutlined-CMilRURi.js +3 -0
  2. package/dist/CloseCircleOutlined-CMilRURi.js.map +1 -0
  3. package/dist/CloseCircleOutlined-CSHx89Jn.js +3 -0
  4. package/dist/CloseCircleOutlined-CSHx89Jn.js.map +1 -0
  5. package/dist/InfoCircleOutlined-DR9DmuN-.js +5 -0
  6. package/dist/InfoCircleOutlined-DR9DmuN-.js.map +1 -0
  7. package/dist/InfoCircleOutlined-Hx86sClq.js +5 -0
  8. package/dist/InfoCircleOutlined-Hx86sClq.js.map +1 -0
  9. package/dist/alerts/index.cjs.js +1 -1
  10. package/dist/alerts/index.cjs.js.map +1 -1
  11. package/dist/alerts/index.js +1 -1
  12. package/dist/alerts/index.js.map +1 -1
  13. package/dist/dialogs/index.cjs.js +3 -1
  14. package/dist/dialogs/index.cjs.js.map +1 -1
  15. package/dist/dialogs/index.js +3 -1
  16. package/dist/dialogs/index.js.map +1 -1
  17. package/dist/features/alerts/alert.js +18 -18
  18. package/dist/features/dialogs/tembo-confirm.js +11 -11
  19. package/dist/features/notifications/tembo-notify.d.ts +32 -105
  20. package/dist/features/notifications/tembo-notify.js +102 -111
  21. package/dist/features/notifications/toast-config.d.ts +4 -6
  22. package/dist/features/notifications/toast-config.js +28 -21
  23. package/dist/features/notifications/toast-container.d.ts +13 -3
  24. package/dist/features/notifications/toast-container.js +80 -9
  25. package/dist/index.cjs.js +1 -1
  26. package/dist/index.cjs.js.map +1 -1
  27. package/dist/index.esm.js +1 -1
  28. package/dist/index.esm.js.map +1 -1
  29. package/dist/notifications/index.cjs.js +1 -1
  30. package/dist/notifications/index.js +1 -1
  31. package/dist/providers.d.ts +2 -32
  32. package/dist/providers.js +3 -24
  33. package/dist/tembo-notify-BSIZkV5f.js +3 -0
  34. package/dist/tembo-notify-BSIZkV5f.js.map +1 -0
  35. package/dist/tembo-notify-ZYud9J7B.js +3 -0
  36. package/dist/tembo-notify-ZYud9J7B.js.map +1 -0
  37. package/dist/theme/{colors.d.ts → deprecated/colors.d.ts} +55 -23
  38. package/dist/theme/deprecated/colors.js +212 -0
  39. package/dist/theme/deprecated/theme-provider.d.ts +100 -0
  40. package/dist/theme/deprecated/theme-provider.js +405 -0
  41. package/dist/theme/index.cjs.js +1 -1
  42. package/dist/theme/index.d.ts +3 -2
  43. package/dist/theme/index.js +1 -1
  44. package/dist/theme/theme-config.d.ts +15 -0
  45. package/dist/theme/theme-config.js +735 -0
  46. package/dist/theme/theme-provider.d.ts +13 -71
  47. package/dist/theme/theme-provider.js +21 -387
  48. package/dist/theme/tokens/colors.d.ts +108 -0
  49. package/dist/theme/tokens/colors.js +236 -0
  50. package/dist/theme/tokens/constants.d.ts +126 -0
  51. package/dist/theme/tokens/constants.js +126 -0
  52. package/dist/theme-provider-CCkR2IcZ.js +11 -0
  53. package/dist/theme-provider-CCkR2IcZ.js.map +1 -0
  54. package/dist/theme-provider-CCwq2x0C.js +2 -0
  55. package/dist/theme-provider-CCwq2x0C.js.map +1 -0
  56. package/dist/theme-provider-D2HR_D4s.js +11 -0
  57. package/dist/theme-provider-D2HR_D4s.js.map +1 -0
  58. package/dist/theme-provider-dbj9jb7X.js +2 -0
  59. package/dist/theme-provider-dbj9jb7X.js.map +1 -0
  60. package/dist/validation/index.cjs.js.map +1 -1
  61. package/dist/validation/index.js.map +1 -1
  62. package/package.json +17 -18
  63. package/dist/InfoCircleOutlined-B7d2aRfV.js +0 -7
  64. package/dist/InfoCircleOutlined-B7d2aRfV.js.map +0 -1
  65. package/dist/InfoCircleOutlined-DYs90hdV.js +0 -7
  66. package/dist/InfoCircleOutlined-DYs90hdV.js.map +0 -1
  67. package/dist/ZoomOutOutlined-BL6A5RSq.js +0 -2
  68. package/dist/ZoomOutOutlined-BL6A5RSq.js.map +0 -1
  69. package/dist/ZoomOutOutlined-BY_CCwq7.js +0 -2
  70. package/dist/ZoomOutOutlined-BY_CCwq7.js.map +0 -1
  71. package/dist/tembo-notify-C-QGduBt.js +0 -2
  72. package/dist/tembo-notify-C-QGduBt.js.map +0 -1
  73. package/dist/tembo-notify-D-uOV3t0.js +0 -2
  74. package/dist/tembo-notify-D-uOV3t0.js.map +0 -1
  75. package/dist/theme/colors.js +0 -138
  76. package/dist/theme-provider-D_oV1J_K.js +0 -11
  77. package/dist/theme-provider-D_oV1J_K.js.map +0 -1
  78. package/dist/theme-provider-Dqvy24OD.js +0 -11
  79. package/dist/theme-provider-Dqvy24OD.js.map +0 -1
  80. /package/dist/theme/{constants.d.ts → deprecated/constants.d.ts} +0 -0
  81. /package/dist/theme/{constants.js → deprecated/constants.js} +0 -0
@@ -1,124 +1,51 @@
1
1
  import { ToastOptions, ToastContent, Id } from 'react-toastify';
2
- import { TemboColorPalette, TemboUIConstants } from '../../theme/index.js';
3
- export interface NotifyOptions {
4
- /**
5
- * Duration in milliseconds before auto-closing (default: 4000 for most, 6000 for errors)
6
- * Set to false to prevent auto-close
7
- */
2
+ import { ColorPalette } from '../../theme/tokens/colors.js';
3
+ import { UIConstants } from '../../theme/tokens/constants.js';
4
+ /**
5
+ * Message input - can be simple string or object with title and description
6
+ */
7
+ export type NotifyMessage = ToastContent | {
8
+ title?: string;
9
+ description?: string;
10
+ };
11
+ export interface NotifyOptions extends Omit<ToastOptions, 'type'> {
12
+ toastId?: Id;
8
13
  duration?: number | false;
9
- /**
10
- * Custom position for the notification
11
- */
12
- position?: ToastOptions['position'];
13
- /**
14
- * Callback when notification is clicked
15
- */
16
14
  onClick?: () => void;
17
- /**
18
- * Callback when notification is closed
19
- */
20
15
  onClose?: () => void;
21
16
  }
22
17
  /**
23
18
  * TemboNotify - Unified notification system
24
- *
25
- * Wraps react-toastify with consistent styling and behavior
26
- * aligned with Tembo's design system.
27
- *
28
- * Note: This class needs to be initialized with theme tokens before use.
29
- * Call TemboNotify.init(colors, constants) in your app setup.
30
- *
31
- * @example
32
- * ```typescript
33
- * // In your app setup (e.g., App.tsx)
34
- * const { colors, constants } = useTemboTheme();
35
- * useEffect(() => {
36
- * TemboNotify.init(colors, constants);
37
- * }, [colors, constants]);
38
- *
39
- * // Then use anywhere in your app
40
- * TemboNotify.success('Payment sent successfully!');
41
- *
42
- * // With options
43
- * TemboNotify.error('Payment failed', {
44
- * duration: 8000,
45
- * onClick: () => console.log('Error clicked')
46
- * });
47
- *
48
- * // Loading with promise
49
- * const loadingId = TemboNotify.loading('Processing payment...');
50
- * await processPayment();
51
- * TemboNotify.success('Payment complete!', { id: loadingId });
52
- *
53
- * // Promise-based
54
- * TemboNotify.promise(
55
- * apiCall(),
56
- * {
57
- * pending: 'Processing...',
58
- * success: 'Done!',
59
- * error: 'Failed!'
60
- * }
61
- * );
62
- * ```
63
19
  */
64
20
  export declare class TemboNotify {
65
21
  private static configs;
66
- /**
67
- * Initialize TemboNotify with theme tokens
68
- * Must be called before using any notification methods
69
- */
70
- static init(colors: TemboColorPalette, constants: TemboUIConstants): void;
71
- /**
72
- * Get current toast configs, throws if not initialized
73
- */
22
+ static init(colors: ColorPalette, constants: UIConstants): void;
74
23
  private static getConfigs;
75
24
  /**
76
- * Display a success notification
77
- */
78
- static success(message: ToastContent, options?: NotifyOptions): Id;
79
- /**
80
- * Display an error notification
81
- */
82
- static error(message: ToastContent, options?: NotifyOptions): Id;
83
- /**
84
- * Display a warning notification
85
- */
86
- static warning(message: ToastContent, options?: NotifyOptions): Id;
87
- /**
88
- * Display an info notification
89
- */
90
- static info(message: ToastContent, options?: NotifyOptions): Id;
91
- /**
92
- * Display a loading notification
93
- * Returns an ID that can be used to update/dismiss it
94
- */
95
- static loading(message: ToastContent, options?: Omit<NotifyOptions, 'duration'>): Id;
96
- /**
97
- * Update an existing notification
98
- */
25
+ * Format message content for display
26
+ * - title only → bold
27
+ * - description only weight 500
28
+ * - title + description → stacked
29
+ */
30
+ private static formatMessage;
31
+ private static buildOptions;
32
+ private static getSuccessConfig;
33
+ private static getErrorConfig;
34
+ private static getWarningConfig;
35
+ private static getInfoConfig;
36
+ private static getLoadingConfig;
37
+ static success(message: NotifyMessage, options?: NotifyOptions): Id;
38
+ static error(message: NotifyMessage, options?: NotifyOptions): Id;
39
+ static warning(message: NotifyMessage, options?: NotifyOptions): Id;
40
+ static info(message: NotifyMessage, options?: NotifyOptions): Id;
41
+ static loading(message: NotifyMessage, options?: Omit<NotifyOptions, 'duration'>): Id;
99
42
  static update(id: Id, options: {
100
43
  type?: 'success' | 'error' | 'warning' | 'info';
101
- message?: ToastContent;
44
+ message?: NotifyMessage;
102
45
  autoClose?: number | false;
46
+ render?: ToastContent;
103
47
  }): void;
104
- /**
105
- * Dismiss a specific notification by ID
106
- */
107
- static dismiss(id: Id): void;
108
- /**
109
- * Dismiss all notifications
110
- */
48
+ static dismiss(id?: Id): void;
111
49
  static dismissAll(): void;
112
- /**
113
- * Check if a notification is active
114
- */
115
50
  static isActive(id: Id): boolean;
116
- /**
117
- * Handle promise-based operations with notifications
118
- */
119
- static promise<T>(promise: Promise<T>, messages: {
120
- pending: ToastContent;
121
- success: ToastContent<T>;
122
- error: ToastContent | ((error: any) => ToastContent);
123
- }, options?: NotifyOptions): Promise<T>;
124
51
  }
@@ -1,149 +1,140 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
3
  import { toast } from 'react-toastify';
2
4
  import { buildToastConfigs } from './toast-config.js';
5
+ /**
6
+ * Simple fallback config when TemboNotify.init hasn't been called yet.
7
+ */
8
+ const FALLBACK_BASE_CONFIG = {
9
+ position: 'top-right',
10
+ autoClose: 4000, // ~4 seconds for everything except loading
11
+ hideProgressBar: true,
12
+ closeOnClick: true,
13
+ pauseOnHover: true,
14
+ draggable: true,
15
+ closeButton: false,
16
+ };
3
17
  /**
4
18
  * TemboNotify - Unified notification system
5
- *
6
- * Wraps react-toastify with consistent styling and behavior
7
- * aligned with Tembo's design system.
8
- *
9
- * Note: This class needs to be initialized with theme tokens before use.
10
- * Call TemboNotify.init(colors, constants) in your app setup.
11
- *
12
- * @example
13
- * ```typescript
14
- * // In your app setup (e.g., App.tsx)
15
- * const { colors, constants } = useTemboTheme();
16
- * useEffect(() => {
17
- * TemboNotify.init(colors, constants);
18
- * }, [colors, constants]);
19
- *
20
- * // Then use anywhere in your app
21
- * TemboNotify.success('Payment sent successfully!');
22
- *
23
- * // With options
24
- * TemboNotify.error('Payment failed', {
25
- * duration: 8000,
26
- * onClick: () => console.log('Error clicked')
27
- * });
28
- *
29
- * // Loading with promise
30
- * const loadingId = TemboNotify.loading('Processing payment...');
31
- * await processPayment();
32
- * TemboNotify.success('Payment complete!', { id: loadingId });
33
- *
34
- * // Promise-based
35
- * TemboNotify.promise(
36
- * apiCall(),
37
- * {
38
- * pending: 'Processing...',
39
- * success: 'Done!',
40
- * error: 'Failed!'
41
- * }
42
- * );
43
- * ```
44
19
  */
45
20
  export class TemboNotify {
46
- /**
47
- * Initialize TemboNotify with theme tokens
48
- * Must be called before using any notification methods
49
- */
50
21
  static init(colors, constants) {
51
22
  this.configs = buildToastConfigs(colors, constants);
52
23
  }
53
- /**
54
- * Get current toast configs, throws if not initialized
55
- */
56
24
  static getConfigs() {
57
- if (!this.configs) {
58
- throw new Error('TemboNotify not initialized. Call TemboNotify.init(colors, constants) before using notifications.');
59
- }
60
25
  return this.configs;
61
26
  }
62
27
  /**
63
- * Display a success notification
28
+ * Format message content for display
29
+ * - title only → bold
30
+ * - description only → weight 500
31
+ * - title + description → stacked
64
32
  */
65
- static success(message, options) {
66
- var _a;
33
+ static formatMessage(message) {
34
+ if (message && typeof message === 'object' && !('$$typeof' in message)) {
35
+ const hasTitle = !!message.title;
36
+ const hasDescription = !!message.description;
37
+ if (hasTitle && hasDescription) {
38
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsx("div", { style: { fontWeight: 600, fontSize: 14 }, children: message.title }), _jsx("div", { style: { fontSize: 13, fontWeight: 400, opacity: 0.95 }, children: message.description })] }));
39
+ }
40
+ if (hasTitle && !hasDescription) {
41
+ return (_jsx("div", { style: { fontWeight: 600, fontSize: 14 }, children: message.title }));
42
+ }
43
+ if (!hasTitle && hasDescription) {
44
+ return (_jsx("div", { style: { fontSize: 13, fontWeight: 500 }, children: message.description }));
45
+ }
46
+ // Empty object case
47
+ return '';
48
+ }
49
+ return message;
50
+ }
51
+ static buildOptions(baseConfig, options) {
52
+ const _a = options || {}, { duration, toastId, onClick, onClose } = _a, restOptions = __rest(_a, ["duration", "toastId", "onClick", "onClose"]);
53
+ const effectiveBase = baseConfig !== null && baseConfig !== void 0 ? baseConfig : FALLBACK_BASE_CONFIG;
54
+ return Object.assign(Object.assign(Object.assign({}, effectiveBase), restOptions), { // includes custom icon if provided
55
+ toastId, autoClose: duration !== undefined
56
+ ? duration || false
57
+ : effectiveBase.autoClose, onClick,
58
+ onClose });
59
+ }
60
+ static getSuccessConfig() {
61
+ var _a, _b;
67
62
  const configs = this.getConfigs();
68
- return toast.success(message, Object.assign(Object.assign({}, configs.successConfig), { autoClose: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : configs.successConfig.autoClose, position: options === null || options === void 0 ? void 0 : options.position, onClick: options === null || options === void 0 ? void 0 : options.onClick, onClose: options === null || options === void 0 ? void 0 : options.onClose }));
63
+ return (_b = (_a = configs === null || configs === void 0 ? void 0 : configs.successConfig) !== null && _a !== void 0 ? _a : configs === null || configs === void 0 ? void 0 : configs.baseConfig) !== null && _b !== void 0 ? _b : undefined;
69
64
  }
70
- /**
71
- * Display an error notification
72
- */
73
- static error(message, options) {
74
- var _a;
65
+ static getErrorConfig() {
66
+ var _a, _b;
75
67
  const configs = this.getConfigs();
76
- return toast.error(message, Object.assign(Object.assign({}, configs.errorConfig), { autoClose: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : configs.errorConfig.autoClose, position: options === null || options === void 0 ? void 0 : options.position, onClick: options === null || options === void 0 ? void 0 : options.onClick, onClose: options === null || options === void 0 ? void 0 : options.onClose }));
68
+ return (_b = (_a = configs === null || configs === void 0 ? void 0 : configs.errorConfig) !== null && _a !== void 0 ? _a : configs === null || configs === void 0 ? void 0 : configs.baseConfig) !== null && _b !== void 0 ? _b : undefined;
77
69
  }
78
- /**
79
- * Display a warning notification
80
- */
81
- static warning(message, options) {
82
- var _a;
70
+ static getWarningConfig() {
71
+ var _a, _b;
83
72
  const configs = this.getConfigs();
84
- return toast.warning(message, Object.assign(Object.assign({}, configs.warningConfig), { autoClose: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : configs.warningConfig.autoClose, position: options === null || options === void 0 ? void 0 : options.position, onClick: options === null || options === void 0 ? void 0 : options.onClick, onClose: options === null || options === void 0 ? void 0 : options.onClose }));
73
+ return (_b = (_a = configs === null || configs === void 0 ? void 0 : configs.warningConfig) !== null && _a !== void 0 ? _a : configs === null || configs === void 0 ? void 0 : configs.baseConfig) !== null && _b !== void 0 ? _b : undefined;
85
74
  }
86
- /**
87
- * Display an info notification
88
- */
89
- static info(message, options) {
90
- var _a;
75
+ static getInfoConfig() {
76
+ var _a, _b;
91
77
  const configs = this.getConfigs();
92
- return toast.info(message, Object.assign(Object.assign({}, configs.infoConfig), { autoClose: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : configs.infoConfig.autoClose, position: options === null || options === void 0 ? void 0 : options.position, onClick: options === null || options === void 0 ? void 0 : options.onClick, onClose: options === null || options === void 0 ? void 0 : options.onClose }));
78
+ return (_b = (_a = configs === null || configs === void 0 ? void 0 : configs.infoConfig) !== null && _a !== void 0 ? _a : configs === null || configs === void 0 ? void 0 : configs.baseConfig) !== null && _b !== void 0 ? _b : undefined;
93
79
  }
94
- /**
95
- * Display a loading notification
96
- * Returns an ID that can be used to update/dismiss it
97
- */
98
- static loading(message, options) {
80
+ static getLoadingConfig() {
81
+ var _a, _b;
99
82
  const configs = this.getConfigs();
100
- return toast.loading(message, Object.assign(Object.assign({}, configs.loadingConfig), { position: options === null || options === void 0 ? void 0 : options.position, onClick: options === null || options === void 0 ? void 0 : options.onClick, onClose: options === null || options === void 0 ? void 0 : options.onClose }));
83
+ return (_b = (_a = configs === null || configs === void 0 ? void 0 : configs.loadingConfig) !== null && _a !== void 0 ? _a : configs === null || configs === void 0 ? void 0 : configs.baseConfig) !== null && _b !== void 0 ? _b : undefined;
101
84
  }
102
- /**
103
- * Update an existing notification
104
- */
105
- static update(id, options) {
85
+ static success(message, options) {
86
+ const content = this.formatMessage(message);
87
+ const toastOptions = this.buildOptions(this.getSuccessConfig(), options);
88
+ return toast.success(content, toastOptions);
89
+ }
90
+ static error(message, options) {
91
+ const content = this.formatMessage(message);
92
+ const toastOptions = this.buildOptions(this.getErrorConfig(), options);
93
+ return toast.error(content, toastOptions);
94
+ }
95
+ static warning(message, options) {
96
+ const content = this.formatMessage(message);
97
+ const toastOptions = this.buildOptions(this.getWarningConfig(), options);
98
+ return toast.warning(content, toastOptions);
99
+ }
100
+ static info(message, options) {
101
+ const content = this.formatMessage(message);
102
+ const toastOptions = this.buildOptions(this.getInfoConfig(), options);
103
+ return toast.info(content, toastOptions);
104
+ }
105
+ static loading(message, options) {
106
106
  var _a;
107
+ const content = this.formatMessage(message);
108
+ const _b = options || {}, { toastId, onClick, onClose } = _b, restOptions = __rest(_b, ["toastId", "onClick", "onClose"]);
109
+ const baseConfig = (_a = this.getLoadingConfig()) !== null && _a !== void 0 ? _a : FALLBACK_BASE_CONFIG;
110
+ return toast.loading(content, Object.assign(Object.assign(Object.assign({}, baseConfig), restOptions), { toastId,
111
+ onClick,
112
+ onClose }));
113
+ }
114
+ static update(id, options) {
115
+ var _a, _b;
107
116
  const configs = this.getConfigs();
108
- const config = options.type ? {
109
- success: configs.successConfig,
110
- error: configs.errorConfig,
111
- warning: configs.warningConfig,
112
- info: configs.infoConfig,
113
- }[options.type] : undefined;
114
- toast.update(id, Object.assign({ render: options.message, type: options.type, isLoading: false, autoClose: (_a = options.autoClose) !== null && _a !== void 0 ? _a : config === null || config === void 0 ? void 0 : config.autoClose }, config));
117
+ const typeConfig = options.type && configs
118
+ ? {
119
+ success: configs.successConfig,
120
+ error: configs.errorConfig,
121
+ warning: configs.warningConfig,
122
+ info: configs.infoConfig,
123
+ }[options.type]
124
+ : undefined;
125
+ const content = options.message
126
+ ? this.formatMessage(options.message)
127
+ : options.render;
128
+ toast.update(id, Object.assign({ render: content, type: options.type, isLoading: false, autoClose: (_b = (_a = options.autoClose) !== null && _a !== void 0 ? _a : typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.autoClose) !== null && _b !== void 0 ? _b : FALLBACK_BASE_CONFIG.autoClose }, (typeConfig !== null && typeConfig !== void 0 ? typeConfig : {})));
115
129
  }
116
- /**
117
- * Dismiss a specific notification by ID
118
- */
119
130
  static dismiss(id) {
120
131
  toast.dismiss(id);
121
132
  }
122
- /**
123
- * Dismiss all notifications
124
- */
125
133
  static dismissAll() {
126
134
  toast.dismiss();
127
135
  }
128
- /**
129
- * Check if a notification is active
130
- */
131
136
  static isActive(id) {
132
137
  return toast.isActive(id);
133
138
  }
134
- /**
135
- * Handle promise-based operations with notifications
136
- */
137
- static promise(promise, messages, options) {
138
- var _a, _b;
139
- const configs = this.getConfigs();
140
- return toast.promise(promise, {
141
- pending: Object.assign({ render: messages.pending }, configs.loadingConfig),
142
- success: Object.assign(Object.assign({ render: messages.success }, configs.successConfig), { autoClose: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : configs.successConfig.autoClose }),
143
- error: Object.assign(Object.assign({ render: messages.error }, configs.errorConfig), { autoClose: (_b = options === null || options === void 0 ? void 0 : options.duration) !== null && _b !== void 0 ? _b : configs.errorConfig.autoClose }),
144
- }, {
145
- position: options === null || options === void 0 ? void 0 : options.position,
146
- });
147
- }
148
139
  }
149
140
  TemboNotify.configs = null;
@@ -1,15 +1,13 @@
1
1
  import { ToastOptions } from 'react-toastify';
2
- import { TemboColorPalette, TemboUIConstants } from '../../theme/index.js';
3
- /**
4
- * Build toast configurations from theme tokens
5
- * This function is called with theme values to generate toast configs
6
- */
7
- export declare const buildToastConfigs: (colors: TemboColorPalette, constants: TemboUIConstants) => {
2
+ import { ColorPalette } from '../../theme/tokens/colors.js';
3
+ import { UIConstants } from '../../theme/tokens/constants.js';
4
+ export declare const buildToastConfigs: (colors: ColorPalette, constants: UIConstants) => {
8
5
  loadingConfig: ToastOptions<unknown>;
9
6
  infoConfig: ToastOptions<unknown>;
10
7
  warningConfig: ToastOptions<unknown>;
11
8
  errorConfig: ToastOptions<unknown>;
12
9
  successConfig: ToastOptions<unknown>;
13
10
  baseConfig: ToastOptions<unknown>;
11
+ colors: ColorPalette;
14
12
  };
15
13
  export type ToastConfigs = ReturnType<typeof buildToastConfigs>;
@@ -1,47 +1,53 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CheckCircleOutlined, CloseCircleOutlined, ExclamationCircleOutlined, InfoCircleOutlined, } from '@ant-design/icons';
3
- /**
4
- * Build toast configurations from theme tokens
5
- * This function is called with theme values to generate toast configs
6
- */
2
+ import { CheckCircleOutlined, CloseCircleOutlined, ExclamationCircleOutlined, InfoCircleOutlined, LoadingOutlined, } from '@ant-design/icons';
7
3
  export const buildToastConfigs = (colors, constants) => {
8
4
  /**
9
- * Common toast configuration aligned with Tembo theme
5
+ * Base = WHITE background for everything unless overridden
10
6
  */
11
7
  const baseConfig = {
12
8
  position: 'top-right',
13
9
  autoClose: 4000,
14
- hideProgressBar: false,
10
+ hideProgressBar: true,
15
11
  closeOnClick: true,
16
12
  pauseOnHover: true,
17
13
  draggable: true,
18
- progress: undefined,
14
+ closeButton: false,
19
15
  style: {
20
- fontFamily: constants.typography.fontFamily,
21
- fontSize: constants.typography.fontSize.base,
22
- borderRadius: constants.radius.base,
16
+ fontFamily: constants.typography.fontFamily.base,
17
+ fontSize: 14,
18
+ borderRadius: 10,
19
+ padding: '10px 14px',
20
+ boxShadow: '0 12px 24px rgba(15, 23, 42, 0.12)',
21
+ border: 'none',
22
+ minHeight: 56,
23
+ backgroundColor: colors.surface.overlay,
24
+ color: colors.text.primary,
25
+ display: 'flex',
26
+ alignItems: 'center',
27
+ gap: 8,
23
28
  },
24
29
  };
25
30
  /**
26
- * Success notification configuration
31
+ * SUCCESS success colors
27
32
  */
28
- const successConfig = Object.assign(Object.assign({}, baseConfig), { icon: _jsx(CheckCircleOutlined, { style: { fontSize: 20, color: colors.success.main } }), style: Object.assign(Object.assign({}, baseConfig.style), { border: `1px solid ${colors.success.border}` }) });
33
+ const successConfig = Object.assign(Object.assign({}, baseConfig), { icon: (_jsx(CheckCircleOutlined, { style: { fontSize: 18, color: colors.semantic.success.main } })), style: Object.assign(Object.assign({}, baseConfig.style), { backgroundColor: colors.semantic.success.subtle, color: colors.semantic.success.main }), className: 'toast-success' });
29
34
  /**
30
- * Error notification configuration
35
+ * ERROR error colors
31
36
  */
32
- const errorConfig = Object.assign(Object.assign({}, baseConfig), { icon: _jsx(CloseCircleOutlined, { style: { fontSize: 20, color: colors.error.main } }), style: Object.assign(Object.assign({}, baseConfig.style), { border: `1px solid ${colors.error.border}` }), autoClose: 6000 });
37
+ const errorConfig = Object.assign(Object.assign({}, baseConfig), { icon: (_jsx(CloseCircleOutlined, { style: { fontSize: 18, color: colors.semantic.error.main } })), style: Object.assign(Object.assign({}, baseConfig.style), { backgroundColor: colors.semantic.error.subtle, color: colors.semantic.error.main }), className: 'toast-error' });
33
38
  /**
34
- * Warning notification configuration
39
+ * WARNING warning colors
35
40
  */
36
- const warningConfig = Object.assign(Object.assign({}, baseConfig), { icon: _jsx(ExclamationCircleOutlined, { style: { fontSize: 20, color: colors.warning.main } }), style: Object.assign(Object.assign({}, baseConfig.style), { border: `1px solid ${colors.warning.border}` }) });
41
+ const warningConfig = Object.assign(Object.assign({}, baseConfig), { icon: (_jsx(ExclamationCircleOutlined, { style: { fontSize: 18, color: colors.semantic.warning.main } })), style: Object.assign(Object.assign({}, baseConfig.style), { backgroundColor: colors.semantic.warning.subtle, color: colors.semantic.warning.main }), className: 'toast-warning' });
37
42
  /**
38
- * Info notification configuration
43
+ * INFO *white background*, blue accents only
44
+ * (no colored background)
39
45
  */
40
- const infoConfig = Object.assign(Object.assign({}, baseConfig), { icon: _jsx(InfoCircleOutlined, { style: { fontSize: 20, color: colors.info.main } }), style: Object.assign(Object.assign({}, baseConfig.style), { border: `1px solid ${colors.info.border}` }) });
46
+ const infoConfig = Object.assign(Object.assign({}, baseConfig), { icon: (_jsx(InfoCircleOutlined, { style: { fontSize: 18, color: colors.text.primary } })), style: Object.assign(Object.assign({}, baseConfig.style), { backgroundColor: colors.surface.overlay, color: colors.text.primary }), className: 'toast-info' });
41
47
  /**
42
- * Loading notification configuration
48
+ * LOADING (unchanged)
43
49
  */
44
- const loadingConfig = Object.assign(Object.assign({}, baseConfig), { autoClose: false, closeButton: false });
50
+ const loadingConfig = Object.assign(Object.assign({}, baseConfig), { icon: (_jsx(LoadingOutlined, { style: { fontSize: 18, color: colors.neutral[4] } })), style: Object.assign(Object.assign({}, baseConfig.style), { backgroundColor: colors.surface.overlay, color: colors.text.primary }), autoClose: false, closeButton: false, hideProgressBar: true, className: 'toast-loading' });
45
51
  return {
46
52
  loadingConfig,
47
53
  infoConfig,
@@ -49,5 +55,6 @@ export const buildToastConfigs = (colors, constants) => {
49
55
  errorConfig,
50
56
  successConfig,
51
57
  baseConfig,
58
+ colors,
52
59
  };
53
60
  };
@@ -1,9 +1,19 @@
1
1
  import React from 'react';
2
2
  import { ToastContainerProps as RTToastContainerProps } from 'react-toastify';
3
- export type TemboToastContainerProps = RTToastContainerProps;
3
+ export interface TemboToastContainerProps extends Omit<RTToastContainerProps, 'closeButton' | 'hideProgressBar'> {
4
+ /**
5
+ * Show the X close button on each toast
6
+ * @default false
7
+ */
8
+ showCloseButton?: boolean;
9
+ /**
10
+ * Show the progress bar at the bottom of each toast
11
+ * @default false
12
+ */
13
+ showProgressBar?: boolean;
14
+ }
4
15
  /**
5
- * Toast container that automatically initializes TemboNotify with current theme
6
- * Reinitializes when theme changes to respect color/constant overrides
16
+ * Toast container with Tembo styling
7
17
  */
8
18
  declare const TemboToastContainer: React.FC<TemboToastContainerProps>;
9
19
  export default TemboToastContainer;
@@ -1,18 +1,89 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { useEffect } from 'react';
3
- import { ToastContainer } from 'react-toastify';
4
- import { useTemboTheme } from '../../theme/index.js';
4
+ import { ToastContainer, } from 'react-toastify';
5
5
  import { TemboNotify } from './tembo-notify.js';
6
+ import { useNewTemboTheme } from '../../theme/theme-provider.js';
6
7
  /**
7
- * Toast container that automatically initializes TemboNotify with current theme
8
- * Reinitializes when theme changes to respect color/constant overrides
8
+ * Toast container with Tembo styling
9
9
  */
10
- const TemboToastContainer = (props) => {
11
- const { colors, constants } = useTemboTheme();
12
- // Initialize/update TemboNotify whenever theme changes
10
+ const TemboToastContainer = (_a) => {
11
+ var { showCloseButton = false, showProgressBar = false } = _a, rest = __rest(_a, ["showCloseButton", "showProgressBar"]);
12
+ const { colors, constants } = useNewTemboTheme();
13
13
  useEffect(() => {
14
14
  TemboNotify.init(colors, constants);
15
15
  }, [colors, constants]);
16
- return _jsx(ToastContainer, Object.assign({}, props));
16
+ return (_jsxs(_Fragment, { children: [_jsx(ToastContainer, Object.assign({ closeButton: showCloseButton, hideProgressBar: !showProgressBar }, rest)), _jsx("style", { children: `
17
+ .Toastify__toast {
18
+ font-family: ${constants.typography.fontFamily};
19
+ line-height: 1.5;
20
+ display: flex;
21
+ align-items: center; /* center icon + content */
22
+ }
23
+
24
+ .Toastify__toast-body {
25
+ padding: 0;
26
+ margin: 0;
27
+ display: flex;
28
+ align-items: flex-start;
29
+ }
30
+
31
+ .Toastify__toast-icon {
32
+ width: 18px;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ margin-inline-end: 6px; /* tighter spacing */
37
+ }
38
+
39
+ .Toastify__progress-bar {
40
+ display: none;
41
+ }
42
+
43
+ .Toastify__close-button {
44
+ opacity: 0.5;
45
+ transition: opacity 0.2s ease;
46
+ }
47
+
48
+ .Toastify__close-button:hover {
49
+ opacity: 1;
50
+ }
51
+
52
+ /* Force progress bar hidden in case someone enables it unintentionally */
53
+ .Toastify__progress-bar {
54
+ display: none;
55
+ }
56
+
57
+ /* Smooth entrance animation */
58
+ @keyframes toastSlideIn {
59
+ from {
60
+ transform: translateX(110%);
61
+ opacity: 0;
62
+ }
63
+ to {
64
+ transform: translateX(0);
65
+ opacity: 1;
66
+ }
67
+ }
68
+
69
+ .Toastify__toast--top-right {
70
+ animation: toastSlideIn 0.3s ease-out;
71
+ }
72
+
73
+ /* Optional: full-width mobile behaviour */
74
+ @media (max-width: 480px) {
75
+ .Toastify__toast-container--top-right {
76
+ right: 0;
77
+ left: 0;
78
+ padding: 0;
79
+ width: 100vw;
80
+ }
81
+
82
+ .Toastify__toast {
83
+ margin-bottom: 0;
84
+ border-radius: 0;
85
+ }
86
+ }
87
+ ` })] }));
17
88
  };
18
89
  export default TemboToastContainer;
package/dist/index.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./theme-provider-Dqvy24OD.js"),r=require("@ebay/nice-modal-react"),t=require("react"),s=require("react-toastify");require("lodash");var i=require("./tembo-notify-D-uOV3t0.js");function o(e){return e&&e.__esModule?e:{default:e}}require("antd"),require("./InfoCircleOutlined-B7d2aRfV.js"),require("./ZoomOutOutlined-BY_CCwq7.js");var n=o(r);const u=r=>e.jsxRuntimeExports.jsx(n.default.Provider,{children:r.children}),c=r=>{const{colors:o,constants:n}=e.useTemboTheme();return t.useEffect(()=>{i.TemboNotify.init(o,n)},[o,n]),e.jsxRuntimeExports.jsx(s.ToastContainer,Object.assign({},r))};exports.TemboUIProviders=({children:r,colors:t,constants:s,themeOverrides:i})=>e.jsxRuntimeExports.jsx(e.TemboThemeProvider,{colors:t,constants:s,themeOverrides:i,children:e.jsxRuntimeExports.jsxs(u,{children:[r,e.jsxRuntimeExports.jsx(c,{})]})});
1
+ "use strict";var n=require("./theme-provider-CCkR2IcZ.js"),e=require("@ebay/nice-modal-react"),t=require("tslib"),s=require("react"),i=require("react-toastify"),o=require("./tembo-notify-ZYud9J7B.js");function r(n){return n&&n.__esModule?n:{default:n}}require("antd"),require("./InfoCircleOutlined-DR9DmuN-.js"),require("./CloseCircleOutlined-CMilRURi.js");var a=r(e);const l=e=>n.jsxRuntimeExports.jsx(a.default.Provider,{children:e.children}),d=e=>{var{showCloseButton:r=!1,showProgressBar:a=!1}=e,l=t.__rest(e,["showCloseButton","showProgressBar"]);const{colors:d,constants:c}=n.useNewTemboTheme();return s.useEffect(()=>{o.TemboNotify.init(d,c)},[d,c]),n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(i.ToastContainer,Object.assign({closeButton:r,hideProgressBar:!a},l)),n.jsxRuntimeExports.jsx("style",{children:`\n .Toastify__toast {\n font-family: ${c.typography.fontFamily};\n line-height: 1.5;\n display: flex;\n align-items: center; /* center icon + content */\n }\n\n .Toastify__toast-body {\n padding: 0;\n margin: 0;\n display: flex;\n align-items: flex-start;\n }\n\n .Toastify__toast-icon {\n width: 18px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-inline-end: 6px; /* tighter spacing */\n }\n\n .Toastify__progress-bar {\n display: none;\n }\n\n .Toastify__close-button {\n opacity: 0.5;\n transition: opacity 0.2s ease;\n }\n\n .Toastify__close-button:hover {\n opacity: 1;\n }\n\n /* Force progress bar hidden in case someone enables it unintentionally */\n .Toastify__progress-bar {\n display: none;\n }\n\n /* Smooth entrance animation */\n @keyframes toastSlideIn {\n from {\n transform: translateX(110%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n }\n\n .Toastify__toast--top-right {\n animation: toastSlideIn 0.3s ease-out;\n }\n\n /* Optional: full-width mobile behaviour */\n @media (max-width: 480px) {\n .Toastify__toast-container--top-right {\n right: 0;\n left: 0;\n padding: 0;\n width: 100vw;\n }\n\n .Toastify__toast {\n margin-bottom: 0;\n border-radius: 0;\n }\n }\n `})]})};exports.TemboUIProviders=({children:e,mode:t,antdThemeOverrides:s})=>n.jsxRuntimeExports.jsx(n.TemboThemeProvider,{mode:t,antdThemeOverrides:s,children:n.jsxRuntimeExports.jsxs(l,{children:[e,n.jsxRuntimeExports.jsx(d,{})]})});
2
2
  //# sourceMappingURL=index.cjs.js.map