import{_ as i,o as a,c as t,ae as e}from"./chunks/framework.C8AWLET_.js";const c=JSON.parse('{"title":"🧩 UI Components (WIP)","description":"","frontmatter":{},"headers":[],"relativePath":"ui/quick.md","filePath":"ui/quick.md"}'),n={name:"ui/quick.md"};function l(h,s,p,o,k,r){return a(),t("div",null,[...s[0]||(s[0]=[e(`

🧩 UI Components (WIP) ​

Status: Work In Progress. > These are high-level, complex visual components designed to speed up development. They often replace native HTML elements with "superpowered" versions that handle their own internal logic, reactivity, and accessibility.

1. What are UI Components? ​

Unlike Tag Helpers (which are just functional mirrors of HTML tags), SigPro UI Components are smart abstractions.


2. The UI Registry (Available Now) ​

CategoryComponents
Logic & FlowIf, For, Json
Forms & InputsButton, Input, Select, Autocomplete, Datepicker, Colorpicker, CheckBox, Radio, Range, Rating, Swap
FeedbackAlert, Toast, Modal, Loading, Badge, Tooltip, Indicator
NavigationNavbar, Menu, Drawer, Tabs, Accordion, Dropdown
Data & LayoutRequest, Response, Grid (AG-Grid), List, Stack, Timeline, Stat, Fieldset, Fab

3. Examples with "Superpowers" ​

A. The Declarative API Flow (Request & Response) ​

Instead of manually managing loading and error flags, use these two together to handle data fetching elegantly.

javascript
// 1. Define the request (it tracks dependencies automatically)
const userProfile = Request(
  () => \`https://api.example.com/user/\${userId()}\`
);

// 2. Render the UI based on the request state
Div({ class: "p-4" }, [
  Response(userProfile, (data) => 
    Div([
      H1(data.name),
      P(data.email)
    ])
  )
]);

B. Smart Inputs & Autocomplete ​

Native inputs are boring. SigPro UI inputs handle labels, icons, password toggles, and validation states out of the box.

javascript
const searchQuery = $("");

Autocomplete({
  label: "Find a Country",
  placeholder: "Start typing...",
  options: ["Spain", "France", "Germany", "Italy", "Portugal"],
  $value: searchQuery,
  onSelect: (val) => console.log("Selected:", val)
});

C. The Reactive Datepicker ​

Handles single dates or ranges with a clean, reactive interface.

javascript
const myDate = $(""); // or { start: "", end: "" } for range

Datepicker({
  label: "Select Expiry Date",
  $value: myDate,
  range: false // Set to true for range selection
});

D. Imperative Toasts & Modals ​

Sometimes you just need to trigger a message without cluttering your template.

javascript
// Show a notification from anywhere in your logic
Toast("Settings saved successfully!", "alert-success", 3000);

// Control a modal with a simple signal
const isModalOpen = $(false);

Modal({ 
  $open: isModalOpen, 
  title: "Delete Account",
  buttons: [
    Button({ class: "btn-error", onclick: doDelete }, "Confirm")
  ]
}, "This action cannot be undone.");

4. Internationalization (i18n) ​

The UI library comes with a built-in locale system. It currently supports es and en.

javascript
// Set the global UI language
SetLocale("en");

// Access translated strings in your own components
const t = tt("confirm"); // Returns a signal that tracks the current locale

5. Best Practices ​

`,29)])])}const E=i(n,[["render",l]]);export{c as __pageData,E as default};