@temboplus/frontend-react-core 0.1.3-beta.10 → 0.1.3-beta.11
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.
- package/dist/CloseCircleOutlined-CMilRURi.js +3 -0
- package/dist/CloseCircleOutlined-CMilRURi.js.map +1 -0
- package/dist/CloseCircleOutlined-CSHx89Jn.js +3 -0
- package/dist/CloseCircleOutlined-CSHx89Jn.js.map +1 -0
- package/dist/InfoCircleOutlined-DR9DmuN-.js +5 -0
- package/dist/InfoCircleOutlined-DR9DmuN-.js.map +1 -0
- package/dist/InfoCircleOutlined-Hx86sClq.js +5 -0
- package/dist/InfoCircleOutlined-Hx86sClq.js.map +1 -0
- package/dist/alerts/index.cjs.js +1 -1
- package/dist/alerts/index.cjs.js.map +1 -1
- package/dist/alerts/index.js +1 -1
- package/dist/alerts/index.js.map +1 -1
- package/dist/dialogs/index.cjs.js +3 -1
- package/dist/dialogs/index.cjs.js.map +1 -1
- package/dist/dialogs/index.js +3 -1
- package/dist/dialogs/index.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/notifications/index.cjs.js +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/providers.d.ts +2 -11
- package/dist/providers.js +3 -3
- package/dist/tembo-notify-Bh92g5d-.js +3 -0
- package/dist/tembo-notify-Bh92g5d-.js.map +1 -0
- package/dist/tembo-notify-D_LOB3jW.js +3 -0
- package/dist/tembo-notify-D_LOB3jW.js.map +1 -0
- package/dist/theme/deprecated/theme-provider.d.ts +100 -0
- package/dist/theme/deprecated/theme-provider.js +405 -0
- package/dist/theme/index.cjs.js +1 -1
- package/dist/theme/index.d.ts +3 -2
- package/dist/theme/index.js +1 -1
- package/dist/theme/theme-config.d.ts +6 -0
- package/dist/theme/theme-config.js +762 -0
- package/dist/theme/theme-provider.d.ts +60 -63
- package/dist/theme/theme-provider.js +73 -377
- package/dist/theme/tokens/color.d.ts +168 -0
- package/dist/theme/tokens/color.js +225 -0
- package/dist/theme/tokens/radius.d.ts +26 -0
- package/dist/theme/tokens/radius.js +17 -0
- package/dist/theme/tokens/shadow.d.ts +27 -0
- package/dist/theme/tokens/shadow.js +23 -0
- package/dist/theme/tokens/spacing.d.ts +47 -0
- package/dist/theme/tokens/spacing.js +32 -0
- package/dist/theme/tokens/typography.d.ts +43 -0
- package/dist/theme/tokens/typography.js +33 -0
- package/dist/theme-provider-C31WJ-NK.js +11 -0
- package/dist/theme-provider-C31WJ-NK.js.map +1 -0
- package/dist/theme-provider-DH1PzDC8.js +11 -0
- package/dist/theme-provider-DH1PzDC8.js.map +1 -0
- package/dist/validation/index.cjs.js.map +1 -1
- package/dist/validation/index.js.map +1 -1
- package/package.json +15 -16
- package/dist/InfoCircleOutlined-B7d2aRfV.js +0 -7
- package/dist/InfoCircleOutlined-B7d2aRfV.js.map +0 -1
- package/dist/InfoCircleOutlined-DYs90hdV.js +0 -7
- package/dist/InfoCircleOutlined-DYs90hdV.js.map +0 -1
- package/dist/ZoomOutOutlined-CW-jqBMI.js +0 -2
- package/dist/ZoomOutOutlined-CW-jqBMI.js.map +0 -1
- package/dist/ZoomOutOutlined-Pw8hpWWK.js +0 -2
- package/dist/ZoomOutOutlined-Pw8hpWWK.js.map +0 -1
- package/dist/tembo-notify-Bp14qngd.js +0 -2
- package/dist/tembo-notify-Bp14qngd.js.map +0 -1
- package/dist/tembo-notify-h5Xn66oA.js +0 -2
- package/dist/tembo-notify-h5Xn66oA.js.map +0 -1
- package/dist/theme-provider-Ca4P0Hcp.js +0 -11
- package/dist/theme-provider-Ca4P0Hcp.js.map +0 -1
- package/dist/theme-provider-RhAw3jw_.js +0 -11
- package/dist/theme-provider-RhAw3jw_.js.map +0 -1
- /package/dist/theme/{colors.d.ts → deprecated/colors.d.ts} +0 -0
- /package/dist/theme/{colors.js → deprecated/colors.js} +0 -0
- /package/dist/theme/{constants.d.ts → deprecated/constants.d.ts} +0 -0
- /package/dist/theme/{constants.js → deprecated/constants.js} +0 -0
|
@@ -1,99 +1,96 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
4
|
-
import { TemboUIConstants, TemboUIConstantsOverrides } from './constants.js';
|
|
2
|
+
import { type ThemeConfig } from 'antd';
|
|
3
|
+
import { ColorPalette, ThemeMode } from './tokens/color.js';
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
* Theme context value
|
|
7
6
|
*/
|
|
8
|
-
export interface
|
|
9
|
-
colors:
|
|
10
|
-
constants: TemboUIConstants;
|
|
7
|
+
export interface TemboTheme {
|
|
8
|
+
colors: ColorPalette;
|
|
11
9
|
mode: ThemeMode;
|
|
12
10
|
}
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
12
|
+
* Theme provider props
|
|
13
|
+
*/
|
|
14
|
+
export interface TemboThemeProviderProps {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
/** Theme mode - 'light' or 'dark' */
|
|
17
|
+
mode?: ThemeMode;
|
|
18
|
+
/** Raw Ant Design theme overrides (advanced usage) */
|
|
19
|
+
antdThemeOverrides?: Partial<ThemeConfig>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* TemboThemeProvider
|
|
23
|
+
*
|
|
24
|
+
* Wraps your application with monochrome-first theming system.
|
|
25
|
+
* Supports seamless light/dark mode switching.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
28
|
+
* ```tsx
|
|
17
29
|
* // Basic usage
|
|
18
30
|
* <TemboThemeProvider>
|
|
19
31
|
* <App />
|
|
20
32
|
* </TemboThemeProvider>
|
|
21
33
|
*
|
|
22
|
-
*
|
|
23
|
-
* // With dark mode
|
|
34
|
+
* // Dark mode
|
|
24
35
|
* <TemboThemeProvider mode="dark">
|
|
25
36
|
* <App />
|
|
26
37
|
* </TemboThemeProvider>
|
|
27
38
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* <TemboThemeProvider
|
|
31
|
-
* colors={{
|
|
32
|
-
* primary: { main: '#007bff' },
|
|
33
|
-
* action: { main: '#28a745' }
|
|
34
|
-
* }}
|
|
35
|
-
* >
|
|
36
|
-
* <App />
|
|
37
|
-
* </TemboThemeProvider>
|
|
39
|
+
* // With state management for toggling
|
|
40
|
+
* const [mode, setMode] = useState<ThemeMode>('light');
|
|
38
41
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* <TemboThemeProvider
|
|
42
|
-
* mode="dark"
|
|
43
|
-
* colors={{ primary: { main: '#007bff' } }}
|
|
44
|
-
* constants={{ radius: { base: 8 } }}
|
|
45
|
-
* themeOverrides={{
|
|
46
|
-
* components: {
|
|
47
|
-
* Button: { controlHeight: 40 }
|
|
48
|
-
* }
|
|
49
|
-
* }}
|
|
50
|
-
* >
|
|
51
|
-
* <App />
|
|
42
|
+
* <TemboThemeProvider mode={mode}>
|
|
43
|
+
* <App onToggleTheme={() => setMode(m => m === 'light' ? 'dark' : 'light')} />
|
|
52
44
|
* </TemboThemeProvider>
|
|
53
|
-
|
|
54
|
-
export interface TemboThemeProviderProps {
|
|
55
|
-
children: React.ReactNode;
|
|
56
|
-
/** Theme mode - 'light' or 'dark' */
|
|
57
|
-
mode?: ThemeMode;
|
|
58
|
-
/** Color palette overrides - supports deep partial overrides */
|
|
59
|
-
colors?: TemboColorOverrides;
|
|
60
|
-
/** UI constants overrides - supports deep partial overrides */
|
|
61
|
-
constants?: TemboUIConstantsOverrides;
|
|
62
|
-
/** Raw Ant Design ThemeConfig overrides for advanced customization */
|
|
63
|
-
themeOverrides?: Partial<ThemeConfig>;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* TemboThemeProvider
|
|
67
|
-
*
|
|
68
|
-
* Wraps your application to provide theming through React context and Ant Design's ConfigProvider.
|
|
69
|
-
* Merges default colors/constants with host overrides and configures Ant Design components.
|
|
70
|
-
* Supports light and dark mode through the mode prop.
|
|
71
|
-
*
|
|
72
|
-
* All child components can access theme values via the useTemboTheme() hook.
|
|
45
|
+
* ```
|
|
73
46
|
*/
|
|
74
47
|
export declare const TemboThemeProvider: React.FC<TemboThemeProviderProps>;
|
|
75
48
|
/**
|
|
76
|
-
* Hook to access
|
|
77
|
-
*
|
|
78
|
-
* Returns the merged color palette, UI constants, and current theme mode.
|
|
79
|
-
* Components should always use this hook instead of importing defaults directly.
|
|
49
|
+
* Hook to access current theme
|
|
80
50
|
*
|
|
81
|
-
*
|
|
51
|
+
* Returns the active color palette and theme mode.
|
|
52
|
+
* Use this in components that need direct access to theme tokens.
|
|
82
53
|
*
|
|
83
54
|
* @example
|
|
55
|
+
* ```tsx
|
|
84
56
|
* function MyComponent() {
|
|
85
|
-
* const { colors,
|
|
57
|
+
* const { colors, mode } = useTemboTheme();
|
|
86
58
|
*
|
|
87
59
|
* return (
|
|
88
60
|
* <div style={{
|
|
89
61
|
* color: colors.text.primary,
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* backgroundColor: colors.neutral.lightest
|
|
62
|
+
* backgroundColor: colors.surface.card,
|
|
63
|
+
* padding: spacing[4],
|
|
93
64
|
* }}>
|
|
94
65
|
* Current theme: {mode}
|
|
95
66
|
* </div>
|
|
96
67
|
* );
|
|
97
68
|
* }
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* // Using secondary colors for data visualization
|
|
74
|
+
* function ProductCard({ type }: { type: string }) {
|
|
75
|
+
* const { colors } = useTemboTheme();
|
|
76
|
+
*
|
|
77
|
+
* const colorMap = {
|
|
78
|
+
* savings: colors.secondary.blue,
|
|
79
|
+
* investment: colors.secondary.purple,
|
|
80
|
+
* credit: colors.secondary.pink,
|
|
81
|
+
* };
|
|
82
|
+
*
|
|
83
|
+
* const color = colorMap[type] || colors.secondary.blue;
|
|
84
|
+
*
|
|
85
|
+
* return (
|
|
86
|
+
* <div style={{
|
|
87
|
+
* borderLeft: `4px solid ${color.main}`,
|
|
88
|
+
* backgroundColor: color.subtle,
|
|
89
|
+
* }}>
|
|
90
|
+
* Product content
|
|
91
|
+
* </div>
|
|
92
|
+
* );
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
98
95
|
*/
|
|
99
|
-
export declare const
|
|
96
|
+
export declare const useNewTemboTheme: () => TemboTheme;
|
|
@@ -1,404 +1,100 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ConfigProvider } from 'antd';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
/**
|
|
7
|
-
* Internal React context carrying the active Tembo theme
|
|
8
|
-
*/
|
|
4
|
+
import { buildAntDTheme } from './theme-config.js';
|
|
5
|
+
import { buildColorPalette } from './tokens/color.js';
|
|
9
6
|
const TemboThemeContext = React.createContext({
|
|
10
|
-
colors: buildColorPalette(),
|
|
11
|
-
constants: buildUIConstants(),
|
|
7
|
+
colors: buildColorPalette('light'),
|
|
12
8
|
mode: 'light',
|
|
13
9
|
});
|
|
14
|
-
/**
|
|
15
|
-
* Build Ant Design theme configuration from Tembo tokens
|
|
16
|
-
* Maps semantic Tembo color palette and constants to Ant Design's token system
|
|
17
|
-
*
|
|
18
|
-
* @param palette - Complete Tembo color palette
|
|
19
|
-
* @param constants - Complete Tembo UI constants
|
|
20
|
-
* @param mode - Theme mode
|
|
21
|
-
* @param overrides - Optional raw Ant Design theme overrides
|
|
22
|
-
* @returns Ant Design ThemeConfig
|
|
23
|
-
*/
|
|
24
|
-
const buildAntDThemeConfig = (palette, constants, mode, overrides) => {
|
|
25
|
-
var _a, _b;
|
|
26
|
-
const baseTokens = {
|
|
27
|
-
// Primary colors
|
|
28
|
-
colorPrimary: palette.primary.main,
|
|
29
|
-
colorPrimaryHover: palette.primary.hover,
|
|
30
|
-
colorPrimaryActive: palette.primary.active,
|
|
31
|
-
colorPrimaryBorder: palette.primary.main,
|
|
32
|
-
// Text colors
|
|
33
|
-
colorText: palette.text.primary,
|
|
34
|
-
colorTextSecondary: palette.text.secondary,
|
|
35
|
-
colorTextTertiary: palette.text.tertiary,
|
|
36
|
-
colorTextQuaternary: palette.text.quaternary,
|
|
37
|
-
colorTextDisabled: palette.text.disabled,
|
|
38
|
-
// Background colors
|
|
39
|
-
colorBgBase: palette.surface.background,
|
|
40
|
-
colorBgContainer: palette.surface.main,
|
|
41
|
-
colorBgElevated: palette.surface.elevated,
|
|
42
|
-
colorBgLayout: palette.surface.background,
|
|
43
|
-
colorBgSpotlight: palette.surface.hover,
|
|
44
|
-
// Border colors
|
|
45
|
-
colorBorder: palette.border.main,
|
|
46
|
-
colorBorderSecondary: palette.border.light,
|
|
47
|
-
colorSplit: palette.border.divider,
|
|
48
|
-
// Success colors
|
|
49
|
-
colorSuccess: palette.success.main,
|
|
50
|
-
colorSuccessBg: palette.success.bg,
|
|
51
|
-
colorSuccessBorder: palette.success.border,
|
|
52
|
-
colorSuccessText: palette.success.text,
|
|
53
|
-
// Error colors
|
|
54
|
-
colorError: palette.error.main,
|
|
55
|
-
colorErrorBg: palette.error.bg,
|
|
56
|
-
colorErrorBorder: palette.error.border,
|
|
57
|
-
colorErrorText: palette.error.text,
|
|
58
|
-
// Warning colors
|
|
59
|
-
colorWarning: palette.warning.main,
|
|
60
|
-
colorWarningBg: palette.warning.bg,
|
|
61
|
-
colorWarningBorder: palette.warning.border,
|
|
62
|
-
colorWarningText: palette.warning.text,
|
|
63
|
-
// Info colors
|
|
64
|
-
colorInfo: palette.info.main,
|
|
65
|
-
colorInfoBg: palette.info.bg,
|
|
66
|
-
colorInfoBorder: palette.info.border,
|
|
67
|
-
colorInfoText: palette.info.text,
|
|
68
|
-
// Link colors
|
|
69
|
-
colorLink: palette.utility.link,
|
|
70
|
-
colorLinkHover: palette.utility.linkHover,
|
|
71
|
-
colorLinkActive: palette.utility.linkActive,
|
|
72
|
-
// Border radius
|
|
73
|
-
borderRadius: constants.radius.base,
|
|
74
|
-
borderRadiusLG: constants.radius.lg,
|
|
75
|
-
borderRadiusSM: constants.radius.sm,
|
|
76
|
-
borderRadiusXS: 6,
|
|
77
|
-
// Shadows
|
|
78
|
-
boxShadow: constants.shadow.base,
|
|
79
|
-
boxShadowSecondary: constants.shadow.card,
|
|
80
|
-
boxShadowTertiary: constants.shadow.elevated,
|
|
81
|
-
// Typography
|
|
82
|
-
fontFamily: constants.typography.fontFamily,
|
|
83
|
-
fontSize: constants.typography.fontSize.base,
|
|
84
|
-
fontSizeHeading1: 38,
|
|
85
|
-
fontSizeHeading2: 30,
|
|
86
|
-
fontSizeHeading3: 24,
|
|
87
|
-
fontSizeHeading4: 20,
|
|
88
|
-
fontSizeHeading5: constants.typography.fontSize.lg,
|
|
89
|
-
fontWeightStrong: constants.typography.fontWeight.medium,
|
|
90
|
-
lineHeight: constants.typography.lineHeight.base,
|
|
91
|
-
lineHeightHeading1: 1.21,
|
|
92
|
-
lineHeightHeading2: 1.27,
|
|
93
|
-
lineHeightHeading3: 1.33,
|
|
94
|
-
lineHeightHeading4: 1.4,
|
|
95
|
-
lineHeightHeading5: 1.5,
|
|
96
|
-
};
|
|
97
|
-
const baseTheme = {
|
|
98
|
-
token: baseTokens,
|
|
99
|
-
// algorithm: mode === 'dark' ? 'dark' : undefined,
|
|
100
|
-
components: {
|
|
101
|
-
Button: {
|
|
102
|
-
colorPrimary: palette.components.button.primary.bg,
|
|
103
|
-
colorPrimaryHover: palette.components.button.primary.hover,
|
|
104
|
-
colorPrimaryActive: palette.action.active,
|
|
105
|
-
colorPrimaryBorder: palette.components.button.primary.bg,
|
|
106
|
-
primaryColor: palette.components.button.primary.text,
|
|
107
|
-
colorBorder: palette.components.button.default.border,
|
|
108
|
-
colorBgContainer: palette.components.button.default.bg,
|
|
109
|
-
colorText: palette.components.button.default.text,
|
|
110
|
-
defaultBg: palette.components.button.default.bg,
|
|
111
|
-
defaultBorderColor: palette.components.button.default.border,
|
|
112
|
-
defaultColor: palette.components.button.default.text,
|
|
113
|
-
primaryShadow: 'none',
|
|
114
|
-
defaultShadow: 'none',
|
|
115
|
-
dangerShadow: 'none',
|
|
116
|
-
fontWeight: constants.typography.fontWeight.medium,
|
|
117
|
-
controlHeight: 32,
|
|
118
|
-
paddingContentHorizontal: constants.spacing.lg,
|
|
119
|
-
borderRadius: constants.radius.button,
|
|
120
|
-
borderRadiusLG: constants.radius.button,
|
|
121
|
-
borderRadiusSM: constants.radius.sm + 8,
|
|
122
|
-
},
|
|
123
|
-
Input: {
|
|
124
|
-
colorBgContainer: palette.components.input.bg,
|
|
125
|
-
colorBorder: palette.components.input.border,
|
|
126
|
-
hoverBorderColor: palette.components.input.borderHover,
|
|
127
|
-
activeBorderColor: palette.components.input.borderFocus,
|
|
128
|
-
colorPrimaryHover: palette.components.input.borderFocus,
|
|
129
|
-
colorTextPlaceholder: palette.components.input.placeholder,
|
|
130
|
-
borderRadius: constants.radius.input,
|
|
131
|
-
borderRadiusLG: constants.radius.base,
|
|
132
|
-
borderRadiusSM: constants.radius.sm,
|
|
133
|
-
},
|
|
134
|
-
Select: {
|
|
135
|
-
colorBgContainer: palette.components.input.bg,
|
|
136
|
-
colorBorder: palette.components.input.border,
|
|
137
|
-
colorTextPlaceholder: palette.components.input.placeholder,
|
|
138
|
-
colorPrimaryHover: palette.action.main,
|
|
139
|
-
hoverBorderColor: palette.components.input.borderHover,
|
|
140
|
-
activeBorderColor: palette.components.input.borderFocus,
|
|
141
|
-
optionSelectedBg: palette.action.main,
|
|
142
|
-
optionSelectedColor: palette.action.contrast,
|
|
143
|
-
optionActiveBg: palette.surface.hover,
|
|
144
|
-
colorBgElevated: palette.neutral.brightest,
|
|
145
|
-
controlItemBgHover: palette.surface.hover,
|
|
146
|
-
boxShadowSecondary: constants.shadow.elevated,
|
|
147
|
-
borderRadius: constants.radius.input,
|
|
148
|
-
borderRadiusLG: constants.radius.base,
|
|
149
|
-
borderRadiusSM: constants.radius.sm,
|
|
150
|
-
},
|
|
151
|
-
Checkbox: {
|
|
152
|
-
colorPrimary: palette.action.main,
|
|
153
|
-
colorPrimaryHover: palette.action.hover,
|
|
154
|
-
colorBorder: palette.border.strong,
|
|
155
|
-
borderRadiusSM: 6,
|
|
156
|
-
},
|
|
157
|
-
Radio: {
|
|
158
|
-
colorPrimary: palette.action.main,
|
|
159
|
-
colorPrimaryHover: palette.action.hover,
|
|
160
|
-
colorBorder: palette.border.strong,
|
|
161
|
-
},
|
|
162
|
-
Switch: {
|
|
163
|
-
colorPrimary: palette.action.main,
|
|
164
|
-
colorPrimaryHover: palette.action.hover,
|
|
165
|
-
colorTextQuaternary: palette.text.quaternary,
|
|
166
|
-
},
|
|
167
|
-
Form: {
|
|
168
|
-
labelColor: palette.text.primary,
|
|
169
|
-
labelRequiredMarkColor: palette.error.main,
|
|
170
|
-
labelFontSize: constants.typography.fontSize.base,
|
|
171
|
-
itemMarginBottom: constants.spacing.lg,
|
|
172
|
-
},
|
|
173
|
-
DatePicker: {
|
|
174
|
-
colorBgContainer: palette.components.input.bg,
|
|
175
|
-
colorBorder: palette.components.input.border,
|
|
176
|
-
hoverBorderColor: palette.components.input.borderHover,
|
|
177
|
-
activeBorderColor: palette.components.input.borderFocus,
|
|
178
|
-
colorPrimary: palette.action.main,
|
|
179
|
-
borderRadius: constants.radius.input,
|
|
180
|
-
},
|
|
181
|
-
InputNumber: {
|
|
182
|
-
borderRadius: constants.radius.input,
|
|
183
|
-
},
|
|
184
|
-
Table: {
|
|
185
|
-
colorBgContainer: palette.components.table.bg,
|
|
186
|
-
headerBg: palette.components.table.headerBg,
|
|
187
|
-
headerColor: palette.components.table.headerText,
|
|
188
|
-
borderColor: palette.components.table.border,
|
|
189
|
-
headerSplitColor: palette.components.table.border,
|
|
190
|
-
rowHoverBg: palette.components.table.rowHover,
|
|
191
|
-
rowSelectedBg: palette.action.light,
|
|
192
|
-
rowSelectedHoverBg: palette.action.lighter,
|
|
193
|
-
colorText: palette.text.primary,
|
|
194
|
-
colorTextHeading: palette.text.primary,
|
|
195
|
-
borderRadius: constants.radius.base,
|
|
196
|
-
borderRadiusLG: constants.radius.lg,
|
|
197
|
-
},
|
|
198
|
-
Card: {
|
|
199
|
-
colorBgContainer: palette.surface.main,
|
|
200
|
-
colorBorder: palette.border.main,
|
|
201
|
-
colorBorderSecondary: palette.border.light,
|
|
202
|
-
boxShadowTertiary: constants.shadow.card,
|
|
203
|
-
borderRadius: constants.radius.card,
|
|
204
|
-
borderRadiusLG: constants.radius.lg + 4,
|
|
205
|
-
},
|
|
206
|
-
Statistic: {
|
|
207
|
-
contentFontSize: 24,
|
|
208
|
-
colorTextHeading: palette.text.primary,
|
|
209
|
-
},
|
|
210
|
-
Descriptions: {
|
|
211
|
-
labelBg: palette.surface.hover,
|
|
212
|
-
colorTextSecondary: palette.text.secondary,
|
|
213
|
-
itemPaddingBottom: constants.spacing.md,
|
|
214
|
-
},
|
|
215
|
-
Badge: {
|
|
216
|
-
colorError: palette.error.main,
|
|
217
|
-
colorSuccess: palette.success.main,
|
|
218
|
-
colorInfo: palette.info.main,
|
|
219
|
-
colorInfoBg: palette.info.bg,
|
|
220
|
-
borderRadiusSM: constants.radius.input,
|
|
221
|
-
},
|
|
222
|
-
Tag: {
|
|
223
|
-
colorBorder: palette.border.main,
|
|
224
|
-
defaultBg: palette.surface.hover,
|
|
225
|
-
borderRadiusSM: constants.radius.sm,
|
|
226
|
-
},
|
|
227
|
-
Timeline: {
|
|
228
|
-
dotBg: palette.surface.main,
|
|
229
|
-
tailColor: palette.border.main,
|
|
230
|
-
},
|
|
231
|
-
Alert: {
|
|
232
|
-
colorSuccessBg: palette.success.bg,
|
|
233
|
-
colorSuccessBorder: palette.success.border,
|
|
234
|
-
colorErrorBg: palette.error.bg,
|
|
235
|
-
colorErrorBorder: palette.error.border,
|
|
236
|
-
colorWarningBg: palette.warning.bg,
|
|
237
|
-
colorWarningBorder: palette.warning.border,
|
|
238
|
-
colorInfoBg: palette.info.bg,
|
|
239
|
-
colorInfoBorder: palette.info.border,
|
|
240
|
-
borderRadiusLG: constants.radius.base,
|
|
241
|
-
},
|
|
242
|
-
Modal: {
|
|
243
|
-
contentBg: palette.surface.elevated,
|
|
244
|
-
headerBg: palette.surface.elevated,
|
|
245
|
-
colorBgMask: 'rgba(0, 0, 0, 0.45)',
|
|
246
|
-
borderRadiusLG: constants.radius.lg,
|
|
247
|
-
},
|
|
248
|
-
Drawer: {
|
|
249
|
-
colorBgElevated: palette.surface.elevated,
|
|
250
|
-
colorBgMask: 'rgba(0, 0, 0, 0.45)',
|
|
251
|
-
borderRadiusLG: constants.radius.lg,
|
|
252
|
-
},
|
|
253
|
-
Notification: {
|
|
254
|
-
colorBgElevated: palette.neutral.brightest,
|
|
255
|
-
borderRadiusLG: constants.radius.base,
|
|
256
|
-
},
|
|
257
|
-
Message: {
|
|
258
|
-
contentBg: palette.neutral.brightest,
|
|
259
|
-
borderRadiusLG: constants.radius.base,
|
|
260
|
-
},
|
|
261
|
-
Spin: {
|
|
262
|
-
colorPrimary: palette.primary.main,
|
|
263
|
-
},
|
|
264
|
-
Progress: {
|
|
265
|
-
colorSuccess: palette.success.main,
|
|
266
|
-
colorError: palette.error.main,
|
|
267
|
-
defaultColor: palette.primary.main,
|
|
268
|
-
borderRadius: 100,
|
|
269
|
-
},
|
|
270
|
-
Skeleton: {
|
|
271
|
-
colorFill: palette.neutral[2],
|
|
272
|
-
colorFillContent: palette.neutral[1],
|
|
273
|
-
borderRadiusSM: constants.radius.sm,
|
|
274
|
-
},
|
|
275
|
-
Menu: {
|
|
276
|
-
itemBg: 'transparent',
|
|
277
|
-
itemColor: palette.text.primary,
|
|
278
|
-
itemHoverBg: palette.surface.hover,
|
|
279
|
-
itemSelectedBg: palette.action.lighter,
|
|
280
|
-
itemSelectedColor: palette.action.main,
|
|
281
|
-
itemActiveBg: palette.action.lighter,
|
|
282
|
-
subMenuItemBg: 'transparent',
|
|
283
|
-
darkItemBg: palette.components.sidebar.bg,
|
|
284
|
-
darkSubMenuItemBg: palette.components.sidebar.bg,
|
|
285
|
-
darkItemColor: palette.components.sidebar.text,
|
|
286
|
-
darkItemHoverBg: palette.components.sidebar.hover,
|
|
287
|
-
darkItemSelectedBg: palette.components.sidebar.selected,
|
|
288
|
-
darkItemSelectedColor: palette.primary.contrast,
|
|
289
|
-
borderRadius: constants.radius.input,
|
|
290
|
-
borderRadiusLG: constants.radius.base,
|
|
291
|
-
},
|
|
292
|
-
Breadcrumb: {
|
|
293
|
-
linkColor: palette.utility.link,
|
|
294
|
-
linkHoverColor: palette.utility.linkHover,
|
|
295
|
-
itemColor: palette.text.secondary,
|
|
296
|
-
lastItemColor: palette.text.primary,
|
|
297
|
-
separatorColor: palette.text.tertiary,
|
|
298
|
-
borderRadiusSM: 6,
|
|
299
|
-
},
|
|
300
|
-
Pagination: {
|
|
301
|
-
colorPrimary: palette.primary.main,
|
|
302
|
-
colorPrimaryHover: palette.primary.hover,
|
|
303
|
-
itemActiveBg: palette.primary.main,
|
|
304
|
-
borderRadius: constants.radius.sm,
|
|
305
|
-
},
|
|
306
|
-
Steps: {
|
|
307
|
-
colorPrimary: palette.action.main,
|
|
308
|
-
colorText: palette.text.secondary,
|
|
309
|
-
colorTextDescription: palette.text.tertiary,
|
|
310
|
-
borderRadiusSM: 100,
|
|
311
|
-
},
|
|
312
|
-
Tabs: {
|
|
313
|
-
colorPrimary: palette.action.main,
|
|
314
|
-
colorBorderSecondary: palette.border.main,
|
|
315
|
-
itemColor: palette.text.secondary,
|
|
316
|
-
itemHoverColor: palette.action.hover,
|
|
317
|
-
itemSelectedColor: palette.action.main,
|
|
318
|
-
inkBarColor: palette.action.main,
|
|
319
|
-
borderRadiusSM: constants.radius.sm,
|
|
320
|
-
},
|
|
321
|
-
Layout: {
|
|
322
|
-
colorBgBody: palette.surface.background,
|
|
323
|
-
colorBgHeader: palette.neutral.brightest,
|
|
324
|
-
colorBgTrigger: palette.components.sidebar.bg,
|
|
325
|
-
siderBg: palette.components.sidebar.bg,
|
|
326
|
-
headerBg: palette.neutral.brightest,
|
|
327
|
-
borderRadiusLG: 0,
|
|
328
|
-
},
|
|
329
|
-
Divider: {
|
|
330
|
-
colorSplit: palette.border.divider,
|
|
331
|
-
},
|
|
332
|
-
Typography: {
|
|
333
|
-
colorText: palette.text.primary,
|
|
334
|
-
colorTextSecondary: palette.text.secondary,
|
|
335
|
-
colorTextDescription: palette.text.tertiary,
|
|
336
|
-
},
|
|
337
|
-
Tooltip: {
|
|
338
|
-
colorBgSpotlight: palette.neutral.darkest,
|
|
339
|
-
colorTextLightSolid: palette.neutral.brightest,
|
|
340
|
-
borderRadius: constants.radius.sm,
|
|
341
|
-
},
|
|
342
|
-
Popover: {
|
|
343
|
-
colorBgElevated: palette.neutral.brightest,
|
|
344
|
-
borderRadiusLG: constants.radius.base,
|
|
345
|
-
},
|
|
346
|
-
Dropdown: {
|
|
347
|
-
boxShadowSecondary: constants.shadow.dropdown,
|
|
348
|
-
},
|
|
349
|
-
Calendar: {
|
|
350
|
-
colorBgContainer: palette.neutral.brightest,
|
|
351
|
-
colorPrimary: palette.action.main,
|
|
352
|
-
borderRadiusLG: constants.radius.base,
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
|
-
if (!overrides)
|
|
357
|
-
return baseTheme;
|
|
358
|
-
return Object.assign(Object.assign({}, baseTheme), { token: Object.assign(Object.assign({}, baseTheme.token), ((_a = overrides.token) !== null && _a !== void 0 ? _a : {})), components: Object.assign(Object.assign({}, baseTheme.components), ((_b = overrides.components) !== null && _b !== void 0 ? _b : {})) });
|
|
359
|
-
};
|
|
360
10
|
/**
|
|
361
11
|
* TemboThemeProvider
|
|
362
12
|
*
|
|
363
|
-
* Wraps your application
|
|
364
|
-
*
|
|
365
|
-
* Supports light and dark mode through the mode prop.
|
|
13
|
+
* Wraps your application with monochrome-first theming system.
|
|
14
|
+
* Supports seamless light/dark mode switching.
|
|
366
15
|
*
|
|
367
|
-
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic usage
|
|
19
|
+
* <TemboThemeProvider>
|
|
20
|
+
* <App />
|
|
21
|
+
* </TemboThemeProvider>
|
|
22
|
+
*
|
|
23
|
+
* // Dark mode
|
|
24
|
+
* <TemboThemeProvider mode="dark">
|
|
25
|
+
* <App />
|
|
26
|
+
* </TemboThemeProvider>
|
|
27
|
+
*
|
|
28
|
+
* // With state management for toggling
|
|
29
|
+
* const [mode, setMode] = useState<ThemeMode>('light');
|
|
30
|
+
*
|
|
31
|
+
* <TemboThemeProvider mode={mode}>
|
|
32
|
+
* <App onToggleTheme={() => setMode(m => m === 'light' ? 'dark' : 'light')} />
|
|
33
|
+
* </TemboThemeProvider>
|
|
34
|
+
* ```
|
|
368
35
|
*/
|
|
369
|
-
export const TemboThemeProvider = ({ children, mode = 'light',
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
36
|
+
export const TemboThemeProvider = ({ children, mode = 'light', antdThemeOverrides, }) => {
|
|
37
|
+
// Build color palette for current mode
|
|
38
|
+
const colors = React.useMemo(() => buildColorPalette(mode), [mode]);
|
|
39
|
+
// Build Ant Design theme configuration
|
|
40
|
+
const antdTheme = React.useMemo(() => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const baseTheme = buildAntDTheme(colors);
|
|
43
|
+
if (!antdThemeOverrides)
|
|
44
|
+
return baseTheme;
|
|
45
|
+
// Deep merge overrides
|
|
46
|
+
return Object.assign(Object.assign({}, baseTheme), { token: Object.assign(Object.assign({}, baseTheme.token), ((_a = antdThemeOverrides.token) !== null && _a !== void 0 ? _a : {})), components: Object.assign(Object.assign({}, baseTheme.components), ((_b = antdThemeOverrides.components) !== null && _b !== void 0 ? _b : {})) });
|
|
47
|
+
}, [colors, antdThemeOverrides]);
|
|
48
|
+
// Build context value
|
|
49
|
+
const contextValue = React.useMemo(() => ({ colors, mode }), [colors, mode]);
|
|
50
|
+
return (_jsx(TemboThemeContext.Provider, { value: contextValue, children: _jsx(ConfigProvider, { theme: antdTheme, children: children }) }));
|
|
379
51
|
};
|
|
380
52
|
/**
|
|
381
|
-
* Hook to access
|
|
382
|
-
*
|
|
383
|
-
* Returns the merged color palette, UI constants, and current theme mode.
|
|
384
|
-
* Components should always use this hook instead of importing defaults directly.
|
|
53
|
+
* Hook to access current theme
|
|
385
54
|
*
|
|
386
|
-
*
|
|
55
|
+
* Returns the active color palette and theme mode.
|
|
56
|
+
* Use this in components that need direct access to theme tokens.
|
|
387
57
|
*
|
|
388
58
|
* @example
|
|
59
|
+
* ```tsx
|
|
389
60
|
* function MyComponent() {
|
|
390
|
-
* const { colors,
|
|
61
|
+
* const { colors, mode } = useTemboTheme();
|
|
391
62
|
*
|
|
392
63
|
* return (
|
|
393
64
|
* <div style={{
|
|
394
65
|
* color: colors.text.primary,
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* backgroundColor: colors.neutral.lightest
|
|
66
|
+
* backgroundColor: colors.surface.card,
|
|
67
|
+
* padding: spacing[4],
|
|
398
68
|
* }}>
|
|
399
69
|
* Current theme: {mode}
|
|
400
70
|
* </div>
|
|
401
71
|
* );
|
|
402
72
|
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Using secondary colors for data visualization
|
|
78
|
+
* function ProductCard({ type }: { type: string }) {
|
|
79
|
+
* const { colors } = useTemboTheme();
|
|
80
|
+
*
|
|
81
|
+
* const colorMap = {
|
|
82
|
+
* savings: colors.secondary.blue,
|
|
83
|
+
* investment: colors.secondary.purple,
|
|
84
|
+
* credit: colors.secondary.pink,
|
|
85
|
+
* };
|
|
86
|
+
*
|
|
87
|
+
* const color = colorMap[type] || colors.secondary.blue;
|
|
88
|
+
*
|
|
89
|
+
* return (
|
|
90
|
+
* <div style={{
|
|
91
|
+
* borderLeft: `4px solid ${color.main}`,
|
|
92
|
+
* backgroundColor: color.subtle,
|
|
93
|
+
* }}>
|
|
94
|
+
* Product content
|
|
95
|
+
* </div>
|
|
96
|
+
* );
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
403
99
|
*/
|
|
404
|
-
export const
|
|
100
|
+
export const useNewTemboTheme = () => React.useContext(TemboThemeContext);
|