@nubitio/ui 0.1.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/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/index.cjs +2396 -0
- package/dist/index.d.cts +780 -0
- package/dist/index.d.mts +780 -0
- package/dist/index.mjs +2332 -0
- package/dist/style.css +2614 -0
- package/dist/themes/nb-theme-dark.css +79 -0
- package/dist/themes/nb-theme-light.css +78 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Johan Guerreros
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# @nubitio/ui
|
|
2
|
+
|
|
3
|
+
Visual primitives and theme system for the Nubit admin stack: buttons, dialogs, drawers, cards, form controls, date pickers, badges, and a light/dark theme with density and accent-color support.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nubitio/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer dependencies
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
"react": "^19",
|
|
15
|
+
"react-dom": "^19"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { ThemeProvider, Button, AppDialog, Card } from '@nubitio/ui';
|
|
22
|
+
import '@nubitio/ui/style.css';
|
|
23
|
+
|
|
24
|
+
export function App() {
|
|
25
|
+
return (
|
|
26
|
+
<ThemeProvider>
|
|
27
|
+
<Card>
|
|
28
|
+
<Button variant="primary">Save</Button>
|
|
29
|
+
</Card>
|
|
30
|
+
</ThemeProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What's inside
|
|
36
|
+
|
|
37
|
+
- **Primitives** — `Button`, `IconButton`, `Badge`, `Chip`, `Toggle`, `Avatar`, `Skeleton`, `EmptyState`, `StatCard`, `Card`, `CollapsibleSection`
|
|
38
|
+
- **Overlays** — `AppDialog`, `ConfirmDialog`, `Drawer`, `Popover`, `ContextMenu`, `AppDropdown`
|
|
39
|
+
- **Form controls** — `TextField`, `TextAreaField`, `SelectField`, `FormField`, `DatePicker`, `DateRangePicker`
|
|
40
|
+
- **Theming** — `ThemeProvider`, `ThemeSwitcher`, `DensityProvider`, `useAccentColor`, `SettingsPanel`
|
|
41
|
+
- **Layout** — `AppToolbar`
|
|
42
|
+
|
|
43
|
+
All components ship their styles in `dist/style.css`; import it once at the app root. Static design tokens (typography, spacing, radii) are included in `style.css`.
|
|
44
|
+
|
|
45
|
+
## Theming
|
|
46
|
+
|
|
47
|
+
Color/surface tokens live in runtime-switchable theme stylesheets shipped with the package (`@nubitio/ui/themes/nb-theme-light.css` and `nb-theme-dark.css`). `ThemeProvider` loads them from `basePath` (default `/themes/`) and toggles a `data-theme` attribute plus a `nb-theme-{light,dark}` class on `<html>` — copy the two theme files into your public directory (or point `basePath` wherever you serve them):
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { ThemeProvider, ThemeSwitcher } from '@nubitio/ui';
|
|
51
|
+
|
|
52
|
+
<ThemeProvider basePath="/themes/">
|
|
53
|
+
<App />
|
|
54
|
+
</ThemeProvider>;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`storageKey` (default `nb-theme`) and `themePrefix` (default `nb-theme-`) are configurable.
|
|
58
|
+
|
|
59
|
+
## Localization
|
|
60
|
+
|
|
61
|
+
Built-in strings (aria-labels, calendar buttons) default to English. Localize them once at the app root with `UiStringsProvider` — a Spanish preset ships with the package:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { UiStringsProvider, ES_UI_STRINGS } from '@nubitio/ui';
|
|
65
|
+
|
|
66
|
+
<UiStringsProvider strings={ES_UI_STRINGS}>
|
|
67
|
+
<App />
|
|
68
|
+
</UiStringsProvider>;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Partial overrides work too (`strings={{ close: 'Schließen' }}`); missing keys fall back to English. Per-component label props (e.g. `closeLabel` on `AppDialog`/`Drawer`) win over the provider.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|