@wealthx/ui 0.0.0 → 0.0.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.
- package/README.md +124 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @wealthx/ui
|
|
2
|
+
|
|
3
|
+
UI components and design system theme for WealthX. Built on [MUI (Material UI)](https://mui.com/) with a tenant-based color system, typography tokens, and CSS variables.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @wealthx/ui @mui/material @emotion/react @emotion/styled react react-dom
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependencies:** `react` and `react-dom` (^18.3.1). MUI packages are listed as dependencies; ensure your app satisfies them or install as needed.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
Wrap your app with `ThemeProvider` and use design system components:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { ThemeProvider } from "@wealthx/ui/theme";
|
|
19
|
+
import { Button } from "@wealthx/ui/button";
|
|
20
|
+
|
|
21
|
+
function App() {
|
|
22
|
+
return (
|
|
23
|
+
<ThemeProvider primary="#33FF99" secondary="#162029">
|
|
24
|
+
<Button variant="contained" color="primary">
|
|
25
|
+
Primary action
|
|
26
|
+
</Button>
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`ThemeProvider` applies the MUI theme and injects design-system CSS variables. `primary` and `secondary` are optional; omit them to use the default brand colors.
|
|
33
|
+
|
|
34
|
+
## Exports
|
|
35
|
+
|
|
36
|
+
| Specifier | Description |
|
|
37
|
+
|---------------------|--------------------------------------|
|
|
38
|
+
| `@wealthx/ui/button` | Button component (MUI Button wrapper) |
|
|
39
|
+
| `@wealthx/ui/theme` | Theme provider, theme factory, tokens, typography, utilities |
|
|
40
|
+
|
|
41
|
+
## Theme
|
|
42
|
+
|
|
43
|
+
### ThemeProvider
|
|
44
|
+
|
|
45
|
+
Provides the MUI theme and design-system CSS variables. Use it once at the root (e.g. `App`).
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { ThemeProvider } from "@wealthx/ui/theme";
|
|
49
|
+
|
|
50
|
+
<ThemeProvider
|
|
51
|
+
primary="#33FF99" // optional; tenant primary
|
|
52
|
+
secondary="#162029" // optional; tenant secondary
|
|
53
|
+
injectCssVariables={true} // default: inject :root CSS variables
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</ThemeProvider>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### createDesignTheme
|
|
60
|
+
|
|
61
|
+
Build an MUI theme with the design system palette (e.g. for custom providers or testing):
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { createDesignTheme } from "@wealthx/ui/theme";
|
|
65
|
+
|
|
66
|
+
const theme = createDesignTheme({ primary: "#33FF99", secondary: "#162029" });
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### CSS variables
|
|
70
|
+
|
|
71
|
+
When using `ThemeProvider`, the library injects CSS variables such as:
|
|
72
|
+
|
|
73
|
+
- **Brand:** `--color-brand-primary`, `--color-brand-secondary`
|
|
74
|
+
- **Text:** `--color-text-primary`, `--color-text-secondary`, `--color-text-disabled`, `--color-text-inverse`
|
|
75
|
+
- **Background:** `--color-background-primary`, `--color-background-secondary`, `--color-background-tertiary`, `--color-background-elevated`
|
|
76
|
+
- **Borders:** `--color-border-default`, `--color-border-focus`, `--color-border-error`
|
|
77
|
+
- **Primary scale:** `--primary-50` … `--primary-900` (derived from `primary`)
|
|
78
|
+
|
|
79
|
+
Use them in your styles or MUI `sx` (e.g. `color: "var(--color-text-primary)"`).
|
|
80
|
+
|
|
81
|
+
### Tokens and utilities
|
|
82
|
+
|
|
83
|
+
From `@wealthx/ui/theme` you can also use:
|
|
84
|
+
|
|
85
|
+
- **Colors:** `FOUNDATION_COLORS`, `GRAY_SCALE`, `ACCENTS`, `CHART_COLORS`, `OPACITY_UTILITY`
|
|
86
|
+
- **Typography:** `TYPOGRAPHY`, `getTypographyCssVars`, `getResponsiveFontOverrides`, `VIEWPORT_LABELS`, `VIEWPORT_MAX_WIDTH`, etc.
|
|
87
|
+
- **Utils:** `getContrastText`, `hexToRgb`, `rgba`, `getLuminance`, `buildOpacityScale`, and related helpers
|
|
88
|
+
|
|
89
|
+
## Components
|
|
90
|
+
|
|
91
|
+
### Button
|
|
92
|
+
|
|
93
|
+
MUI `Button` re-exported for consistent use with the design theme. Supports all MUI Button props (`variant`, `color`, `size`, `disabled`, `loading`, `startIcon`, `endIcon`, etc.).
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { Button } from "@wealthx/ui/button";
|
|
97
|
+
|
|
98
|
+
<Button variant="contained" color="primary">Save</Button>
|
|
99
|
+
<Button variant="outlined" color="secondary" startIcon={<SendIcon />}>Send</Button>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Building
|
|
103
|
+
|
|
104
|
+
From the repo root:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
yarn build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This compiles the package with [tsup](https://tsup.egoist.dev/) into `dist/` (ESM and CJS). Types are emitted (`.d.ts` / `.d.mts`).
|
|
111
|
+
|
|
112
|
+
## Documentation
|
|
113
|
+
|
|
114
|
+
The design system is documented in Storybook in the `apps/docs` app. From the repo root:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
yarn dev
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Then open the Storybook URL (e.g. `http://localhost:6006`) for components, colors, and typography.
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wealthx/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./button": {
|
|
8
|
-
"types": "./
|
|
8
|
+
"types": "./dist/button.d.ts",
|
|
9
9
|
"import": "./dist/button.mjs",
|
|
10
10
|
"require": "./dist/button.js"
|
|
11
11
|
},
|
|
12
12
|
"./theme": {
|
|
13
|
-
"types": "./
|
|
14
|
-
"import": "./dist/theme.mjs",
|
|
15
|
-
"require": "./dist/theme.js"
|
|
13
|
+
"types": "./dist/theme/index.d.ts",
|
|
14
|
+
"import": "./dist/theme/index.mjs",
|
|
15
|
+
"require": "./dist/theme/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|