@rubenpazch/description-list 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/README.md +31 -2
- package/dist/DescriptionList.d.ts +28 -0
- package/dist/DescriptionList.d.ts.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +75 -3
package/README.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @rubenpazch/description-list
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- catalogo:inicio (generado por pnpm catalogo, no editar) -->
|
|
4
|
+
|
|
5
|
+
Pares etiqueta/valor en columnas: resumen de un registro (datos de un trámite, de un cliente, de un pago).
|
|
6
|
+
|
|
7
|
+
- **Usar cuando:** Mostrar varios datos de solo lectura de un registro, con etiquetas.
|
|
8
|
+
- **Evitar cuando:** Datos tabulares de muchos registros: usa DataTable. Una sola fila con icono: usa InfoRow.
|
|
9
|
+
|
|
10
|
+
Se recomienda instalar el paquete completo `@rubenpazch/ui` (incluye este). Por separado:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @rubenpazch/description-list
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## DescriptionList
|
|
17
|
+
|
|
18
|
+
Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro.
|
|
19
|
+
|
|
20
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
21
|
+
| ------------ | ------------------- | ---- | ------------ | ----------------------------------------------------------------- |
|
|
22
|
+
| `items` | `DescriptionItem[]` | sí | | |
|
|
23
|
+
| `className` | `string` | | | |
|
|
24
|
+
| `columns` | `1 \| 2 \| 3` | | `2` | Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. |
|
|
25
|
+
| `emptyText` | `ReactNode` | | `Sin datos.` | Texto si no hay ningún dato. |
|
|
26
|
+
| `emptyValue` | `ReactNode` | | `—` | Qué mostrar si un valor está vacío. |
|
|
27
|
+
| `footnote` | `ReactNode` | | | Nota al pie (fuente de los datos, aclaraciones). |
|
|
28
|
+
| `title` | `ReactNode` | | | Título opcional sobre la lista. |
|
|
29
|
+
|
|
30
|
+
Tipos: `DescriptionItem`, `DescriptionListProps`.
|
|
31
|
+
|
|
32
|
+
<!-- catalogo:fin -->
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DescriptionItem {
|
|
3
|
+
/** Etiqueta: "Remitente", "Fecha de ingreso". */
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
/** Valor. Vacío (null, undefined o "") muestra `emptyValue`. */
|
|
6
|
+
value?: React.ReactNode;
|
|
7
|
+
/** Resalta el valor (p. ej. un dato importante o inferido). */
|
|
8
|
+
highlight?: boolean;
|
|
9
|
+
/** Ocupa toda la fila (textos largos: asunto, observaciones). */
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DescriptionListProps {
|
|
13
|
+
items: DescriptionItem[];
|
|
14
|
+
/** Título opcional sobre la lista. */
|
|
15
|
+
title?: React.ReactNode;
|
|
16
|
+
/** Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. */
|
|
17
|
+
columns?: 1 | 2 | 3;
|
|
18
|
+
/** Qué mostrar si un valor está vacío. */
|
|
19
|
+
emptyValue?: React.ReactNode;
|
|
20
|
+
/** Texto si no hay ningún dato. */
|
|
21
|
+
emptyText?: React.ReactNode;
|
|
22
|
+
/** Nota al pie (fuente de los datos, aclaraciones). */
|
|
23
|
+
footnote?: React.ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro. */
|
|
27
|
+
export default function DescriptionList({ items, title, columns, emptyValue, emptyText, footnote, className, }: DescriptionListProps): React.JSX.Element;
|
|
28
|
+
//# sourceMappingURL=DescriptionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionList.d.ts","sourceRoot":"","sources":["../src/DescriptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,gEAAgE;IAChE,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,wEAAwE;IACxE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,mCAAmC;IACnC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,6EAA6E;AAC7E,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,KAAK,EACL,KAAK,EACL,OAAW,EACX,UAAgB,EAChB,SAAwB,EACxB,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,qBA8BtB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");var i={wrapper:"DescriptionList-module_wrapper__vsJV5",title:"DescriptionList-module_title__q33V9",list:"DescriptionList-module_list__EGDQC",cols2:"DescriptionList-module_cols2__uRkpK",cols3:"DescriptionList-module_cols3__qAkyu",item:"DescriptionList-module_item__X4XEW",full:"DescriptionList-module_full__EYw0V",label:"DescriptionList-module_label__6FxWe",value:"DescriptionList-module_value__AXC0B",highlight:"DescriptionList-module_highlight__yuPI3",missing:"DescriptionList-module_missing__b8EZA",empty:"DescriptionList-module_empty__iD-Ej",footnote:"DescriptionList-module_footnote__hQhVr"};!function(e,i){void 0===i&&(i={});var t=i.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".DescriptionList-module_wrapper__vsJV5 {\n font-family: var(--lb-font-sans);\n}\n\n.DescriptionList-module_title__q33V9 {\n margin: 0 0 var(--lb-space-3);\n font-size: var(--lb-font-size-sm);\n font-weight: var(--lb-font-weight-semibold);\n color: var(--lb-color-foreground);\n}\n\n.DescriptionList-module_list__EGDQC {\n display: grid;\n grid-template-columns: 1fr;\n gap: var(--lb-space-3) var(--lb-space-6);\n margin: 0;\n}\n\n@media (min-width: 640px) {\n .DescriptionList-module_cols2__uRkpK {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n .DescriptionList-module_cols3__qAkyu {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n}\n\n.DescriptionList-module_item__X4XEW {\n min-width: 0;\n}\n\n.DescriptionList-module_full__EYw0V {\n grid-column: 1 / -1;\n}\n\n.DescriptionList-module_label__6FxWe {\n font-size: var(--lb-font-size-xs);\n font-weight: var(--lb-font-weight-medium);\n color: var(--lb-color-muted-foreground);\n text-transform: uppercase;\n letter-spacing: 0.03em;\n}\n\n.DescriptionList-module_value__AXC0B {\n margin: var(--lb-space-1) 0 0;\n font-size: var(--lb-font-size-sm);\n color: var(--lb-color-foreground);\n overflow-wrap: anywhere;\n}\n\n.DescriptionList-module_highlight__yuPI3 {\n font-weight: var(--lb-font-weight-semibold);\n color: var(--lb-color-primary-strong, var(--lb-color-primary));\n}\n\n.DescriptionList-module_missing__b8EZA {\n color: var(--lb-color-muted-foreground);\n}\n\n.DescriptionList-module_empty__iD-Ej,\n.DescriptionList-module_footnote__hQhVr {\n margin: 0;\n font-size: var(--lb-font-size-xs);\n color: var(--lb-color-muted-foreground);\n}\n\n.DescriptionList-module_footnote__hQhVr {\n margin-top: var(--lb-space-3);\n}\n");const t=(...e)=>e.filter(Boolean).join(" "),n=e=>null==e||""===e;module.exports=function({items:o,title:l,columns:s=2,emptyValue:r="—",emptyText:a="Sin datos.",footnote:m,className:c}){return e.jsxs("section",{className:t(i.wrapper,c),children:[l&&e.jsx("h3",{className:i.title,children:l}),0===o.length?e.jsx("p",{className:i.empty,children:a}):e.jsx("dl",{className:t(i.list,i[`cols${s}`]),children:o.map((o,l)=>e.jsxs("div",{className:t(i.item,o.fullWidth&&i.full),children:[e.jsx("dt",{className:i.label,children:o.label}),e.jsx("dd",{className:t(i.value,o.highlight&&i.highlight,n(o.value)&&i.missing),children:n(o.value)?r:o.value})]},l))}),m&&e.jsx("p",{className:i.footnote,children:m})]})};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/DescriptionList.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from \"react\";\nimport styles from \"./DescriptionList.module.css\";\n\nexport interface DescriptionItem {\n /** Etiqueta: \"Remitente\", \"Fecha de ingreso\". */\n label: React.ReactNode;\n /** Valor. Vacío (null, undefined o \"\") muestra `emptyValue`. */\n value?: React.ReactNode;\n /** Resalta el valor (p. ej. un dato importante o inferido). */\n highlight?: boolean;\n /** Ocupa toda la fila (textos largos: asunto, observaciones). */\n fullWidth?: boolean;\n}\n\nexport interface DescriptionListProps {\n items: DescriptionItem[];\n /** Título opcional sobre la lista. */\n title?: React.ReactNode;\n /** Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. */\n columns?: 1 | 2 | 3;\n /** Qué mostrar si un valor está vacío. */\n emptyValue?: React.ReactNode;\n /** Texto si no hay ningún dato. */\n emptyText?: React.ReactNode;\n /** Nota al pie (fuente de los datos, aclaraciones). */\n footnote?: React.ReactNode;\n className?: string;\n}\n\nconst cx = (...c: Array<string | false | undefined>) =>\n c.filter(Boolean).join(\" \");\nconst vacio = (v: React.ReactNode) => v === null || v === undefined || v === \"\";\n\n/** Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro. */\nexport default function DescriptionList({\n items,\n title,\n columns = 2,\n emptyValue = \"—\",\n emptyText = \"Sin datos.\",\n footnote,\n className,\n}: DescriptionListProps) {\n return (\n <section className={cx(styles.wrapper, className)}>\n {title && <h3 className={styles.title}>{title}</h3>}\n {items.length === 0 ? (\n <p className={styles.empty}>{emptyText}</p>\n ) : (\n <dl className={cx(styles.list, styles[`cols${columns}`])}>\n {items.map((item, i) => (\n <div\n key={i}\n className={cx(styles.item, item.fullWidth && styles.full)}\n >\n <dt className={styles.label}>{item.label}</dt>\n <dd\n className={cx(\n styles.value,\n item.highlight && styles.highlight,\n vacio(item.value) && styles.missing,\n )}\n >\n {vacio(item.value) ? emptyValue : item.value}\n </dd>\n </div>\n ))}\n </dl>\n )}\n {footnote && <p className={styles.footnote}>{footnote}</p>}\n </section>\n );\n}\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","cx","c","filter","Boolean","join","vacio","v","items","title","columns","emptyValue","emptyText","footnote","className","_jsxs","styles","wrapper","children","_jsx","length","empty","list","map","item","i","fullWidth","full","label","value","highlight","missing"],"mappings":"qoBAAA,SAAqBA,EAAKC,YACnBA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,+sDCIA,MAAMe,EAAK,IAAIC,IACbA,EAAEC,OAAOC,SAASC,KAAK,KACnBC,EAASC,GAAuBA,SAAuC,KAANA,iBAGzD,UAA0BC,MACtCA,EAAKC,MACLA,EAAKC,QACLA,EAAU,EAACC,WACXA,EAAa,IAAGC,UAChBA,EAAY,aAAYC,SACxBA,EAAQC,UACRA,IAEA,OACEC,EAAAA,KAAA,UAAA,CAASD,UAAWb,EAAGe,EAAOC,QAASH,GAAUI,SAAA,CAC9CT,GAASU,EAAAA,IAAA,KAAA,CAAIL,UAAWE,EAAOP,MAAKS,SAAGT,IACtB,IAAjBD,EAAMY,OACLD,EAAAA,IAAA,IAAA,CAAGL,UAAWE,EAAOK,MAAKH,SAAGN,IAE7BO,EAAAA,IAAA,KAAA,CAAIL,UAAWb,EAAGe,EAAOM,KAAMN,EAAO,OAAON,MAAWQ,SACrDV,EAAMe,IAAI,CAACC,EAAMC,IAChBV,EAAAA,KAAA,MAAA,CAEED,UAAWb,EAAGe,EAAOQ,KAAMA,EAAKE,WAAaV,EAAOW,MAAKT,SAAA,CAEzDC,EAAAA,UAAIL,UAAWE,EAAOY,MAAKV,SAAGM,EAAKI,QACnCT,EAAAA,IAAA,KAAA,CACEL,UAAWb,EACTe,EAAOa,MACPL,EAAKM,WAAad,EAAOc,UACzBxB,EAAMkB,EAAKK,QAAUb,EAAOe,SAC7Bb,SAEAZ,EAAMkB,EAAKK,OAASlB,EAAaa,EAAKK,UAXpCJ,MAiBZZ,GAAYM,EAAAA,IAAA,IAAA,CAAGL,UAAWE,EAAOH,SAAQK,SAAGL,MAGnD","x_google_ignoreList":[0]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface DescriptionItem {
|
|
4
|
+
/** Etiqueta: "Remitente", "Fecha de ingreso". */
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
/** Valor. Vacío (null, undefined o "") muestra `emptyValue`. */
|
|
7
|
+
value?: React.ReactNode;
|
|
8
|
+
/** Resalta el valor (p. ej. un dato importante o inferido). */
|
|
9
|
+
highlight?: boolean;
|
|
10
|
+
/** Ocupa toda la fila (textos largos: asunto, observaciones). */
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DescriptionListProps {
|
|
14
|
+
items: DescriptionItem[];
|
|
15
|
+
/** Título opcional sobre la lista. */
|
|
16
|
+
title?: React.ReactNode;
|
|
17
|
+
/** Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. */
|
|
18
|
+
columns?: 1 | 2 | 3;
|
|
19
|
+
/** Qué mostrar si un valor está vacío. */
|
|
20
|
+
emptyValue?: React.ReactNode;
|
|
21
|
+
/** Texto si no hay ningún dato. */
|
|
22
|
+
emptyText?: React.ReactNode;
|
|
23
|
+
/** Nota al pie (fuente de los datos, aclaraciones). */
|
|
24
|
+
footnote?: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro. */
|
|
28
|
+
declare function DescriptionList({ items, title, columns, emptyValue, emptyText, footnote, className, }: DescriptionListProps): React.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { DescriptionList as default };
|
|
31
|
+
export type { DescriptionItem, DescriptionListProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsxs as e,jsx as i}from"react/jsx-runtime";var t={wrapper:"DescriptionList-module_wrapper__vsJV5",title:"DescriptionList-module_title__q33V9",list:"DescriptionList-module_list__EGDQC",cols2:"DescriptionList-module_cols2__uRkpK",cols3:"DescriptionList-module_cols3__qAkyu",item:"DescriptionList-module_item__X4XEW",full:"DescriptionList-module_full__EYw0V",label:"DescriptionList-module_label__6FxWe",value:"DescriptionList-module_value__AXC0B",highlight:"DescriptionList-module_highlight__yuPI3",missing:"DescriptionList-module_missing__b8EZA",empty:"DescriptionList-module_empty__iD-Ej",footnote:"DescriptionList-module_footnote__hQhVr"};!function(e,i){void 0===i&&(i={});var t=i.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".DescriptionList-module_wrapper__vsJV5 {\n font-family: var(--lb-font-sans);\n}\n\n.DescriptionList-module_title__q33V9 {\n margin: 0 0 var(--lb-space-3);\n font-size: var(--lb-font-size-sm);\n font-weight: var(--lb-font-weight-semibold);\n color: var(--lb-color-foreground);\n}\n\n.DescriptionList-module_list__EGDQC {\n display: grid;\n grid-template-columns: 1fr;\n gap: var(--lb-space-3) var(--lb-space-6);\n margin: 0;\n}\n\n@media (min-width: 640px) {\n .DescriptionList-module_cols2__uRkpK {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n }\n .DescriptionList-module_cols3__qAkyu {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n}\n\n.DescriptionList-module_item__X4XEW {\n min-width: 0;\n}\n\n.DescriptionList-module_full__EYw0V {\n grid-column: 1 / -1;\n}\n\n.DescriptionList-module_label__6FxWe {\n font-size: var(--lb-font-size-xs);\n font-weight: var(--lb-font-weight-medium);\n color: var(--lb-color-muted-foreground);\n text-transform: uppercase;\n letter-spacing: 0.03em;\n}\n\n.DescriptionList-module_value__AXC0B {\n margin: var(--lb-space-1) 0 0;\n font-size: var(--lb-font-size-sm);\n color: var(--lb-color-foreground);\n overflow-wrap: anywhere;\n}\n\n.DescriptionList-module_highlight__yuPI3 {\n font-weight: var(--lb-font-weight-semibold);\n color: var(--lb-color-primary-strong, var(--lb-color-primary));\n}\n\n.DescriptionList-module_missing__b8EZA {\n color: var(--lb-color-muted-foreground);\n}\n\n.DescriptionList-module_empty__iD-Ej,\n.DescriptionList-module_footnote__hQhVr {\n margin: 0;\n font-size: var(--lb-font-size-xs);\n color: var(--lb-color-muted-foreground);\n}\n\n.DescriptionList-module_footnote__hQhVr {\n margin-top: var(--lb-space-3);\n}\n");const n=(...e)=>e.filter(Boolean).join(" "),o=e=>null==e||""===e;function l({items:l,title:s,columns:r=2,emptyValue:a="—",emptyText:m="Sin datos.",footnote:c,className:_}){return e("section",{className:n(t.wrapper,_),children:[s&&i("h3",{className:t.title,children:s}),0===l.length?i("p",{className:t.empty,children:m}):i("dl",{className:n(t.list,t[`cols${r}`]),children:l.map((l,s)=>e("div",{className:n(t.item,l.fullWidth&&t.full),children:[i("dt",{className:t.label,children:l.label}),i("dd",{className:n(t.value,l.highlight&&t.highlight,o(l.value)&&t.missing),children:o(l.value)?a:l.value})]},s))}),c&&i("p",{className:t.footnote,children:c})]})}export{l as default};
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../src/DescriptionList.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from \"react\";\nimport styles from \"./DescriptionList.module.css\";\n\nexport interface DescriptionItem {\n /** Etiqueta: \"Remitente\", \"Fecha de ingreso\". */\n label: React.ReactNode;\n /** Valor. Vacío (null, undefined o \"\") muestra `emptyValue`. */\n value?: React.ReactNode;\n /** Resalta el valor (p. ej. un dato importante o inferido). */\n highlight?: boolean;\n /** Ocupa toda la fila (textos largos: asunto, observaciones). */\n fullWidth?: boolean;\n}\n\nexport interface DescriptionListProps {\n items: DescriptionItem[];\n /** Título opcional sobre la lista. */\n title?: React.ReactNode;\n /** Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. */\n columns?: 1 | 2 | 3;\n /** Qué mostrar si un valor está vacío. */\n emptyValue?: React.ReactNode;\n /** Texto si no hay ningún dato. */\n emptyText?: React.ReactNode;\n /** Nota al pie (fuente de los datos, aclaraciones). */\n footnote?: React.ReactNode;\n className?: string;\n}\n\nconst cx = (...c: Array<string | false | undefined>) =>\n c.filter(Boolean).join(\" \");\nconst vacio = (v: React.ReactNode) => v === null || v === undefined || v === \"\";\n\n/** Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro. */\nexport default function DescriptionList({\n items,\n title,\n columns = 2,\n emptyValue = \"—\",\n emptyText = \"Sin datos.\",\n footnote,\n className,\n}: DescriptionListProps) {\n return (\n <section className={cx(styles.wrapper, className)}>\n {title && <h3 className={styles.title}>{title}</h3>}\n {items.length === 0 ? (\n <p className={styles.empty}>{emptyText}</p>\n ) : (\n <dl className={cx(styles.list, styles[`cols${columns}`])}>\n {items.map((item, i) => (\n <div\n key={i}\n className={cx(styles.item, item.fullWidth && styles.full)}\n >\n <dt className={styles.label}>{item.label}</dt>\n <dd\n className={cx(\n styles.value,\n item.highlight && styles.highlight,\n vacio(item.value) && styles.missing,\n )}\n >\n {vacio(item.value) ? emptyValue : item.value}\n </dd>\n </div>\n ))}\n </dl>\n )}\n {footnote && <p className={styles.footnote}>{footnote}</p>}\n </section>\n );\n}\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","cx","c","filter","Boolean","join","vacio","v","DescriptionList","items","title","columns","emptyValue","emptyText","footnote","className","_jsxs","styles","wrapper","children","_jsx","length","empty","list","map","item","i","fullWidth","full","label","value","highlight","missing"],"mappings":"uoBAAA,SAAqBA,EAAKC,YACnBA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,+sDCIA,MAAMe,EAAK,IAAIC,IACbA,EAAEC,OAAOC,SAASC,KAAK,KACnBC,EAASC,GAAuBA,SAAuC,KAANA,EAGzD,SAAUC,GAAgBC,MACtCA,EAAKC,MACLA,EAAKC,QACLA,EAAU,EAACC,WACXA,EAAa,IAAGC,UAChBA,EAAY,aAAYC,SACxBA,EAAQC,UACRA,IAEA,OACEC,EAAA,UAAA,CAASD,UAAWd,EAAGgB,EAAOC,QAASH,GAAUI,SAAA,CAC9CT,GAASU,EAAA,KAAA,CAAIL,UAAWE,EAAOP,MAAKS,SAAGT,IACtB,IAAjBD,EAAMY,OACLD,EAAA,IAAA,CAAGL,UAAWE,EAAOK,MAAKH,SAAGN,IAE7BO,EAAA,KAAA,CAAIL,UAAWd,EAAGgB,EAAOM,KAAMN,EAAO,OAAON,MAAWQ,SACrDV,EAAMe,IAAI,CAACC,EAAMC,IAChBV,EAAA,MAAA,CAEED,UAAWd,EAAGgB,EAAOQ,KAAMA,EAAKE,WAAaV,EAAOW,MAAKT,SAAA,CAEzDC,QAAIL,UAAWE,EAAOY,MAAKV,SAAGM,EAAKI,QACnCT,EAAA,KAAA,CACEL,UAAWd,EACTgB,EAAOa,MACPL,EAAKM,WAAad,EAAOc,UACzBzB,EAAMmB,EAAKK,QAAUb,EAAOe,SAC7Bb,SAEAb,EAAMmB,EAAKK,OAASlB,EAAaa,EAAKK,UAXpCJ,MAiBZZ,GAAYM,EAAA,IAAA,CAAGL,UAAWE,EAAOH,SAAQK,SAAGL,MAGnD","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenpazch/description-list",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lista de pares etiqueta/valor (resumen de datos)",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/rubenpazch/lbyte-ui-library.git",
|
|
8
|
+
"directory": "packages/description-list"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "dist/index.cjs.js",
|
|
12
|
+
"module": "dist/index.esm.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.esm.js",
|
|
18
|
+
"require": "./dist/index.cjs.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"sideEffects": [
|
|
25
|
+
"**/*.css"
|
|
26
|
+
],
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": "^19.2.3",
|
|
29
|
+
"react-dom": "^19.2.3",
|
|
30
|
+
"@rubenpazch/tokens": "0.5.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
35
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
36
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
37
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
|
+
"@testing-library/react": "^16.3.3",
|
|
39
|
+
"@types/jest": "^30.0.0",
|
|
40
|
+
"@types/react": "^19.2.18",
|
|
41
|
+
"@types/react-dom": "^19.2.5",
|
|
42
|
+
"autoprefixer": "^10.5.4",
|
|
43
|
+
"eslint": "^9.39.5",
|
|
44
|
+
"identity-obj-proxy": "^3.0.0",
|
|
45
|
+
"jest": "^30.5.0",
|
|
46
|
+
"jest-environment-jsdom": "^30.5.0",
|
|
47
|
+
"postcss": "^8.5.26",
|
|
48
|
+
"prettier": "^3.9.6",
|
|
49
|
+
"react": "^19.2.8",
|
|
50
|
+
"react-dom": "^19.2.8",
|
|
51
|
+
"rollup": "^4.63.1",
|
|
52
|
+
"rollup-plugin-dts": "^6.5.1",
|
|
53
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
54
|
+
"rollup-plugin-typescript2": "^0.37.0",
|
|
55
|
+
"tslib": "^2.8.1",
|
|
56
|
+
"typescript": "^6.0.3",
|
|
57
|
+
"@rubenpazch/eslint-config": "4.0.0",
|
|
58
|
+
"@rubenpazch/typescript-config": "3.0.0",
|
|
59
|
+
"@rubenpazch/badge": "0.1.2",
|
|
60
|
+
"@rubenpazch/button": "6.2.3"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"lbyte": {
|
|
66
|
+
"categoria": "presentacion",
|
|
67
|
+
"resumen": "Pares etiqueta/valor en columnas: resumen de un registro (datos de un trámite, de un cliente, de un pago).",
|
|
68
|
+
"usarCuando": "Mostrar varios datos de solo lectura de un registro, con etiquetas.",
|
|
69
|
+
"evitarCuando": "Datos tabulares de muchos registros: usa DataTable. Una sola fila con icono: usa InfoRow."
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "rollup -c",
|
|
73
|
+
"test": "jest --passWithNoTests",
|
|
74
|
+
"test:watch": "jest --watch",
|
|
75
|
+
"lint": "eslint src",
|
|
76
|
+
"clean": "rm -rf dist"
|
|
77
|
+
}
|
|
6
78
|
}
|