@temboplus/frontend-react-core 0.1.3-beta.1 → 0.1.3-beta.3

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 (49) hide show
  1. package/dist/alerts/index.cjs.js +1 -1
  2. package/dist/alerts/index.d.ts +1 -0
  3. package/dist/alerts/index.js +1 -1
  4. package/dist/dialogs/index.cjs.js +1 -1
  5. package/dist/dialogs/index.d.ts +1 -0
  6. package/dist/dialogs/index.js +1 -1
  7. package/dist/features/alerts/alert.js +95 -0
  8. package/dist/features/alerts/index.js +1 -0
  9. package/dist/features/dialogs/index.js +1 -0
  10. package/dist/features/dialogs/modal-provider.js +6 -0
  11. package/dist/features/dialogs/tembo-confirm.js +111 -0
  12. package/dist/features/input-validation/account-name-validator.js +28 -0
  13. package/dist/features/input-validation/account-number-validator.js +65 -0
  14. package/dist/features/input-validation/amount-validator.js +100 -0
  15. package/dist/features/input-validation/index.js +5 -0
  16. package/dist/features/input-validation/phone-number-validator.js +79 -0
  17. package/dist/features/input-validation/swift-code-validator.js +38 -0
  18. package/dist/features/notifications/index.js +3 -0
  19. package/dist/features/notifications/tembo-notify.js +149 -0
  20. package/dist/features/notifications/toast-config.js +53 -0
  21. package/dist/features/notifications/toast-container.js +18 -0
  22. package/dist/index.cjs.js +1 -1
  23. package/dist/index.esm.js +1 -1
  24. package/dist/index.js +1 -0
  25. package/dist/notifications/index.cjs.js +1 -1
  26. package/dist/notifications/index.d.ts +1 -0
  27. package/dist/notifications/index.js +1 -1
  28. package/dist/providers.js +32 -0
  29. package/dist/{tembo-notify-C-QGduBt.js → tembo-notify-B-mUpU8q.js} +2 -2
  30. package/dist/{tembo-notify-C-QGduBt.js.map → tembo-notify-B-mUpU8q.js.map} +1 -1
  31. package/dist/{tembo-notify-D-uOV3t0.js → tembo-notify-C4_8DSSc.js} +2 -2
  32. package/dist/{tembo-notify-D-uOV3t0.js.map → tembo-notify-C4_8DSSc.js.map} +1 -1
  33. package/dist/theme/colors.d.ts +55 -23
  34. package/dist/theme/colors.js +212 -0
  35. package/dist/theme/constants.js +82 -0
  36. package/dist/theme/index.cjs.js +1 -1
  37. package/dist/theme/index.js +1 -1
  38. package/dist/theme/theme-provider.d.ts +18 -6
  39. package/dist/theme/theme-provider.js +404 -0
  40. package/dist/theme-provider-Ca4P0Hcp.js +11 -0
  41. package/dist/theme-provider-Ca4P0Hcp.js.map +1 -0
  42. package/dist/theme-provider-RhAw3jw_.js +11 -0
  43. package/dist/theme-provider-RhAw3jw_.js.map +1 -0
  44. package/dist/validation/index.d.ts +1 -0
  45. package/package.json +5 -2
  46. package/dist/theme-provider-D_oV1J_K.js +0 -11
  47. package/dist/theme-provider-D_oV1J_K.js.map +0 -1
  48. package/dist/theme-provider-Dqvy24OD.js +0 -11
  49. package/dist/theme-provider-Dqvy24OD.js.map +0 -1
