opus-react 0.2.22 → 0.2.24
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 +190 -115
- package/dist/index.cjs +3399 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3458 -89
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +543 -4
- package/dist/index.d.ts +543 -4
- package/dist/index.js +3362 -498
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# opus-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React component library for the **Opus Design System** — a themeable UI kit for professional business applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Includes form controls, overlays, navigation, data display, charts, dashboard widgets, layout primitives, and utilities. Ships with light and dark themes, CSS variable tokens, runtime accent colour support, and full TypeScript definitions.
|
|
6
|
+
|
|
7
|
+
**Current version:** `0.2.22`
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- React `^18.2.0` or `^19.0.0`
|
|
12
|
+
- React DOM `^18.2.0` or `^19.0.0`
|
|
13
|
+
- `three` `^0.185.0` — optional, only needed for 3D model components
|
|
6
14
|
|
|
7
15
|
## Install
|
|
8
16
|
|
|
@@ -16,7 +24,7 @@ Peer dependencies:
|
|
|
16
24
|
npm install react react-dom
|
|
17
25
|
```
|
|
18
26
|
|
|
19
|
-
Optional
|
|
27
|
+
Optional peer for 3D model viewers:
|
|
20
28
|
|
|
21
29
|
```bash
|
|
22
30
|
npm install three
|
|
@@ -24,7 +32,7 @@ npm install three
|
|
|
24
32
|
|
|
25
33
|
## Quick start
|
|
26
34
|
|
|
27
|
-
Import
|
|
35
|
+
Import Opus styles, then wrap your app with `OpusThemeProvider`.
|
|
28
36
|
|
|
29
37
|
```tsx
|
|
30
38
|
import "opus-react/styles.css";
|
|
@@ -42,17 +50,22 @@ export function App() {
|
|
|
42
50
|
}
|
|
43
51
|
```
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
### Styles
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
| Import | Purpose |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `opus-react/styles.css` | Theme tokens (`--opus-*` CSS variables) for light and dark mode |
|
|
58
|
+
| `opus-react/index.css` | Component CSS modules plus bundled country-flag assets for `PhoneNumberField` |
|
|
59
|
+
| `opus-react/flags.css` | Standalone flag stylesheet (optional — already included in `index.css`) |
|
|
60
|
+
|
|
61
|
+
`OpusThemeProvider` sets `data-theme` on `document.documentElement` by default, so themed CSS variables apply everywhere — including portalled content such as modals, drawers, and toasts.
|
|
48
62
|
|
|
49
63
|
## Next.js
|
|
50
64
|
|
|
51
|
-
Add `opus-react` to `transpilePackages
|
|
65
|
+
Add `opus-react` to `transpilePackages`:
|
|
52
66
|
|
|
53
67
|
```ts
|
|
54
68
|
// next.config.ts
|
|
55
|
-
|
|
56
69
|
const nextConfig = {
|
|
57
70
|
transpilePackages: ["opus-react"],
|
|
58
71
|
};
|
|
@@ -60,6 +73,13 @@ const nextConfig = {
|
|
|
60
73
|
export default nextConfig;
|
|
61
74
|
```
|
|
62
75
|
|
|
76
|
+
Import styles in your root layout:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import "opus-react/styles.css";
|
|
80
|
+
import "opus-react/index.css";
|
|
81
|
+
```
|
|
82
|
+
|
|
63
83
|
## Theme provider
|
|
64
84
|
|
|
65
85
|
```tsx
|
|
@@ -74,18 +94,13 @@ export function App() {
|
|
|
74
94
|
}
|
|
75
95
|
```
|
|
76
96
|
|
|
77
|
-
Available themes:
|
|
78
|
-
|
|
79
|
-
```tsx
|
|
80
|
-
theme="light"
|
|
81
|
-
theme="dark"
|
|
82
|
-
```
|
|
97
|
+
Available themes: `"light"` | `"dark"`
|
|
83
98
|
|
|
84
|
-
|
|
99
|
+
Pass `applyToDocument={false}` if you manage `data-theme` yourself (for example on a scoped container in embedded widgets).
|
|
85
100
|
|
|
86
101
|
## Accent colour
|
|
87
102
|
|
|
88
|
-
Opus supports runtime accent colours.
|
|
103
|
+
Opus supports runtime accent colours via CSS variables.
|
|
89
104
|
|
|
90
105
|
```tsx
|
|
91
106
|
import { OpusThemeProvider, createAccentStyle } from "opus-react";
|
|
@@ -101,7 +116,7 @@ export function App() {
|
|
|
101
116
|
}
|
|
102
117
|
```
|
|
103
118
|
|
|
104
|
-
|
|
119
|
+
Or use the included picker:
|
|
105
120
|
|
|
106
121
|
```tsx
|
|
107
122
|
import { AccentColorPicker } from "opus-react";
|
|
@@ -111,60 +126,101 @@ import { AccentColorPicker } from "opus-react";
|
|
|
111
126
|
|
|
112
127
|
## What's included
|
|
113
128
|
|
|
114
|
-
###
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
- Tabs
|
|
146
|
-
- Accordion
|
|
129
|
+
### Forms
|
|
130
|
+
|
|
131
|
+
- `Button`, `TextField`, `TextAreaField`, `RichTextField`
|
|
132
|
+
- `SelectField`, `FilterSelectField`, `MultiSelectField`, `TreeSelectField`, `CascaderField`
|
|
133
|
+
- `CheckboxField`, `RadioGroup`, `SwitchField`
|
|
134
|
+
- `NumberField`, `RangeField`, `SliderRangeField`, `RatingField`
|
|
135
|
+
- `DateField`, `ColorField`, `FileField`, `HiddenField`
|
|
136
|
+
- `ChipInput`, `PhoneNumberField`, `CountryPickerField`
|
|
137
|
+
- `PasswordStrengthField`, `TransferListField`, `SegmentedControlField`
|
|
138
|
+
- `ThemeToggleField`, `FieldShell`
|
|
139
|
+
|
|
140
|
+
### Overlays and feedback
|
|
141
|
+
|
|
142
|
+
- `Modal`, `Dialog`, `Drawer`, `Popover`
|
|
143
|
+
- `DropdownMenu`, `ContextMenuProvider`, `CommandPalette`
|
|
144
|
+
- `Tooltip`, `Toast`, `ToastProvider`, `Alert`
|
|
145
|
+
|
|
146
|
+
### Content and data
|
|
147
|
+
|
|
148
|
+
- `Card`, `Panel`, `Section`, `Table`, `DataGrid`
|
|
149
|
+
- `Tabs`, `Accordion`, `AccordionGroup`, `ShowMore`
|
|
150
|
+
- `Badge`, `Avatar`, `AvatarGroup`, `List`, `DescriptionList`
|
|
151
|
+
- `PropertyGrid`, `Statistic`, `EmptyState`, `Skeleton`
|
|
152
|
+
- `ContentTimeline`, `TreeView`, `MasonryGrid`, `JsonViewer`
|
|
153
|
+
|
|
154
|
+
### Layout
|
|
155
|
+
|
|
156
|
+
- `Stack`, `Columns`, `Grid`, `Splitter`, `ResizablePanel`
|
|
157
|
+
- `DockLayout`, `ScrollArea`, `AspectRatio`, `Container`, `Spacer`
|
|
158
|
+
- `Breadcrumb`, `Pagination`, `PageHeader`, `Toolbar`
|
|
159
|
+
- `BottomNavigation`, `NavigationRail`, `SplitButton`, `FloatingActionButton`
|
|
147
160
|
|
|
148
161
|
### Navigation
|
|
149
162
|
|
|
150
|
-
- Sidebar
|
|
151
|
-
|
|
152
|
-
|
|
163
|
+
- `Sidebar`, `SidebarLayout`, `TopNavigation`, `MegaMenu`
|
|
164
|
+
|
|
165
|
+
### Charts and metrics
|
|
166
|
+
|
|
167
|
+
- `Chart` — bar, line, area, pie, donut, scatter, funnel, radar, sankey, treemap, and more
|
|
168
|
+
- `Gauge`, `Sparkline`, `ProgressRing`, `ProgressBar`, `Speedometer`
|
|
169
|
+
- `StatCard`, `MetricTile`, `StatusIndicator`, `TrendBadge`
|
|
170
|
+
- `Tiles`, `Tile`, `StatTile`, `StatTiles`
|
|
171
|
+
|
|
172
|
+
### Dashboard widgets
|
|
173
|
+
|
|
174
|
+
- `DashboardContentContainer`
|
|
175
|
+
- `PipelineOverview`, `DealsOverTime`
|
|
176
|
+
- `UpcomingTasks`, `RecentActivity`, `TopPerformingUsers`
|
|
177
|
+
|
|
178
|
+
Compose dashboard rows with `Columns`:
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import {
|
|
182
|
+
Columns,
|
|
183
|
+
DashboardContentContainer,
|
|
184
|
+
UpcomingTasks,
|
|
185
|
+
RecentActivity,
|
|
186
|
+
TopPerformingUsers,
|
|
187
|
+
} from "opus-react";
|
|
188
|
+
|
|
189
|
+
<Columns direction="row" columns={3} gap={16}>
|
|
190
|
+
<DashboardContentContainer data-component="upcoming-tasks" width="full">
|
|
191
|
+
<UpcomingTasks title="Upcoming Tasks" tasks={tasks} />
|
|
192
|
+
</DashboardContentContainer>
|
|
193
|
+
<DashboardContentContainer data-component="recent-activity" width="full">
|
|
194
|
+
<RecentActivity title="Recent Activity" items={activity} />
|
|
195
|
+
</DashboardContentContainer>
|
|
196
|
+
<DashboardContentContainer data-component="top-performing-users" width="full">
|
|
197
|
+
<TopPerformingUsers title="Top Performing People" users={people} />
|
|
198
|
+
</DashboardContentContainer>
|
|
199
|
+
</Columns>;
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Media and 3D
|
|
153
203
|
|
|
154
|
-
|
|
204
|
+
- `Carousel`, `Lightbox`, `ImageThumbnail`, `ImageGallery`
|
|
205
|
+
- `ModelViewer`, `ModelLightbox`, `ModelThumbnail`, `ModelGallery` (requires `three`)
|
|
155
206
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
207
|
+
### Builders and planning
|
|
208
|
+
|
|
209
|
+
- `FilterBuilder`, `QueryBuilder`, `RuleBuilder`
|
|
210
|
+
- `PermissionsMatrix`, `DualListBuilder`
|
|
211
|
+
- `Scheduler`, `KanbanBoard`, `Calendar`, `ResourcePlanner`
|
|
212
|
+
- `PropertyInspector`
|
|
160
213
|
|
|
161
214
|
### Utilities
|
|
162
215
|
|
|
163
|
-
- `
|
|
164
|
-
- `
|
|
165
|
-
- `CatalogIcon`
|
|
166
|
-
-
|
|
167
|
-
-
|
|
216
|
+
- `OpusThemeProvider`, `useOpusTheme`
|
|
217
|
+
- `AccentColorPicker`, `createAccentStyle`, `useAccentPreference`
|
|
218
|
+
- `IconPicker`, `CatalogIcon`, `Icon`
|
|
219
|
+
- `Portal`, `FocusTrap`, `VisuallyHidden`
|
|
220
|
+
- `HotkeyManager`, `useHotkey`, `KeyboardShortcut`
|
|
221
|
+
- `Clipboard`, `CopyButton`
|
|
222
|
+
- `ThemeProvider`, `ThemeSwitcher`
|
|
223
|
+
- `ResizeObserver`, `IntersectionObserver`, `Spinner`
|
|
168
224
|
|
|
169
225
|
## Examples
|
|
170
226
|
|
|
@@ -173,11 +229,11 @@ import { AccentColorPicker } from "opus-react";
|
|
|
173
229
|
```tsx
|
|
174
230
|
import { Button } from "opus-react";
|
|
175
231
|
|
|
176
|
-
<Button variant="primary">Create project</Button
|
|
177
|
-
<Button variant="secondary">Cancel</Button
|
|
232
|
+
<Button variant="primary">Create project</Button>
|
|
233
|
+
<Button variant="secondary">Cancel</Button>
|
|
178
234
|
```
|
|
179
235
|
|
|
180
|
-
### Text field with
|
|
236
|
+
### Text field with validation
|
|
181
237
|
|
|
182
238
|
```tsx
|
|
183
239
|
import { TextField } from "opus-react";
|
|
@@ -186,75 +242,94 @@ import { TextField } from "opus-react";
|
|
|
186
242
|
label="Email address"
|
|
187
243
|
placeholder="you@example.com"
|
|
188
244
|
error="Enter a valid email address"
|
|
189
|
-
|
|
245
|
+
/>
|
|
190
246
|
```
|
|
191
247
|
|
|
192
|
-
###
|
|
248
|
+
### Toast notifications
|
|
193
249
|
|
|
194
250
|
```tsx
|
|
195
|
-
import {
|
|
196
|
-
|
|
197
|
-
<ChipInput
|
|
198
|
-
label="Tags"
|
|
199
|
-
placeholder="Type and press Enter"
|
|
200
|
-
value={tags}
|
|
201
|
-
onChange={setTags}
|
|
202
|
-
/>;
|
|
203
|
-
```
|
|
251
|
+
import { OpusThemeProvider, ToastProvider, useToast, Button } from "opus-react";
|
|
204
252
|
|
|
205
|
-
|
|
253
|
+
function NotifyButton() {
|
|
254
|
+
const { showToast } = useToast();
|
|
206
255
|
|
|
207
|
-
|
|
208
|
-
|
|
256
|
+
return (
|
|
257
|
+
<Button
|
|
258
|
+
variant="primary"
|
|
259
|
+
onClick={() => showToast({ title: "Saved", description: "Your changes were saved." })}
|
|
260
|
+
>
|
|
261
|
+
Save
|
|
262
|
+
</Button>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
209
265
|
|
|
210
|
-
|
|
266
|
+
export function App() {
|
|
267
|
+
return (
|
|
268
|
+
<OpusThemeProvider theme="dark">
|
|
269
|
+
<ToastProvider>
|
|
270
|
+
<NotifyButton />
|
|
271
|
+
</ToastProvider>
|
|
272
|
+
</OpusThemeProvider>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
211
275
|
```
|
|
212
276
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
From the monorepo root:
|
|
277
|
+
### Chart
|
|
216
278
|
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
|
|
279
|
+
```tsx
|
|
280
|
+
import { Chart } from "opus-react";
|
|
281
|
+
|
|
282
|
+
<Chart
|
|
283
|
+
variant="bar-chart-vertical"
|
|
284
|
+
title="Revenue by region"
|
|
285
|
+
data={[
|
|
286
|
+
{ label: "EMEA", value: 42 },
|
|
287
|
+
{ label: "APAC", value: 28 },
|
|
288
|
+
{ label: "AMER", value: 35 },
|
|
289
|
+
]}
|
|
290
|
+
/>
|
|
220
291
|
```
|
|
221
292
|
|
|
222
|
-
|
|
293
|
+
## TypeScript
|
|
223
294
|
|
|
224
|
-
|
|
225
|
-
packages/opus-react/package.json
|
|
226
|
-
```
|
|
295
|
+
Type definitions ship with the package (`dist/index.d.ts`). Component prop types and shared tokens (for example `ChartVariant`, `ButtonVariant`, `Theme`) are exported from `opus-react`.
|
|
227
296
|
|
|
228
|
-
|
|
297
|
+
## Package exports
|
|
229
298
|
|
|
230
299
|
```json
|
|
231
300
|
{
|
|
232
|
-
"
|
|
301
|
+
".": "./dist/index.js",
|
|
302
|
+
"./styles.css": "./dist/styles.css",
|
|
303
|
+
"./index.css": "./dist/index.css",
|
|
304
|
+
"./flags.css": "./dist/flags.css"
|
|
233
305
|
}
|
|
234
306
|
```
|
|
235
307
|
|
|
308
|
+
ESM and CommonJS builds are both published.
|
|
309
|
+
|
|
236
310
|
## Not included in the package
|
|
237
311
|
|
|
238
|
-
The published package does not include:
|
|
239
|
-
|
|
240
|
-
- Documentation site shells
|
|
241
|
-
-
|
|
242
|
-
- Generated usage-code
|
|
243
|
-
- Internal build scripts
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
dashboard
|
|
256
|
-
dark-theme
|
|
257
|
-
light-theme
|
|
258
|
-
typescript
|
|
259
|
-
opus
|
|
312
|
+
The published npm package does **not** include:
|
|
313
|
+
|
|
314
|
+
- Documentation site shells and routing
|
|
315
|
+
- Component preview / settings tooling
|
|
316
|
+
- Generated usage-code helpers
|
|
317
|
+
- Internal monorepo build scripts
|
|
318
|
+
|
|
319
|
+
Those live in the Opus Library workspace and are for development and docs only.
|
|
320
|
+
|
|
321
|
+
## Publishing (maintainers)
|
|
322
|
+
|
|
323
|
+
From the Library workspace root:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
cd Library
|
|
327
|
+
npm run build:lib
|
|
328
|
+
npm publish -w opus-react --access public
|
|
260
329
|
```
|
|
330
|
+
|
|
331
|
+
`prepublishOnly` runs the package build automatically. Bump the version in `packages/opus-react/package.json` before publishing.
|
|
332
|
+
|
|
333
|
+
## License
|
|
334
|
+
|
|
335
|
+
UNLICENSED — see `package.json`.
|