@rubenpazch/description-list 0.0.0-stage → 0.2.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 CHANGED
@@ -1,3 +1,33 @@
1
- # Temporary Holding Version
1
+ # @rubenpazch/description-list
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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` | | | 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
+ | `labels` | `Partial<{ empty: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
29
+ | `title` | `ReactNode` | | | Título opcional sobre la lista. |
30
+
31
+ Tipos: `DescriptionItem`, `DescriptionListProps`.
32
+
33
+ <!-- catalogo:fin -->
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { type UiMessages } from "@rubenpazch/shared";
3
+ export 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
+ export 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
+ * Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`);
28
+ * también se cambian para toda la app con su prop `messages`.
29
+ */
30
+ labels?: Partial<UiMessages["descriptionList"]>;
31
+ }
32
+ /** Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro. */
33
+ export default function DescriptionList({ items, title, columns, emptyValue, emptyText, footnote, className, labels, }: DescriptionListProps): React.JSX.Element;
34
+ //# 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;AAC1B,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGpE,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;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;CACjD;AAMD,6EAA6E;AAC7E,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,KAAK,EACL,KAAK,EACL,OAAW,EACX,UAAgB,EAChB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,MAAM,GACP,EAAE,oBAAoB,qBA+BtB"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react/jsx-runtime"),i=require("@rubenpazch/shared");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;module.exports=function({items:s,title:l,columns:r=2,emptyValue:a="—",emptyText:m,footnote:c,className:d,labels:_}){const u=i.useUiMessages("descriptionList",_);return e.jsxs("section",{className:n(t.wrapper,d),children:[l&&e.jsx("h3",{className:t.title,children:l}),0===s.length?e.jsx("p",{className:t.empty,children:m??u.empty}):e.jsx("dl",{className:n(t.list,t[`cols${r}`]),children:s.map((i,s)=>e.jsxs("div",{className:n(t.item,i.fullWidth&&t.full),children:[e.jsx("dt",{className:t.label,children:i.label}),e.jsx("dd",{className:n(t.value,i.highlight&&t.highlight,o(i.value)&&t.missing),children:o(i.value)?a:i.value})]},s))}),c&&e.jsx("p",{className:t.footnote,children:c})]})};
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 { useUiMessages, type UiMessages } from \"@rubenpazch/shared\";\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 * Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`);\n * también se cambian para toda la app con su prop `messages`.\n */\n labels?: Partial<UiMessages[\"descriptionList\"]>;\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,\n footnote,\n className,\n labels,\n}: DescriptionListProps) {\n const t = useUiMessages(\"descriptionList\", labels);\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 ?? t.empty}</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","labels","t","useUiMessages","_jsxs","styles","wrapper","children","_jsx","length","empty","list","map","item","i","fullWidth","full","label","value","highlight","missing"],"mappings":"qqBAAA,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,+sDCUA,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,EAASC,SACTA,EAAQC,UACRA,EAASC,OACTA,IAEA,MAAMC,EAAIC,EAAAA,cAAc,kBAAmBF,GAC3C,OACEG,EAAAA,KAAA,UAAA,CAASJ,UAAWb,EAAGkB,EAAOC,QAASN,GAAUO,SAAA,CAC9CZ,GAASa,EAAAA,IAAA,KAAA,CAAIR,UAAWK,EAAOV,MAAKY,SAAGZ,IACtB,IAAjBD,EAAMe,OACLD,EAAAA,SAAGR,UAAWK,EAAOK,eAAQZ,GAAaI,EAAEQ,QAE5CF,EAAAA,IAAA,KAAA,CAAIR,UAAWb,EAAGkB,EAAOM,KAAMN,EAAO,OAAOT,eAC1CF,EAAMkB,IAAI,CAACC,EAAMC,IAChBV,EAAAA,KAAA,MAAA,CAEEJ,UAAWb,EAAGkB,EAAOQ,KAAMA,EAAKE,WAAaV,EAAOW,MAAKT,SAAA,CAEzDC,MAAA,KAAA,CAAIR,UAAWK,EAAOY,eAAQJ,EAAKI,QACnCT,EAAAA,IAAA,KAAA,CACER,UAAWb,EACTkB,EAAOa,MACPL,EAAKM,WAAad,EAAOc,UACzB3B,EAAMqB,EAAKK,QAAUb,EAAOe,kBAG7B5B,EAAMqB,EAAKK,OAASrB,EAAagB,EAAKK,UAXpCJ,MAiBZf,GAAYS,EAAAA,IAAA,IAAA,CAAGR,UAAWK,EAAON,SAAQQ,SAAGR,MAGnD","x_google_ignoreList":[0]}
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { UiMessages } from '@rubenpazch/shared';
3
+
4
+ interface DescriptionItem {
5
+ /** Etiqueta: "Remitente", "Fecha de ingreso". */
6
+ label: React.ReactNode;
7
+ /** Valor. Vacío (null, undefined o "") muestra `emptyValue`. */
8
+ value?: React.ReactNode;
9
+ /** Resalta el valor (p. ej. un dato importante o inferido). */
10
+ highlight?: boolean;
11
+ /** Ocupa toda la fila (textos largos: asunto, observaciones). */
12
+ fullWidth?: boolean;
13
+ }
14
+ interface DescriptionListProps {
15
+ items: DescriptionItem[];
16
+ /** Título opcional sobre la lista. */
17
+ title?: React.ReactNode;
18
+ /** Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. */
19
+ columns?: 1 | 2 | 3;
20
+ /** Qué mostrar si un valor está vacío. */
21
+ emptyValue?: React.ReactNode;
22
+ /** Texto si no hay ningún dato. */
23
+ emptyText?: React.ReactNode;
24
+ /** Nota al pie (fuente de los datos, aclaraciones). */
25
+ footnote?: React.ReactNode;
26
+ className?: string;
27
+ /**
28
+ * Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`);
29
+ * también se cambian para toda la app con su prop `messages`.
30
+ */
31
+ labels?: Partial<UiMessages["descriptionList"]>;
32
+ }
33
+ /** Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro. */
34
+ declare function DescriptionList({ items, title, columns, emptyValue, emptyText, footnote, className, labels, }: DescriptionListProps): React.JSX.Element;
35
+
36
+ export { DescriptionList as default };
37
+ 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";import{useUiMessages as t}from"@rubenpazch/shared";var n={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 o=(...e)=>e.filter(Boolean).join(" "),l=e=>null==e||""===e;function s({items:s,title:r,columns:a=2,emptyValue:m="—",emptyText:c,footnote:d,className:_,labels:p}){const u=t("descriptionList",p);return e("section",{className:o(n.wrapper,_),children:[r&&i("h3",{className:n.title,children:r}),0===s.length?i("p",{className:n.empty,children:c??u.empty}):i("dl",{className:o(n.list,n[`cols${a}`]),children:s.map((t,s)=>e("div",{className:o(n.item,t.fullWidth&&n.full),children:[i("dt",{className:n.label,children:t.label}),i("dd",{className:o(n.value,t.highlight&&n.highlight,l(t.value)&&n.missing),children:l(t.value)?m:t.value})]},s))}),d&&i("p",{className:n.footnote,children:d})]})}export{s 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 { useUiMessages, type UiMessages } from \"@rubenpazch/shared\";\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 * Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`);\n * también se cambian para toda la app con su prop `messages`.\n */\n labels?: Partial<UiMessages[\"descriptionList\"]>;\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,\n footnote,\n className,\n labels,\n}: DescriptionListProps) {\n const t = useUiMessages(\"descriptionList\", labels);\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 ?? t.empty}</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","labels","t","useUiMessages","_jsxs","styles","wrapper","children","_jsx","length","empty","list","map","item","i","fullWidth","full","label","value","highlight","missing"],"mappings":"0rBAAA,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,+sDCUA,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,EAASC,SACTA,EAAQC,UACRA,EAASC,OACTA,IAEA,MAAMC,EAAIC,EAAc,kBAAmBF,GAC3C,OACEG,EAAA,UAAA,CAASJ,UAAWd,EAAGmB,EAAOC,QAASN,GAAUO,SAAA,CAC9CZ,GAASa,EAAA,KAAA,CAAIR,UAAWK,EAAOV,MAAKY,SAAGZ,IACtB,IAAjBD,EAAMe,OACLD,OAAGR,UAAWK,EAAOK,eAAQZ,GAAaI,EAAEQ,QAE5CF,EAAA,KAAA,CAAIR,UAAWd,EAAGmB,EAAOM,KAAMN,EAAO,OAAOT,eAC1CF,EAAMkB,IAAI,CAACC,EAAMC,IAChBV,EAAA,MAAA,CAEEJ,UAAWd,EAAGmB,EAAOQ,KAAMA,EAAKE,WAAaV,EAAOW,MAAKT,SAAA,CAEzDC,EAAA,KAAA,CAAIR,UAAWK,EAAOY,eAAQJ,EAAKI,QACnCT,EAAA,KAAA,CACER,UAAWd,EACTmB,EAAOa,MACPL,EAAKM,WAAad,EAAOc,UACzB5B,EAAMsB,EAAKK,QAAUb,EAAOe,kBAG7B7B,EAAMsB,EAAKK,OAASrB,EAAagB,EAAKK,UAXpCJ,MAiBZf,GAAYS,EAAA,IAAA,CAAGR,UAAWK,EAAON,SAAQQ,SAAGR,MAGnD","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
2
  "name": "@rubenpazch/description-list",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.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
