Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,29 @@ jobs:
run: |
echo "### rblez-ui v$(node -p "require('./package.json').version") · ${GITHUB_SHA::7}" >> "$GITHUB_STEP_SUMMARY"
du -sh apps/preview/dist >> "$GITHUB_STEP_SUMMARY"
patch:
name: Patch snapshots
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout rblez/patch
uses: actions/checkout@v4
with:
repository: rblez/patch
path: .patch-cli
- uses: oven-sh/setup-bun@v2
- name: Link patch CLI
working-directory: .patch-cli
run: |
bun install
bun link
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
- name: patch test design/*/
run: |
fail=0
for f in design/*/*.pat; do
echo "::group::$f"
patch test "$f" || fail=1
echo "::endgroup::"
done
exit $fail
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Todos los cambios notables de rblez-ui. Formato basado en [Keep a Changelog](htt
- Header de la docs: se apilaba en dos filas (logo y versión arriba, búsqueda/Star abajo) y el logo quedaba cortado arriba, en móvil y en escritorio. Causa: `.top` no tenía ninguna regla base (ni `display`, ni altura, ni padding), solo ajustes sueltos en media queries. Ahora `.top` es una fila `sticky` de 56px (`display: flex; justify-content: space-between`) con fondo difuminado y borde inferior, como `.pv__bar`.

### Added
- `Grid` y `GridItem`: rejillas responsive con container queries (480 / 768 / 1024 / 1280px): `auto-fit` / `auto-fill` por ancho mínimo (`min`), `columns` con columnas por breakpoint (`cols: { base, sm, md, lg, xl }`), `masonry` (columnas CSS), `bento` con `colSpan` / `rowSpan` y `split` con columna lateral (`sidebar`, `side`). Los spans anchos ocupan la fila entera por debajo de 768px.
- `Modal`: diálogo sobre `<dialog>` nativo con focus trap, devolución del foco, `aria-modal` / `aria-labelledby` / `aria-describedby`, tamaños `sm` · `md` · `lg`, pie de acciones, cierre con Esc y clic en el fondo configurables y bloqueo de scroll.
- `BottomSheet`: hoja inferior para móvil con asa para arrastrar (y flechas ↑/↓), puntos de anclaje (`snapPoints`, `snap`), cerrar arrastrando, fondo, focus trap, Esc, bloqueo de scroll y padding de safe-area.
- `Select`: select accesible con listbox propio (`role="combobox"`), teclado completo (flechas, Home/End, PageUp/PageDown, búsqueda por tecleo, Enter/Esc/Tab), `aria-activedescendant`, iconos, opciones deshabilitadas, búsqueda opcional (`searchable`, sin tildes ni mayúsculas) e input oculto para formularios. Mismo aspecto que `Input`.
- `Toast`: `<Toaster>` (región `aria-live="polite"`, `position`, `max`) y `toast()` con variantes `default` · `success` · `warning` · `danger`, título, descripción, acción, duración, cierre, apilado y pausa al pasar el ratón o con el foco. El store es agnóstico al framework y vive en `@rblez-ui/tokens`.
- Grupo «Overlay» en la docs; demos y páginas (`/ui/<slug>/`) para los cinco componentes, en español e inglés.
- Versiones Patch en `design/grid`, `design/modal`, `design/bottom-sheet`, `design/select` y `design/toast` con casos de estado (claro/oscuro, abierto/cerrado, opción elegida, variantes…) y sus snapshots.
- CI: job «Patch snapshots» que ejecuta `patch test` sobre cada `design/*/`.
- `NotFound`: página 404 con un 404 isométrico en 3D (vector generado desde Inter), rejilla isométrica y tema claro/oscuro. La docs lo usa para rutas inexistentes.
- Slider de componentes en móvil (deslizar o tocar) y paginador anterior/siguiente.
- Landing en la introducción con animaciones GSAP (timeline y ScrollTrigger) y Motion (inView, hover, springs).
Expand All @@ -21,6 +29,7 @@ Todos los cambios notables de rblez-ui. Formato basado en [Keep a Changelog](htt
- Búsqueda en la cabecera en escritorio (⌘K / Ctrl+K) con paleta de comandos.

### Changed
- `ProfileSettings`: los iconos de las baldosas de color son rellenos (Heroicons solid vía `<Icon variant="fill">`), en blanco sobre la baldosa, como en los ajustes de Telegram; el icono de la pestaña activa también es relleno y las inactivas siguen en línea. Las píldoras superiores (QR, buscar, más) y el chevron siguen en línea. La versión Patch (`design/profile-settings`) usa glifos rellenos equivalentes y sus snapshots se han regenerado.
- El repo pasa a `rblez/ui` y la ruta a `/ui/`.
- La licencia se integra en Acerca de.
- Preview sin selector de framework.
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ Docs: **[www.rblez.com/ui](https://www.rblez.com/ui/)** · [GitHub Pages](https:
| Grupo | Componentes |
|---|---|
| IA / AI | `PromptInput` |
| Formularios / Forms | `Button`, `Input`, `Textarea`, `Switch` |
| Layout | `Card`, `Sidebar`, `Footer` |
| Feedback | `Badge`, `Kbd` |
| Formularios / Forms | `Button`, `Input`, `Textarea`, `Switch`, `Select` |
| Layout | `Grid`, `Card`, `Sidebar`, `Footer`, `ProfileSettings`, `NotFound` |
| Overlay | `Modal`, `BottomSheet` |
| Feedback | `Badge`, `Kbd`, `Toast` (`Toaster` + `toast()`) |
| Base | `Icon` (Heroicons, línea y relleno), tokens |

## Paquetes / Packages
Expand Down Expand Up @@ -50,6 +51,7 @@ packages/svelte Svelte 5
packages/react React 18+
apps/preview docs (Vite + Svelte), base /ui/
scripts/og plantilla de la imagen Open Graph
design/<slug> versión Patch de cada componente (Figma + tests de estado)
```

## Desarrollo
Expand Down
11 changes: 8 additions & 3 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,22 @@ Light: bg `#f7f7f4`, ink `#26251e`. Dark: bg `#14120b`, ink `#edecec`.
| `Input` | `value`, `label`, `hint`, `error`, `size`, `prefix` / `suffix` | `error` sets `aria-invalid`. |
| `Textarea` | `value`, `label`, `hint`, `error`, `rows` | |
| `Switch` | `checked`, `label`, `disabled` | `role="switch"`. |
| `Select` | `value`, `options: { value, label, disabled?, icon? }[]`, `label`, `hint`, `error`, `placeholder`, `size`, `searchable`, `name`, `onchange` | Own listbox (`role="combobox"` + `listbox`): arrows, Home/End, PageUp/Down, typeahead, Enter/Esc/Tab, `aria-activedescendant`. Same look as `Input`. |
| `Modal` | `open`, `onclose`, `title`, `description`, `size: sm · md · lg`, `closeOnBackdrop`, `closeOnEsc`, `showClose`, `footer` | Native `<dialog>` + `showModal()`: focus trap, focus return, `aria-modal`, `aria-labelledby`, scroll lock. |
| `BottomSheet` | `open`, `onclose`, `title`, `description`, `snapPoints` (fractions of the viewport), `snap`, `onsnapchange`, `dismissible`, `footer` | Drag handle (↑/↓ keys), drag to dismiss, backdrop, Esc, focus trap, scroll lock, safe-area padding. |
| `Badge` | `variant: default · secondary · outline · brand · success · warning · danger`, `dot` | |
| `Kbd` | children | Keyboard shortcuts. |
| `Toaster` + `toast()` | `position`, `max`, `label`; `toast(title \| options)`, `toast.success/warning/danger`, `toast.dismiss(id?)` | One `<Toaster>` per app; `aria-live="polite"`; options `{ title, description, variant, duration, action: { label, onClick }, dismissible }`; pauses on hover/focus. Store shared in `@rblez-ui/tokens`. |
| `Card` | `title`, `description`, `footer` | |
| `Grid` | `variant: auto-fit · auto-fill · columns · masonry · bento · split`, `cols` (number or `{ base, sm, md, lg, xl }`), `min`, `gap`, `sidebar`, `side`, `rowHeight`, `as` | Container queries (480/768/1024/1280). `GridItem` with `colSpan` / `rowSpan`; wide spans take the full row below 768px. |
| `Sidebar` | `sections: { title, items: { label, href, badge? }[] }[]`, `active`, `onnavigate` | `aria-current="page"` on the active item. |
| `Footer` | `columns: { title, links }[]`, `legal`, `logo`, `logoHref` | Linear-style; legal moves to a bottom bar on mobile. |
| `PromptInput` | `value`, `plan`, `placeholder` (string or rotating string[]), `submitLabel`, `theme`, `onsubmit(d: { value, plan, files })`, `ondictate` | AI composer: attachments, plan mode, dictation; Enter sends, Shift+Enter new line. |
| `ProfileSettings` | `profile`, `sections`, `tabs`, `activeTab`, `title`, `footer`, `onselect`, `onavatar`, `onqr`, `onsearch`, `onmore`, `ontab` | Telegram-style settings screen; title compacts on scroll; floating tab bar. Row colors: `blue sky indigo cyan green orange amber red rose violet purple gray`. |
| `ProfileSettings` | `profile`, `sections`, `tabs`, `activeTab`, `title`, `footer`, `onselect`, `onavatar`, `onqr`, `onsearch`, `onmore`, `ontab` | Telegram-style settings screen; title compacts on scroll; floating tab bar. Tile icons are filled (white on the color tile); the active tab icon is filled, inactive tabs and top pills stay line. Row colors: `blue sky indigo cyan green orange amber red rose violet purple gray`. |
| `NotFound` | `title`, `description`, `actionLabel`, `href`, `grid`, `onaction` | 404 page: isometric 3D "404" vector + isometric grid. Regenerate the art with `python3 scripts/notfound/gen.py`. |
| `Icon` | `name` (curated) or `icon` (any Heroicon), `variant: line · fill`, `size`, `strokeWidth`, `label` | See §5. |

Types live in `@rblez-ui/tokens` (`ButtonVariant`, `SidebarSection`, `FooterColumn`, `SettingsSection`, `SettingsItem`, `SettingsTab`, `SettingsProfile`, `PromptSubmit`, `IconName`, `IconNode`, …).
Types live in `@rblez-ui/tokens` (`ButtonVariant`, `SidebarSection`, `FooterColumn`, `SettingsSection`, `SettingsItem`, `SettingsTab`, `SettingsProfile`, `PromptSubmit`, `IconName`, `IconNode`, `GridVariant`, `GridCols`, `ModalSize`, `SelectOption`, `ToastOptions`, `ToastVariant`, `ToastPosition`, …).

## 5. Icons (Heroicons)

Expand Down Expand Up @@ -129,7 +134,7 @@ Line icons use stroke 2 at ≤16px and 1.5 above. Icon-only buttons need `aria-l
2. `packages/svelte/src/<Name>.svelte` and `packages/react/src/<Name>.tsx` with identical props; export both from each `index.ts`.
3. Demo in `apps/preview/src/demos/{svelte,react}/<Name>Demo.*` and an entry in `apps/preview/src/docs/registry.ts` (slug, name, group, description, props); English copy in `docs/i18n.svelte.ts`.
4. Regenerate OG images: `pnpm build && python3 scripts/og/render.py && pnpm build`.
5. Optional: a Patch version in `design/<slug>/` with `*.test.json` state cases for Figma export and snapshot tests.
5. A Patch version in `design/<slug>/` with `*.test.json` state cases for Figma export and snapshot tests (`patch test design/<slug>/<Name>.pat`; CI runs every `design/*/`).
6. Add a line to `CHANGELOG.md` under **Unreleased**; open a PR (`feat(<name>): …`).

## 9. Don'ts
Expand Down
Binary file added apps/preview/public/og/bottom-sheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/preview/public/og/grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/preview/public/og/modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/preview/public/og/select.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/preview/public/og/toast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/preview/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
return () => { removeEventListener("popstate", on); removeEventListener("click", click); };
});

const groups = ["IA", "Formularios", "Layout", "Feedback"] as const;
const groups = ["IA", "Formularios", "Layout", "Overlay", "Feedback"] as const;
const L = $derived(t());
$effect(() => { document.documentElement.lang = i18n.lang; });
const sections: SidebarSection[] = $derived([
Expand Down
23 changes: 23 additions & 0 deletions apps/preview/src/demos/react/BottomSheetDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useState } from "react";
import { BottomSheet, Button, Switch } from "@rblez-ui/react";

export default function BottomSheetDemo() {
const [open, setOpen] = useState(false);
const [snap, setSnap] = useState(0);
return (
<>
<div className="demo-row">
<Button variant="outline" onClick={() => setOpen(true)}>Abrir ajustes</Button>
</div>
<BottomSheet open={open} onClose={() => setOpen(false)} snap={snap} onSnapChange={setSnap} snapPoints={[0.45, 0.9]}
title="Ajustes rápidos" description="Arrastra el asa para expandir o cerrar."
footer={<Button variant="brand" onClick={() => setOpen(false)}>Listo</Button>}>
<div className="demo-stack">
<Switch label="Notificaciones" defaultChecked />
<Switch label="Modo avión" />
<Switch label="Ahorro de datos" />
</div>
</BottomSheet>
</>
);
}
51 changes: 51 additions & 0 deletions apps/preview/src/demos/react/GridDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { useState } from "react";
import { Button, Grid, GridItem } from "@rblez-ui/react";
import type { GridVariant } from "@rblez-ui/tokens";

const variants: GridVariant[] = ["bento", "auto-fit", "columns", "masonry", "split"];
const heights = [64, 112, 80, 136, 72, 96];

export default function GridDemo() {
const [variant, setVariant] = useState<GridVariant>("bento");
return (
<div className="demo-grid">
<div className="demo-row" role="group" aria-label="Tipo de grid">
{variants.map((v) => (
<Button key={v} size="sm" variant={v === variant ? "solid" : "outline"} aria-pressed={v === variant} onClick={() => setVariant(v)}>{v}</Button>
))}
</div>

{variant === "bento" && (
<Grid variant="bento" cols={{ base: 2, md: 4 }} rowHeight={88} gap={12}>
<GridItem colSpan={2} rowSpan={2} className="demo-tile demo-tile--brand">2 × 2</GridItem>
<GridItem colSpan={2} className="demo-tile">2 × 1</GridItem>
<GridItem className="demo-tile">1</GridItem>
<GridItem className="demo-tile">1</GridItem>
<GridItem colSpan={3} className="demo-tile">3 × 1</GridItem>
<GridItem className="demo-tile">1</GridItem>
</Grid>
)}
{variant === "auto-fit" && (
<Grid min={140} gap={12}>
{Array.from({ length: 6 }, (_, i) => <div key={i} className="demo-tile">min 140px · {i + 1}</div>)}
</Grid>
)}
{variant === "columns" && (
<Grid variant="columns" cols={{ base: 1, sm: 2, md: 3 }} gap={12}>
{Array.from({ length: 6 }, (_, i) => <div key={i} className="demo-tile">1 · 2 · 3 col · {i + 1}</div>)}
</Grid>
)}
{variant === "masonry" && (
<Grid variant="masonry" cols={{ base: 2, md: 3 }} gap={12}>
{heights.map((h, i) => <div key={i} className="demo-tile" style={{ height: h }}>{i + 1}</div>)}
</Grid>
)}
{variant === "split" && (
<Grid variant="split" sidebar={200} gap={12}>
<aside className="demo-tile">Sidebar 200px</aside>
<div className="demo-tile demo-tile--tall">Contenido</div>
</Grid>
)}
</div>
);
}
20 changes: 20 additions & 0 deletions apps/preview/src/demos/react/ModalDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useState } from "react";
import { Button, Input, Modal } from "@rblez-ui/react";

export default function ModalDemo() {
const [open, setOpen] = useState(false);
return (
<>
<div className="demo-row">
<Button variant="outline" onClick={() => setOpen(true)}>Renombrar proyecto</Button>
</div>
<Modal open={open} onClose={() => setOpen(false)} title="Renombrar proyecto" description="El nombre aparece en la URL y en el panel." size="sm"
footer={<>
<Button variant="ghost" onClick={() => setOpen(false)}>Cancelar</Button>
<Button variant="brand" onClick={() => setOpen(false)}>Guardar</Button>
</>}>
<Input label="Nombre" defaultValue="rblez-ui" />
</Modal>
</>
);
}
28 changes: 28 additions & 0 deletions apps/preview/src/demos/react/SelectDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useState } from "react";
import { Select } from "@rblez-ui/react";
import type { SelectOption } from "@rblez-ui/tokens";

const regions: SelectOption[] = [
{ value: "mad", label: "Madrid (eu-south)", icon: "globe" },
{ value: "fra", label: "Frankfurt (eu-central)", icon: "globe" },
{ value: "iad", label: "Virginia (us-east)", icon: "globe" },
{ value: "sfo", label: "San Francisco (us-west)", icon: "globe" },
{ value: "gru", label: "São Paulo (sa-east)", icon: "globe", disabled: true },
];
const roles: SelectOption[] = [
{ value: "owner", label: "Propietario" },
{ value: "admin", label: "Administrador" },
{ value: "member", label: "Miembro" },
{ value: "viewer", label: "Solo lectura" },
];

export default function SelectDemo() {
const [region, setRegion] = useState("mad");
const [role, setRole] = useState<string>();
return (
<div className="demo-stack">
<Select label="Región" options={regions} value={region} onChange={setRegion} hint="Donde se despliega tu proyecto." searchable />
<Select label="Rol" options={roles} value={role} onChange={setRole} placeholder="Elige un rol" error={role ? undefined : "Elige un rol para continuar."} />
</div>
);
}
15 changes: 15 additions & 0 deletions apps/preview/src/demos/react/ToastDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Button, Toaster, toast } from "@rblez-ui/react";

export default function ToastDemo() {
return (
<>
<div className="demo-row">
<Button variant="outline" onClick={() => toast("Cambios guardados", { description: "Tu perfil está al día." })}>Default</Button>
<Button variant="outline" onClick={() => toast.success("Desplegado", { description: "rblez-ui · producción", action: { label: "Ver", onClick: () => {} } })}>Success</Button>
<Button variant="outline" onClick={() => toast.warning("Cuota al 80%", { description: "Quedan 2 GB este mes." })}>Warning</Button>
<Button variant="outline" onClick={() => toast.danger("Error al desplegar", { description: "Revisa los logs del build.", duration: 0 })}>Danger</Button>
</div>
<Toaster position="bottom-right" />
</>
);
}
20 changes: 20 additions & 0 deletions apps/preview/src/demos/svelte/BottomSheetDemo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script lang="ts">
import { BottomSheet, Button, Switch } from "@rblez-ui/svelte";
let open = $state(false);
let snap = $state(0);
</script>

<div class="demo-row">
<Button variant="outline" onclick={() => (open = true)}>Abrir ajustes</Button>
</div>

<BottomSheet bind:open bind:snap snapPoints={[0.45, 0.9]} title="Ajustes rápidos" description="Arrastra el asa para expandir o cerrar.">
<div class="demo-stack">
<Switch label="Notificaciones" checked />
<Switch label="Modo avión" />
<Switch label="Ahorro de datos" />
</div>
{#snippet footer()}
<Button variant="brand" onclick={() => (open = false)}>Listo</Button>
{/snippet}
</BottomSheet>
43 changes: 43 additions & 0 deletions apps/preview/src/demos/svelte/GridDemo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<script lang="ts">
import { Button, Grid, GridItem } from "@rblez-ui/svelte";
import type { GridVariant } from "@rblez-ui/tokens";
const variants: GridVariant[] = ["bento", "auto-fit", "columns", "masonry", "split"];
let variant = $state<GridVariant>("bento");
const heights = [64, 112, 80, 136, 72, 96];
</script>

<div class="demo-grid">
<div class="demo-row" role="group" aria-label="Tipo de grid">
{#each variants as v (v)}
<Button size="sm" variant={v === variant ? "solid" : "outline"} aria-pressed={v === variant} onclick={() => (variant = v)}>{v}</Button>
{/each}
</div>

{#if variant === "bento"}
<Grid variant="bento" cols={{ base: 2, md: 4 }} rowHeight={88} gap={12}>
<GridItem colSpan={2} rowSpan={2} class="demo-tile demo-tile--brand">2 × 2</GridItem>
<GridItem colSpan={2} class="demo-tile">2 × 1</GridItem>
<GridItem class="demo-tile">1</GridItem>
<GridItem class="demo-tile">1</GridItem>
<GridItem colSpan={3} class="demo-tile">3 × 1</GridItem>
<GridItem class="demo-tile">1</GridItem>
</Grid>
{:else if variant === "auto-fit"}
<Grid min={140} gap={12}>
{#each Array(6) as _, i (i)}<div class="demo-tile">min 140px · {i + 1}</div>{/each}
</Grid>
{:else if variant === "columns"}
<Grid variant="columns" cols={{ base: 1, sm: 2, md: 3 }} gap={12}>
{#each Array(6) as _, i (i)}<div class="demo-tile">1 · 2 · 3 col · {i + 1}</div>{/each}
</Grid>
{:else if variant === "masonry"}
<Grid variant="masonry" cols={{ base: 2, md: 3 }} gap={12}>
{#each heights as h, i (i)}<div class="demo-tile" style:height="{h}px">{i + 1}</div>{/each}
</Grid>
{:else}
<Grid variant="split" sidebar={200} gap={12}>
<aside class="demo-tile">Sidebar 200px</aside>
<div class="demo-tile demo-tile--tall">Contenido</div>
</Grid>
{/if}
</div>
16 changes: 16 additions & 0 deletions apps/preview/src/demos/svelte/ModalDemo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts">
import { Button, Input, Modal } from "@rblez-ui/svelte";
let open = $state(false);
</script>

<div class="demo-row">
<Button variant="outline" onclick={() => (open = true)}>Renombrar proyecto</Button>
</div>

<Modal bind:open title="Renombrar proyecto" description="El nombre aparece en la URL y en el panel." size="sm">
<Input label="Nombre" value="rblez-ui" />
{#snippet footer()}
<Button variant="ghost" onclick={() => (open = false)}>Cancelar</Button>
<Button variant="brand" onclick={() => (open = false)}>Guardar</Button>
{/snippet}
</Modal>
Loading
Loading