@@ -0,0 +1,212 @@
1
+ import { merge } from "lodash";
2
+ /**
3
+ * Base color values for light theme
4
+ * These are the actual color values that get mapped to the palette
5
+ */
6
+ const lightModeColors = {
7
+ neutral: {
8
+ 0: '#ffffff',
9
+ 1: '#fafafa',
10
+ 2: '#f5f5f5',
11
+ 3: '#f0f0f0',
12
+ 4: '#e5e5e5',
13
+ 5: '#d4d4d4',
14
+ 6: '#b3b3b3',
15
+ 7: '#999999',
16
+ 8: '#666666',
17
+ 9: '#1a1a1a',
18
+ 10: '#000000',
19
+ },
20
+ };
21
+ /**
22
+ * Base color values for dark theme
23
+ * Inverted neutral scale for dark mode
24
+ */
25
+ const darkModeColors = {
26
+ neutral: {
27
+ 0: '#000000',
28
+ 1: '#1a1a1a',
29
+ 2: '#666666',
30
+ 3: '#999999',
31
+ 4: '#b3b3b3',
32
+ 5: '#d4d4d4',
33
+ 6: '#e5e5e5',
34
+ 7: '#f0f0f0',
35
+ 8: '#f5f5f5',
36
+ 9: '#fafafa',
37
+ 10: '#ffffff',
38
+ },
39
+ };
40
+ /**
41
+ * Build default color palette for a given theme mode
42
+ *
43
+ * @param mode - 'light' or 'dark'
44
+ * @returns Complete color palette with theme-aware neutral scale
45
+ */
46
+ const buildDefaultPalette = (mode) => {
47
+ const modeColors = mode === 'light' ? lightModeColors : darkModeColors;
48
+ return {
49
+ primary: {
50
+ main: '#000000',
51
+ hover: '#1a1a1a',
52
+ active: '#000000',
53
+ light: '#666666',
54
+ lighter: '#999999',
55
+ contrast: '#FFFFFF',
56
+ },
57
+ action: {
58
+ main: '#1a6985',
59
+ hover: '#145268',
60
+ active: '#0f3d4f',
61
+ light: '#e8f2f5',
62
+ lighter: '#f4f9fa',
63
+ disabled: '#a3c9d6',
64
+ contrast: '#FFFFFF',
65
+ },
66
+ absolute: {
67
+ white: '#ffffff',
68
+ black: '#000000',
69
+ },
70
+ neutral: {
71
+ // Numeric scale (theme-aware)
72
+ 0: modeColors.neutral[0],
73
+ 1: modeColors.neutral[1],
74
+ 2: modeColors.neutral[2],
75
+ 3: modeColors.neutral[3],
76
+ 4: modeColors.neutral[4],
77
+ 5: modeColors.neutral[5],
78
+ 6: modeColors.neutral[6],
79
+ 7: modeColors.neutral[7],
80
+ 8: modeColors.neutral[8],
81
+ 9: modeColors.neutral[9],
82
+ 10: modeColors.neutral[10],
83
+ // Convenient aliases (map to numeric scale)
84
+ brightest: modeColors.neutral[0],
85
+ lightest: modeColors.neutral[1],
86
+ lighter: modeColors.neutral[2],
87
+ light: modeColors.neutral[3],
88
+ medium: modeColors.neutral[5],
89
+ dark: modeColors.neutral[7],
90
+ darker: modeColors.neutral[8],
91
+ darkest: modeColors.neutral[9],
92
+ dimmest: modeColors.neutral[10],
93
+ },
94
+ success: {
95
+ main: '#10b981',
96
+ bg: '#ecfdf5',
97
+ border: '#a7f3d0',
98
+ text: '#047857',
99
+ },
100
+ error: {
101
+ main: '#ef4444',
102
+ bg: '#fef2f2',
103
+ border: '#fecaca',
104
+ text: '#dc2626',
105
+ },
106
+ warning: {
107
+ main: '#f59e0b',
108
+ bg: '#fffbeb',
109
+ border: '#fde68a',
110
+ text: '#d97706',
111
+ },
112
+ info: {
113
+ main: '#1a6985',
114
+ bg: '#e8f2f5',
115
+ border: '#b8d9e6',
116
+ text: '#0f3d4f',
117
+ },
118
+ surface: {
119
+ background: modeColors.neutral[0],
120
+ main: modeColors.neutral[0],
121
+ elevated: modeColors.neutral[0],
122
+ hover: modeColors.neutral[1],
123
+ subtle: modeColors.neutral[1],
124
+ },
125
+ text: {
126
+ primary: modeColors.neutral[10],
127
+ secondary: modeColors.neutral[8],
128
+ tertiary: modeColors.neutral[7],
129
+ quaternary: modeColors.neutral[6],
130
+ disabled: modeColors.neutral[5],
131
+ inverse: modeColors.neutral[0],
132
+ },
133
+ border: {
134
+ main: modeColors.neutral[4],
135
+ light: modeColors.neutral[3],
136
+ strong: modeColors.neutral[5],
137
+ divider: modeColors.neutral[4],
138
+ },
139
+ components: {
140
+ button: {
141
+ primary: {
142
+ bg: '#1a6985',
143
+ hover: '#145268',
144
+ text: '#FFFFFF',
145
+ },
146
+ default: {
147
+ bg: modeColors.neutral[0],
148
+ border: modeColors.neutral[5],
149
+ text: modeColors.neutral[10],
150
+ hover: modeColors.neutral[1],
151
+ },
152
+ },
153
+ input: {
154
+ bg: modeColors.neutral[0],
155
+ border: modeColors.neutral[5],
156
+ borderHover: modeColors.neutral[7],
157
+ borderFocus: '#1a6985',
158
+ placeholder: modeColors.neutral[7],
159
+ },
160
+ table: {
161
+ bg: modeColors.neutral[0],
162
+ headerBg: modeColors.neutral[1],
163
+ headerText: modeColors.neutral[10],
164
+ border: modeColors.neutral[4],
165
+ rowHover: modeColors.neutral[1],
166
+ },
167
+ sidebar: {
168
+ bg: '#000000',
169
+ hover: 'rgba(255, 255, 255, 0.08)',
170
+ selected: 'rgba(255, 255, 255, 0.12)',
171
+ text: '#FFFFFF',
172
+ textSecondary: 'rgba(255, 255, 255, 0.65)',
173
+ },
174
+ },
175
+ utility: {
176
+ transparent: 'transparent',
177
+ link: '#1a6985',
178
+ linkHover: '#145268',
179
+ linkActive: '#0f3d4f',
180
+ },
181
+ };
182
+ };
183
+ /**
184
+ * Default color palette for light theme
185
+ */
186
+ export const defaultColorPalette = buildDefaultPalette('light');
187
+ /**
188
+ * Build a complete color palette by merging overrides with defaults
189
+ * Performs deep merge to allow partial nested overrides
190
+ *
191
+ * @param overrides - Partial color palette overrides
192
+ * @param mode - Theme mode ('light' or 'dark')
193
+ * @returns Complete color palette with overrides applied
194
+ */
195
+ export const buildColorPalette = (overrides, mode = 'light') => {
196
+ const basePalette = buildDefaultPalette(mode);
197
+ if (!overrides)
198
+ return basePalette;
199
+ const merged = merge({}, basePalette, overrides);
200
+ // After merging, ensure neutral aliases are synced with numeric values
201
+ // This handles cases where overrides might change the numeric scale
202
+ merged.neutral.brightest = merged.neutral[0];
203
+ merged.neutral.lightest = merged.neutral[1];
204
+ merged.neutral.lighter = merged.neutral[2];
205
+ merged.neutral.light = merged.neutral[3];
206
+ merged.neutral.medium = merged.neutral[5];
207
+ merged.neutral.dark = merged.neutral[7];
208
+ merged.neutral.darker = merged.neutral[8];
209
+ merged.neutral.darkest = merged.neutral[9];
210
+ merged.neutral.dimmest = merged.neutral[10];
211
+ return merged;
212
+ };
@@ -0,0 +1,82 @@
1
+ import { merge } from 'lodash';
2
+ /**
3
+ * Default UI constants
4
+ * Professional, accessible defaults suitable for most applications
5
+ */
6
+ export const defaultUIConstants = {
7
+ typography: {
8
+ fontFamily: "Avenir, MarkPro, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
9
+ fontSize: {
10
+ xs: 12,
11
+ sm: 13,
12
+ base: 14,
13
+ lg: 16,
14
+ xl: 18,
15
+ },
16
+ fontWeight: {
17
+ normal: 400,
18
+ medium: 500,
19
+ semibold: 600,
20
+ bold: 700,
21
+ },
22
+ lineHeight: {
23
+ tight: 1.25,
24
+ base: 1.5715,
25
+ relaxed: 1.75,
26
+ },
27
+ },
28
+ spacing: {
29
+ xs: 4,
30
+ sm: 8,
31
+ md: 12,
32
+ lg: 16,
33
+ xl: 24,
34
+ '2xl': 32,
35
+ '3xl': 48,
36
+ },
37
+ radius: {
38
+ none: 0,
39
+ sm: 8,
40
+ base: 12,
41
+ md: 14,
42
+ lg: 16,
43
+ xl: 20,
44
+ full: 9999,
45
+ button: 24,
46
+ input: 10,
47
+ card: 16,
48
+ },
49
+ shadow: {
50
+ sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
51
+ base: '0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)',
52
+ md: '0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08)',
53
+ lg: '0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08)',
54
+ xl: '0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08)',
55
+ card: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
56
+ elevated: '0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08)',
57
+ dropdown: '0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08)',
58
+ },
59
+ zIndex: {
60
+ dropdown: 1000,
61
+ modal: 1050,
62
+ popover: 1060,
63
+ tooltip: 1070,
64
+ notification: 1080,
65
+ },
66
+ transition: {
67
+ fast: '150ms cubic-bezier(0.4, 0, 0.2, 1)',
68
+ base: '200ms cubic-bezier(0.4, 0, 0.2, 1)',
69
+ slow: '300ms cubic-bezier(0.4, 0, 0.2, 1)',
70
+ },
71
+ };
72
+ /**
73
+ * Build complete UI constants by merging overrides with defaults
74
+ *
75
+ * @param overrides - Partial UI constants overrides
76
+ * @returns Complete UI constants with overrides applied
77
+ */
78
+ export const buildUIConstants = (overrides) => {
79
+ if (!overrides)
80
+ return defaultUIConstants;
81
+ return merge(defaultUIConstants, overrides);
82
+ };
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("../theme-provider-Dqvy24OD.js");require("react"),require("antd"),require("lodash"),exports.TemboThemeProvider=e.TemboThemeProvider,exports.buildColorPalette=e.buildColorPalette,exports.buildUIConstants=e.buildUIConstants,exports.defaultColorPalette=e.defaultColorPalette,exports.defaultUIConstants=e.defaultUIConstants,exports.useTemboTheme=e.useTemboTheme;
1
+ "use strict";var e=require("../theme-provider-RhAw3jw_.js");require("react"),require("antd"),require("lodash"),exports.TemboThemeProvider=e.TemboThemeProvider,exports.buildColorPalette=e.buildColorPalette,exports.buildUIConstants=e.buildUIConstants,exports.defaultColorPalette=e.defaultColorPalette,exports.defaultUIConstants=e.defaultUIConstants,exports.useTemboTheme=e.useTemboTheme;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1,2 +1,2 @@
1
- export{T as TemboThemeProvider,b as buildColorPalette,c as buildUIConstants,d as defaultColorPalette,a as defaultUIConstants,u as useTemboTheme}from"../theme-provider-D_oV1J_K.js";import"react";import"antd";import"lodash";
1
+ export{T as TemboThemeProvider,b as buildColorPalette,c as buildUIConstants,d as defaultColorPalette,a as defaultUIConstants,u as useTemboTheme}from"../theme-provider-Ca4P0Hcp.js";import"react";import"antd";import"lodash";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ThemeConfig } from 'antd';
3
- import { TemboColorPalette, TemboColorOverrides } from './colors.js';
3
+ import { TemboColorPalette, TemboColorOverrides, ThemeMode } from './colors.js';
4
4
  import { TemboUIConstants, TemboUIConstantsOverrides } from './constants.js';
