@zuccadev-labs/zuix-zui 0.0.0-stage → 0.1.0
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/AGENTS.md +140 -0
- package/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +108 -2
- package/dist/esm/components/actions/Button.d.ts +16 -0
- package/dist/esm/components/actions/Button.js +8 -0
- package/dist/esm/components/actions/Button.js.map +1 -0
- package/dist/esm/components/actions/IconButton.d.ts +16 -0
- package/dist/esm/components/actions/IconButton.js +8 -0
- package/dist/esm/components/actions/IconButton.js.map +1 -0
- package/dist/esm/components/actions/Link.d.ts +15 -0
- package/dist/esm/components/actions/Link.js +10 -0
- package/dist/esm/components/actions/Link.js.map +1 -0
- package/dist/esm/components/actions/SegmentedControl.d.ts +26 -0
- package/dist/esm/components/actions/SegmentedControl.js +20 -0
- package/dist/esm/components/actions/SegmentedControl.js.map +1 -0
- package/dist/esm/components/actions/Toggle.d.ts +13 -0
- package/dist/esm/components/actions/Toggle.js +11 -0
- package/dist/esm/components/actions/Toggle.js.map +1 -0
- package/dist/esm/components/actions/index.d.ts +6 -0
- package/dist/esm/components/actions/index.js +6 -0
- package/dist/esm/components/actions/index.js.map +1 -0
- package/dist/esm/components/actions/types.d.ts +5 -0
- package/dist/esm/components/actions/types.js +3 -0
- package/dist/esm/components/actions/types.js.map +1 -0
- package/dist/esm/components/carousel/Carousel.d.ts +44 -0
- package/dist/esm/components/carousel/Carousel.js +85 -0
- package/dist/esm/components/carousel/Carousel.js.map +1 -0
- package/dist/esm/components/carousel/engine.d.ts +52 -0
- package/dist/esm/components/carousel/engine.js +693 -0
- package/dist/esm/components/carousel/engine.js.map +1 -0
- package/dist/esm/components/carousel/index.d.ts +3 -0
- package/dist/esm/components/carousel/index.js +2 -0
- package/dist/esm/components/carousel/index.js.map +1 -0
- package/dist/esm/components/carousel/lens.d.ts +46 -0
- package/dist/esm/components/carousel/lens.js +117 -0
- package/dist/esm/components/carousel/lens.js.map +1 -0
- package/dist/esm/components/carousel/lensRenderer.d.ts +61 -0
- package/dist/esm/components/carousel/lensRenderer.js +355 -0
- package/dist/esm/components/carousel/lensRenderer.js.map +1 -0
- package/dist/esm/components/carousel/slideTexture.d.ts +17 -0
- package/dist/esm/components/carousel/slideTexture.js +44 -0
- package/dist/esm/components/carousel/slideTexture.js.map +1 -0
- package/dist/esm/components/carousel/useCarouselTrack.d.ts +31 -0
- package/dist/esm/components/carousel/useCarouselTrack.js +66 -0
- package/dist/esm/components/carousel/useCarouselTrack.js.map +1 -0
- package/dist/esm/components/content/Callout.d.ts +12 -0
- package/dist/esm/components/content/Callout.js +17 -0
- package/dist/esm/components/content/Callout.js.map +1 -0
- package/dist/esm/components/content/Card.d.ts +11 -0
- package/dist/esm/components/content/Card.js +7 -0
- package/dist/esm/components/content/Card.js.map +1 -0
- package/dist/esm/components/content/CardFooter.d.ts +7 -0
- package/dist/esm/components/content/CardFooter.js +7 -0
- package/dist/esm/components/content/CardFooter.js.map +1 -0
- package/dist/esm/components/content/CardHeader.d.ts +10 -0
- package/dist/esm/components/content/CardHeader.js +8 -0
- package/dist/esm/components/content/CardHeader.js.map +1 -0
- package/dist/esm/components/content/CodeBlock.d.ts +22 -0
- package/dist/esm/components/content/CodeBlock.js +32 -0
- package/dist/esm/components/content/CodeBlock.js.map +1 -0
- package/dist/esm/components/content/Divider.d.ts +12 -0
- package/dist/esm/components/content/Divider.js +7 -0
- package/dist/esm/components/content/Divider.js.map +1 -0
- package/dist/esm/components/content/Panel.d.ts +15 -0
- package/dist/esm/components/content/Panel.js +8 -0
- package/dist/esm/components/content/Panel.js.map +1 -0
- package/dist/esm/components/content/index.d.ts +7 -0
- package/dist/esm/components/content/index.js +8 -0
- package/dist/esm/components/content/index.js.map +1 -0
- package/dist/esm/components/data/Avatar.d.ts +17 -0
- package/dist/esm/components/data/Avatar.js +21 -0
- package/dist/esm/components/data/Avatar.js.map +1 -0
- package/dist/esm/components/data/AvatarGroup.d.ts +14 -0
- package/dist/esm/components/data/AvatarGroup.js +11 -0
- package/dist/esm/components/data/AvatarGroup.js.map +1 -0
- package/dist/esm/components/data/Badge.d.ts +15 -0
- package/dist/esm/components/data/Badge.js +8 -0
- package/dist/esm/components/data/Badge.js.map +1 -0
- package/dist/esm/components/data/Chip.d.ts +19 -0
- package/dist/esm/components/data/Chip.js +10 -0
- package/dist/esm/components/data/Chip.js.map +1 -0
- package/dist/esm/components/data/DataTable.d.ts +41 -0
- package/dist/esm/components/data/DataTable.js +71 -0
- package/dist/esm/components/data/DataTable.js.map +1 -0
- package/dist/esm/components/data/Kbd.d.ts +9 -0
- package/dist/esm/components/data/Kbd.js +10 -0
- package/dist/esm/components/data/Kbd.js.map +1 -0
- package/dist/esm/components/data/Meter.d.ts +23 -0
- package/dist/esm/components/data/Meter.js +10 -0
- package/dist/esm/components/data/Meter.js.map +1 -0
- package/dist/esm/components/data/Progress.d.ts +15 -0
- package/dist/esm/components/data/Progress.js +9 -0
- package/dist/esm/components/data/Progress.js.map +1 -0
- package/dist/esm/components/data/Rating.d.ts +20 -0
- package/dist/esm/components/data/Rating.js +33 -0
- package/dist/esm/components/data/Rating.js.map +1 -0
- package/dist/esm/components/data/StatTile.d.ts +20 -0
- package/dist/esm/components/data/StatTile.js +10 -0
- package/dist/esm/components/data/StatTile.js.map +1 -0
- package/dist/esm/components/data/Table.d.ts +22 -0
- package/dist/esm/components/data/Table.js +7 -0
- package/dist/esm/components/data/Table.js.map +1 -0
- package/dist/esm/components/data/index.d.ts +11 -0
- package/dist/esm/components/data/index.js +12 -0
- package/dist/esm/components/data/index.js.map +1 -0
- package/dist/esm/components/feedback/Alert.d.ts +17 -0
- package/dist/esm/components/feedback/Alert.js +17 -0
- package/dist/esm/components/feedback/Alert.js.map +1 -0
- package/dist/esm/components/feedback/EmptyState.d.ts +14 -0
- package/dist/esm/components/feedback/EmptyState.js +9 -0
- package/dist/esm/components/feedback/EmptyState.js.map +1 -0
- package/dist/esm/components/feedback/ErrorBoundary.d.ts +26 -0
- package/dist/esm/components/feedback/ErrorBoundary.js +31 -0
- package/dist/esm/components/feedback/ErrorBoundary.js.map +1 -0
- package/dist/esm/components/feedback/ErrorState.d.ts +17 -0
- package/dist/esm/components/feedback/ErrorState.js +11 -0
- package/dist/esm/components/feedback/ErrorState.js.map +1 -0
- package/dist/esm/components/feedback/LoadingOverlay.d.ts +15 -0
- package/dist/esm/components/feedback/LoadingOverlay.js +10 -0
- package/dist/esm/components/feedback/LoadingOverlay.js.map +1 -0
- package/dist/esm/components/feedback/Skeleton.d.ts +12 -0
- package/dist/esm/components/feedback/Skeleton.js +11 -0
- package/dist/esm/components/feedback/Skeleton.js.map +1 -0
- package/dist/esm/components/feedback/Spinner.d.ts +10 -0
- package/dist/esm/components/feedback/Spinner.js +7 -0
- package/dist/esm/components/feedback/Spinner.js.map +1 -0
- package/dist/esm/components/feedback/index.d.ts +7 -0
- package/dist/esm/components/feedback/index.js +8 -0
- package/dist/esm/components/feedback/index.js.map +1 -0
- package/dist/esm/components/forms/Calendar.d.ts +47 -0
- package/dist/esm/components/forms/Calendar.js +208 -0
- package/dist/esm/components/forms/Calendar.js.map +1 -0
- package/dist/esm/components/forms/Checkbox.d.ts +11 -0
- package/dist/esm/components/forms/Checkbox.js +11 -0
- package/dist/esm/components/forms/Checkbox.js.map +1 -0
- package/dist/esm/components/forms/Combobox.d.ts +51 -0
- package/dist/esm/components/forms/Combobox.js +170 -0
- package/dist/esm/components/forms/Combobox.js.map +1 -0
- package/dist/esm/components/forms/DateInput.d.ts +13 -0
- package/dist/esm/components/forms/DateInput.js +34 -0
- package/dist/esm/components/forms/DateInput.js.map +1 -0
- package/dist/esm/components/forms/DatePicker.d.ts +58 -0
- package/dist/esm/components/forms/DatePicker.js +58 -0
- package/dist/esm/components/forms/DatePicker.js.map +1 -0
- package/dist/esm/components/forms/Field.d.ts +34 -0
- package/dist/esm/components/forms/Field.js +32 -0
- package/dist/esm/components/forms/Field.js.map +1 -0
- package/dist/esm/components/forms/FileUpload.d.ts +28 -0
- package/dist/esm/components/forms/FileUpload.js +48 -0
- package/dist/esm/components/forms/FileUpload.js.map +1 -0
- package/dist/esm/components/forms/Input.d.ts +17 -0
- package/dist/esm/components/forms/Input.js +11 -0
- package/dist/esm/components/forms/Input.js.map +1 -0
- package/dist/esm/components/forms/NativeSelect.d.ts +21 -0
- package/dist/esm/components/forms/NativeSelect.js +12 -0
- package/dist/esm/components/forms/NativeSelect.js.map +1 -0
- package/dist/esm/components/forms/OTPInput.d.ts +26 -0
- package/dist/esm/components/forms/OTPInput.js +65 -0
- package/dist/esm/components/forms/OTPInput.js.map +1 -0
- package/dist/esm/components/forms/Radio.d.ts +8 -0
- package/dist/esm/components/forms/Radio.js +9 -0
- package/dist/esm/components/forms/Radio.js.map +1 -0
- package/dist/esm/components/forms/RadioGroup.d.ts +7 -0
- package/dist/esm/components/forms/RadioGroup.js +11 -0
- package/dist/esm/components/forms/RadioGroup.js.map +1 -0
- package/dist/esm/components/forms/SearchInput.d.ts +19 -0
- package/dist/esm/components/forms/SearchInput.js +47 -0
- package/dist/esm/components/forms/SearchInput.js.map +1 -0
- package/dist/esm/components/forms/Select.d.ts +47 -0
- package/dist/esm/components/forms/Select.js +26 -0
- package/dist/esm/components/forms/Select.js.map +1 -0
- package/dist/esm/components/forms/Slider.d.ts +9 -0
- package/dist/esm/components/forms/Slider.js +10 -0
- package/dist/esm/components/forms/Slider.js.map +1 -0
- package/dist/esm/components/forms/Switch.d.ts +11 -0
- package/dist/esm/components/forms/Switch.js +11 -0
- package/dist/esm/components/forms/Switch.js.map +1 -0
- package/dist/esm/components/forms/Textarea.d.ts +13 -0
- package/dist/esm/components/forms/Textarea.js +12 -0
- package/dist/esm/components/forms/Textarea.js.map +1 -0
- package/dist/esm/components/forms/index.d.ts +17 -0
- package/dist/esm/components/forms/index.js +18 -0
- package/dist/esm/components/forms/index.js.map +1 -0
- package/dist/esm/components/navigation/Accordion.d.ts +22 -0
- package/dist/esm/components/navigation/Accordion.js +16 -0
- package/dist/esm/components/navigation/Accordion.js.map +1 -0
- package/dist/esm/components/navigation/Breadcrumb.d.ts +16 -0
- package/dist/esm/components/navigation/Breadcrumb.js +13 -0
- package/dist/esm/components/navigation/Breadcrumb.js.map +1 -0
- package/dist/esm/components/navigation/NavList.d.ts +30 -0
- package/dist/esm/components/navigation/NavList.js +29 -0
- package/dist/esm/components/navigation/NavList.js.map +1 -0
- package/dist/esm/components/navigation/Pagination.d.ts +16 -0
- package/dist/esm/components/navigation/Pagination.js +30 -0
- package/dist/esm/components/navigation/Pagination.js.map +1 -0
- package/dist/esm/components/navigation/Stepper.d.ts +23 -0
- package/dist/esm/components/navigation/Stepper.js +13 -0
- package/dist/esm/components/navigation/Stepper.js.map +1 -0
- package/dist/esm/components/navigation/Tabs.d.ts +36 -0
- package/dist/esm/components/navigation/Tabs.js +14 -0
- package/dist/esm/components/navigation/Tabs.js.map +1 -0
- package/dist/esm/components/navigation/Tree.d.ts +24 -0
- package/dist/esm/components/navigation/Tree.js +121 -0
- package/dist/esm/components/navigation/Tree.js.map +1 -0
- package/dist/esm/components/navigation/index.d.ts +7 -0
- package/dist/esm/components/navigation/index.js +9 -0
- package/dist/esm/components/navigation/index.js.map +1 -0
- package/dist/esm/components/overlay/CommandPalette.d.ts +35 -0
- package/dist/esm/components/overlay/CommandPalette.js +104 -0
- package/dist/esm/components/overlay/CommandPalette.js.map +1 -0
- package/dist/esm/components/overlay/ConfirmDialog.d.ts +22 -0
- package/dist/esm/components/overlay/ConfirmDialog.js +12 -0
- package/dist/esm/components/overlay/ConfirmDialog.js.map +1 -0
- package/dist/esm/components/overlay/ContextMenu.d.ts +14 -0
- package/dist/esm/components/overlay/ContextMenu.js +11 -0
- package/dist/esm/components/overlay/ContextMenu.js.map +1 -0
- package/dist/esm/components/overlay/Drawer.d.ts +20 -0
- package/dist/esm/components/overlay/Drawer.js +10 -0
- package/dist/esm/components/overlay/Drawer.js.map +1 -0
- package/dist/esm/components/overlay/Menu.d.ts +17 -0
- package/dist/esm/components/overlay/Menu.js +11 -0
- package/dist/esm/components/overlay/Menu.js.map +1 -0
- package/dist/esm/components/overlay/Modal.d.ts +21 -0
- package/dist/esm/components/overlay/Modal.js +14 -0
- package/dist/esm/components/overlay/Modal.js.map +1 -0
- package/dist/esm/components/overlay/Popover.d.ts +19 -0
- package/dist/esm/components/overlay/Popover.js +9 -0
- package/dist/esm/components/overlay/Popover.js.map +1 -0
- package/dist/esm/components/overlay/Toast.d.ts +34 -0
- package/dist/esm/components/overlay/Toast.js +78 -0
- package/dist/esm/components/overlay/Toast.js.map +1 -0
- package/dist/esm/components/overlay/Tooltip.d.ts +16 -0
- package/dist/esm/components/overlay/Tooltip.js +12 -0
- package/dist/esm/components/overlay/Tooltip.js.map +1 -0
- package/dist/esm/components/overlay/index.d.ts +10 -0
- package/dist/esm/components/overlay/index.js +11 -0
- package/dist/esm/components/overlay/index.js.map +1 -0
- package/dist/esm/components/overlay/internal.d.ts +82 -0
- package/dist/esm/components/overlay/internal.js +61 -0
- package/dist/esm/components/overlay/internal.js.map +1 -0
- package/dist/esm/cx.d.ts +2 -0
- package/dist/esm/cx.js +5 -0
- package/dist/esm/cx.js.map +1 -0
- package/dist/esm/dom/carousel-gl.d.ts +4 -0
- package/dist/esm/dom/carousel-gl.js +9 -0
- package/dist/esm/dom/carousel-gl.js.map +1 -0
- package/dist/esm/dom/carousel.d.ts +27 -0
- package/dist/esm/dom/carousel.js +346 -0
- package/dist/esm/dom/carousel.js.map +1 -0
- package/dist/esm/dom/collections.d.ts +13 -0
- package/dist/esm/dom/collections.js +572 -0
- package/dist/esm/dom/collections.js.map +1 -0
- package/dist/esm/dom/forms-calendar.d.ts +10 -0
- package/dist/esm/dom/forms-calendar.js +419 -0
- package/dist/esm/dom/forms-calendar.js.map +1 -0
- package/dist/esm/dom/forms-controls.d.ts +6 -0
- package/dist/esm/dom/forms-controls.js +336 -0
- package/dist/esm/dom/forms-controls.js.map +1 -0
- package/dist/esm/dom/forms-listbox.d.ts +17 -0
- package/dist/esm/dom/forms-listbox.js +583 -0
- package/dist/esm/dom/forms-listbox.js.map +1 -0
- package/dist/esm/dom/forms-popup.d.ts +21 -0
- package/dist/esm/dom/forms-popup.js +121 -0
- package/dist/esm/dom/forms-popup.js.map +1 -0
- package/dist/esm/dom/forms.d.ts +5 -0
- package/dist/esm/dom/forms.js +37 -0
- package/dist/esm/dom/forms.js.map +1 -0
- package/dist/esm/dom/index.d.ts +49 -0
- package/dist/esm/dom/index.js +883 -0
- package/dist/esm/dom/index.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/styles/actions.css +316 -0
- package/dist/styles/base.css +25 -0
- package/dist/styles/carousel.css +82 -0
- package/dist/styles/content.css +346 -0
- package/dist/styles/data.css +711 -0
- package/dist/styles/feedback.css +271 -0
- package/dist/styles/forms.css +1063 -0
- package/dist/styles/index.css +12 -0
- package/dist/styles/material.css +51 -0
- package/dist/styles/native.css +43 -0
- package/dist/styles/navigation.css +222 -0
- package/dist/styles/overlay.css +321 -0
- package/dist/zui.css +4390 -0
- package/dist/zui.dom.carousel-gl.js +147 -0
- package/dist/zui.dom.js +2 -0
- package/html.json +1279 -0
- package/manifest.json +7031 -0
- package/package.json +104 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Zui · guía para agentes
|
|
2
|
+
|
|
3
|
+
Formato: reglas → patrones → verificación. Un cambio está terminado cuando la verificación pasa.
|
|
4
|
+
|
|
5
|
+
## Reglas
|
|
6
|
+
|
|
7
|
+
0. **El contrato es el marcado, no React.** Un componente es HTML con clases `z-*` y atributos de estado,
|
|
8
|
+
más su CSS. El `.tsx` es el binding de React que produce ese marcado. Toda la apariencia tiene que
|
|
9
|
+
funcionar copiando el HTML a una página sin React (`zui/html.json`, `docs/agents/04-otros-frameworks.md`).
|
|
10
|
+
|
|
11
|
+
1. **Solo tokens.** El CSS lee `var(--z-*)`. Nunca un color literal (`#hex`, `rgb()`, `hsl()`), nunca un
|
|
12
|
+
primitivo de marca (`--zp-*`). La lista de tokens está en `tokens/dist/tokens.json`.
|
|
13
|
+
2. **Sin apariencia en línea.** `style={{…}}` solo admite maquetación calculada (posición, tamaño,
|
|
14
|
+
transformaciones) y variables locales (`"--z-algo": valor`). Color, fondo, borde, sombra, radio y
|
|
15
|
+
fuente van en la hoja de estilos.
|
|
16
|
+
3. **Iconos de `@zuccadev-labs/zuix-zicon`.** `<Icon name="…" />`. Sin emojis, sin SVG incrustado a mano. Si no existe un
|
|
17
|
+
icono para el concepto, se informa; no se inventa.
|
|
18
|
+
4. **Clases con prefijo `z-`**, estilo BEM: `.z-btn`, `.z-btn__icon`, `.z-btn--primary`. Estado por atributo:
|
|
19
|
+
`[data-state]`, `[data-size]`, `[aria-selected]`, `[disabled]`.
|
|
20
|
+
5. **Cristal solo en el cromo.** `.z-liquid` para paneles, barras, menús y diálogos. Texto denso sobre
|
|
21
|
+
`.z-solid`.
|
|
22
|
+
6. **Accesibilidad no opcional.** Lo interactivo complejo (diálogos, menús, pestañas, popovers) usa las
|
|
23
|
+
primitivas de `radix-ui`. Todo control tiene nombre accesible, foco visible y uso con teclado.
|
|
24
|
+
7. **Sin dominio.** Pagos, reservas, mapas o clima viven en la aplicación, no aquí.
|
|
25
|
+
8. **Sin dependencias nuevas** sin justificarlo en el informe del cambio.
|
|
26
|
+
9. **Texto visible por props.** Los componentes no fijan idioma: las etiquetas llegan por props, con valor
|
|
27
|
+
por defecto en inglés.
|
|
28
|
+
|
|
29
|
+
## Estructura
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
src/components/<grupo>/<Componente>.tsx implementación
|
|
33
|
+
src/components/<grupo>/<Componente>.manifest.json contrato legible por máquina
|
|
34
|
+
src/components/<grupo>/index.ts exportaciones del grupo
|
|
35
|
+
src/styles/<grupo>.css estilos del grupo, dentro de @layer zui.<grupo>
|
|
36
|
+
src/styles/native.css neutraliza <dialog>, [popover] y <button> para el contrato HTML
|
|
37
|
+
src/dom/index.ts comportamiento sin framework (@zuccadev-labs/zuix-zui/dom)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Grupos: `actions`, `forms`, `data`, `feedback`, `content`, `overlay`, `navigation`, `carousel`.
|
|
41
|
+
|
|
42
|
+
## Patrón de componente
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import type { ButtonHTMLAttributes, ReactNode } from "react";
|
|
46
|
+
import { Icon, type IconName } from "@zuccadev-labs/zuix-zicon/core";
|
|
47
|
+
import { cx } from "../../cx";
|
|
48
|
+
|
|
49
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
50
|
+
variant?: "primary" | "secondary" | "ghost" | "danger";
|
|
51
|
+
size?: "sm" | "md" | "lg";
|
|
52
|
+
icon?: IconName;
|
|
53
|
+
loading?: boolean;
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function Button({ variant = "secondary", size = "md", icon, loading, className, children, ...rest }: ButtonProps) {
|
|
58
|
+
return (
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
{...rest}
|
|
62
|
+
className={cx("z-btn", `z-btn--${variant}`, className)}
|
|
63
|
+
data-size={size}
|
|
64
|
+
data-loading={loading || undefined}
|
|
65
|
+
aria-busy={loading || undefined}
|
|
66
|
+
disabled={rest.disabled || loading}
|
|
67
|
+
>
|
|
68
|
+
{icon ? <Icon name={icon} size={16} /> : null}
|
|
69
|
+
{children}
|
|
70
|
+
</button>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
@layer zui.actions {
|
|
77
|
+
.z-btn {
|
|
78
|
+
display: inline-flex; align-items: center; justify-content: center; gap: var(--z-space-2);
|
|
79
|
+
height: var(--z-control-height-md); padding: 0 var(--z-space-4);
|
|
80
|
+
border-radius: var(--z-button-radius); border: 1px solid var(--z-line);
|
|
81
|
+
background: var(--z-surface); color: var(--z-fg);
|
|
82
|
+
font-weight: var(--z-weight-semibold); font-size: var(--z-text-body);
|
|
83
|
+
transition: background var(--z-duration-fast) var(--z-ease-standard);
|
|
84
|
+
}
|
|
85
|
+
.z-btn:hover:not(:disabled) { background: var(--z-surface-2); }
|
|
86
|
+
.z-btn:focus-visible { outline: none; box-shadow: var(--z-focus-ring); }
|
|
87
|
+
.z-btn--primary { background: var(--z-button-primary-bg); color: var(--z-button-primary-fg); border-color: transparent; }
|
|
88
|
+
.z-btn[data-size="sm"] { height: var(--z-control-height-sm); }
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Manifiesto
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"name": "Button",
|
|
97
|
+
"group": "actions",
|
|
98
|
+
"description": "Acción principal o secundaria.",
|
|
99
|
+
"import": "import { Button } from \"@zuccadev-labs/zuix-zui\"",
|
|
100
|
+
"props": [
|
|
101
|
+
{ "name": "variant", "type": "enum", "values": ["primary", "secondary", "ghost", "danger"], "default": "secondary", "description": "Intención." },
|
|
102
|
+
{ "name": "size", "type": "enum", "values": ["sm", "md", "lg"], "default": "md" },
|
|
103
|
+
{ "name": "icon", "type": "IconName", "description": "Icono a la izquierda del texto." },
|
|
104
|
+
{ "name": "loading", "type": "boolean", "default": false }
|
|
105
|
+
],
|
|
106
|
+
"states": ["rest", "hover", "focus", "active", "disabled", "loading"],
|
|
107
|
+
"tokens": ["button-radius", "button-primary-bg", "button-primary-fg", "surface", "surface-2", "line", "fg", "focus-ring", "control-height-md"],
|
|
108
|
+
"classes": ["z-btn"],
|
|
109
|
+
"a11y": "Elemento button nativo. Con `loading` expone aria-busy y queda deshabilitado.",
|
|
110
|
+
"examples": [
|
|
111
|
+
{ "title": "Primario con icono", "code": "<Button variant=\"primary\" icon=\"plus\">New project</Button>" }
|
|
112
|
+
],
|
|
113
|
+
"origin": "Button de un design system previo; variantes de zutool."
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Campos obligatorios: `name`, `group`, `description`, `import`, `props`, `tokens`, `classes`, `examples`.
|
|
118
|
+
|
|
119
|
+
Campos del contrato HTML: `behavior` (`none` | `dom` | `react`; se deduce si falta) y `html` (lista de
|
|
120
|
+
`{ title, code, script? }`) cuando el marcado no sale del render estático, como en lo que va por portal.
|
|
121
|
+
|
|
122
|
+
## Si falta algo
|
|
123
|
+
|
|
124
|
+
- **Falta una variante:** se añade al componente y a su manifiesto. No se resuelve con una clase suelta en
|
|
125
|
+
la pantalla.
|
|
126
|
+
- **Falta un token:** se propone en `tokens/src/base.json` (nivel `component`), referenciando un semántico.
|
|
127
|
+
No se escribe el valor literal.
|
|
128
|
+
- **Falta un icono:** se informa.
|
|
129
|
+
|
|
130
|
+
## Verificación
|
|
131
|
+
|
|
132
|
+
Desde la raíz de zuix:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
pnpm style-audit # color, prim, token, emoji, inline: todo en 0
|
|
136
|
+
pnpm typecheck # sin errores
|
|
137
|
+
pnpm manifest # todo componente exportado tiene manifiesto válido
|
|
138
|
+
pnpm html # el contrato HTML se regenera
|
|
139
|
+
pnpm test:html # si tocaste zui/dom, native.css o un componente con behavior "dom"
|
|
140
|
+
```
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Cambios de @zuccadev-labs/zuix-zui
|
|
2
|
+
|
|
3
|
+
Formato: [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/). Versionado: semver, con la misma
|
|
4
|
+
versión en toda la suite ([Versionado](https://github.com/zuccadev-labs/zuix/blob/main/docs/package/01-versionado.md)).
|
|
5
|
+
|
|
6
|
+
## [Sin publicar]
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-11-14
|
|
9
|
+
|
|
10
|
+
Primera versión publicada.
|
|
11
|
+
|
|
12
|
+
### Añadido
|
|
13
|
+
|
|
14
|
+
- 64 componentes en 8 grupos: acciones (5), formularios (17), datos (11), estado (7), contenido (7),
|
|
15
|
+
capas (9), navegación (7) y Carousel. La lista con props, tokens y clases está en `manifest.json`.
|
|
16
|
+
- Contrato HTML: clases `z-*`, atributos de estado (`data-state`, `data-size`, `aria-*`) y el marcado de cada
|
|
17
|
+
ejemplo en `html.json`, generado desde el binding de React.
|
|
18
|
+
- Estilos sobre tokens `--z-*`: `@zuccadev-labs/zuix-zui/styles.css` (todo) y `@zuccadev-labs/zuix-zui/styles/<grupo>.css`. Material
|
|
19
|
+
liquid glass (`.z-liquid`, `.z-solid`).
|
|
20
|
+
- `@zuccadev-labs/zuix-zui/dom`: comportamiento sin framework. Diálogos, popovers, menús, menú contextual, tooltips,
|
|
21
|
+
avisos, confirmación, pestañas, acordeón, controles de formulario, Select, Combobox, Calendar,
|
|
22
|
+
DatePicker, Slider, OTPInput, FileUpload, CommandPalette, Tree, orden de DataTable, Pagination y
|
|
23
|
+
Carousel. Eventos `z:open`, `z:close`, `z:change`, `z:select` y `z:sort`.
|
|
24
|
+
- `@zuccadev-labs/zuix-zui`: binding de React 19 sobre Radix. React es un peer opcional: el contrato y `dom` no lo usan.
|
|
25
|
+
- `@zuccadev-labs/zuix-zicon` es `peerDependency`: la aplicación lo instala junto a este paquete y hay una sola copia
|
|
26
|
+
del registro de iconos.
|
|
27
|
+
- `dist/zui.css` y `dist/zui.dom.js`: listos para enlazar sin bundler.
|
|
28
|
+
- Salida de publicación: ESM compilado módulo a módulo con declaraciones en `dist/esm/`, y `"use client"`
|
|
29
|
+
en los módulos con estado, eventos o Radix.
|
|
30
|
+
- Carousel sin React en modo `gl`: las zonas curvas se dibujan en WebGL2 cuando cada slide declara su imagen
|
|
31
|
+
(`data-raster`, `data-raster="#selector"`, `data-raster-src`) o con `carousel(el, { rasterize })`. Cae a
|
|
32
|
+
`css` sin WebGL2 o si falta una imagen. `carousel(el).refresh()` rehace réplicas y texturas.
|
|
33
|
+
- `@zuccadev-labs/zuix-zui/dom/carousel-gl` y `dist/zui.dom.carousel-gl.js`: los shaders, que `@zuccadev-labs/zuix-zui/dom` carga bajo
|
|
34
|
+
demanda. `zui.dom.js` no los incluye.
|
|
35
|
+
- `README.md` en el paquete publicado.
|
|
36
|
+
|
|
37
|
+
### Táctil
|
|
38
|
+
|
|
39
|
+
- **Objetivo táctil de 40 px.** Con puntero principal grueso (`@media (pointer: coarse)`) los controles `sm` y `md`
|
|
40
|
+
crecen hasta `--z-touch-target` (40 px; token de `@zuccadev-labs/zuix-tokens`): botones, campos, Select, pestañas,
|
|
41
|
+
filas de árbol y de menú, opciones de lista. Checkbox, Radio y Switch ganan aire vertical, el Slider crece en
|
|
42
|
+
su eje corto, y los botones de cierre (`.z-overlay-close`, `.z-alert__dismiss`), el botón del campo y las
|
|
43
|
+
opciones de SegmentedControl amplían su zona de pulsación sin cambiar el dibujo. Con ratón nada cambia.
|
|
44
|
+
`--z-touch-target: 0px` lo desactiva.
|
|
45
|
+
- **Sin hover pegajoso.** Todas las reglas `:hover` van dentro de `@media (hover: hover)`: en una pantalla táctil
|
|
46
|
+
el último control tocado no se queda con el estilo de hover.
|
|
47
|
+
- `@zuccadev-labs/zuix-zui/dom`: los avisos (`toast()`) se descartan deslizando, con dedo, lápiz o ratón, igual que el Toast de
|
|
48
|
+
React (a la derecha, o hacia el borde en las posiciones centradas). `.z-toast` declara `touch-action`. Al
|
|
49
|
+
descartarlo, el aviso conserva el desplazamiento mientras se desvanece.
|
|
50
|
+
- `@zuccadev-labs/zuix-zui/dom`: el menú contextual (`data-z-context`) se abre con una pulsación larga de 600 ms con dedo o
|
|
51
|
+
lápiz. iOS no emite `contextmenu`, y un Chromium de escritorio con pantalla táctil tampoco. El menú sigue
|
|
52
|
+
abierto al levantar el dedo.
|
|
53
|
+
- ContextMenu de React en ventanas estrechas: si el menú no cabe a ningún lado del puntero, se estrecha hasta
|
|
54
|
+
el hueco disponible en lugar de salirse de la ventana.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Euclides Zuccarini Barrueta (devzucca / zuccadev)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zuccadev-labs/zuix-zui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Sistema de componentes de la suite zuix: 64 componentes accesibles en 8 grupos. Cada componente es un
|
|
4
|
+
contrato de HTML y CSS sobre tokens; el comportamiento sin framework está en `@zuccadev-labs/zuix-zui/dom` y el
|
|
5
|
+
binding de React en la entrada principal.
|
|
6
|
+
|
|
7
|
+
| Capa | Entrada | Depende de |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Contrato | `@zuccadev-labs/zuix-zui/styles.css`, `@zuccadev-labs/zuix-zui/html.json` | `@zuccadev-labs/zuix-tokens` |
|
|
10
|
+
| Comportamiento | `@zuccadev-labs/zuix-zui/dom` | El navegador (`<dialog>`, `popover`) |
|
|
11
|
+
| Binding de React | `@zuccadev-labs/zuix-zui` | React 19 y Radix |
|
|
12
|
+
|
|
13
|
+
## Instalación
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
pnpm add @zuccadev-labs/zuix-zui @zuccadev-labs/zuix-tokens @zuccadev-labs/zuix-zicon
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`@zuccadev-labs/zuix-zicon` es un peer obligatorio (los componentes dibujan sus iconos con la copia de la
|
|
20
|
+
aplicación). `react` y `react-dom` 19 son peers opcionales: solo los necesita el binding
|
|
21
|
+
(`pnpm add react react-dom`). Los paquetes de la suite se instalan y se actualizan juntos, en la misma versión.
|
|
22
|
+
|
|
23
|
+
Para instalarlo todo con una sola dependencia: [`@zuccadev-labs/zuix`](https://www.npmjs.com/package/@zuccadev-labs/zuix).
|
|
24
|
+
|
|
25
|
+
## Uso sin React
|
|
26
|
+
|
|
27
|
+
Con un bundler:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import "@zuccadev-labs/zuix-tokens/tokens.css";
|
|
31
|
+
import "@zuccadev-labs/zuix-zui/styles.css";
|
|
32
|
+
import "@zuccadev-labs/zuix-zicon/element"; // <z-icon>
|
|
33
|
+
import { init, toast } from "@zuccadev-labs/zuix-zui/dom";
|
|
34
|
+
|
|
35
|
+
init();
|
|
36
|
+
toast({ title: "Ready", intent: "success" });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<body class="z-root z-canvas" data-z-dom>
|
|
41
|
+
<button type="button" class="z-btn z-btn--secondary" data-size="md" data-z-open="#edit">Edit profile</button>
|
|
42
|
+
|
|
43
|
+
<dialog id="edit" class="z-liquid z-modal" data-size="md" aria-labelledby="edit-title">
|
|
44
|
+
<header class="z-modal__header">
|
|
45
|
+
<div class="z-modal__heading"><h2 id="edit-title" class="z-modal__title">Edit profile</h2></div>
|
|
46
|
+
</header>
|
|
47
|
+
<div class="z-modal__body">…</div>
|
|
48
|
+
<footer class="z-modal__footer">
|
|
49
|
+
<button class="z-dialog-btn" data-variant="primary" data-z-close value="save">Save</button>
|
|
50
|
+
</footer>
|
|
51
|
+
</dialog>
|
|
52
|
+
</body>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `z-root` aplica tipografía y foco; `z-canvas` pinta el fondo.
|
|
56
|
+
- `data-z-dom` activa pestañas, acordeón y controles dentro de ese contenedor.
|
|
57
|
+
- El marcado de cada componente está en `@zuccadev-labs/zuix-zui/html.json`. Cada componente declara su `behavior`:
|
|
58
|
+
`none` (solo CSS), `dom` (necesita `@zuccadev-labs/zuix-zui/dom`) o `react` (hoy solo en el binding de React).
|
|
59
|
+
|
|
60
|
+
Sin bundler se enlazan `dist/zui.css` y `dist/zui.dom.js`, incluidos en el paquete.
|
|
61
|
+
|
|
62
|
+
## Uso con React
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import "@zuccadev-labs/zuix-tokens/tokens.css";
|
|
66
|
+
import "@zuccadev-labs/zuix-zui/styles.css";
|
|
67
|
+
import "@zuccadev-labs/zuix-zicon/all"; // registra los iconos
|
|
68
|
+
|
|
69
|
+
import { Button } from "@zuccadev-labs/zuix-zui";
|
|
70
|
+
|
|
71
|
+
export function NewProject() {
|
|
72
|
+
return <Button variant="primary" icon="plus">New project</Button>;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
En `<html>` va `data-theme="dark"` o `"light"`, y en el contenedor de la aplicación, `class="z-root z-canvas"`.
|
|
77
|
+
|
|
78
|
+
Los componentes con hooks, contexto o Radix declaran `"use client"`. Los que solo producen marcado
|
|
79
|
+
(`Button`, `Badge`, `Card`…) no lo llevan.
|
|
80
|
+
|
|
81
|
+
## Entradas
|
|
82
|
+
|
|
83
|
+
| Entrada | Contenido |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `@zuccadev-labs/zuix-zui` | Componentes de React y sus tipos `*Props` |
|
|
86
|
+
| `@zuccadev-labs/zuix-zui/dom` | Comportamiento sin framework: `init`, `hydrate`, `toast`, `confirm`… |
|
|
87
|
+
| `@zuccadev-labs/zuix-zui/styles.css` | Todos los estilos |
|
|
88
|
+
| `@zuccadev-labs/zuix-zui/styles/*` | Hojas sueltas por grupo |
|
|
89
|
+
| `@zuccadev-labs/zuix-zui/manifest.json` | Componentes, props, clases y ejemplos, para herramientas y agentes |
|
|
90
|
+
| `@zuccadev-labs/zuix-zui/html.json` | Marcado de cada ejemplo |
|
|
91
|
+
| `@zuccadev-labs/zuix-zui/dist/zui.css`, `@zuccadev-labs/zuix-zui/dist/zui.dom.js` | Bundles para enlazar sin bundler |
|
|
92
|
+
|
|
93
|
+
## Reglas
|
|
94
|
+
|
|
95
|
+
1. Los componentes solo leen tokens: sin colores, radios ni sombras literales.
|
|
96
|
+
2. Los iconos se piden por nombre; no se usan emojis como iconos.
|
|
97
|
+
3. Si falta una variante, un token o un icono, se añade al sistema.
|
|
98
|
+
|
|
99
|
+
## Documentación
|
|
100
|
+
|
|
101
|
+
- [Guía de componentes](https://github.com/zuccadev-labs/zuix/blob/main/docs/users/03-zui.md)
|
|
102
|
+
- [Uso con otros frameworks o sin ninguno](https://github.com/zuccadev-labs/zuix/blob/main/docs/users/06-frameworks.md)
|
|
103
|
+
- [Contrato público](https://github.com/zuccadev-labs/zuix/blob/main/docs/package/03-contrato-publico.md): qué es superficie pública
|
|
104
|
+
- [Cambios](https://github.com/zuccadev-labs/zuix/blob/main/zui/CHANGELOG.md)
|
|
105
|
+
- Reglas para agentes de IA: `AGENTS.md`, incluido en el paquete.
|
|
106
|
+
|
|
107
|
+
## Licencia
|
|
108
|
+
|
|
109
|
+
[MIT](https://github.com/zuccadev-labs/zuix/blob/main/LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
import { type IconName } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
import { type ControlSize, type Intent } from "./types.js";
|
|
4
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: Intent;
|
|
6
|
+
size?: ControlSize;
|
|
7
|
+
/** Icono a la izquierda del texto. */
|
|
8
|
+
icon?: IconName;
|
|
9
|
+
/** Icono a la derecha del texto. */
|
|
10
|
+
iconRight?: IconName;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
ref?: Ref<HTMLButtonElement>;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function Button({ variant, size, icon, iconRight, loading, fullWidth, className, children, disabled, ...rest }: ButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
import { cx } from "../../cx.js";
|
|
4
|
+
import { ICON_SIZE } from "./types.js";
|
|
5
|
+
export function Button({ variant = "secondary", size = "md", icon, iconRight, loading, fullWidth, className, children, disabled, ...rest }) {
|
|
6
|
+
return (_jsxs("button", { type: "button", ...rest, className: cx("z-btn", `z-btn--${variant}`, className), "data-size": size, "data-block": fullWidth || undefined, "data-loading": loading || undefined, "aria-busy": loading || undefined, disabled: disabled || loading, children: [loading ? _jsx("span", { className: "z-btn__spinner", "aria-hidden": "true" }) : icon ? _jsx(Icon, { name: icon, size: ICON_SIZE[size] }) : null, children, iconRight ? _jsx(Icon, { name: iconRight, size: ICON_SIZE[size] }) : null] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/components/actions/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAiC,MAAM,SAAS,CAAC;AAenE,MAAM,UAAU,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAe;IACrJ,OAAO,CACL,kBACE,IAAI,EAAC,QAAQ,KACT,IAAI,EACR,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,UAAU,OAAO,EAAE,EAAE,SAAS,CAAC,eAC3C,IAAI,gBACH,SAAS,IAAI,SAAS,kBACpB,OAAO,IAAI,SAAS,eACvB,OAAO,IAAI,SAAS,EAC/B,QAAQ,EAAE,QAAQ,IAAI,OAAO,aAG5B,OAAO,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,gBAAgB,iBAAa,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EAC5H,QAAQ,EACR,SAAS,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,IAC7D,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { Icon, type IconName } from \"@zuccadev-labs/zuix-zicon/core\";\nimport { cx } from \"../../cx\";\nimport { ICON_SIZE, type ControlSize, type Intent } from \"./types\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: Intent;\n size?: ControlSize;\n /** Icono a la izquierda del texto. */\n icon?: IconName;\n /** Icono a la derecha del texto. */\n iconRight?: IconName;\n loading?: boolean;\n fullWidth?: boolean;\n ref?: Ref<HTMLButtonElement>;\n children?: ReactNode;\n}\n\nexport function Button({ variant = \"secondary\", size = \"md\", icon, iconRight, loading, fullWidth, className, children, disabled, ...rest }: ButtonProps) {\n return (\n <button\n type=\"button\"\n {...rest}\n className={cx(\"z-btn\", `z-btn--${variant}`, className)}\n data-size={size}\n data-block={fullWidth || undefined}\n data-loading={loading || undefined}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n >\n {/* Con carga, el anillo sustituye al icono izquierdo. */}\n {loading ? <span className=\"z-btn__spinner\" aria-hidden=\"true\" /> : icon ? <Icon name={icon} size={ICON_SIZE[size]} /> : null}\n {children}\n {iconRight ? <Icon name={iconRight} size={ICON_SIZE[size]} /> : null}\n </button>\n );\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, Ref } from "react";
|
|
2
|
+
import { type IconName } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
import { type ControlSize, type Intent } from "./types.js";
|
|
4
|
+
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
5
|
+
icon: IconName;
|
|
6
|
+
/** Nombre accesible; también se muestra como título nativo. */
|
|
7
|
+
label: string;
|
|
8
|
+
variant?: Intent;
|
|
9
|
+
size?: ControlSize;
|
|
10
|
+
iconVariant?: "outline" | "solid";
|
|
11
|
+
/** Marca el botón como activo (por ejemplo, un panel abierto). */
|
|
12
|
+
active?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
ref?: Ref<HTMLButtonElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare function IconButton({ icon, label, variant, size, iconVariant, active, loading, className, disabled, ...rest }: IconButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
import { cx } from "../../cx.js";
|
|
4
|
+
import { ICON_SIZE } from "./types.js";
|
|
5
|
+
export function IconButton({ icon, label, variant = "ghost", size = "md", iconVariant = "outline", active, loading, className, disabled, ...rest }) {
|
|
6
|
+
return (_jsx("button", { type: "button", title: label, ...rest, "aria-label": label, className: cx("z-btn", "z-btn--icon", `z-btn--${variant}`, className), "data-size": size, "data-active": active || undefined, "data-loading": loading || undefined, "aria-busy": loading || undefined, disabled: disabled || loading, children: loading ? _jsx("span", { className: "z-btn__spinner", "aria-hidden": "true" }) : _jsx(Icon, { name: icon, variant: iconVariant, size: ICON_SIZE[size] }) }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../../../../src/components/actions/IconButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAiC,MAAM,SAAS,CAAC;AAenE,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAmB;IACjK,OAAO,CACL,iBACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,KAAK,KACR,IAAI,gBACI,KAAK,EACjB,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,UAAU,OAAO,EAAE,EAAE,SAAS,CAAC,eAC1D,IAAI,iBACF,MAAM,IAAI,SAAS,kBAClB,OAAO,IAAI,SAAS,eACvB,OAAO,IAAI,SAAS,EAC/B,QAAQ,EAAE,QAAQ,IAAI,OAAO,YAE5B,OAAO,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,gBAAgB,iBAAa,MAAM,GAAG,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAI,GAC9H,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { ButtonHTMLAttributes, Ref } from \"react\";\nimport { Icon, type IconName } from \"@zuccadev-labs/zuix-zicon/core\";\nimport { cx } from \"../../cx\";\nimport { ICON_SIZE, type ControlSize, type Intent } from \"./types\";\n\nexport interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"children\"> {\n icon: IconName;\n /** Nombre accesible; también se muestra como título nativo. */\n label: string;\n variant?: Intent;\n size?: ControlSize;\n iconVariant?: \"outline\" | \"solid\";\n /** Marca el botón como activo (por ejemplo, un panel abierto). */\n active?: boolean;\n loading?: boolean;\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport function IconButton({ icon, label, variant = \"ghost\", size = \"md\", iconVariant = \"outline\", active, loading, className, disabled, ...rest }: IconButtonProps) {\n return (\n <button\n type=\"button\"\n title={label}\n {...rest}\n aria-label={label}\n className={cx(\"z-btn\", \"z-btn--icon\", `z-btn--${variant}`, className)}\n data-size={size}\n data-active={active || undefined}\n data-loading={loading || undefined}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n >\n {loading ? <span className=\"z-btn__spinner\" aria-hidden=\"true\" /> : <Icon name={icon} variant={iconVariant} size={ICON_SIZE[size]} />}\n </button>\n );\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
import { type IconName } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
4
|
+
/** `inline` va subrayado dentro de un texto; `subtle` solo se subraya al pasar; `standalone` es una acción suelta. */
|
|
5
|
+
variant?: "inline" | "subtle" | "standalone";
|
|
6
|
+
/** Abre en otra pestaña y añade el icono de enlace externo. */
|
|
7
|
+
external?: boolean;
|
|
8
|
+
/** Texto para lectores de pantalla en enlaces externos. */
|
|
9
|
+
externalLabel?: string;
|
|
10
|
+
icon?: IconName;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
ref?: Ref<HTMLAnchorElement>;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function Link({ variant, external, externalLabel, icon, disabled, className, children, href, ...rest }: LinkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
import { cx } from "../../cx.js";
|
|
4
|
+
export function Link({ variant = "inline", external, externalLabel = "opens in a new tab", icon, disabled, className, children, href, ...rest }) {
|
|
5
|
+
const externalProps = external ? { target: "_blank", rel: "noopener noreferrer" } : null;
|
|
6
|
+
return (_jsxs("a", { ...externalProps, ...rest,
|
|
7
|
+
// Sin href un ancla deja de ser enlace: así se representa el estado deshabilitado.
|
|
8
|
+
href: disabled ? undefined : href, "aria-disabled": disabled || undefined, role: disabled ? "link" : rest.role, className: cx("z-link", `z-link--${variant}`, className), children: [icon ? _jsx(Icon, { name: icon, size: 14 }) : null, children, external ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "arrow-top-right-on-square", size: 12 }), _jsxs("span", { className: "z-sr-only", children: [" (", externalLabel, ")"] })] })) : null] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../src/components/actions/Link.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAiB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAe9B,MAAM,UAAU,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,oBAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAI,EAAa;IACxJ,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACzF,OAAO,CACL,gBACM,aAAa,KACb,IAAI;QACR,mFAAmF;QACnF,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,mBAClB,QAAQ,IAAI,SAAS,EACpC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EACnC,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,WAAW,OAAO,EAAE,EAAE,SAAS,CAAC,aAEvD,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI,EAC5C,QAAQ,EACR,QAAQ,CAAC,CAAC,CAAC,CACV,8BACE,KAAC,IAAI,IAAC,IAAI,EAAC,2BAA2B,EAAC,IAAI,EAAE,EAAE,GAAI,EACnD,gBAAM,SAAS,EAAC,WAAW,mBAAI,aAAa,SAAS,IACpD,CACJ,CAAC,CAAC,CAAC,IAAI,IACN,CACL,CAAC;AACJ,CAAC","sourcesContent":["import type { AnchorHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { Icon, type IconName } from \"@zuccadev-labs/zuix-zicon/core\";\nimport { cx } from \"../../cx\";\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /** `inline` va subrayado dentro de un texto; `subtle` solo se subraya al pasar; `standalone` es una acción suelta. */\n variant?: \"inline\" | \"subtle\" | \"standalone\";\n /** Abre en otra pestaña y añade el icono de enlace externo. */\n external?: boolean;\n /** Texto para lectores de pantalla en enlaces externos. */\n externalLabel?: string;\n icon?: IconName;\n disabled?: boolean;\n ref?: Ref<HTMLAnchorElement>;\n children?: ReactNode;\n}\n\nexport function Link({ variant = \"inline\", external, externalLabel = \"opens in a new tab\", icon, disabled, className, children, href, ...rest }: LinkProps) {\n const externalProps = external ? { target: \"_blank\", rel: \"noopener noreferrer\" } : null;\n return (\n <a\n {...externalProps}\n {...rest}\n // Sin href un ancla deja de ser enlace: así se representa el estado deshabilitado.\n href={disabled ? undefined : href}\n aria-disabled={disabled || undefined}\n role={disabled ? \"link\" : rest.role}\n className={cx(\"z-link\", `z-link--${variant}`, className)}\n >\n {icon ? <Icon name={icon} size={14} /> : null}\n {children}\n {external ? (\n <>\n <Icon name=\"arrow-top-right-on-square\" size={12} />\n <span className=\"z-sr-only\"> ({externalLabel})</span>\n </>\n ) : null}\n </a>\n );\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type IconName } from "@zuccadev-labs/zuix-zicon/core";
|
|
3
|
+
import { type ControlSize } from "./types.js";
|
|
4
|
+
export interface SegmentedItem<T extends string = string> {
|
|
5
|
+
value: T;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/** Nombre accesible cuando la etiqueta no es texto o se oculta. */
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SegmentedControlProps<T extends string = string> {
|
|
13
|
+
items: ReadonlyArray<SegmentedItem<T>>;
|
|
14
|
+
value?: T;
|
|
15
|
+
defaultValue?: T;
|
|
16
|
+
onValueChange?: (value: T) => void;
|
|
17
|
+
size?: ControlSize;
|
|
18
|
+
/** Reparte el ancho disponible entre los segmentos. */
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Nombre accesible del grupo. */
|
|
22
|
+
label: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Selector de una opción entre pocas, siempre con una elegida. */
|
|
26
|
+
export declare function SegmentedControl<T extends string = string>({ items, value, defaultValue, onValueChange, size, fullWidth, disabled, label, className }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { ToggleGroup } from "radix-ui";
|
|
5
|
+
import { Icon } from "@zuccadev-labs/zuix-zicon/core";
|
|
6
|
+
import { cx } from "../../cx.js";
|
|
7
|
+
import { ICON_SIZE } from "./types.js";
|
|
8
|
+
/** Selector de una opción entre pocas, siempre con una elegida. */
|
|
9
|
+
export function SegmentedControl({ items, value, defaultValue, onValueChange, size = "md", fullWidth, disabled, label, className }) {
|
|
10
|
+
// Radix permite deseleccionar (valor vacío); aquí siempre queda una opción, por eso el valor se controla.
|
|
11
|
+
const [inner, setInner] = useState(defaultValue);
|
|
12
|
+
const current = value ?? inner;
|
|
13
|
+
return (_jsx(ToggleGroup.Root, { type: "single", value: current ?? "", onValueChange: (next) => {
|
|
14
|
+
if (!next)
|
|
15
|
+
return;
|
|
16
|
+
setInner(next);
|
|
17
|
+
onValueChange?.(next);
|
|
18
|
+
}, disabled: disabled, "aria-label": label, className: cx("z-segmented", className), "data-size": size, "data-block": fullWidth || undefined, children: items.map((item) => (_jsxs(ToggleGroup.Item, { value: item.value, disabled: item.disabled, "aria-label": item.ariaLabel, className: "z-segmented__item", children: [item.icon ? _jsx(Icon, { name: item.icon, size: ICON_SIZE[size] }) : null, item.label != null ? _jsx("span", { className: "z-segmented__label", children: item.label }) : null] }, item.value))) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.js","sourceRoot":"","sources":["../../../../src/components/actions/SegmentedControl.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,IAAI,EAAiB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AAyBtD,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAA4B,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAA4B;IACrL,0GAA0G;IAC1G,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,YAAY,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC;IAC/B,OAAO,CACL,KAAC,WAAW,CAAC,IAAI,IACf,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE,OAAO,IAAI,EAAE,EACpB,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,IAAI,CAAC,IAAI;gBAAE,OAAO;YAClB,QAAQ,CAAC,IAAS,CAAC,CAAC;YACpB,aAAa,EAAE,CAAC,IAAS,CAAC,CAAC;QAC7B,CAAC,EACD,QAAQ,EAAE,QAAQ,gBACN,KAAK,EACjB,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,eAC5B,IAAI,gBACH,SAAS,IAAI,SAAS,YAEjC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,MAAC,WAAW,CAAC,IAAI,IAAkB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,gBAAc,IAAI,CAAC,SAAS,EAAE,SAAS,EAAC,mBAAmB,aACrI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EACnE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,oBAAoB,YAAE,IAAI,CAAC,KAAK,GAAQ,CAAC,CAAC,CAAC,IAAI,KAFhE,IAAI,CAAC,KAAK,CAGd,CACpB,CAAC,GACe,CACpB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\nimport { useState, type ReactNode } from \"react\";\nimport { ToggleGroup } from \"radix-ui\";\nimport { Icon, type IconName } from \"@zuccadev-labs/zuix-zicon/core\";\nimport { cx } from \"../../cx\";\nimport { ICON_SIZE, type ControlSize } from \"./types\";\n\nexport interface SegmentedItem<T extends string = string> {\n value: T;\n label: ReactNode;\n icon?: IconName;\n /** Nombre accesible cuando la etiqueta no es texto o se oculta. */\n ariaLabel?: string;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps<T extends string = string> {\n items: ReadonlyArray<SegmentedItem<T>>;\n value?: T;\n defaultValue?: T;\n onValueChange?: (value: T) => void;\n size?: ControlSize;\n /** Reparte el ancho disponible entre los segmentos. */\n fullWidth?: boolean;\n disabled?: boolean;\n /** Nombre accesible del grupo. */\n label: string;\n className?: string;\n}\n\n/** Selector de una opción entre pocas, siempre con una elegida. */\nexport function SegmentedControl<T extends string = string>({ items, value, defaultValue, onValueChange, size = \"md\", fullWidth, disabled, label, className }: SegmentedControlProps<T>) {\n // Radix permite deseleccionar (valor vacío); aquí siempre queda una opción, por eso el valor se controla.\n const [inner, setInner] = useState<T | undefined>(defaultValue);\n const current = value ?? inner;\n return (\n <ToggleGroup.Root\n type=\"single\"\n value={current ?? \"\"}\n onValueChange={(next) => {\n if (!next) return;\n setInner(next as T);\n onValueChange?.(next as T);\n }}\n disabled={disabled}\n aria-label={label}\n className={cx(\"z-segmented\", className)}\n data-size={size}\n data-block={fullWidth || undefined}\n >\n {items.map((item) => (\n <ToggleGroup.Item key={item.value} value={item.value} disabled={item.disabled} aria-label={item.ariaLabel} className=\"z-segmented__item\">\n {item.icon ? <Icon name={item.icon} size={ICON_SIZE[size]} /> : null}\n {item.label != null ? <span className=\"z-segmented__label\">{item.label}</span> : null}\n </ToggleGroup.Item>\n ))}\n </ToggleGroup.Root>\n );\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { Toggle as RadixToggle } from "radix-ui";
|
|
3
|
+
import { type IconName } from "@zuccadev-labs/zuix-zicon/core";
|
|
4
|
+
import { type ControlSize } from "./types.js";
|
|
5
|
+
export interface ToggleProps extends ComponentProps<typeof RadixToggle.Root> {
|
|
6
|
+
size?: ControlSize;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
/** Nombre accesible; obligatorio cuando solo hay icono. */
|
|
9
|
+
label?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** Botón de dos estados (aria-pressed). */
|
|
13
|
+
export declare function Toggle({ size, icon, label, className, children, ...rest }: ToggleProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Toggle as RadixToggle } from "radix-ui";
|
|
4
|
+
import { Icon } from "@zuccadev-labs/zuix-zicon/core";
|
|
5
|
+
import { cx } from "../../cx.js";
|
|
6
|
+
import { ICON_SIZE } from "./types.js";
|
|
7
|
+
/** Botón de dos estados (aria-pressed). */
|
|
8
|
+
export function Toggle({ size = "md", icon, label, className, children, ...rest }) {
|
|
9
|
+
return (_jsxs(RadixToggle.Root, { title: children ? undefined : label, ...rest, "aria-label": label ?? rest["aria-label"], className: cx("z-toggle", className), "data-size": size, "data-icon-only": children ? undefined : true, children: [icon ? _jsx(Icon, { name: icon, size: ICON_SIZE[size] }) : null, children] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../../../src/components/actions/Toggle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,IAAI,EAAiB,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AAUtD,2CAA2C;AAC3C,MAAM,UAAU,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAe;IAC5F,OAAO,CACL,MAAC,WAAW,CAAC,IAAI,IACf,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAC/B,IAAI,gBACI,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,EACvC,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,eACzB,IAAI,oBACC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,aAE1C,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EACzD,QAAQ,IACQ,CACpB,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { Toggle as RadixToggle } from \"radix-ui\";\nimport { Icon, type IconName } from \"@zuccadev-labs/zuix-zicon/core\";\nimport { cx } from \"../../cx\";\nimport { ICON_SIZE, type ControlSize } from \"./types\";\n\nexport interface ToggleProps extends ComponentProps<typeof RadixToggle.Root> {\n size?: ControlSize;\n icon?: IconName;\n /** Nombre accesible; obligatorio cuando solo hay icono. */\n label?: string;\n children?: ReactNode;\n}\n\n/** Botón de dos estados (aria-pressed). */\nexport function Toggle({ size = \"md\", icon, label, className, children, ...rest }: ToggleProps) {\n return (\n <RadixToggle.Root\n title={children ? undefined : label}\n {...rest}\n aria-label={label ?? rest[\"aria-label\"]}\n className={cx(\"z-toggle\", className)}\n data-size={size}\n data-icon-only={children ? undefined : true}\n >\n {icon ? <Icon name={icon} size={ICON_SIZE[size]} /> : null}\n {children}\n </RadixToggle.Root>\n );\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Button, type ButtonProps } from "./Button.js";
|
|
2
|
+
export { IconButton, type IconButtonProps } from "./IconButton.js";
|
|
3
|
+
export { Link, type LinkProps } from "./Link.js";
|
|
4
|
+
export { Toggle, type ToggleProps } from "./Toggle.js";
|
|
5
|
+
export { SegmentedControl, type SegmentedControlProps, type SegmentedItem } from "./SegmentedControl.js";
|
|
6
|
+
export type { Tone, ControlSize, Intent } from "./types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAkD,MAAM,oBAAoB,CAAC","sourcesContent":["export { Button, type ButtonProps } from \"./Button\";\nexport { IconButton, type IconButtonProps } from \"./IconButton\";\nexport { Link, type LinkProps } from \"./Link\";\nexport { Toggle, type ToggleProps } from \"./Toggle\";\nexport { SegmentedControl, type SegmentedControlProps, type SegmentedItem } from \"./SegmentedControl\";\nexport type { Tone, ControlSize, Intent } from \"./types\";\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type Tone = "neutral" | "accent" | "success" | "warning" | "danger" | "info";
|
|
2
|
+
export type ControlSize = "sm" | "md" | "lg";
|
|
3
|
+
export type Intent = "primary" | "secondary" | "ghost" | "danger";
|
|
4
|
+
/** Tamaño de icono (px) para cada altura de control. */
|
|
5
|
+
export declare const ICON_SIZE: Record<ControlSize, number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/actions/types.ts"],"names":[],"mappings":"AAKA,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAgC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC","sourcesContent":["// Tipos compartidos por los grupos de componentes.\nexport type Tone = \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\" | \"info\";\nexport type ControlSize = \"sm\" | \"md\" | \"lg\";\nexport type Intent = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\n\n/** Tamaño de icono (px) para cada altura de control. */\nexport const ICON_SIZE: Record<ControlSize, number> = { sm: 14, md: 16, lg: 18 };\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type HTMLAttributes, type Key, type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { CarouselRasterSize, CarouselRasterSource } from "./slideTexture.js";
|
|
3
|
+
export interface CarouselSlideState {
|
|
4
|
+
/** Posición del elemento en `items`. */
|
|
5
|
+
index: number;
|
|
6
|
+
count: number;
|
|
7
|
+
/** Es el slide centrado. */
|
|
8
|
+
active: boolean;
|
|
9
|
+
/** Réplica del bucle infinito: decorativa, inerte y oculta a lectores de pantalla. */
|
|
10
|
+
clone: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface CarouselLabels {
|
|
13
|
+
previous: string;
|
|
14
|
+
next: string;
|
|
15
|
+
/** Nombre accesible y anuncio de cada slide. `index` empieza en 0. */
|
|
16
|
+
slide: (index: number, count: number) => string;
|
|
17
|
+
/** Valor de aria-roledescription de la región. */
|
|
18
|
+
carousel: string;
|
|
19
|
+
/** Valor de aria-roledescription de cada slide. */
|
|
20
|
+
slideRole: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CarouselProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, "children" | "aria-label"> {
|
|
23
|
+
items: readonly T[];
|
|
24
|
+
renderItem: (item: T, index: number, state: CarouselSlideState) => ReactNode;
|
|
25
|
+
getKey?: (item: T, index: number) => Key;
|
|
26
|
+
/** "lens": el centro queda plano y los bordes se curvan como a través de un cristal. */
|
|
27
|
+
effect?: "lens" | "none";
|
|
28
|
+
loop?: boolean;
|
|
29
|
+
ariaLabel: string;
|
|
30
|
+
labels?: Partial<CarouselLabels>;
|
|
31
|
+
defaultIndex?: number;
|
|
32
|
+
onIndexChange?: (index: number) => void;
|
|
33
|
+
/** Ancho de cada slide: número en px o cualquier longitud CSS. */
|
|
34
|
+
slideWidth?: number | string;
|
|
35
|
+
/** Separación entre slides: número en px o cualquier longitud CSS. */
|
|
36
|
+
gap?: number | string;
|
|
37
|
+
/**
|
|
38
|
+
* Imagen de cada slide tal como se ve (o su URL). Activa el dibujo WebGL de las zonas curvas;
|
|
39
|
+
* sin esta prop, o sin WebGL2, la lente se aplica con transformaciones CSS sobre los slides reales.
|
|
40
|
+
*/
|
|
41
|
+
rasterize?: (item: T, index: number, size: CarouselRasterSize) => CarouselRasterSource | Promise<CarouselRasterSource>;
|
|
42
|
+
ref?: Ref<HTMLDivElement>;
|
|
43
|
+
}
|
|
44
|
+
export declare function Carousel<T>({ items, renderItem, getKey, effect, loop, ariaLabel, labels, defaultIndex, onIndexChange, slideWidth, gap, rasterize, className, style, ref, ...rest }: CarouselProps<T>): import("react").JSX.Element;
|