nsg-ui 0.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/README.md +181 -0
- package/dist/dev.js +2739 -0
- package/dist/dev.jsx +2280 -0
- package/dist/index.d.ts +554 -0
- package/dist/index.js +2739 -0
- package/dist/index.jsx +2280 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# nsg-ui
|
|
2
|
+
|
|
3
|
+
A SolidJS component library built on [Kobalte](https://kobalte.dev) primitives with Tailwind CSS styling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add nsg-ui @kobalte/core solid-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
### Tailwind CSS 4
|
|
14
|
+
|
|
15
|
+
Add the `@source` directive to scan the library for Tailwind classes:
|
|
16
|
+
|
|
17
|
+
```css
|
|
18
|
+
@import 'tailwindcss';
|
|
19
|
+
@source "node_modules/nsg-ui/dist/**/*.{js,jsx}";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Define theme colors in your `@theme` block:
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
@theme {
|
|
26
|
+
--color-surface: oklch(97% 0.003 80);
|
|
27
|
+
--color-surface-raised: oklch(100% 0 0);
|
|
28
|
+
--color-border: oklch(90% 0.006 80);
|
|
29
|
+
--color-text: oklch(15% 0.01 80);
|
|
30
|
+
--color-text-secondary: oklch(40% 0.01 80);
|
|
31
|
+
--color-text-muted: oklch(55% 0.01 80);
|
|
32
|
+
--color-primary: oklch(50% 0.2 260);
|
|
33
|
+
--color-danger: oklch(55% 0.2 25);
|
|
34
|
+
--color-success: oklch(55% 0.15 145);
|
|
35
|
+
--color-warning: oklch(70% 0.15 75);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Button, Dialog, Toast, toast } from 'nsg-ui';
|
|
43
|
+
|
|
44
|
+
function App() {
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<Button variant="default" onClick={() => toast.success({ title: 'Saved!' })}>
|
|
48
|
+
Save
|
|
49
|
+
</Button>
|
|
50
|
+
|
|
51
|
+
<Dialog
|
|
52
|
+
trigger={<Button variant="outline">Open Dialog</Button>}
|
|
53
|
+
title="Confirm"
|
|
54
|
+
description="Are you sure?"
|
|
55
|
+
>
|
|
56
|
+
<Button variant="danger">Delete</Button>
|
|
57
|
+
</Dialog>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Components
|
|
64
|
+
|
|
65
|
+
| Component | Description |
|
|
66
|
+
|-----------|-------------|
|
|
67
|
+
| Accordion | Expandable content sections |
|
|
68
|
+
| Badge | Status indicators |
|
|
69
|
+
| Button | Actions with variants: default, outline, ghost, danger, link |
|
|
70
|
+
| Card | Content container |
|
|
71
|
+
| Checkbox | Boolean input with indeterminate state |
|
|
72
|
+
| ComboBox | Searchable select with single/multiple selection |
|
|
73
|
+
| CommandBar | Command palette with keyboard navigation |
|
|
74
|
+
| ContextMenu | Right-click menu |
|
|
75
|
+
| Dialog | Modal dialogs |
|
|
76
|
+
| DropdownMenu | Menus with submenus, checkboxes, radios |
|
|
77
|
+
| Image | Image with fallback |
|
|
78
|
+
| Link | Navigation links |
|
|
79
|
+
| NumberInput | Numeric input field |
|
|
80
|
+
| Popover | Floating content |
|
|
81
|
+
| Progress | Progress indicators |
|
|
82
|
+
| RadioGroup | Single selection from options |
|
|
83
|
+
| SegmentedControl | Toggle between options |
|
|
84
|
+
| Separator | Visual divider |
|
|
85
|
+
| Tabs | Tabbed content |
|
|
86
|
+
| Text | Themed text with color variants |
|
|
87
|
+
| TextInput | Text input field |
|
|
88
|
+
| Toast | Notifications (info, success, warning, danger) |
|
|
89
|
+
| ToggleButton | On/off toggle |
|
|
90
|
+
|
|
91
|
+
### Icons
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { CheckIcon, ChevronRightIcon } from 'nsg-ui/icons';
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## API Examples
|
|
98
|
+
|
|
99
|
+
### Button
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Button variant="default" size="md" disabled={false}>
|
|
103
|
+
Click me
|
|
104
|
+
</Button>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Variants: `default` | `outline` | `ghost` | `danger` | `link`
|
|
108
|
+
Sizes: `sm` | `md` | `lg` | `icon`
|
|
109
|
+
|
|
110
|
+
### Toast
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
// Auto-injects toast region on first call
|
|
114
|
+
toast.info({ title: 'Message received' });
|
|
115
|
+
toast.success({ title: 'Saved!', description: 'Changes applied' });
|
|
116
|
+
toast.warning({ title: 'Session expiring' });
|
|
117
|
+
toast.danger({ title: 'Error', description: 'Failed to save' });
|
|
118
|
+
|
|
119
|
+
// Options
|
|
120
|
+
toast.success({
|
|
121
|
+
title: 'Uploading...',
|
|
122
|
+
description: 'Optional details',
|
|
123
|
+
withCloseIcon: true,
|
|
124
|
+
duration: 2000,
|
|
125
|
+
persistent: false,
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### ComboBox
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
<ComboBox
|
|
133
|
+
options={['Apple', 'Banana', 'Cherry']}
|
|
134
|
+
value={fruit()}
|
|
135
|
+
onChange={setFruit}
|
|
136
|
+
placeholder="Select a fruit..."
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
// Multiple selection
|
|
140
|
+
<ComboBox
|
|
141
|
+
multiple
|
|
142
|
+
options={frameworks}
|
|
143
|
+
value={selected()}
|
|
144
|
+
onChange={setSelected}
|
|
145
|
+
/>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### DropdownMenu
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
<DropdownMenu trigger={<Button>Open</Button>}>
|
|
152
|
+
<DropdownMenu.Group label="Actions">
|
|
153
|
+
<DropdownMenu.ActionItem label="Edit" onSelect={() => {}} />
|
|
154
|
+
<DropdownMenu.ActionItem label="Delete" variant="danger" onSelect={() => {}} />
|
|
155
|
+
</DropdownMenu.Group>
|
|
156
|
+
|
|
157
|
+
<DropdownMenu.Separator />
|
|
158
|
+
|
|
159
|
+
<DropdownMenu.SingleSelect label="Theme" value={theme()} onChange={setTheme}>
|
|
160
|
+
<DropdownMenu.Option value="light" label="Light" />
|
|
161
|
+
<DropdownMenu.Option value="dark" label="Dark" />
|
|
162
|
+
</DropdownMenu.SingleSelect>
|
|
163
|
+
</DropdownMenu>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Development
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Build library
|
|
170
|
+
bun run build
|
|
171
|
+
|
|
172
|
+
# Watch mode
|
|
173
|
+
bun run dev
|
|
174
|
+
|
|
175
|
+
# Run demo website
|
|
176
|
+
cd website && bun dev
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT
|