This commit is contained in:
@@ -18,8 +18,8 @@ import "sigpro-ui/css";
|
||||
|
||||
| Component | Purpose | Basic Example |
|
||||
| :--- | :--- | :--- |
|
||||
| **Button** | Styled button with DaisyUI | `Button({ class: "btn-primary" }, "Submit")` |
|
||||
| **Input** | Reactive text field with validation | `Input({ value: $name, validate: (v) => !v ? "Required" : "" })` |
|
||||
| **Button** | Styled button with DaisyUI | `button({ class: "btn-primary" }, "Submit")` |
|
||||
| **Input** | Reactive text field with validation | `input({ value: $name, validate: (v) => !v ? "Required" : "" })` |
|
||||
| **Select** | Dropdown selection menu | `Select({ options: ["Admin", "User"], value: $role })` |
|
||||
| **Checkbox** | Binary toggle (boolean) | `Checkbox({ label: "Active", checked: $isActive })` |
|
||||
| **Table** | Data grid with column rendering | `Table({ items: $data, columns: [...] })` |
|
||||
@@ -37,9 +37,9 @@ import "sigpro-ui/css";
|
||||
|
||||
| Component | Description | Example |
|
||||
| :--- | :--- | :--- |
|
||||
| **Input** | Text input with floating label, validation, password toggle | `Input({ label: "Email", type: "email", value: $email, validate: validateEmail })` |
|
||||
| **Input** | Text input with floating label, validation, password toggle | `input({ label: "Email", type: "email", value: $email, validate: validateEmail })` |
|
||||
| **Select** | Dropdown selector | `Select({ label: "Role", options: ["Admin", "User"], value: $role })` |
|
||||
| **Autocomplete** | Searchable dropdown with filtering | `Autocomplete({ label: "Country", options: countryList, value: $country })` |
|
||||
| **Autocomplete** | Searchable dropdown with filtering | `autocomplete({ label: "Country", options: countryList, value: $country })` |
|
||||
| **Datepicker** | Date picker (single or range mode) | `Datepicker({ label: "Date", value: $date, range: false })` |
|
||||
| **Colorpicker** | Visual color picker with palette | `Colorpicker({ label: "Theme", value: $color })` |
|
||||
| **Checkbox** | Checkbox or toggle switch | `Checkbox({ label: "Remember me", value: $remember })` |
|
||||
@@ -57,7 +57,7 @@ The `Input` component supports real-time validation via the `validate` prop:
|
||||
```javascript
|
||||
const email = $('');
|
||||
|
||||
Input({
|
||||
input({
|
||||
type: 'email',
|
||||
value: email,
|
||||
placeholder: 'Enter your email',
|
||||
@@ -90,7 +90,7 @@ Input({
|
||||
| **Stat** | Statistical data blocks (KPIs) | `Stat({ label: "Total", value: "1.2k", desc: "Monthly" })` |
|
||||
| **Timeline** | Vertical/horizontal timeline | `Timeline({ items: [{ title: "Step 1", detail: "Completed" }] })` |
|
||||
| **Stack** | Stacked elements | `Stack({}, [Card1, Card2, Card3])` |
|
||||
| **Indicator** | Badge on corner of element | `Indicator({ value: () => count() }, Button(...))` |
|
||||
| **Indicator** | Badge on corner of element | `Indicator({ value: () => count() }, button(...))` |
|
||||
|
||||
---
|
||||
|
||||
@@ -101,7 +101,7 @@ Input({
|
||||
| **Alert** | Inline contextual notification | `Alert({ type: "success" }, "Changes saved!")` |
|
||||
| **Modal** | Dialog overlay | `Modal({ open: $isOpen, title: "Confirm" }, "Are you sure?")` |
|
||||
| **Toast** | Floating notification (auto-stacking) | `Toast("Action completed", "alert-info", 3000)` |
|
||||
| **Tooltip** | Hover tooltip wrapper | `Tooltip({ tip: "Help text", ui: "tooltip-top" }, Button(...))` |
|
||||
| **Tooltip** | Hover tooltip wrapper | `Tooltip({ tip: "Help text", ui: "tooltip-top" }, button(...))` |
|
||||
|
||||
---
|
||||
|
||||
@@ -115,7 +115,7 @@ Input({
|
||||
| **Tabs** | Content switching | `Tabs({ items: [{ label: "Tab1", content: Panel1 }] })` |
|
||||
| **Accordion** | Collapsible sections | `Accordion({ title: "Details" }, "Hidden content")` |
|
||||
| **Dropdown** | Contextual menus | `Dropdown({ label: "Options" }, [MenuLink("Edit")])` |
|
||||
| **Fieldset** | Form grouping with legend | `Fieldset({ legend: "Personal Info" }, [Input(...)])` |
|
||||
| **Fieldset** | Form grouping with legend | `Fieldset({ legend: "Personal Info" }, [input(...)])` |
|
||||
|
||||
---
|
||||
|
||||
@@ -124,7 +124,7 @@ Input({
|
||||
| Component | Description | Example |
|
||||
| :--- | :--- | :--- |
|
||||
| **Fab** | Floating Action Button with actions | `Fab({ icon: "+", actions: [{ label: "Add", onclick: add }] })` |
|
||||
| **Indicator** | Badge indicator wrapper | `Indicator({ value: () => unread() }, Button(...))` |
|
||||
| **Indicator** | Badge indicator wrapper | `Indicator({ value: () => unread() }, button(...))` |
|
||||
|
||||
---
|
||||
|
||||
@@ -150,7 +150,7 @@ const closeText = tt("close"); // "Close" or "Cerrar"
|
||||
2. **DaisyUI v5**: Pass any daisyUI styling via the `class` attribute.
|
||||
|
||||
```javascript
|
||||
Button({ class: "btn-primary btn-sm rounded-full shadow-lg" }, "Click")
|
||||
button({ class: "btn-primary btn-sm rounded-full shadow-lg" }, "Click")
|
||||
```
|
||||
|
||||
3. **Zero Imports (Global Mode)**: After calling `UI()`, all components are attached to `window`. No manual imports needed.
|
||||
@@ -166,7 +166,7 @@ const closeText = tt("close"); // "Close" or "Cerrar"
|
||||
```javascript
|
||||
const name = $("");
|
||||
|
||||
Input({
|
||||
input({
|
||||
value: name,
|
||||
placeholder: "Name",
|
||||
validate: (value) => {
|
||||
@@ -203,7 +203,7 @@ Modal({
|
||||
open: showModal,
|
||||
title: "Delete Item",
|
||||
buttons: [
|
||||
Button({ class: "btn-error", onclick: () => { deleteItem(); showModal(false); } }, "Delete")
|
||||
button({ class: "btn-error", onclick: () => { deleteItem(); showModal(false); } }, "Delete")
|
||||
]
|
||||
}, "Are you sure you want to delete this item?");
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user