5
5
  /**
6
6
  * Shape of the theme context exposed via useTemboTheme()
@@ -8,6 +8,7 @@ import { TemboUIConstants, TemboUIConstantsOverrides } from './constants.js';
8
8
  export interface TemboThemeContextValue {
9
9
  colors: TemboColorPalette;
10
10
  constants: TemboUIConstants;
11
+ mode: ThemeMode;
11
12
  }
12
13
  /**
13
14
  * Props for TemboThemeProvider
@@ -19,6 +20,12 @@ export interface TemboThemeContextValue {
19
20
  * </TemboThemeProvider>
20
21
  *
21
22
  * @example
23
+ * // With dark mode
24
+ * <TemboThemeProvider mode="dark">
25
+ * <App />
26
+ * </TemboThemeProvider>
27
+ *
28
+ * @example
22
29
  * // With color overrides
23
30
  * <TemboThemeProvider
24
31
  * colors={{
@@ -32,6 +39,7 @@ export interface TemboThemeContextValue {
32
39
  * @example
33
40
  * // With all customizations
34
41
  * <TemboThemeProvider
42
+ * mode="dark"
35
43
  * colors={{ primary: { main: '#007bff' } }}
36
44
  * constants={{ radius: { base: 8 } }}
37
45
  * themeOverrides={{
@@ -45,6 +53,8 @@ export interface TemboThemeContextValue {
45
53
  */
