@wealthx/ui 0.0.0 → 1.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.
- package/.turbo/turbo-build.log +24 -0
- package/CHANGELOG.md +11 -0
- package/README.md +124 -0
- package/dist/button.d.mts +9 -0
- package/dist/button.d.ts +9 -0
- package/dist/button.js +59 -0
- package/dist/button.mjs +14 -0
- package/dist/chunk-FWCSY2DS.mjs +37 -0
- package/dist/chunk-I4E63NIC.mjs +24 -0
- package/dist/theme/index.d.mts +246 -0
- package/dist/theme/index.d.ts +246 -0
- package/dist/theme/index.js +687 -0
- package/dist/theme/index.mjs +615 -0
- package/package.json +5 -5
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(from))
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
|
|
47
|
+
// src/theme/index.ts
|
|
48
|
+
var theme_exports = {};
|
|
49
|
+
__export(theme_exports, {
|
|
50
|
+
ACCENTS: () => ACCENTS,
|
|
51
|
+
CHART_COLORS: () => CHART_COLORS,
|
|
52
|
+
FONT_FAMILY_SANS: () => FONT_FAMILY_SANS,
|
|
53
|
+
FOUNDATION_COLORS: () => FOUNDATION_COLORS,
|
|
54
|
+
GRAY_SCALE: () => GRAY_SCALE,
|
|
55
|
+
OPACITY_UTILITY: () => OPACITY_UTILITY,
|
|
56
|
+
TYPOGRAPHY: () => TYPOGRAPHY,
|
|
57
|
+
TYPOGRAPHY_BODY: () => TYPOGRAPHY_BODY,
|
|
58
|
+
TYPOGRAPHY_DISPLAY: () => TYPOGRAPHY_DISPLAY,
|
|
59
|
+
TYPOGRAPHY_EXTRA_CSS: () => TYPOGRAPHY_EXTRA_CSS,
|
|
60
|
+
TYPOGRAPHY_HEADING: () => TYPOGRAPHY_HEADING,
|
|
61
|
+
TYPOGRAPHY_LABEL: () => TYPOGRAPHY_LABEL,
|
|
62
|
+
TYPOGRAPHY_UTILITY: () => TYPOGRAPHY_UTILITY,
|
|
63
|
+
ThemeProvider: () => ThemeProvider,
|
|
64
|
+
VIEWPORT_LABELS: () => VIEWPORT_LABELS,
|
|
65
|
+
VIEWPORT_MAX_WIDTH: () => VIEWPORT_MAX_WIDTH,
|
|
66
|
+
buildCssVariables: () => buildCssVariables,
|
|
67
|
+
buildOpacityScale: () => buildOpacityScale,
|
|
68
|
+
createDesignTheme: () => createDesignTheme,
|
|
69
|
+
getContrastText: () => getContrastText,
|
|
70
|
+
getLuminance: () => getLuminance,
|
|
71
|
+
getResponsiveFontOverrides: () => getResponsiveFontOverrides,
|
|
72
|
+
getTypographyCssVars: () => getTypographyCssVars,
|
|
73
|
+
hexToRgb: () => hexToRgb,
|
|
74
|
+
rgbToCssRgbString: () => rgbToCssRgbString,
|
|
75
|
+
rgba: () => rgba
|
|
76
|
+
});
|
|
77
|
+
module.exports = __toCommonJS(theme_exports);
|
|
78
|
+
|
|
79
|
+
// src/theme/ThemeProvider.tsx
|
|
80
|
+
var import_react = require("react");
|
|
81
|
+
var import_styles2 = require("@mui/material/styles");
|
|
82
|
+
var import_CssBaseline = __toESM(require("@mui/material/CssBaseline"));
|
|
83
|
+
|
|
84
|
+
// src/theme/createDesignTheme.ts
|
|
85
|
+
var import_styles = require("@mui/material/styles");
|
|
86
|
+
|
|
87
|
+
// src/theme/constants.ts
|
|
88
|
+
var FOUNDATION_COLORS = {
|
|
89
|
+
// Brand are tenant-driven; defaults for fallback
|
|
90
|
+
brand: {
|
|
91
|
+
primary: "#33FF99",
|
|
92
|
+
secondary: "#162029"
|
|
93
|
+
},
|
|
94
|
+
text: {
|
|
95
|
+
primary: "#040D13",
|
|
96
|
+
secondary: "#4A5C6A",
|
|
97
|
+
disabled: "#9EAAB5",
|
|
98
|
+
inverse: "#FFFFFF"
|
|
99
|
+
},
|
|
100
|
+
background: {
|
|
101
|
+
primary: "#FFFFFF",
|
|
102
|
+
secondary: "#F5F8FA",
|
|
103
|
+
tertiary: "#E8EAEC",
|
|
104
|
+
elevated: "#FFFFFF"
|
|
105
|
+
},
|
|
106
|
+
border: {
|
|
107
|
+
default: "#E8EAEC",
|
|
108
|
+
focus: "#33FF99",
|
|
109
|
+
// default only; at runtime --color-border-focus uses brand primary
|
|
110
|
+
error: "#F44336"
|
|
111
|
+
},
|
|
112
|
+
state: {
|
|
113
|
+
error: "#F44336",
|
|
114
|
+
warning: "#FF9800",
|
|
115
|
+
success: "#4CAF50",
|
|
116
|
+
info: "#2196F3"
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var GRAY_SCALE = {
|
|
120
|
+
50: "#F6F6F8",
|
|
121
|
+
100: "#E8E8EB",
|
|
122
|
+
200: "#D9D9D9",
|
|
123
|
+
300: "#B9BCBF",
|
|
124
|
+
400: "#959495",
|
|
125
|
+
500: "#868686",
|
|
126
|
+
600: "#8A8F94"
|
|
127
|
+
};
|
|
128
|
+
var ACCENTS = {
|
|
129
|
+
purple: "#9747FF",
|
|
130
|
+
darkGreen: "#1E4620"
|
|
131
|
+
};
|
|
132
|
+
var OPACITY_UTILITY = {
|
|
133
|
+
disabled: 0.38,
|
|
134
|
+
hover: 0.08
|
|
135
|
+
};
|
|
136
|
+
var CHART_COLORS = {
|
|
137
|
+
background: "#F7F7F8",
|
|
138
|
+
textLabels: "#000000",
|
|
139
|
+
textTitle: "#757373",
|
|
140
|
+
grid: "#E3E3E8",
|
|
141
|
+
series: {
|
|
142
|
+
blue: "#2B72FB",
|
|
143
|
+
teal: "#64BDC6",
|
|
144
|
+
yellow: "#EECA34",
|
|
145
|
+
orange: "#FE6A35",
|
|
146
|
+
red: "#FA4B42",
|
|
147
|
+
pink: "#EE60E0",
|
|
148
|
+
purple: "#7B47E9",
|
|
149
|
+
indigo: "#5D89DF",
|
|
150
|
+
lightBlue: "#6AD1FE",
|
|
151
|
+
green: "#3FDC7E"
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var PRIMARY_OPACITY_STEPS = [0.05, 0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9];
|
|
155
|
+
var SECONDARY_OPACITY_STEPS = [0.05, 0.1, 0.2, 0.6, 0.7, 0.8, 0.9];
|
|
156
|
+
var PRIMARY_SCALE_KEYS = ["50", "100", "200", "300", "400", "600", "700", "800", "900"];
|
|
157
|
+
var SECONDARY_SCALE_KEYS = ["50", "100", "200", "600", "700", "800", "900"];
|
|
158
|
+
var DEFAULT_THEME_OPTIONS = {
|
|
159
|
+
primary: FOUNDATION_COLORS.brand.primary,
|
|
160
|
+
secondary: FOUNDATION_COLORS.brand.secondary
|
|
161
|
+
};
|
|
162
|
+
var CONTRAST_DARK = "#040D13";
|
|
163
|
+
var CONTRAST_LIGHT = "#FFFFFF";
|
|
164
|
+
|
|
165
|
+
// src/theme/typography.ts
|
|
166
|
+
var FONT_FAMILY_SANS = '"Proxima Nova", sans-serif';
|
|
167
|
+
function style(weight, size, lineHeight, extra) {
|
|
168
|
+
return __spreadValues({ fontWeight: weight, fontSize: size, lineHeight }, extra);
|
|
169
|
+
}
|
|
170
|
+
var TYPOGRAPHY_DISPLAY = {
|
|
171
|
+
large: style(700, "4rem", "4.5rem", { letterSpacing: "-0.03125rem" }),
|
|
172
|
+
medium: style(700, "3rem", "3.5rem"),
|
|
173
|
+
small: style(600, "2.125rem", "2.625rem")
|
|
174
|
+
};
|
|
175
|
+
var TYPOGRAPHY_HEADING = {
|
|
176
|
+
h1: style(700, "2rem", "2.5rem"),
|
|
177
|
+
h2: style(600, "1.75rem", "2.25rem"),
|
|
178
|
+
h3: style(600, "1.5rem", "2rem"),
|
|
179
|
+
h4: style(600, "1.3125rem", "1.75rem"),
|
|
180
|
+
h5: style(600, "1.125rem", "1.5rem"),
|
|
181
|
+
h6: style(600, "1rem", "1.375rem")
|
|
182
|
+
};
|
|
183
|
+
var TYPOGRAPHY_BODY = {
|
|
184
|
+
large: style(400, "1.125rem", "1.75rem"),
|
|
185
|
+
medium: style(400, "1rem", "1.5rem"),
|
|
186
|
+
small: style(400, "0.875rem", "1.25rem")
|
|
187
|
+
};
|
|
188
|
+
var TYPOGRAPHY_LABEL = {
|
|
189
|
+
large: style(600, "1rem", "1.25rem"),
|
|
190
|
+
medium: style(600, "0.875rem", "1.125rem"),
|
|
191
|
+
small: style(600, "0.75rem", "1rem", { letterSpacing: "0.03125rem" })
|
|
192
|
+
};
|
|
193
|
+
var TYPOGRAPHY_UTILITY = {
|
|
194
|
+
caption: style(400, "0.75rem", "1rem"),
|
|
195
|
+
overline: style(600, "0.625rem", "0.875rem", {
|
|
196
|
+
letterSpacing: "0.09375rem",
|
|
197
|
+
textTransform: "uppercase"
|
|
198
|
+
}),
|
|
199
|
+
code: style(400, "0.875rem", "1.25rem")
|
|
200
|
+
};
|
|
201
|
+
var TYPOGRAPHY = {
|
|
202
|
+
display: TYPOGRAPHY_DISPLAY,
|
|
203
|
+
heading: TYPOGRAPHY_HEADING,
|
|
204
|
+
body: TYPOGRAPHY_BODY,
|
|
205
|
+
label: TYPOGRAPHY_LABEL,
|
|
206
|
+
utility: TYPOGRAPHY_UTILITY
|
|
207
|
+
};
|
|
208
|
+
function toFontShorthand(s, family = FONT_FAMILY_SANS) {
|
|
209
|
+
var _a;
|
|
210
|
+
const f = (_a = s.fontFamily) != null ? _a : family;
|
|
211
|
+
return `${s.fontWeight} ${s.fontSize}/${s.lineHeight} ${f}`;
|
|
212
|
+
}
|
|
213
|
+
function getTypographyCssVars() {
|
|
214
|
+
var _a;
|
|
215
|
+
const family = FONT_FAMILY_SANS;
|
|
216
|
+
const entries = [];
|
|
217
|
+
entries.push(["--font-family-sans", family]);
|
|
218
|
+
for (const [key, style2] of Object.entries(TYPOGRAPHY_DISPLAY)) {
|
|
219
|
+
entries.push([`--font-display-${key}`, toFontShorthand(style2, family)]);
|
|
220
|
+
}
|
|
221
|
+
for (const [key, style2] of Object.entries(TYPOGRAPHY_HEADING)) {
|
|
222
|
+
entries.push([`--font-${key}`, toFontShorthand(style2, family)]);
|
|
223
|
+
}
|
|
224
|
+
for (const [key, style2] of Object.entries(TYPOGRAPHY_BODY)) {
|
|
225
|
+
entries.push([`--font-body-${key}`, toFontShorthand(style2, family)]);
|
|
226
|
+
}
|
|
227
|
+
for (const [key, style2] of Object.entries(TYPOGRAPHY_LABEL)) {
|
|
228
|
+
entries.push([`--font-label-${key}`, toFontShorthand(style2, family)]);
|
|
229
|
+
}
|
|
230
|
+
for (const [key, style2] of Object.entries(TYPOGRAPHY_UTILITY)) {
|
|
231
|
+
entries.push([`--font-${key}`, toFontShorthand(style2, (_a = style2.fontFamily) != null ? _a : family)]);
|
|
232
|
+
}
|
|
233
|
+
const out = {};
|
|
234
|
+
entries.forEach(([k, v]) => {
|
|
235
|
+
out[k] = v;
|
|
236
|
+
});
|
|
237
|
+
return out;
|
|
238
|
+
}
|
|
239
|
+
var TYPOGRAPHY_EXTRA_CSS = {
|
|
240
|
+
"font-display-large": { letterSpacing: "-0.03125rem" },
|
|
241
|
+
"font-label-small": { letterSpacing: "0.03125rem" },
|
|
242
|
+
"font-overline": { letterSpacing: "0.09375rem", textTransform: "uppercase" }
|
|
243
|
+
};
|
|
244
|
+
var VIEWPORT_LABELS = {
|
|
245
|
+
desktop: "Desktop (default)",
|
|
246
|
+
tablet: "Tablet (768\u20131024px)",
|
|
247
|
+
mobile: "Mobile (< 768px)"
|
|
248
|
+
};
|
|
249
|
+
var VIEWPORT_MAX_WIDTH = {
|
|
250
|
+
desktop: void 0,
|
|
251
|
+
tablet: 768,
|
|
252
|
+
mobile: 375
|
|
253
|
+
};
|
|
254
|
+
var RESPONSIVE_DISPLAY_MOBILE = {
|
|
255
|
+
displayLarge: style(700, "2.5rem", "2.8125rem", { letterSpacing: "-0.03125rem" }),
|
|
256
|
+
displayMedium: style(700, "2rem", "2.334rem"),
|
|
257
|
+
h1: style(700, "1.75rem", "2.1875rem"),
|
|
258
|
+
h2: style(600, "1.5rem", "1.93rem")
|
|
259
|
+
};
|
|
260
|
+
var RESPONSIVE_DISPLAY_TABLET = {
|
|
261
|
+
displayLarge: style(700, "3.6rem", "4.05rem", { letterSpacing: "-0.03125rem" }),
|
|
262
|
+
displayMedium: style(700, "2.7rem", "3.15rem"),
|
|
263
|
+
displaySmall: style(600, "1.9125rem", "2.3625rem")
|
|
264
|
+
};
|
|
265
|
+
function getResponsiveFontOverrides(mode) {
|
|
266
|
+
if (mode === "desktop") return {};
|
|
267
|
+
const f = FONT_FAMILY_SANS;
|
|
268
|
+
if (mode === "mobile") {
|
|
269
|
+
return {
|
|
270
|
+
"--font-display-large": toFontShorthand(RESPONSIVE_DISPLAY_MOBILE.displayLarge, f),
|
|
271
|
+
"--font-display-medium": toFontShorthand(RESPONSIVE_DISPLAY_MOBILE.displayMedium, f),
|
|
272
|
+
"--font-h1": toFontShorthand(RESPONSIVE_DISPLAY_MOBILE.h1, f),
|
|
273
|
+
"--font-h2": toFontShorthand(RESPONSIVE_DISPLAY_MOBILE.h2, f)
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
"--font-display-large": toFontShorthand(RESPONSIVE_DISPLAY_TABLET.displayLarge, f),
|
|
278
|
+
"--font-display-medium": toFontShorthand(RESPONSIVE_DISPLAY_TABLET.displayMedium, f),
|
|
279
|
+
"--font-display-small": toFontShorthand(RESPONSIVE_DISPLAY_TABLET.displaySmall, f)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// src/theme/utils.ts
|
|
284
|
+
function hexToRgb(hex) {
|
|
285
|
+
const normalized = hex.replace(/^#/, "");
|
|
286
|
+
if (normalized.length === 3) {
|
|
287
|
+
const r = parseInt(normalized[0] + normalized[0], 16);
|
|
288
|
+
const g = parseInt(normalized[1] + normalized[1], 16);
|
|
289
|
+
const b = parseInt(normalized[2] + normalized[2], 16);
|
|
290
|
+
return [r, g, b];
|
|
291
|
+
}
|
|
292
|
+
if (normalized.length === 6) {
|
|
293
|
+
const r = parseInt(normalized.slice(0, 2), 16);
|
|
294
|
+
const g = parseInt(normalized.slice(2, 4), 16);
|
|
295
|
+
const b = parseInt(normalized.slice(4, 6), 16);
|
|
296
|
+
return [r, g, b];
|
|
297
|
+
}
|
|
298
|
+
throw new Error(`Invalid hex color: ${hex}`);
|
|
299
|
+
}
|
|
300
|
+
function rgbToCssRgbString(rgb) {
|
|
301
|
+
return `${rgb[0]}, ${rgb[1]}, ${rgb[2]}`;
|
|
302
|
+
}
|
|
303
|
+
function rgba(hex, alpha) {
|
|
304
|
+
const [r, g, b] = hexToRgb(hex);
|
|
305
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
306
|
+
}
|
|
307
|
+
function buildOpacityScale(hex, steps) {
|
|
308
|
+
const [r, g, b] = hexToRgb(hex);
|
|
309
|
+
const out = {};
|
|
310
|
+
for (const { key, opacity } of steps) {
|
|
311
|
+
out[key] = `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
312
|
+
}
|
|
313
|
+
return out;
|
|
314
|
+
}
|
|
315
|
+
function linearizeSrgb(c) {
|
|
316
|
+
const n = c / 255;
|
|
317
|
+
return n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4);
|
|
318
|
+
}
|
|
319
|
+
function getLuminance(hex) {
|
|
320
|
+
const [r, g, b] = hexToRgb(hex);
|
|
321
|
+
return 0.2126 * linearizeSrgb(r) + 0.7152 * linearizeSrgb(g) + 0.0722 * linearizeSrgb(b);
|
|
322
|
+
}
|
|
323
|
+
function getContrastText(backgroundColor) {
|
|
324
|
+
const luminance = getLuminance(backgroundColor);
|
|
325
|
+
return luminance > 0.179 ? CONTRAST_DARK : CONTRAST_LIGHT;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// src/theme/createDesignTheme.ts
|
|
329
|
+
function buildPrimaryScale(primaryHex) {
|
|
330
|
+
const steps = [
|
|
331
|
+
{ key: "50", opacity: 0.05 },
|
|
332
|
+
{ key: "100", opacity: 0.1 },
|
|
333
|
+
{ key: "200", opacity: 0.2 },
|
|
334
|
+
{ key: "300", opacity: 0.3 },
|
|
335
|
+
{ key: "400", opacity: 0.4 },
|
|
336
|
+
{ key: "600", opacity: 0.6 },
|
|
337
|
+
{ key: "700", opacity: 0.7 },
|
|
338
|
+
{ key: "800", opacity: 0.8 },
|
|
339
|
+
{ key: "900", opacity: 0.9 }
|
|
340
|
+
];
|
|
341
|
+
const out = {};
|
|
342
|
+
steps.forEach(({ key, opacity }) => {
|
|
343
|
+
out[key] = rgba(primaryHex, opacity);
|
|
344
|
+
});
|
|
345
|
+
return out;
|
|
346
|
+
}
|
|
347
|
+
function buildSecondaryScale(secondaryHex) {
|
|
348
|
+
const steps = [
|
|
349
|
+
{ key: "50", opacity: 0.05 },
|
|
350
|
+
{ key: "100", opacity: 0.1 },
|
|
351
|
+
{ key: "200", opacity: 0.2 },
|
|
352
|
+
{ key: "600", opacity: 0.6 },
|
|
353
|
+
{ key: "700", opacity: 0.7 },
|
|
354
|
+
{ key: "800", opacity: 0.8 },
|
|
355
|
+
{ key: "900", opacity: 0.9 }
|
|
356
|
+
];
|
|
357
|
+
const out = {};
|
|
358
|
+
steps.forEach(({ key, opacity }) => {
|
|
359
|
+
out[key] = rgba(secondaryHex, opacity);
|
|
360
|
+
});
|
|
361
|
+
return out;
|
|
362
|
+
}
|
|
363
|
+
function buildPrimaryScalePalette(primaryHex) {
|
|
364
|
+
const scale = buildPrimaryScale(primaryHex);
|
|
365
|
+
return {
|
|
366
|
+
50: scale["50"],
|
|
367
|
+
100: scale["100"],
|
|
368
|
+
200: scale["200"],
|
|
369
|
+
300: scale["300"],
|
|
370
|
+
400: scale["400"],
|
|
371
|
+
500: primaryHex,
|
|
372
|
+
600: scale["600"],
|
|
373
|
+
700: scale["700"],
|
|
374
|
+
800: scale["800"],
|
|
375
|
+
900: scale["900"],
|
|
376
|
+
main: primaryHex,
|
|
377
|
+
light: scale["200"],
|
|
378
|
+
dark: scale["800"],
|
|
379
|
+
contrastText: getContrastText(primaryHex)
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function buildSecondaryScalePalette(secondaryHex) {
|
|
383
|
+
const scale = buildSecondaryScale(secondaryHex);
|
|
384
|
+
return {
|
|
385
|
+
50: scale["50"],
|
|
386
|
+
100: scale["100"],
|
|
387
|
+
200: scale["200"],
|
|
388
|
+
600: scale["600"],
|
|
389
|
+
700: scale["700"],
|
|
390
|
+
800: scale["800"],
|
|
391
|
+
900: scale["900"],
|
|
392
|
+
main: secondaryHex,
|
|
393
|
+
light: scale["200"],
|
|
394
|
+
dark: scale["800"],
|
|
395
|
+
contrastText: getContrastText(secondaryHex)
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
function createDesignTheme(config) {
|
|
399
|
+
const { primary, secondary } = config;
|
|
400
|
+
const foundation = FOUNDATION_COLORS;
|
|
401
|
+
const palette = {
|
|
402
|
+
mode: "light",
|
|
403
|
+
primary: buildPrimaryScalePalette(primary),
|
|
404
|
+
secondary: buildSecondaryScalePalette(secondary),
|
|
405
|
+
error: {
|
|
406
|
+
main: FOUNDATION_COLORS.state.error
|
|
407
|
+
},
|
|
408
|
+
warning: {
|
|
409
|
+
main: FOUNDATION_COLORS.state.warning
|
|
410
|
+
},
|
|
411
|
+
success: {
|
|
412
|
+
main: FOUNDATION_COLORS.state.success
|
|
413
|
+
},
|
|
414
|
+
info: {
|
|
415
|
+
main: FOUNDATION_COLORS.state.info
|
|
416
|
+
},
|
|
417
|
+
background: {
|
|
418
|
+
default: foundation.background.primary,
|
|
419
|
+
paper: foundation.background.elevated
|
|
420
|
+
},
|
|
421
|
+
text: {
|
|
422
|
+
primary: foundation.text.primary,
|
|
423
|
+
secondary: foundation.text.secondary,
|
|
424
|
+
disabled: foundation.text.disabled
|
|
425
|
+
},
|
|
426
|
+
grey: GRAY_SCALE,
|
|
427
|
+
divider: foundation.border.default
|
|
428
|
+
};
|
|
429
|
+
const themeOptions = {
|
|
430
|
+
palette,
|
|
431
|
+
typography: {
|
|
432
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
433
|
+
h1: {
|
|
434
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
435
|
+
fontWeight: TYPOGRAPHY_HEADING.h1.fontWeight,
|
|
436
|
+
fontSize: TYPOGRAPHY_HEADING.h1.fontSize,
|
|
437
|
+
lineHeight: TYPOGRAPHY_HEADING.h1.lineHeight
|
|
438
|
+
},
|
|
439
|
+
h2: {
|
|
440
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
441
|
+
fontWeight: TYPOGRAPHY_HEADING.h2.fontWeight,
|
|
442
|
+
fontSize: TYPOGRAPHY_HEADING.h2.fontSize,
|
|
443
|
+
lineHeight: TYPOGRAPHY_HEADING.h2.lineHeight
|
|
444
|
+
},
|
|
445
|
+
h3: {
|
|
446
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
447
|
+
fontWeight: TYPOGRAPHY_HEADING.h3.fontWeight,
|
|
448
|
+
fontSize: TYPOGRAPHY_HEADING.h3.fontSize,
|
|
449
|
+
lineHeight: TYPOGRAPHY_HEADING.h3.lineHeight
|
|
450
|
+
},
|
|
451
|
+
h4: {
|
|
452
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
453
|
+
fontWeight: TYPOGRAPHY_HEADING.h4.fontWeight,
|
|
454
|
+
fontSize: TYPOGRAPHY_HEADING.h4.fontSize,
|
|
455
|
+
lineHeight: TYPOGRAPHY_HEADING.h4.lineHeight
|
|
456
|
+
},
|
|
457
|
+
h5: {
|
|
458
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
459
|
+
fontWeight: TYPOGRAPHY_HEADING.h5.fontWeight,
|
|
460
|
+
fontSize: TYPOGRAPHY_HEADING.h5.fontSize,
|
|
461
|
+
lineHeight: TYPOGRAPHY_HEADING.h5.lineHeight
|
|
462
|
+
},
|
|
463
|
+
h6: {
|
|
464
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
465
|
+
fontWeight: TYPOGRAPHY_HEADING.h6.fontWeight,
|
|
466
|
+
fontSize: TYPOGRAPHY_HEADING.h6.fontSize,
|
|
467
|
+
lineHeight: TYPOGRAPHY_HEADING.h6.lineHeight
|
|
468
|
+
},
|
|
469
|
+
body1: {
|
|
470
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
471
|
+
fontWeight: TYPOGRAPHY_BODY.medium.fontWeight,
|
|
472
|
+
fontSize: TYPOGRAPHY_BODY.medium.fontSize,
|
|
473
|
+
lineHeight: TYPOGRAPHY_BODY.medium.lineHeight
|
|
474
|
+
},
|
|
475
|
+
body2: {
|
|
476
|
+
fontFamily: FONT_FAMILY_SANS,
|
|
477
|
+
fontWeight: TYPOGRAPHY_BODY.small.fontWeight,
|
|
478
|
+
fontSize: TYPOGRAPHY_BODY.small.fontSize,
|
|
479
|
+
lineHeight: TYPOGRAPHY_BODY.small.lineHeight
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
components: {
|
|
483
|
+
MuiButton: {
|
|
484
|
+
styleOverrides: {
|
|
485
|
+
root: {
|
|
486
|
+
textTransform: "none",
|
|
487
|
+
borderRadius: 0
|
|
488
|
+
},
|
|
489
|
+
outlined: {
|
|
490
|
+
color: CONTRAST_DARK,
|
|
491
|
+
"& .MuiButton-startIcon, & .MuiButton-endIcon": {
|
|
492
|
+
color: CONTRAST_DARK
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
sizeSmall: {
|
|
496
|
+
height: 32,
|
|
497
|
+
minHeight: 32
|
|
498
|
+
},
|
|
499
|
+
sizeMedium: {
|
|
500
|
+
height: 40,
|
|
501
|
+
minHeight: 40
|
|
502
|
+
},
|
|
503
|
+
sizeLarge: {
|
|
504
|
+
height: 48,
|
|
505
|
+
minHeight: 48
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
MuiCssBaseline: {
|
|
510
|
+
styleOverrides: {
|
|
511
|
+
":root": {
|
|
512
|
+
"--theme-primary": primary,
|
|
513
|
+
"--theme-secondary": secondary
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
return (0, import_styles.createTheme)(themeOptions);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/theme/buildCssVariables.ts
|
|
523
|
+
function entriesToVars(prefix, obj) {
|
|
524
|
+
const out = {};
|
|
525
|
+
for (const k of Object.keys(obj)) {
|
|
526
|
+
out[prefix + k] = obj[k];
|
|
527
|
+
}
|
|
528
|
+
return out;
|
|
529
|
+
}
|
|
530
|
+
function buildPrimaryScale2(primaryHex) {
|
|
531
|
+
const steps = PRIMARY_SCALE_KEYS.map((key, i) => ({
|
|
532
|
+
key,
|
|
533
|
+
opacity: PRIMARY_OPACITY_STEPS[i]
|
|
534
|
+
}));
|
|
535
|
+
const [r, g, b] = hexToRgb(primaryHex);
|
|
536
|
+
const out = {};
|
|
537
|
+
steps.forEach(({ key, opacity }) => {
|
|
538
|
+
out[key] = `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
539
|
+
});
|
|
540
|
+
return out;
|
|
541
|
+
}
|
|
542
|
+
function buildSecondaryScale2(secondaryHex) {
|
|
543
|
+
const steps = SECONDARY_SCALE_KEYS.map((key, i) => ({
|
|
544
|
+
key,
|
|
545
|
+
opacity: SECONDARY_OPACITY_STEPS[i]
|
|
546
|
+
}));
|
|
547
|
+
const [r, g, b] = hexToRgb(secondaryHex);
|
|
548
|
+
const out = {};
|
|
549
|
+
steps.forEach(({ key, opacity }) => {
|
|
550
|
+
out[key] = `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
551
|
+
});
|
|
552
|
+
return out;
|
|
553
|
+
}
|
|
554
|
+
function buildCssVariables(options) {
|
|
555
|
+
var _a;
|
|
556
|
+
const { primary, secondary } = options;
|
|
557
|
+
const foundation = FOUNDATION_COLORS;
|
|
558
|
+
const primaryRgb = hexToRgb(primary);
|
|
559
|
+
const secondaryRgb = hexToRgb(secondary);
|
|
560
|
+
const primaryScale = buildPrimaryScale2(primary);
|
|
561
|
+
const secondaryScale = buildSecondaryScale2(secondary);
|
|
562
|
+
return __spreadValues(__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues({
|
|
563
|
+
// RGB triplets for opacity-based usage
|
|
564
|
+
"--primary-rgb": rgbToCssRgbString(primaryRgb),
|
|
565
|
+
"--secondary-rgb": rgbToCssRgbString(secondaryRgb),
|
|
566
|
+
// Brand (tenant)
|
|
567
|
+
"--color-brand-primary": primary,
|
|
568
|
+
"--color-brand-secondary": secondary
|
|
569
|
+
}, entriesToVars("--primary-", primaryScale)), entriesToVars("--secondary-", secondaryScale)), {
|
|
570
|
+
// Foundation – text
|
|
571
|
+
"--color-text-primary": foundation.text.primary,
|
|
572
|
+
"--color-text-secondary": foundation.text.secondary,
|
|
573
|
+
"--color-text-disabled": foundation.text.disabled,
|
|
574
|
+
"--color-text-inverse": foundation.text.inverse,
|
|
575
|
+
// Foundation – background
|
|
576
|
+
"--color-background-primary": foundation.background.primary,
|
|
577
|
+
"--color-background-secondary": foundation.background.secondary,
|
|
578
|
+
"--color-background-tertiary": foundation.background.tertiary,
|
|
579
|
+
"--color-background-elevated": foundation.background.elevated,
|
|
580
|
+
// Foundation – border (focus = brand primary for tenant theming)
|
|
581
|
+
"--color-border-default": foundation.border.default,
|
|
582
|
+
"--color-border-focus": primary,
|
|
583
|
+
"--color-border-error": foundation.border.error,
|
|
584
|
+
// Foundation – state
|
|
585
|
+
"--color-state-error": FOUNDATION_COLORS.state.error,
|
|
586
|
+
"--color-state-warning": FOUNDATION_COLORS.state.warning,
|
|
587
|
+
"--color-state-success": FOUNDATION_COLORS.state.success,
|
|
588
|
+
"--color-state-info": FOUNDATION_COLORS.state.info
|
|
589
|
+
}), entriesToVars("--gray-", GRAY_SCALE)), {
|
|
590
|
+
// Accents
|
|
591
|
+
"--accent-purple": ACCENTS.purple,
|
|
592
|
+
"--accent-dark-green": ACCENTS.darkGreen,
|
|
593
|
+
// Opacity utility
|
|
594
|
+
"--opacity-disabled": String(OPACITY_UTILITY.disabled),
|
|
595
|
+
"--opacity-hover": String(OPACITY_UTILITY.hover),
|
|
596
|
+
// Semantic aliases (component-level tokens that alias foundation/extended)
|
|
597
|
+
"--input-background": foundation.background.primary,
|
|
598
|
+
"--input-border": foundation.border.default,
|
|
599
|
+
"--input-border-focus": foundation.border.focus,
|
|
600
|
+
"--input-border-error": foundation.border.error,
|
|
601
|
+
"--input-text": foundation.text.primary,
|
|
602
|
+
"--input-placeholder": foundation.text.disabled,
|
|
603
|
+
"--card-background": foundation.background.elevated,
|
|
604
|
+
"--card-border": foundation.border.default,
|
|
605
|
+
"--navbar-background": foundation.background.elevated,
|
|
606
|
+
"--navbar-text": foundation.text.primary,
|
|
607
|
+
"--navbar-text-active": primary,
|
|
608
|
+
"--navbar-border": foundation.border.default,
|
|
609
|
+
"--link-default": primary,
|
|
610
|
+
"--link-hover": (_a = primaryScale["400"]) != null ? _a : rgba(primary, 0.4),
|
|
611
|
+
"--modal-background": foundation.background.elevated,
|
|
612
|
+
"--tooltip-background": secondary,
|
|
613
|
+
"--tooltip-text": foundation.text.inverse,
|
|
614
|
+
"--divider": foundation.border.default,
|
|
615
|
+
// Charts
|
|
616
|
+
"--chart-background": CHART_COLORS.background,
|
|
617
|
+
"--chart-text-labels": CHART_COLORS.textLabels,
|
|
618
|
+
"--chart-text-title": CHART_COLORS.textTitle,
|
|
619
|
+
"--chart-grid": CHART_COLORS.grid,
|
|
620
|
+
"--chart-series-blue": CHART_COLORS.series.blue,
|
|
621
|
+
"--chart-series-teal": CHART_COLORS.series.teal,
|
|
622
|
+
"--chart-series-yellow": CHART_COLORS.series.yellow,
|
|
623
|
+
"--chart-series-orange": CHART_COLORS.series.orange,
|
|
624
|
+
"--chart-series-red": CHART_COLORS.series.red,
|
|
625
|
+
"--chart-series-pink": CHART_COLORS.series.pink,
|
|
626
|
+
"--chart-series-purple": CHART_COLORS.series.purple,
|
|
627
|
+
"--chart-series-indigo": CHART_COLORS.series.indigo,
|
|
628
|
+
"--chart-series-light-blue": CHART_COLORS.series.lightBlue,
|
|
629
|
+
"--chart-series-green": CHART_COLORS.series.green
|
|
630
|
+
}), getTypographyCssVars());
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// src/theme/ThemeProvider.tsx
|
|
634
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
635
|
+
function ThemeProvider({
|
|
636
|
+
children,
|
|
637
|
+
primary = DEFAULT_THEME_OPTIONS.primary,
|
|
638
|
+
secondary = DEFAULT_THEME_OPTIONS.secondary,
|
|
639
|
+
injectCssVariables = true
|
|
640
|
+
}) {
|
|
641
|
+
const options = (0, import_react.useMemo)(() => ({ primary, secondary }), [primary, secondary]);
|
|
642
|
+
const theme = (0, import_react.useMemo)(() => createDesignTheme(options), [options]);
|
|
643
|
+
const cssVars = (0, import_react.useMemo)(() => buildCssVariables(options), [options]);
|
|
644
|
+
const styleId = (0, import_react.useId)().replace(/:/g, "-");
|
|
645
|
+
const styleContent = (0, import_react.useMemo)(() => {
|
|
646
|
+
if (!injectCssVariables) return "";
|
|
647
|
+
const declarations = Object.entries(cssVars).map(([key, value]) => `${key}: ${value};`).join("\n ");
|
|
648
|
+
return `:root {
|
|
649
|
+
${declarations}
|
|
650
|
+
}`;
|
|
651
|
+
}, [cssVars, injectCssVariables]);
|
|
652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles2.ThemeProvider, { theme, children: [
|
|
653
|
+
injectCssVariables && styleContent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { id: `theme-vars-${styleId}`, "data-theme-vars": true, children: styleContent }) : null,
|
|
654
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CssBaseline.default, {}),
|
|
655
|
+
children
|
|
656
|
+
] });
|
|
657
|
+
}
|
|
658
|
+
ThemeProvider.displayName = "ThemeProvider";
|
|
659
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
660
|
+
0 && (module.exports = {
|
|
661
|
+
ACCENTS,
|
|
662
|
+
CHART_COLORS,
|
|
663
|
+
FONT_FAMILY_SANS,
|
|
664
|
+
FOUNDATION_COLORS,
|
|
665
|
+
GRAY_SCALE,
|
|
666
|
+
OPACITY_UTILITY,
|
|
667
|
+
TYPOGRAPHY,
|
|
668
|
+
TYPOGRAPHY_BODY,
|
|
669
|
+
TYPOGRAPHY_DISPLAY,
|
|
670
|
+
TYPOGRAPHY_EXTRA_CSS,
|
|
671
|
+
TYPOGRAPHY_HEADING,
|
|
672
|
+
TYPOGRAPHY_LABEL,
|
|
673
|
+
TYPOGRAPHY_UTILITY,
|
|
674
|
+
ThemeProvider,
|
|
675
|
+
VIEWPORT_LABELS,
|
|
676
|
+
VIEWPORT_MAX_WIDTH,
|
|
677
|
+
buildCssVariables,
|
|
678
|
+
buildOpacityScale,
|
|
679
|
+
createDesignTheme,
|
|
680
|
+
getContrastText,
|
|
681
|
+
getLuminance,
|
|
682
|
+
getResponsiveFontOverrides,
|
|
683
|
+
getTypographyCssVars,
|
|
684
|
+
hexToRgb,
|
|
685
|
+
rgbToCssRgbString,
|
|
686
|
+
rgba
|
|
687
|
+
});
|