@danielitouci96/design-system 1.3.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -10,6 +10,23 @@ Todas las versiones notables de `@danielitouci96/design-system`.
10
10
  > que quedan en las entradas de abajo también se actualizaron. El nombre en npmjs es inmutable: una
11
11
  > vez publicado, habría sido para siempre.
12
12
 
13
+ ## [1.4.0] — 2026-11-14
14
+
15
+ ### Tree y TreeToolbar
16
+
17
+ El árbol jerárquico de Tipología vivía en `g-clinica` con su propio CSS (animación de carpetas, filas, badges, código y estados de carga/error/vacío). Ese bloque era un componente genérico, no una decisión de dominio, así que pasa al design system.
18
+
19
+ - **`Tree`** es data-driven: recibe `TreeNode[]` con `id`, `label`, `icon`, `code`, `description`, `meta`, `actions`, `children` y `empty`. El componente resuelve la jerarquía, la indentación y las líneas de rama.
20
+ - **Estado controlado.** La expansión se controla con `expandedIds` (`ReadonlySet<string>`) y `onToggle`. No hay estado interno duplicado.
21
+ - **Estados completos.** `loading` con filas esqueleto, `error` y `empty` con slots; si hay `nodes`, esos estados no se muestran.
22
+ - **Accesibilidad.** La región lleva `aria-label`; las ramas son botones con `aria-expanded` y `aria-controls`; los iconos son decorativos y el foco tiene anillo visible. Se navega con Tab y se activa con Enter/Espacio, como cualquier botón nativo.
23
+ - **Animación sin medir alturas.** La apertura usa `grid-template-rows: 0fr → 1fr` y respeta `prefers-reduced-motion`.
24
+ - **`TreeToolbar`** agrupa búsqueda, resumen y acciones con el layout responsive del DS. En móvil la búsqueda ocupa la fila completa y las acciones se alinean a la izquierda; en escritorio se reparten en una sola fila.
25
+
26
+ ### Tokens
27
+
28
+ Se añaden los tokens `--tree-*` y `--tree-toolbar-*` en `_data-display.scss`. Los alias que leen tokens base re-mapeados (`--tree-group-border`, `--tree-row-hover-background`, `--tree-icon-color-muted`, `--tree-code-background`, `--tree-code-text`, `--tree-leaf-background`, `--tree-leaf-border`, `--tree-state-text`) se re-declaran también en el scope `inverse`, según el invariante de `inverse-surface.spec.ts`.
29
+
13
30
  ## [1.3.0] — 2026-11-14
14
31
 
15
32
  ### PageHeader: más aire entre las acciones
@@ -0,0 +1,47 @@
1
+ import * as React from 'react';
2
+ import { type IconName } from '../../icons/Icon';
3
+ export interface TreeNode {
4
+ /** Stable id used for expansion state and aria-controls. */
5
+ id: string;
6
+ label: React.ReactNode;
7
+ /** Optional leading icon. */
8
+ icon?: IconName;
9
+ /** Short code rendered next to the label. */
10
+ code?: React.ReactNode;
11
+ /** Secondary line rendered below the label on leaf rows. */
12
+ description?: React.ReactNode;
13
+ /** Badges or counters rendered next to the branch row or leaf actions. */
14
+ meta?: React.ReactNode;
15
+ /** Leaf-only actions rendered on the right side. */
16
+ actions?: React.ReactNode;
17
+ /** Child nodes. Presence of this property makes the node expandable. */
18
+ children?: TreeNode[];
19
+ /** Message rendered when an expandable node has no children. */
20
+ empty?: React.ReactNode;
21
+ }
22
+ export interface TreeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onToggle'> {
23
+ nodes: TreeNode[];
24
+ /** Ids of the currently expanded branches. */
25
+ expandedIds: ReadonlySet<string>;
26
+ onToggle: (id: string) => void;
27
+ loading?: boolean;
28
+ loadingRows?: number;
29
+ error?: React.ReactNode;
30
+ empty?: React.ReactNode;
31
+ /** Accessible name for the tree region. */
32
+ label?: string;
33
+ }
34
+ declare const Tree: React.ForwardRefExoticComponent<TreeProps & React.RefAttributes<HTMLDivElement>>;
35
+ export interface TreeToolbarProps {
36
+ /** Search control, usually a SearchInput plus an optional clear action. */
37
+ search?: React.ReactNode;
38
+ /** Result summary, aligned to the right of the search row. */
39
+ summary?: React.ReactNode;
40
+ /** Secondary actions, rendered on their own row. */
41
+ actions?: React.ReactNode;
42
+ className?: string;
43
+ }
44
+ declare const TreeToolbar: React.ForwardRefExoticComponent<TreeToolbarProps & React.RefAttributes<HTMLDivElement>>;
45
+ export { Tree, TreeToolbar };
46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