46
54
  export interface TemboThemeProviderProps {
47
55
  children: React.ReactNode;
56
+ /** Theme mode - 'light' or 'dark' */
57
+ mode?: ThemeMode;
48
58
  /** Color palette overrides - supports deep partial overrides */
49
59
  colors?: TemboColorOverrides;
50
60
  /** UI constants overrides - supports deep partial overrides */
@@ -57,6 +67,7 @@ export interface TemboThemeProviderProps {
57
67
  *
58
68
  * Wraps your application to provide theming through React context and Ant Design's ConfigProvider.
59
69
  * Merges default colors/constants with host overrides and configures Ant Design components.
70
+ * Supports light and dark mode through the mode prop.
60
71
  *
61
72
  * All child components can access theme values via the useTemboTheme() hook.
62
73
  */
@@ -64,22 +75,23 @@ export declare const TemboThemeProvider: React.FC<TemboThemeProviderProps>;
64
75
  /**
65
76
  * Hook to access the active Tembo theme
66
77
  *
67
- * Returns the merged color palette and UI constants with any host overrides applied.
78
+ * Returns the merged color palette, UI constants, and current theme mode.
68
79
  * Components should always use this hook instead of importing defaults directly.
69
80
  *
70
- * @returns Theme context containing colors and constants
81
+ * @returns Theme context containing colors, constants, and mode
71
82
  *
72
83
  * @example
73
84
  * function MyComponent() {
74
- * const { colors, constants } = useTemboTheme();
85
+ * const { colors, constants, mode } = useTemboTheme();
75
86
  *
76
87
  * return (
77
88
  * <div style={{
78
89
  * color: colors.text.primary,
79
90
  * padding: constants.spacing.md,
80
- * borderRadius: constants.radius.base
91
+ * borderRadius: constants.radius.base,
92
+ * backgroundColor: colors.neutral.lightest
81
93
  * }}>
82
- * Themed content
94
+ * Current theme: {mode}
83
95
  * </div>
84
96
  * );
85
97
  * }