orbcafe-ui 2.0.0 → 2.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/BRAND_THEMING.md +45 -0
- package/MIGRATION_V2.md +161 -0
- package/README.md +8 -10
- package/bin/lib/theme-core.mjs +446 -0
- package/bin/orbcafe-theme.mjs +169 -0
- package/dist/index.css +1 -0
- package/dist/index.d.mts +59 -4
- package/dist/index.d.ts +59 -4
- package/dist/index.js +17 -17
- package/dist/index.mjs +16 -16
- package/dist/orbis.css +249 -322
- package/dist/themes/nvidia.css +36 -0
- package/dist/themes/nvidia.tokens.mjs +117 -0
- package/dist/themes/orbis/fonts/montserrat-300.otf +0 -0
- package/dist/themes/orbis/fonts/montserrat-500.otf +0 -0
- package/dist/themes/orbis/fonts/montserrat-600.otf +0 -0
- package/dist/themes/orbis/fonts/montserrat-700.otf +0 -0
- package/dist/themes/orbis.css +62 -0
- package/dist/themes/orbis.tokens.mjs +117 -0
- package/package.json +23 -7
package/BRAND_THEMING.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Brand Theming
|
|
2
|
+
|
|
3
|
+
ORBCAFE UI ships with the ORBIS theme as its default. Open Design is optional:
|
|
4
|
+
it is only needed when a project wants to discover and apply brand presets stored
|
|
5
|
+
on the developer's machine.
|
|
6
|
+
|
|
7
|
+
## Built-in theme packs
|
|
8
|
+
|
|
9
|
+
Projects without Open Design can import the packaged themes directly. Import the
|
|
10
|
+
base styles first, then one theme override:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import 'orbcafe-ui/styles.css';
|
|
14
|
+
import 'orbcafe-ui/themes/orbis.css';
|
|
15
|
+
// or: import 'orbcafe-ui/themes/nvidia.css';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The ORBIS theme is already included by `orbcafe-ui/styles.css`; importing its
|
|
19
|
+
theme pack is useful when an application wants the packaged Montserrat font files
|
|
20
|
+
and explicit ORBIS overrides.
|
|
21
|
+
|
|
22
|
+
## Open Design presets
|
|
23
|
+
|
|
24
|
+
The optional CLI discovers local Open Design systems and generates a project-local
|
|
25
|
+
theme pack containing CSS variables, fonts, and JavaScript tokens:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx orbcafe-theme list --json
|
|
29
|
+
npx orbcafe-theme apply <slug> --json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Import the generated CSS after the base styles:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import 'orbcafe-ui/styles.css';
|
|
36
|
+
import './orbcafe-theme/<slug>.css';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Use the generated `.tokens.mjs` file for charts or canvas code that cannot read
|
|
40
|
+
CSS custom properties. If Open Design is unavailable, the default ORBIS theme and
|
|
41
|
+
the built-in theme packs remain available; no runtime connection to Open Design is
|
|
42
|
+
required by ORBCAFE components.
|
|
43
|
+
|
|
44
|
+
Only one brand override should be active at a time. Regenerate generated files
|
|
45
|
+
with the CLI when the source design system changes instead of editing them by hand.
|
package/MIGRATION_V2.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Migrating ORBCAFE UI from v1 to v2
|
|
2
|
+
|
|
3
|
+
`orbcafe-ui@2` is a breaking major release. It replaces the MUI-based implementation with the ORBIS design system, changes the theme integration, and requires host-side Tailwind configuration. Upgrade in a branch and verify the application before releasing it.
|
|
4
|
+
|
|
5
|
+
## Supported baseline
|
|
6
|
+
|
|
7
|
+
- Next.js 13-16. The canonical setup is Next.js App Router.
|
|
8
|
+
- React 18 or 19.
|
|
9
|
+
- Tailwind CSS 4.
|
|
10
|
+
- Import public APIs only from `orbcafe-ui`.
|
|
11
|
+
|
|
12
|
+
## 1. Upgrade dependencies
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install orbcafe-ui@^2
|
|
16
|
+
npm install -D tailwindcss@^4 @tailwindcss/postcss@^4
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
ORBCAFE UI v2 does not require `@mui/*`, `@emotion/*`, `lucide-react`, or `next-themes`. Remove them only when the host application does not use them for anything else.
|
|
20
|
+
|
|
21
|
+
## 2. Configure PostCSS and global CSS
|
|
22
|
+
|
|
23
|
+
Use the Tailwind v4 PostCSS plugin:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
// postcss.config.mjs
|
|
27
|
+
const config = {
|
|
28
|
+
plugins: {
|
|
29
|
+
"@tailwindcss/postcss": {},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default config;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Import the ORBIS stylesheet once and scan the published library output. Adjust the relative `@source` path if the global CSS file is nested differently.
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
/* app/globals.css */
|
|
40
|
+
@import "tailwindcss";
|
|
41
|
+
@import "orbcafe-ui/styles.css";
|
|
42
|
+
@source "../node_modules/orbcafe-ui/dist";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Without both the stylesheet import and source scan, components may render without their complete layout and interaction styles.
|
|
46
|
+
|
|
47
|
+
## 3. Configure application providers
|
|
48
|
+
|
|
49
|
+
Mount `GlobalMessage` once. Use `OrbisModeProvider` at the application layer when standalone ORBCAFE surfaces or the host design system need the same mode.
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
'use client';
|
|
53
|
+
|
|
54
|
+
import { GlobalMessage, OrbisModeProvider } from 'orbcafe-ui';
|
|
55
|
+
|
|
56
|
+
export function Providers({ children }: { children: React.ReactNode }) {
|
|
57
|
+
return (
|
|
58
|
+
<OrbisModeProvider mode="system">
|
|
59
|
+
{children}
|
|
60
|
+
<GlobalMessage />
|
|
61
|
+
</OrbisModeProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`CAppPageLayout` renders its own ORBIS mode provider. In the next v2 patch it also accepts controlled `mode`, `defaultMode`, and `onModeChange` props, allowing a host theme store to synchronize it directly.
|
|
67
|
+
|
|
68
|
+
## 4. Use the standard application shell
|
|
69
|
+
|
|
70
|
+
Prefer `CAppPageLayout` over manually combining `CAppHeader`, `NavigationIsland`, and `usePageLayout`.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
'use client';
|
|
74
|
+
|
|
75
|
+
import { useState } from 'react';
|
|
76
|
+
import {
|
|
77
|
+
CAppPageLayout,
|
|
78
|
+
type OrbModeSetting,
|
|
79
|
+
type TreeMenuItem,
|
|
80
|
+
} from 'orbcafe-ui';
|
|
81
|
+
|
|
82
|
+
const menuData: TreeMenuItem[] = [
|
|
83
|
+
{
|
|
84
|
+
id: 'reports',
|
|
85
|
+
title: 'Reports',
|
|
86
|
+
pinnable: false,
|
|
87
|
+
children: [
|
|
88
|
+
{ id: 'sales-report', title: 'Sales Report', href: '/reports/sales' },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
export function AppShell({ children }: { children: React.ReactNode }) {
|
|
94
|
+
const [mode, setMode] = useState<OrbModeSetting>('system');
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<CAppPageLayout
|
|
98
|
+
appId="customer-portal"
|
|
99
|
+
appTitle="Customer Portal"
|
|
100
|
+
menuData={menuData}
|
|
101
|
+
mode={mode}
|
|
102
|
+
onModeChange={setMode}
|
|
103
|
+
logo={<img src="/brand/logo.svg" alt="Customer Portal" width={36} height={36} />}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</CAppPageLayout>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The `appId` prop is available in the next v2 patch. It creates stable application-wide storage keys without depending on a localized or page-specific `appTitle`. On v2.0.0, pass one explicit `navigationPinStorageKey` everywhere instead.
|
|
112
|
+
|
|
113
|
+
## 5. Stabilize navigation persistence
|
|
114
|
+
|
|
115
|
+
- Treat every `TreeMenuItem.id` as a durable identifier. Do not translate or regenerate it.
|
|
116
|
+
- Give navigable leaves a stable `href` or `appurl`.
|
|
117
|
+
- Set `pinnable: false` on group and synthetic nodes.
|
|
118
|
+
- Use one `appId` or one `navigationPinStorageKey` for the entire application.
|
|
119
|
+
- For zero first-paint movement, load pin preferences from a server profile or cookie and pass controlled `pinnedNavigationItemIds` with `onPinnedNavigationItemIdsChange`.
|
|
120
|
+
- LocalStorage-only persistence is hydration-safe but is restored after mount, so a short pinned-section appearance is possible.
|
|
121
|
+
|
|
122
|
+
## 6. Replace MUI-specific integration
|
|
123
|
+
|
|
124
|
+
- Import icons from `orbcafe-ui` instead of MUI or Lucide packages.
|
|
125
|
+
- Replace MUI `ThemeProvider`, `CssBaseline`, and date-picker providers when they existed only for ORBCAFE UI.
|
|
126
|
+
- Review every public `sx` value. ORBCAFE v2 `sx` uses the ORBIS compatibility contract and does not execute MUI theme callbacks.
|
|
127
|
+
- Replace responsive MUI `sx` objects with host CSS/media queries where needed.
|
|
128
|
+
- Import only from the package root. The v2 `exports` map intentionally blocks unsupported internal paths such as `orbcafe-ui/dist/components/...`.
|
|
129
|
+
|
|
130
|
+
## 7. Logo behavior
|
|
131
|
+
|
|
132
|
+
In v2.0.0, pass an explicit `logo` prop to avoid a request to `/orbcafe.png`. The next v2 patch renders an offline package icon when `logo` is omitted. Pass `logo={null}` when the header should have no logo.
|
|
133
|
+
|
|
134
|
+
## Verification checklist
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm ls orbcafe-ui react react-dom next tailwindcss
|
|
138
|
+
npm run build
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Then verify:
|
|
142
|
+
|
|
143
|
+
- No install-time peer warnings remain.
|
|
144
|
+
- Light, dark, and system modes stay synchronized with the host.
|
|
145
|
+
- Navigation search, expand/collapse, routing, fixed/floating mode, and pin/unpin work.
|
|
146
|
+
- Pinned items survive reload and do not split across page titles or locales.
|
|
147
|
+
- No `/orbcafe.png` 404 or `ERR_PACKAGE_PATH_NOT_EXPORTED` appears.
|
|
148
|
+
- Standard report, dialogs, date fields, charts, Kanban, Planning, and AgentUI receive complete styles.
|
|
149
|
+
- Browser console and server logs are clean during SSR and hydration.
|
|
150
|
+
|
|
151
|
+
## Rollback
|
|
152
|
+
|
|
153
|
+
If the application cannot complete the migration in the current release window, pin the previous major explicitly and keep the lock file:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"dependencies": {
|
|
158
|
+
"orbcafe-ui": "1.4.6"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
package/README.md
CHANGED
|
@@ -41,6 +41,8 @@ The library is designed for two audiences at once:
|
|
|
41
41
|
|
|
42
42
|
## Install
|
|
43
43
|
|
|
44
|
+
> Upgrading from v1? Version 2 is a breaking MUI-to-ORBIS migration. Follow the [v2 migration guide](MIGRATION_V2.md) before changing a production dependency.
|
|
45
|
+
|
|
44
46
|
Install the package. `orbcafe-ui@2` is **MUI-free** — the runtime dependencies (Radix primitives, `class-variance-authority`, `tailwind-merge`, `clsx`, `dayjs`, ...) ship with the package, so you do **not** need `@mui/*`, `@emotion/*`, or `lucide-react`:
|
|
45
47
|
|
|
46
48
|
```bash
|
|
@@ -53,6 +55,10 @@ Tailwind v4 is required to compile the utility classes used by the components:
|
|
|
53
55
|
npm install -D tailwindcss @tailwindcss/postcss
|
|
54
56
|
```
|
|
55
57
|
|
|
58
|
+
Brand theming is optional. The default ORBIS theme and packaged theme overrides
|
|
59
|
+
work without Open Design; see [BRAND_THEMING.md](BRAND_THEMING.md) for built-in
|
|
60
|
+
packs and the optional `orbcafe-theme` CLI workflow.
|
|
61
|
+
|
|
56
62
|
## Required App Setup
|
|
57
63
|
|
|
58
64
|
### Tailwind source scanning
|
|
@@ -73,17 +79,9 @@ When developing inside this repo, the examples app also scans the source package
|
|
|
73
79
|
@source "../../src";
|
|
74
80
|
```
|
|
75
81
|
|
|
76
|
-
Tailwind v3 fallback:
|
|
77
|
-
|
|
78
|
-
```js
|
|
79
|
-
module.exports = {
|
|
80
|
-
content: ["./node_modules/orbcafe-ui/dist/**/*.{js,mjs}"],
|
|
81
|
-
};
|
|
82
|
-
```
|
|
83
|
-
|
|
84
82
|
### Providers
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
Mount `GlobalMessage` once at the application layer. Add `OrbisModeProvider` there when standalone ORBCAFE surfaces or the host design system share the same mode. V2 is MUI-free, so there is no ORBCAFE requirement for MUI `ThemeProvider`, `CssBaseline`, or `LocalizationProvider`:
|
|
87
85
|
|
|
88
86
|
```tsx
|
|
89
87
|
'use client';
|
|
@@ -102,7 +100,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|
|
102
100
|
}
|
|
103
101
|
```
|
|
104
102
|
|
|
105
|
-
> `CAppPageLayout` / `PAppPageLayout`
|
|
103
|
+
> `CAppPageLayout` / `PAppPageLayout` render their own `OrbisModeProvider`, but `GlobalMessage` must be mounted once by the host. `CAppPageLayout` supports controlled `mode` / `onModeChange` for synchronizing another design system. Dark mode is applied automatically by toggling the `orb-dark` class on `<html>`.
|
|
106
104
|
|
|
107
105
|
## Run The Official Examples
|
|
108
106
|
|