Updateing Docs

This commit is contained in:
2026-04-02 19:31:39 +02:00
parent 5a77deb442
commit f0c710f8c2
138 changed files with 25729 additions and 3918 deletions

View File

@@ -2,11 +2,6 @@
Follow these steps to integrate **SigPro-UI** into your project.
## Prerequisites
- [Tailwind CSS v4](https://tailwindcss.com/) configured.
- [daisyUI v5](https://daisyui.com/) installed.
---
@@ -21,35 +16,16 @@ Choose your preferred package manager:
```bash
npm install sigpro-ui
# or
pnpm add sigpro-ui
# or
bun add sigpro-ui
# or
yarn add sigpro-ui
```
## 2. Configure CSS
Add the following to your main CSS file (e.g., `app.css`):
```css
@import "tailwindcss";
@plugin "daisyui";
```
> This enables Tailwind CSS v4 + daisyUI v5 styles for all SigPro-UI components.
## 3. Import and use in your app
## 2. Import and use in your app
### ESM / Module usage
```javascript
// Import everything from sigpro-ui (includes sigpro core)
import { $, $mount, Button, Alert, Input, tt } from "sigpro-ui";
// Import your CSS (adjust the path if needed)
import "./app.css";
import "sigpro-ui/css";
// Create your app
const App = () => {
@@ -59,7 +35,6 @@ const App = () => {
$html('h1', { class: 'text-2xl font-bold mb-4' }, 'SigProUI Demo'),
Input({
label: 'Your name',
placeholder: 'Enter your name...'
}),
@@ -79,26 +54,7 @@ const App = () => {
$mount(App, "#app");
```
### CommonJS usage
```javascript
const { $, $mount, Button, Input, Alert } = require('sigpro-ui');
const App = () => {
const count = $(0);
return $html('div', { class: 'p-8' }, [
Button({
class: 'btn-primary',
onclick: () => count(count() + 1)
}, () => `Clicks: ${count()}`)
]);
};
$mount(App, "#app");
```
## 4. CDN Usage (no build step)
### CDN Usage (no build step)
Simply add the script tag and start using SigProUI:
@@ -110,7 +66,7 @@ Simply add the script tag and start using SigProUI:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SigProUI Demo</title>
<script src="https://unpkg.com/sigpro-ui@latest/dist/sigpro-ui.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/daisyui@4/dist/full.css" rel="stylesheet">
<link href="https://unpkg.com/sigpro-ui@latest/css/sigpro-ui.min.css" rel="stylesheet">
<style>
body { padding: 2rem; }
</style>
@@ -132,7 +88,6 @@ Simply add the script tag and start using SigProUI:
$html('h1', { class: 'text-2xl font-bold mb-4' }, 'SigProUI Demo'),
Input({
label: 'Your name',
value: name,
placeholder: 'Enter your name...'
}),
@@ -178,8 +133,7 @@ When you install SigProUI, you get:
- And 30+ more components!
### Utilities
- `Icons` - SVG icon set
- `Utils` - Helper functions (joinClass, val)
- `Utils` - Helper functions (ui, val)
- `tt()` - i18n translation function
## Language Support
@@ -190,15 +144,13 @@ SigProUI includes built-in i18n with Spanish and English:
import { tt } from 'sigpro-ui';
// Change locale (default is 'es')
tt.setLocale('en');
Locale('en');
// Use translations
const closeButton = Button({}, tt('close')());
const searchPlaceholder = Input({ placeholder: tt('search')() });
```
Available translations: `close`, `confirm`, `cancel`, `search`, `loading`, `nodata`
## TypeScript Support
SigProUI includes TypeScript definitions. Import types as needed:
@@ -215,27 +167,11 @@ const MyButton: React.FC<ButtonProps> = (props) => {
| Problem | Solution |
| :--- | :--- |
| Components don't look styled | Check that you've included Tailwind + daisyUI CSS (either via import or CDN) |
| Components don't look styled | Make sure you're loading css 'sigpro.css' (either via import or CDN)|
| `$ is not defined` | SigProUI includes sigpro core - no need to install separately. Make sure you're importing from 'sigpro-ui' |
| `Button is not defined` | In CDN mode, all components are in window. Use `window.Button` or destructure from window |
| Build errors | Ensure you're using a modern bundler that supports ESM |
| CDN components not working | The CDN version exposes everything globally. Use `const { $, Button } = window;` or call directly |
| Locale not working | Set locale with `tt.setLocale('en')` before using translations |
## Migration from older versions
If you were using SigProUI v1.0.x with separate SigPro installation:
**Before:**
```javascript
import { $ } from 'sigpro';
import { Button } from 'sigpro-ui';
```
**Now:**
```javascript
import { $, Button } from 'sigpro-ui';
// That's it! Everything comes from one package.
```
| Locale not working | Set locale with `Locale('en')` before using translations |
**Happy coding!** 🎉