orbital-ds 0.21.0 → 0.22.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 +2 -2
- package/components.manifest.json +16 -1
- package/dist/hooks/use-ds-messages.d.ts +1 -0
- package/dist/lib/i18n.d.ts +1 -0
- package/dist/lib/i18n.js +3 -0
- package/dist/styles.css +2 -0
- package/dist/ui/entity-list.d.ts +23 -0
- package/dist/ui/entity-list.js +65 -0
- package/docs/CONTRACT.md +2 -2
- package/package.json +1 -1
- package/scripts/doctor.mjs +19 -0
package/AGENTS.md
CHANGED
|
@@ -154,8 +154,8 @@ en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`,
|
|
|
154
154
|
4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
|
|
155
155
|
5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
|
|
156
156
|
6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
|
|
157
|
-
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `StepFlow` (quick · activation · long), `FormLayout`
|
|
158
|
-
(inline · sectioned · settings), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
157
|
+
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
|
|
158
|
+
(inline · sectioned · settings), `NoticeReview` (read · acknowledge · resolve · respond), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
159
159
|
compact · comparison) y `ConfirmAction` (simple · typed).
|
|
160
160
|
|
|
161
161
|
## Avisos y comunicaciones in-app (qué canal usar)
|
package/components.manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "orbital-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"engine": "@base-ui/react",
|
|
5
5
|
"docs": [
|
|
6
6
|
"README.md",
|
|
@@ -857,6 +857,21 @@
|
|
|
857
857
|
"Estado vacío: qué es esto, por qué está vacío y la acción para empezar; sin resultados: los filtros aplicados y «Limpiar filtros»."
|
|
858
858
|
]
|
|
859
859
|
},
|
|
860
|
+
"entity-list": {
|
|
861
|
+
"import": "orbital-ds/ui/entity-list",
|
|
862
|
+
"exports": [
|
|
863
|
+
"EntityList",
|
|
864
|
+
"type EntityListPreset"
|
|
865
|
+
],
|
|
866
|
+
"slots": [
|
|
867
|
+
"entity-list"
|
|
868
|
+
],
|
|
869
|
+
"optionalPeers": [],
|
|
870
|
+
"notes": [
|
|
871
|
+
"Lista de entidades con cargando/error/vacío resueltos: pasa `items`, `renderItem` (un `Item variant=\"card\"`) y, si hay filtros, `toolbar` y `filtered`. `list` por defecto, `grid` para tarjetas, `compact` para muchas filas.",
|
|
872
|
+
"No compone Card + Item a mano: la fila es siempre un Item."
|
|
873
|
+
]
|
|
874
|
+
},
|
|
860
875
|
"eyebrow": {
|
|
861
876
|
"import": "orbital-ds/ui/eyebrow",
|
|
862
877
|
"exports": [
|
package/dist/lib/i18n.d.ts
CHANGED
package/dist/lib/i18n.js
CHANGED
|
@@ -91,6 +91,7 @@ const en = {
|
|
|
91
91
|
noticeStateNew: "New",
|
|
92
92
|
noticeStateAcknowledged: "Acknowledged",
|
|
93
93
|
noticeStateResolved: "Resolved",
|
|
94
|
+
entityRetry: "Try again",
|
|
94
95
|
statIncrease: "Increase",
|
|
95
96
|
statDecrease: "Decrease",
|
|
96
97
|
statNoChange: "No change",
|
|
@@ -235,6 +236,7 @@ const es = {
|
|
|
235
236
|
noticeStateNew: "Nuevo",
|
|
236
237
|
noticeStateAcknowledged: "Reconocido",
|
|
237
238
|
noticeStateResolved: "Resuelto",
|
|
239
|
+
entityRetry: "Reintentar",
|
|
238
240
|
statIncrease: "Subida",
|
|
239
241
|
statDecrease: "Bajada",
|
|
240
242
|
statNoChange: "Sin cambios",
|
|
@@ -379,6 +381,7 @@ const ptBR = {
|
|
|
379
381
|
noticeStateNew: "Novo",
|
|
380
382
|
noticeStateAcknowledged: "Reconhecido",
|
|
381
383
|
noticeStateResolved: "Resolvido",
|
|
384
|
+
entityRetry: "Tentar novamente",
|
|
382
385
|
statIncrease: "Aumento",
|
|
383
386
|
statDecrease: "Queda",
|
|
384
387
|
statNoChange: "Sem altera\xE7\xE3o",
|
package/dist/styles.css
CHANGED
|
@@ -517,6 +517,8 @@
|
|
|
517
517
|
--ds-page-max-w: 72rem; /* ancho máximo del contenido de una vista (PageHeader) */
|
|
518
518
|
--ds-page-gap: 1.5rem;
|
|
519
519
|
--ds-section-gap: 1rem;
|
|
520
|
+
--ds-list-gap: 0.75rem; /* separación entre filas/tarjetas de una lista de entidades */
|
|
521
|
+
--ds-list-gap-compact: 0.25rem; /* ídem en el preset compact */
|
|
520
522
|
--ds-stat-value-weight: 600; /* cifra de un KPI */
|
|
521
523
|
--ds-stat-accent-w: calc(var(--ds-rule-w) * 3); /* filete de tono del KPI */
|
|
522
524
|
--ds-sparkline-h: 2rem;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type EntityListPreset = "list" | "grid" | "compact";
|
|
4
|
+
declare function EntityList<T>({ items, getKey, renderItem, preset, toolbar, loading, error, onRetry, filtered, emptyAction, skeletonCount, className, }: {
|
|
5
|
+
items: readonly T[];
|
|
6
|
+
getKey: (item: T) => string | number;
|
|
7
|
+
renderItem: (item: T) => React.ReactNode;
|
|
8
|
+
preset?: EntityListPreset;
|
|
9
|
+
/** Barra superior (FilterBar, buscador…). */
|
|
10
|
+
toolbar?: React.ReactNode;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
/** Si hay error, se muestra en lugar de la lista. */
|
|
13
|
+
error?: unknown;
|
|
14
|
+
onRetry?: () => void;
|
|
15
|
+
/** Hay filtros o búsqueda activos (distingue «sin resultados» de «primer uso»). */
|
|
16
|
+
filtered?: boolean;
|
|
17
|
+
/** Acción del estado vacío (crear la primera, quitar filtros…). */
|
|
18
|
+
emptyAction?: React.ReactNode;
|
|
19
|
+
skeletonCount?: number;
|
|
20
|
+
className?: string;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { EntityList, type EntityListPreset };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { EmptyState } from "./empty-state.js";
|
|
8
|
+
import { Skeleton } from "./skeleton.js";
|
|
9
|
+
const LAYOUT = {
|
|
10
|
+
list: "grid-cols-1 gap-(--ds-list-gap)",
|
|
11
|
+
grid: "grid-cols-1 gap-(--ds-list-gap) @[36rem]:grid-cols-2 @[56rem]:grid-cols-3",
|
|
12
|
+
compact: "grid-cols-1 gap-(--ds-list-gap-compact)"
|
|
13
|
+
};
|
|
14
|
+
function EntityList({
|
|
15
|
+
items,
|
|
16
|
+
getKey,
|
|
17
|
+
renderItem,
|
|
18
|
+
preset = "list",
|
|
19
|
+
toolbar,
|
|
20
|
+
loading = false,
|
|
21
|
+
error,
|
|
22
|
+
onRetry,
|
|
23
|
+
filtered = false,
|
|
24
|
+
emptyAction,
|
|
25
|
+
skeletonCount = 4,
|
|
26
|
+
className
|
|
27
|
+
}) {
|
|
28
|
+
const t = useDsMessages();
|
|
29
|
+
const state = error ? "error" : loading ? "loading" : items.length === 0 ? "empty" : "ready";
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "entity-list",
|
|
34
|
+
"data-preset": preset,
|
|
35
|
+
"data-state": state,
|
|
36
|
+
className: cn("@container flex flex-col gap-(--ds-list-gap)", className),
|
|
37
|
+
children: [
|
|
38
|
+
toolbar,
|
|
39
|
+
state === "error" ? /* @__PURE__ */ jsx(
|
|
40
|
+
EmptyState,
|
|
41
|
+
{
|
|
42
|
+
preset: "error",
|
|
43
|
+
action: onRetry ? /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onRetry, children: t.entityRetry }) : void 0
|
|
44
|
+
}
|
|
45
|
+
) : state === "loading" ? /* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
"aria-busy": "true",
|
|
49
|
+
className: cn("grid", LAYOUT[preset]),
|
|
50
|
+
children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx(
|
|
51
|
+
Skeleton,
|
|
52
|
+
{
|
|
53
|
+
className: cn(preset === "compact" ? "h-12" : "h-24", "w-full")
|
|
54
|
+
},
|
|
55
|
+
i
|
|
56
|
+
))
|
|
57
|
+
}
|
|
58
|
+
) : state === "empty" ? /* @__PURE__ */ jsx(EmptyState, { preset: filtered ? "no-results" : "first-use", action: emptyAction }) : /* @__PURE__ */ jsx("div", { className: cn("grid", LAYOUT[preset]), children: items.map((item) => /* @__PURE__ */ jsx(React.Fragment, { children: renderItem(item) }, getKey(item))) })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
EntityList
|
|
65
|
+
};
|
package/docs/CONTRACT.md
CHANGED
|
@@ -134,8 +134,8 @@ en cualquier proyecto. Vocabulario común en `src/lib/presets.ts` (`DsDensity`,
|
|
|
134
134
|
4. **El diseño sigue el ancho del contenedor** (container query), no el dispositivo ni la presentación.
|
|
135
135
|
5. **Aviso en desarrollo** (`dsWarn`, mensaje en inglés) si la combinación no cuadra.
|
|
136
136
|
6. **Ganchos del DOM**: `data-slot` y `data-preset` (más `data-presentation`/`data-density` si aplica).
|
|
137
|
-
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `StepFlow` (quick · activation · long), `FormLayout`
|
|
138
|
-
(inline · sectioned · settings), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
137
|
+
7. **Un `@note`** que diga cuándo usar cada preset. Catálogo hoy: `EntityList` (list · grid · compact), `StepFlow` (quick · activation · long), `FormLayout`
|
|
138
|
+
(inline · sectioned · settings), `NoticeReview` (read · acknowledge · resolve · respond), `EmptyState` (first-use · no-results · error · forbidden), `StatGroup` (overview ·
|
|
139
139
|
compact · comparison) y `ConfirmAction` (simple · typed).
|
|
140
140
|
|
|
141
141
|
## Avisos y comunicaciones in-app (qué canal usar)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orbital-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Sistema de diseño genérico: estructura común + temas con personalidad (qratia, zyro) + ~60 componentes sobre Base UI y Tailwind v4, con contrato verificable y legible por agentes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
package/scripts/doctor.mjs
CHANGED
|
@@ -453,6 +453,25 @@ if (base && themeInfo[base]) {
|
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
+
// 9) PRESETS (estándar de AGENTS.md): un componente con prop `preset` emite `data-preset`, sus valores
|
|
457
|
+
// son una palabra en inglés en minúsculas (kebab-case) y lleva un @note que explica cuándo usar cada uno.
|
|
458
|
+
{
|
|
459
|
+
const uiDir9 = join(ROOT, 'src/ui');
|
|
460
|
+
if (existsSync(uiDir9)) {
|
|
461
|
+
for (const f of readdirSync(uiDir9).filter((n) => n.endsWith('.tsx'))) {
|
|
462
|
+
const src = read(join(uiDir9, f));
|
|
463
|
+
if (!/preset\??:/.test(src)) continue;
|
|
464
|
+
if (!/data-preset=/.test(src)) errors.push(`ui/${f}: tiene prop preset pero no emite data-preset`);
|
|
465
|
+
if (!/@note/.test(src)) errors.push(`ui/${f}: tiene prop preset pero ningún @note que explique cuándo usar cada uno`);
|
|
466
|
+
for (const m of src.matchAll(/type \w*Preset\s*=\s*([^;]+);/g)) {
|
|
467
|
+
for (const v of m[1].matchAll(/"([^"]+)"/g)) {
|
|
468
|
+
if (!/^[a-z]+(-[a-z]+)*$/.test(v[1])) errors.push(`ui/${f}: valor de preset «${v[1]}» fuera del estándar (inglés, minúsculas, kebab-case)`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
456
475
|
// CSS de una app (opcional)
|
|
457
476
|
const cssArgIdx = process.argv.indexOf('--css');
|
|
458
477
|
if (cssArgIdx > -1 && process.argv[cssArgIdx + 1]) {
|