@omni-design/components 0.7.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/.claude/commands/ScanComponents.md +26 -0
- package/.claude/commands/ShareComponent.md +128 -0
- package/.cursorrules +21 -0
- package/CLAUDE.md +1046 -0
- package/README.md +70 -0
- package/dist/OmniDesignProvider.esm.js +2 -0
- package/dist/OmniDesignProvider.esm.js.map +1 -0
- package/dist/OmniDesignProvider.js +2 -0
- package/dist/OmniDesignProvider.js.map +1 -0
- package/dist/index.esm.js +42 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/types/OmniDesignProvider.d.ts +158 -0
- package/dist/types/components/Accordion/Accordion.d.ts +42 -0
- package/dist/types/components/Accordion/AccordionShowcase.d.ts +2 -0
- package/dist/types/components/Accordion/index.d.ts +2 -0
- package/dist/types/components/Alert/Alert.d.ts +14 -0
- package/dist/types/components/Alert/AlertShowcase.d.ts +2 -0
- package/dist/types/components/Alert/index.d.ts +2 -0
- package/dist/types/components/AppBar/AppBar.d.ts +43 -0
- package/dist/types/components/AppBar/AppBarShowcase.d.ts +2 -0
- package/dist/types/components/AppBar/index.d.ts +2 -0
- package/dist/types/components/Autocomplete/Autocomplete.d.ts +26 -0
- package/dist/types/components/Autocomplete/AutocompleteShowcase.d.ts +2 -0
- package/dist/types/components/Autocomplete/index.d.ts +2 -0
- package/dist/types/components/Avatar/Avatar.d.ts +29 -0
- package/dist/types/components/Avatar/AvatarShowcase.d.ts +2 -0
- package/dist/types/components/Avatar/defaultAvatar.d.ts +2 -0
- package/dist/types/components/Avatar/index.d.ts +3 -0
- package/dist/types/components/BackgroundPicker.d.ts +12 -0
- package/dist/types/components/Badge/Badge.d.ts +43 -0
- package/dist/types/components/Badge/BadgeShowcase.d.ts +1 -0
- package/dist/types/components/Badge/index.d.ts +2 -0
- package/dist/types/components/BevelText/BevelText.d.ts +15 -0
- package/dist/types/components/BevelText/BevelTextShowcase.d.ts +2 -0
- package/dist/types/components/BevelText/index.d.ts +2 -0
- package/dist/types/components/BottomNavigation/BottomNavigation.d.ts +15 -0
- package/dist/types/components/BottomNavigation/BottomNavigationShowcase.d.ts +2 -0
- package/dist/types/components/BottomNavigation/index.d.ts +2 -0
- package/dist/types/components/Box/Box.d.ts +36 -0
- package/dist/types/components/Box/BoxShowcase.d.ts +2 -0
- package/dist/types/components/Box/index.d.ts +2 -0
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +22 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsShowcase.d.ts +2 -0
- package/dist/types/components/Breadcrumbs/index.d.ts +2 -0
- package/dist/types/components/Button/Button.d.ts +66 -0
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +41 -0
- package/dist/types/components/ButtonGroup/index.d.ts +2 -0
- package/dist/types/components/Card/Card.d.ts +54 -0
- package/dist/types/components/Card/CardShowcase.d.ts +2 -0
- package/dist/types/components/Card/index.d.ts +2 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +51 -0
- package/dist/types/components/Checkbox/index.d.ts +2 -0
- package/dist/types/components/Chip/Chip.d.ts +42 -0
- package/dist/types/components/Chip/ChipShowcase.d.ts +2 -0
- package/dist/types/components/Chip/index.d.ts +2 -0
- package/dist/types/components/CircularProgress/CircularProgress.d.ts +12 -0
- package/dist/types/components/CircularProgress/CircularProgressShowcase.d.ts +2 -0
- package/dist/types/components/CircularProgress/index.d.ts +2 -0
- package/dist/types/components/CodeBlock/CodeBlock.d.ts +35 -0
- package/dist/types/components/Colors/Colors.d.ts +7 -0
- package/dist/types/components/Colors/index.d.ts +1 -0
- package/dist/types/components/Container/Container.d.ts +70 -0
- package/dist/types/components/Container/index.d.ts +1 -0
- package/dist/types/components/Copyright/Copyright.d.ts +11 -0
- package/dist/types/components/Copyright/CopyrightShowcase.d.ts +2 -0
- package/dist/types/components/Copyright/index.d.ts +2 -0
- package/dist/types/components/CurvedText/CurvedText.d.ts +23 -0
- package/dist/types/components/CurvedText/CurvedTextShowcase.d.ts +2 -0
- package/dist/types/components/CurvedText/index.d.ts +2 -0
- package/dist/types/components/Dialog/Dialog.d.ts +82 -0
- package/dist/types/components/Dialog/DialogShowcase.d.ts +2 -0
- package/dist/types/components/Dialog/index.d.ts +2 -0
- package/dist/types/components/Divider/Divider.d.ts +22 -0
- package/dist/types/components/Divider/DividerShowcase.d.ts +2 -0
- package/dist/types/components/Divider/index.d.ts +2 -0
- package/dist/types/components/Drawer/Drawer.d.ts +30 -0
- package/dist/types/components/Drawer/DrawerShowcase.d.ts +2 -0
- package/dist/types/components/Drawer/index.d.ts +2 -0
- package/dist/types/components/DropZone/DropZone.d.ts +15 -0
- package/dist/types/components/DropZone/index.d.ts +2 -0
- package/dist/types/components/Fab/Fab.d.ts +17 -0
- package/dist/types/components/Fab/FabShowcase.d.ts +2 -0
- package/dist/types/components/Fab/index.d.ts +2 -0
- package/dist/types/components/Footer/Footer.d.ts +14 -0
- package/dist/types/components/Footer/FooterShowcase.d.ts +2 -0
- package/dist/types/components/Footer/index.d.ts +2 -0
- package/dist/types/components/Gradient/Gradient.d.ts +38 -0
- package/dist/types/components/Gradient/GradientShowcase.d.ts +2 -0
- package/dist/types/components/Gradient/gradientUtils.d.ts +185 -0
- package/dist/types/components/Gradient/index.d.ts +3 -0
- package/dist/types/components/Grid/Grid.d.ts +112 -0
- package/dist/types/components/Grid/index.d.ts +1 -0
- package/dist/types/components/Header/Header.d.ts +53 -0
- package/dist/types/components/Header/index.d.ts +1 -0
- package/dist/types/components/Icon/Icon.d.ts +19 -0
- package/dist/types/components/Icon/IconShowcase.d.ts +2 -0
- package/dist/types/components/Icon/index.d.ts +2 -0
- package/dist/types/components/IconBadge/IconBadge.d.ts +10 -0
- package/dist/types/components/IconBadge/IconBadgeShowcase.d.ts +2 -0
- package/dist/types/components/IconBadge/index.d.ts +2 -0
- package/dist/types/components/Input/Input.d.ts +47 -0
- package/dist/types/components/Input/index.d.ts +2 -0
- package/dist/types/components/LinearProgress/LinearProgress.d.ts +9 -0
- package/dist/types/components/LinearProgress/LinearProgressShowcase.d.ts +2 -0
- package/dist/types/components/LinearProgress/index.d.ts +2 -0
- package/dist/types/components/Link/Link.d.ts +16 -0
- package/dist/types/components/Link/LinkShowcase.d.ts +2 -0
- package/dist/types/components/Link/index.d.ts +2 -0
- package/dist/types/components/List/List.d.ts +55 -0
- package/dist/types/components/List/ListShowcase.d.ts +2 -0
- package/dist/types/components/List/index.d.ts +2 -0
- package/dist/types/components/MainLayout/MainLayout.d.ts +28 -0
- package/dist/types/components/MainLayout/index.d.ts +1 -0
- package/dist/types/components/Menu/Menu.d.ts +37 -0
- package/dist/types/components/Menu/MenuShowcase.d.ts +2 -0
- package/dist/types/components/Menu/index.d.ts +2 -0
- package/dist/types/components/Modal/Modal.d.ts +18 -0
- package/dist/types/components/Modal/ModalShowcase.d.ts +2 -0
- package/dist/types/components/Modal/index.d.ts +2 -0
- package/dist/types/components/NumberField/NumberField.d.ts +22 -0
- package/dist/types/components/NumberField/NumberFieldShowcase.d.ts +2 -0
- package/dist/types/components/NumberField/index.d.ts +2 -0
- package/dist/types/components/Pagination/Pagination.d.ts +17 -0
- package/dist/types/components/Pagination/PaginationShowcase.d.ts +2 -0
- package/dist/types/components/Pagination/index.d.ts +2 -0
- package/dist/types/components/Paper/Paper.d.ts +111 -0
- package/dist/types/components/Paper/index.d.ts +1 -0
- package/dist/types/components/Popover/Popover.d.ts +31 -0
- package/dist/types/components/Popover/index.d.ts +1 -0
- package/dist/types/components/PreviewSurface.d.ts +18 -0
- package/dist/types/components/Radio/Radio.d.ts +55 -0
- package/dist/types/components/Radio/RadioShowcase.d.ts +2 -0
- package/dist/types/components/Radio/index.d.ts +2 -0
- package/dist/types/components/Rail/Rail.d.ts +15 -0
- package/dist/types/components/Rail/RailShowcase.d.ts +2 -0
- package/dist/types/components/Rail/index.d.ts +2 -0
- package/dist/types/components/Rating/Rating.d.ts +16 -0
- package/dist/types/components/Rating/RatingShowcase.d.ts +2 -0
- package/dist/types/components/Rating/index.d.ts +2 -0
- package/dist/types/components/Ratio/Ratio.d.ts +20 -0
- package/dist/types/components/Ratio/RatioShowcase.d.ts +2 -0
- package/dist/types/components/Ratio/index.d.ts +2 -0
- package/dist/types/components/SearchField/SearchField.d.ts +19 -0
- package/dist/types/components/SearchField/SearchFieldShowcase.d.ts +2 -0
- package/dist/types/components/SearchField/index.d.ts +2 -0
- package/dist/types/components/Section/Section.d.ts +44 -0
- package/dist/types/components/Section/SectionShowcase.d.ts +2 -0
- package/dist/types/components/Section/index.d.ts +2 -0
- package/dist/types/components/Select/Select.d.ts +23 -0
- package/dist/types/components/Select/SelectShowcase.d.ts +2 -0
- package/dist/types/components/Select/index.d.ts +2 -0
- package/dist/types/components/SettingsPanel.d.ts +2 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts +53 -0
- package/dist/types/components/Sidebar/index.d.ts +1 -0
- package/dist/types/components/Slider/Slider.d.ts +79 -0
- package/dist/types/components/Slider/SliderShowcase.d.ts +2 -0
- package/dist/types/components/Slider/index.d.ts +2 -0
- package/dist/types/components/Snackbar/Snackbar.d.ts +17 -0
- package/dist/types/components/Snackbar/SnackbarShowcase.d.ts +2 -0
- package/dist/types/components/Snackbar/index.d.ts +2 -0
- package/dist/types/components/Spacing/Spacing.d.ts +16 -0
- package/dist/types/components/Spacing/index.d.ts +1 -0
- package/dist/types/components/SpeedDial/SpeedDial.d.ts +17 -0
- package/dist/types/components/SpeedDial/SpeedDialShowcase.d.ts +2 -0
- package/dist/types/components/SpeedDial/index.d.ts +2 -0
- package/dist/types/components/Stack/Stack.d.ts +52 -0
- package/dist/types/components/Stack/StackShowcase.d.ts +2 -0
- package/dist/types/components/Stack/index.d.ts +2 -0
- package/dist/types/components/Stepper/Stepper.d.ts +33 -0
- package/dist/types/components/Stepper/StepperShowcase.d.ts +2 -0
- package/dist/types/components/Stepper/index.d.ts +2 -0
- package/dist/types/components/Switch/Switch.d.ts +65 -0
- package/dist/types/components/Switch/SwitchShowcase.d.ts +2 -0
- package/dist/types/components/Switch/index.d.ts +2 -0
- package/dist/types/components/Table/Table.d.ts +20 -0
- package/dist/types/components/Table/TableShowcase.d.ts +2 -0
- package/dist/types/components/Table/index.d.ts +2 -0
- package/dist/types/components/Tabs/Tabs.d.ts +51 -0
- package/dist/types/components/Tabs/TabsShowcase.d.ts +2 -0
- package/dist/types/components/Tabs/index.d.ts +2 -0
- package/dist/types/components/Tag/Tag.d.ts +57 -0
- package/dist/types/components/Tag/TagShowcase.d.ts +2 -0
- package/dist/types/components/Tag/index.d.ts +2 -0
- package/dist/types/components/TextField/TextField.d.ts +105 -0
- package/dist/types/components/TextField/index.d.ts +1 -0
- package/dist/types/components/ToggleButton/ToggleButton.d.ts +94 -0
- package/dist/types/components/ToggleButton/index.d.ts +1 -0
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +48 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +14 -0
- package/dist/types/components/Toolbar/ToolbarShowcase.d.ts +2 -0
- package/dist/types/components/Toolbar/index.d.ts +2 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +20 -0
- package/dist/types/components/Tooltip/TooltipShowcase.d.ts +2 -0
- package/dist/types/components/Tooltip/index.d.ts +2 -0
- package/dist/types/components/TreeView/TreeBranch.d.ts +14 -0
- package/dist/types/components/TreeView/TreeView.d.ts +82 -0
- package/dist/types/components/TreeView/TreeViewShowcase.d.ts +2 -0
- package/dist/types/components/TreeView/index.d.ts +3 -0
- package/dist/types/components/Typography/Typography.d.ts +492 -0
- package/dist/types/components/Typography/TypographyShowcase.d.ts +2 -0
- package/dist/types/components/Typography/index.d.ts +2 -0
- package/dist/types/components/_a11y/ContrastCheck.d.ts +15 -0
- package/dist/types/components/_bevelPresets.d.ts +92 -0
- package/dist/types/components/_shadows.d.ts +32 -0
- package/dist/types/components/index.d.ts +74 -0
- package/dist/types/theme/useThemeMode.d.ts +4 -0
- package/docs/components.md +797 -0
- package/docs/getting-started.md +409 -0
- package/docs/token-system.md +468 -0
- package/package.json +126 -0
- package/public/styles/Dark-Mode.css +13867 -0
- package/public/styles/Light-Mode.css +14091 -0
- package/public/styles/README.md +93 -0
- package/public/styles/base.css +261 -0
- package/public/styles/core.css +378 -0
- package/public/styles/foundation.css +72 -0
- package/public/styles/styles.css +6 -0
- package/public/styles/theme.js +234 -0
- package/public/styles/theme.json +12 -0
- package/public/styles/typography-tokens.css +720 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
# Getting Started with Dyno Design System
|
|
2
|
+
|
|
3
|
+
## What is Dyno?
|
|
4
|
+
|
|
5
|
+
Dyno is a brand-adaptive React component library. Components automatically inherit
|
|
6
|
+
their visual style from the theme context around them — colors, typography, spacing,
|
|
7
|
+
shadows, and interaction states all resolve at runtime from CSS variables. Swapping
|
|
8
|
+
a brand requires only replacing the token CSS files; no component code changes.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- React 18+
|
|
15
|
+
- A Dyno theme URL (provided by OmniDesign after brand generation) **or** local CSS files
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### 1. Install peer dependencies
|
|
22
|
+
|
|
23
|
+
`@omni-design/components` is built on MUI and uses Emotion for styling. These must be installed in your app — they are not bundled inside the package:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @mui/material @mui/icons-material @emotion/react @emotion/styled
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Install OmniDesign
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @omni-design/components
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> **Why peer dependencies?** MUI is not bundled inside `@omni-design/components` to avoid shipping duplicate copies of React and MUI in apps that already use them. Your app provides MUI; OmniDesign provides the token-driven theme layer on top of it. You never need to configure MUI directly — `OmniDesignProvider` handles all of that automatically.
|
|
36
|
+
|
|
37
|
+
### Required peer dependency versions
|
|
38
|
+
|
|
39
|
+
| Package | Minimum Version |
|
|
40
|
+
|---------|----------------|
|
|
41
|
+
| `react` | `18.0.0` |
|
|
42
|
+
| `react-dom` | `18.0.0` |
|
|
43
|
+
| `@mui/material` | `5.0.0` |
|
|
44
|
+
| `@mui/icons-material` | `5.0.0` |
|
|
45
|
+
| `@emotion/react` | `11.0.0` |
|
|
46
|
+
| `@emotion/styled` | `11.0.0` |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Setup
|
|
51
|
+
|
|
52
|
+
Wrap your app root once with `OmniDesignProvider`. That's the only configuration
|
|
53
|
+
required.
|
|
54
|
+
|
|
55
|
+
### Option A — Theme URL (recommended for production)
|
|
56
|
+
|
|
57
|
+
Point to a hosted Dino-generated theme. The Provider reads the manifest, then
|
|
58
|
+
loads each CSS file as a `<link rel="stylesheet">` tag so the browser fetches
|
|
59
|
+
them in parallel, caches them, and blocks paint until they apply — no flash
|
|
60
|
+
of unbranded styling. The Provider wrapper is `visibility: hidden` while the
|
|
61
|
+
sheets load and becomes visible the moment they're ready.
|
|
62
|
+
|
|
63
|
+
```jsx
|
|
64
|
+
// src/index.js
|
|
65
|
+
import React from 'react';
|
|
66
|
+
import ReactDOM from 'react-dom/client';
|
|
67
|
+
import App from './App';
|
|
68
|
+
import { OmniDesignProvider } from '@omni-design/components';
|
|
69
|
+
|
|
70
|
+
ReactDOM.createRoot(document.getElementById('root')).render(
|
|
71
|
+
<React.StrictMode>
|
|
72
|
+
<OmniDesignProvider themeURL="https://your-theme-cdn.com/brand">
|
|
73
|
+
<App />
|
|
74
|
+
</OmniDesignProvider>
|
|
75
|
+
</React.StrictMode>
|
|
76
|
+
);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Option B — Local CSS files (local dev / self-hosted)
|
|
80
|
+
|
|
81
|
+
```jsx
|
|
82
|
+
<OmniDesignProvider
|
|
83
|
+
foundationCSS="/styles/base.css"
|
|
84
|
+
lightModeCSS="/styles/light-mode.css"
|
|
85
|
+
darkModeCSS="/styles/dark-mode.css"
|
|
86
|
+
stylesCSS="/styles/themes.css"
|
|
87
|
+
defaultTheme="Default"
|
|
88
|
+
defaultStyle="Modern"
|
|
89
|
+
>
|
|
90
|
+
<App />
|
|
91
|
+
</OmniDesignProvider>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Option C — No Provider (CSS imported directly)
|
|
95
|
+
|
|
96
|
+
If you manage CSS loading yourself, just import the files and use components
|
|
97
|
+
directly. No Provider needed.
|
|
98
|
+
|
|
99
|
+
```jsx
|
|
100
|
+
import '@omni-design/components/public/styles/foundation.css';
|
|
101
|
+
import '@omni-design/components/public/styles/core.css';
|
|
102
|
+
import '@omni-design/components/public/styles/Light-Mode.css';
|
|
103
|
+
|
|
104
|
+
// Components work without a Provider
|
|
105
|
+
<Card variant="solid" color="primary">
|
|
106
|
+
<Button color="primary">Click me</Button>
|
|
107
|
+
</Card>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Option D — Render-blocking `<link>` in HTML (fastest first paint)
|
|
111
|
+
|
|
112
|
+
The Provider's `<link>` injection (Options A/B) loads CSS as fast as
|
|
113
|
+
JavaScript can mount the React tree — but the JS bundle still has to
|
|
114
|
+
download first. For the fastest possible time-to-styled-paint, put the
|
|
115
|
+
brand `<link>` tags directly in your HTML's `<head>`, *before* the bundle.
|
|
116
|
+
The browser fetches CSS in parallel with JS, then applies it before the
|
|
117
|
+
React tree first renders.
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<!-- public/index.html (or your SSR template) -->
|
|
121
|
+
<head>
|
|
122
|
+
<link rel="preconnect" href="https://your-theme-cdn.com" crossorigin>
|
|
123
|
+
<link rel="stylesheet" id="omni-foundation" data-omni="true" href="https://your-theme-cdn.com/<uuid>/foundation.css">
|
|
124
|
+
<link rel="stylesheet" id="omni-core" data-omni="true" href="https://your-theme-cdn.com/<uuid>/core.css">
|
|
125
|
+
<link rel="stylesheet" id="omni-mode" data-omni="true" href="https://your-theme-cdn.com/<uuid>/Light-Mode.css">
|
|
126
|
+
<link rel="stylesheet" id="omni-base" data-omni="true" href="https://your-theme-cdn.com/<uuid>/base.css">
|
|
127
|
+
<link rel="stylesheet" id="omni-styles" data-omni="true" href="https://your-theme-cdn.com/<uuid>/styles.css">
|
|
128
|
+
<script type="module" src="/main.js" defer></script>
|
|
129
|
+
</head>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The `id="omni-*"` attributes match the Provider's internal tag ids — so
|
|
133
|
+
when `<OmniDesignProvider>` later calls `loadCSSSource`, it finds the
|
|
134
|
+
existing `<link>` by id and uses it instead of re-fetching.
|
|
135
|
+
|
|
136
|
+
Mount the Provider with `themeURL` (or individual props) anyway so dark-mode
|
|
137
|
+
swap still works — the Provider's `<link>` adoption skips the initial fetch
|
|
138
|
+
but it still needs to know about the dark-mode source to swap on toggle.
|
|
139
|
+
|
|
140
|
+
If you're hosting on a platform with edge functions (Netlify, Vercel,
|
|
141
|
+
Cloudflare), this can be automated per-request by reading a query
|
|
142
|
+
parameter or subdomain and templating the `<link>` tags in. See
|
|
143
|
+
`netlify/edge-functions/playground-css.ts` in the OmniDesign Studio repo
|
|
144
|
+
for a reference implementation.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Your First Component
|
|
149
|
+
|
|
150
|
+
Once the Provider is set up, import and use components anywhere in your app.
|
|
151
|
+
No additional wiring required — components inherit the active theme automatically.
|
|
152
|
+
|
|
153
|
+
```jsx
|
|
154
|
+
import { Button } from '@omni-design/components';
|
|
155
|
+
|
|
156
|
+
function MyPage() {
|
|
157
|
+
return (
|
|
158
|
+
<Button color="primary" variant="solid">
|
|
159
|
+
Get Started
|
|
160
|
+
</Button>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Theme Inheritance
|
|
168
|
+
|
|
169
|
+
Components automatically adapt to the theme of their nearest surface ancestor.
|
|
170
|
+
You never need to pass a theme down manually.
|
|
171
|
+
|
|
172
|
+
```jsx
|
|
173
|
+
import { Card, CardContent, Button } from '@omni-design/components';
|
|
174
|
+
|
|
175
|
+
// Card sets the surface context — Button inherits it automatically
|
|
176
|
+
<Card variant="solid" color="primary">
|
|
177
|
+
<CardContent>
|
|
178
|
+
<p>Everything inside this card reads Primary theme variables.</p>
|
|
179
|
+
<Button color="primary">Confirm</Button>
|
|
180
|
+
</CardContent>
|
|
181
|
+
</Card>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
To nest a different theme inside another:
|
|
185
|
+
|
|
186
|
+
```jsx
|
|
187
|
+
// Outer context: Primary
|
|
188
|
+
<Card variant="solid" color="primary">
|
|
189
|
+
<CardContent>
|
|
190
|
+
{/* Inner context: Default — Card inherits from its own data-theme */}
|
|
191
|
+
<Card variant="default">
|
|
192
|
+
<Button color="primary">Different surface, same button</Button>
|
|
193
|
+
</Card>
|
|
194
|
+
</CardContent>
|
|
195
|
+
</Card>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Dark Mode
|
|
201
|
+
|
|
202
|
+
`OmniDesignProvider` manages dark mode for you. Toggle it with the
|
|
203
|
+
`useOmniDesign` hook:
|
|
204
|
+
|
|
205
|
+
```jsx
|
|
206
|
+
import { useOmniDesign } from '@omni-design/components';
|
|
207
|
+
|
|
208
|
+
function DarkModeToggle() {
|
|
209
|
+
const { isDark, toggleDarkMode } = useOmniDesign();
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<Button color="neutral" onClick={toggleDarkMode}>
|
|
213
|
+
{isDark ? 'Light Mode' : 'Dark Mode'}
|
|
214
|
+
</Button>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Or start in dark mode by default:
|
|
220
|
+
|
|
221
|
+
```jsx
|
|
222
|
+
<OmniDesignProvider
|
|
223
|
+
themeURL="..."
|
|
224
|
+
defaultDarkMode={true}
|
|
225
|
+
>
|
|
226
|
+
<App />
|
|
227
|
+
</OmniDesignProvider>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Or control it externally:
|
|
231
|
+
|
|
232
|
+
```jsx
|
|
233
|
+
const [dark, setDark] = useState(false);
|
|
234
|
+
|
|
235
|
+
<OmniDesignProvider
|
|
236
|
+
themeURL="..."
|
|
237
|
+
darkMode={dark}
|
|
238
|
+
onDarkModeChange={setDark}
|
|
239
|
+
>
|
|
240
|
+
<App />
|
|
241
|
+
</OmniDesignProvider>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Changing the Active Theme
|
|
247
|
+
|
|
248
|
+
Use `setTheme` from `useOmniDesign` to change the root theme at runtime:
|
|
249
|
+
|
|
250
|
+
```jsx
|
|
251
|
+
import { useOmniDesign } from '@omni-design/components';
|
|
252
|
+
|
|
253
|
+
function ThemeSwitcher() {
|
|
254
|
+
const { theme, setTheme } = useOmniDesign();
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<select value={theme} onChange={e => setTheme(e.target.value)}>
|
|
258
|
+
<option value="Default">Default</option>
|
|
259
|
+
<option value="Primary">Primary</option>
|
|
260
|
+
<option value="Secondary">Secondary</option>
|
|
261
|
+
<option value="Neutral">Neutral</option>
|
|
262
|
+
</select>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## OmniDesignProvider Props
|
|
270
|
+
|
|
271
|
+
| Prop | Type | Default | Description |
|
|
272
|
+
|---|---|---|---|
|
|
273
|
+
| `themeURL` | string | — | Base URL of a Dino-generated theme folder |
|
|
274
|
+
| `foundationCSS` | string | — | URL or raw CSS string for base tokens |
|
|
275
|
+
| `lightModeCSS` | string | — | URL or raw CSS string for light mode |
|
|
276
|
+
| `darkModeCSS` | string | — | URL or raw CSS string for dark mode |
|
|
277
|
+
| `stylesCSS` | string | — | URL or raw CSS string for theme selectors |
|
|
278
|
+
| `defaultTheme` | string | `'Default'` | Starting theme |
|
|
279
|
+
| `defaultStyle` | string | `'Modern'` | Starting style variant |
|
|
280
|
+
| `defaultSurface` | string | `'Surface'` | Root surface type |
|
|
281
|
+
| `defaultDarkMode` | boolean | `false` | Start in dark mode |
|
|
282
|
+
| `darkMode` | boolean | — | Controlled dark mode |
|
|
283
|
+
| `onDarkModeChange` | function | — | Controlled dark mode handler |
|
|
284
|
+
| `fullHeight` | boolean | `true` | Adds `minHeight: 100vh` to root div |
|
|
285
|
+
| `className` | string | — | Class on root div |
|
|
286
|
+
| `style` | object | — | Inline styles on root div |
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## useOmniDesign Hook
|
|
291
|
+
|
|
292
|
+
Access the active theme state anywhere inside the Provider:
|
|
293
|
+
|
|
294
|
+
```jsx
|
|
295
|
+
import { useOmniDesign } from '@omni-design/components';
|
|
296
|
+
|
|
297
|
+
const {
|
|
298
|
+
theme, // active theme name e.g. 'Primary'
|
|
299
|
+
style, // active style variant e.g. 'Modern'
|
|
300
|
+
surface, // root surface type e.g. 'Surface'
|
|
301
|
+
isDark, // boolean
|
|
302
|
+
cssStatus, // 'loading' | 'ready' | 'error'
|
|
303
|
+
cssError, // error message string or null
|
|
304
|
+
setTheme, // (themeName: string) => void
|
|
305
|
+
setStyle, // (styleName: string) => void
|
|
306
|
+
setSurface, // (surfaceName: string) => void
|
|
307
|
+
toggleDarkMode, // () => void
|
|
308
|
+
themes, // string[] — all valid theme names
|
|
309
|
+
styles, // string[] — all valid style names
|
|
310
|
+
surfaces, // string[] — all valid surface names
|
|
311
|
+
} = useOmniDesign();
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Handling CSS Load State
|
|
317
|
+
|
|
318
|
+
The Provider loads CSS asynchronously. Use `cssStatus` if you need to wait
|
|
319
|
+
before rendering:
|
|
320
|
+
|
|
321
|
+
```jsx
|
|
322
|
+
function App() {
|
|
323
|
+
const { cssStatus, cssError } = useOmniDesign();
|
|
324
|
+
|
|
325
|
+
if (cssStatus === 'loading') return <div>Loading theme...</div>;
|
|
326
|
+
if (cssStatus === 'error') return <div>Theme error: {cssError}</div>;
|
|
327
|
+
|
|
328
|
+
return <YourApp />;
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Available Themes
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
Default
|
|
338
|
+
Primary-Light Primary Primary-Dark
|
|
339
|
+
Secondary-Light Secondary Secondary-Dark
|
|
340
|
+
Tertiary-Light Tertiary Tertiary-Dark
|
|
341
|
+
Neutral-Light Neutral Neutral-Dark
|
|
342
|
+
Info-Light Success-Light Warning-Light Error-Light
|
|
343
|
+
Info-Dark Success-Dark Warning-Dark Error-Dark
|
|
344
|
+
App-Bar Nav-Bar Status
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Available Surfaces
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
Surface Surface-Dim Surface-Bright
|
|
351
|
+
Container Container-Low Container-Lowest Container-High Container-Highest
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Available Styles
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
Professional Modern Bold Playful
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## TypeScript
|
|
363
|
+
|
|
364
|
+
Types are included. Import them as needed:
|
|
365
|
+
|
|
366
|
+
```ts
|
|
367
|
+
import type { DynoTheme, DynoSurface, DynoStyle } from '@omni-design/components';
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Using with Cursor / AI Agents
|
|
373
|
+
|
|
374
|
+
Dyno ships a `.cursorrules` file that tells Cursor exactly how to use your design system.
|
|
375
|
+
|
|
376
|
+
### Option A — Copy from node_modules (quickest)
|
|
377
|
+
After installing, copy the file into your project root:
|
|
378
|
+
```bash
|
|
379
|
+
cp node_modules/@omni-design/components/.cursorrules .cursorrules
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Option B — Copy and paste
|
|
383
|
+
Create a `.cursorrules` file at your project root and paste this in:
|
|
384
|
+
```
|
|
385
|
+
This project uses the @omni-design/components design system.
|
|
386
|
+
|
|
387
|
+
Read these docs before writing any code:
|
|
388
|
+
- node_modules/@omni-design/components/docs/getting-started.md
|
|
389
|
+
- node_modules/@omni-design/components/docs/token-system.md
|
|
390
|
+
- node_modules/@omni-design/components/docs/components.md
|
|
391
|
+
|
|
392
|
+
ALWAYS import components from '@omni-design/components'
|
|
393
|
+
ALWAYS import CSS at the top of App.js:
|
|
394
|
+
import '@omni-design/components/public/styles/foundation.css'
|
|
395
|
+
import '@omni-design/components/public/styles/core.css'
|
|
396
|
+
import '@omni-design/components/public/styles/Light-Mode.css'
|
|
397
|
+
import '@omni-design/components/public/styles/base.css'
|
|
398
|
+
|
|
399
|
+
ALWAYS wrap content in a div with data-theme, data-surface, and data-style attributes.
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Once in place, any prompt you give Cursor will automatically use your Dyno components correctly.
|
|
403
|
+
|
|
404
|
+
## Next Steps
|
|
405
|
+
|
|
406
|
+
- **[Token System](./token-system.md)** — how CSS variables cascade through layers
|
|
407
|
+
- **[Components](./components.md)** — full component API reference
|
|
408
|
+
- **[Theming](./theming.md)** — advanced theme nesting and surface patterns
|
|
409
|
+
- **[Generating a Brand](./brand-generation.md)** — how Dino creates token files from an image
|