+ "@rubenpazch/shared": "5.4.0"
34
+ },
35
+ "devDependencies": {
36
+ "@rollup/plugin-commonjs": "^29.0.3",
37
+ "@rollup/plugin-node-resolve": "^16.0.3",
38
+ "@rollup/plugin-terser": "^1.0.0",
39
+ "@rollup/plugin-typescript": "^12.3.0",
40
+ "@testing-library/react": "^16.3.3",
41
+ "@types/jest": "^30.0.0",
42
+ "@types/react": "^19.2.18",
43
+ "@types/react-dom": "^19.2.5",
44
+ "autoprefixer": "^10.5.4",
45
+ "eslint": "^9.39.5",
46
+ "identity-obj-proxy": "^3.0.0",
47
+ "jest": "^30.5.0",
48
+ "jest-environment-jsdom": "^30.5.0",
49
+ "postcss": "^8.5.26",
50
+ "prettier": "^3.9.6",
51
+ "react": "^19.2.8",
52
+ "react-dom": "^19.2.8",
53
+ "rollup": "^4.63.1",
54
+ "rollup-plugin-dts": "^6.5.1",
55
+ "rollup-plugin-postcss": "^4.0.2",
56
+ "rollup-plugin-typescript2": "^0.37.0",
57
+ "tslib": "^2.8.1",
58
+ "typescript": "^6.0.3",
59
+ "@rubenpazch/eslint-config": "4.0.0",
60
+ "@rubenpazch/typescript-config": "3.0.0",
61
+ "@rubenpazch/badge": "0.1.3",
62
+ "@rubenpazch/button": "6.2.6"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "lbyte": {
68
+ "categoria": "presentacion",
69
+ "resumen": "Pares etiqueta/valor en columnas: resumen de un registro (datos de un trámite, de un cliente, de un pago).",
70
+ "usarCuando": "Mostrar varios datos de solo lectura de un registro, con etiquetas.",
71
+ "evitarCuando": "Datos tabulares de muchos registros: usa DataTable. Una sola fila con icono: usa InfoRow."
72
+ },
73
+ "scripts": {
74
+ "build": "rollup -c",
75
+ "test": "jest --passWithNoTests",
76
+ "test:watch": "jest --watch",
77
+ "lint": "eslint src",
78
+ "clean": "rm -rf dist"
79
+ }
6
80
  }