@busiverse/ui 0.2.12 → 0.2.13
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 +5 -0
- package/dist/{chunk-BJYKR462.js → chunk-UWSNRCQW.js} +36 -10
- package/dist/index.js +5 -1
- package/dist/theme/BusiverseThemeProvider.d.ts +12 -0
- package/dist/theme/BusiverseThemeProvider.d.ts.map +1 -0
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme-public.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -288,3 +288,8 @@ This frontend uses the shared BUSIVERSE theme contract from `@busiverse/ui`.
|
|
|
288
288
|
- App pages must not hard-code `className="dark ..."` wrappers.
|
|
289
289
|
- `vite.config.ts` must keep `loadEnv`; do not remove it while adding build or chunking improvements.
|
|
290
290
|
- Existing `VITE_*` environment variable names must not be renamed without approval.
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
## Theme contract
|
|
294
|
+
|
|
295
|
+
Use `BusiverseThemeProvider` from `@busiverse/ui/theme` in every separately deployed frontend. The only approved storage key is `busiverse-theme`, and every app must expose Light, Dark, and System through `ThemeModeSelect`. Do not create per-frontend theme storage keys or binary-only toggles.
|
|
@@ -2,32 +2,56 @@ import {
|
|
|
2
2
|
cn
|
|
3
3
|
} from "./chunk-PYZVP4NI.js";
|
|
4
4
|
|
|
5
|
+
// src/theme/BusiverseThemeProvider.tsx
|
|
6
|
+
import { ThemeProvider } from "next-themes";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var BUSIVERSE_THEME_STORAGE_KEY = "busiverse-theme";
|
|
9
|
+
function BusiverseThemeProvider({
|
|
10
|
+
children,
|
|
11
|
+
defaultTheme = "system",
|
|
12
|
+
storageKey = BUSIVERSE_THEME_STORAGE_KEY,
|
|
13
|
+
enableSystem = true,
|
|
14
|
+
disableTransitionOnChange = true
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
ThemeProvider,
|
|
18
|
+
{
|
|
19
|
+
attribute: "class",
|
|
20
|
+
defaultTheme,
|
|
21
|
+
enableSystem,
|
|
22
|
+
storageKey,
|
|
23
|
+
disableTransitionOnChange,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
5
29
|
// src/theme/ThemeModeSelect.tsx
|
|
6
30
|
import { useTheme } from "next-themes";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
8
32
|
var MODES = [
|
|
9
33
|
{
|
|
10
34
|
value: "light",
|
|
11
35
|
label: "Light",
|
|
12
36
|
title: "Use light mode",
|
|
13
37
|
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "4" }),
|
|
39
|
+
/* @__PURE__ */ jsx2("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" })
|
|
16
40
|
] })
|
|
17
41
|
},
|
|
18
42
|
{
|
|
19
43
|
value: "dark",
|
|
20
44
|
label: "Dark",
|
|
21
45
|
title: "Use dark mode",
|
|
22
|
-
icon: /* @__PURE__ */
|
|
46
|
+
icon: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx2("path", { d: "M20.99 12.43A8.5 8.5 0 1 1 11.57 3a6.5 6.5 0 0 0 9.42 9.43Z" }) })
|
|
23
47
|
},
|
|
24
48
|
{
|
|
25
49
|
value: "system",
|
|
26
50
|
label: "System",
|
|
27
51
|
title: "Follow system theme",
|
|
28
52
|
icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ jsx2("rect", { x: "3", y: "4", width: "18", height: "12", rx: "2" }),
|
|
54
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 20h8M12 16v4" })
|
|
31
55
|
] })
|
|
32
56
|
}
|
|
33
57
|
];
|
|
@@ -35,8 +59,8 @@ function ThemeModeSelect({ className, buttonClassName, label = "Theme", compact
|
|
|
35
59
|
const { theme = "system", setTheme, resolvedTheme } = useTheme();
|
|
36
60
|
const currentMode = theme === "light" || theme === "dark" || theme === "system" ? theme : "system";
|
|
37
61
|
return /* @__PURE__ */ jsxs("div", { className: cn("busiverse-theme-mode-select", className), role: "group", "aria-label": label, "data-theme-mode": currentMode, "data-resolved-theme": resolvedTheme ?? currentMode, children: [
|
|
38
|
-
!compact && /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
62
|
+
!compact && /* @__PURE__ */ jsx2("span", { className: "busiverse-theme-mode-label", children: label }),
|
|
63
|
+
/* @__PURE__ */ jsx2("div", { className: "busiverse-theme-mode-options", children: MODES.map((mode) => {
|
|
40
64
|
const active = currentMode === mode.value;
|
|
41
65
|
return /* @__PURE__ */ jsxs(
|
|
42
66
|
"button",
|
|
@@ -48,8 +72,8 @@ function ThemeModeSelect({ className, buttonClassName, label = "Theme", compact
|
|
|
48
72
|
onClick: () => setTheme(mode.value),
|
|
49
73
|
children: [
|
|
50
74
|
mode.icon,
|
|
51
|
-
!compact && /* @__PURE__ */
|
|
52
|
-
compact && /* @__PURE__ */
|
|
75
|
+
!compact && /* @__PURE__ */ jsx2("span", { children: mode.label }),
|
|
76
|
+
compact && /* @__PURE__ */ jsx2("span", { className: "busiverse-sr-only", children: mode.label })
|
|
53
77
|
]
|
|
54
78
|
},
|
|
55
79
|
mode.value
|
|
@@ -59,5 +83,7 @@ function ThemeModeSelect({ className, buttonClassName, label = "Theme", compact
|
|
|
59
83
|
}
|
|
60
84
|
|
|
61
85
|
export {
|
|
86
|
+
BUSIVERSE_THEME_STORAGE_KEY,
|
|
87
|
+
BusiverseThemeProvider,
|
|
62
88
|
ThemeModeSelect
|
|
63
89
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BUSIVERSE_THEME_STORAGE_KEY,
|
|
3
|
+
BusiverseThemeProvider,
|
|
2
4
|
ThemeModeSelect
|
|
3
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UWSNRCQW.js";
|
|
4
6
|
import {
|
|
5
7
|
Badge,
|
|
6
8
|
Card,
|
|
@@ -348,6 +350,7 @@ function UserMenu() {
|
|
|
348
350
|
export {
|
|
349
351
|
AppShell,
|
|
350
352
|
AuthSessionProvider,
|
|
353
|
+
BUSIVERSE_THEME_STORAGE_KEY,
|
|
351
354
|
Badge,
|
|
352
355
|
BusiverseBrandHead,
|
|
353
356
|
BusiverseGithubIcon,
|
|
@@ -356,6 +359,7 @@ export {
|
|
|
356
359
|
BusiverseLogo,
|
|
357
360
|
BusiverseMailIcon,
|
|
358
361
|
BusiverseSocialIcon,
|
|
362
|
+
BusiverseThemeProvider,
|
|
359
363
|
BusiverseXIcon,
|
|
360
364
|
Button,
|
|
361
365
|
Card,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare const BUSIVERSE_THEME_STORAGE_KEY = "busiverse-theme";
|
|
3
|
+
export type BusiverseThemeMode = "light" | "dark" | "system";
|
|
4
|
+
export interface BusiverseThemeProviderProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
defaultTheme?: BusiverseThemeMode;
|
|
7
|
+
storageKey?: string;
|
|
8
|
+
enableSystem?: boolean;
|
|
9
|
+
disableTransitionOnChange?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function BusiverseThemeProvider({ children, defaultTheme, storageKey, enableSystem, disableTransitionOnChange, }: BusiverseThemeProviderProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=BusiverseThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BusiverseThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/BusiverseThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,YAAuB,EACvB,UAAwC,EACxC,YAAmB,EACnB,yBAAgC,GACjC,EAAE,2BAA2B,qBAY7B"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/theme-public.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BUSIVERSE_THEME_STORAGE_KEY,
|
|
3
|
+
BusiverseThemeProvider,
|
|
2
4
|
ThemeModeSelect
|
|
3
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UWSNRCQW.js";
|
|
4
6
|
import "./chunk-PYZVP4NI.js";
|
|
5
7
|
export {
|
|
8
|
+
BUSIVERSE_THEME_STORAGE_KEY,
|
|
9
|
+
BusiverseThemeProvider,
|
|
6
10
|
ThemeModeSelect
|
|
7
11
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@busiverse/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"author": "Joel Julius Okoromi <okmarq@gmail.com> (https://busiversehq.com)",
|
|
5
5
|
"description": "BUSIVERSE shared React UI, design tokens, pricing, i18n, auth helpers, and product shell. Network-neutral core; Gateway transport is app-injected.",
|
|
6
6
|
"type": "module",
|