@khipu/design-system 0.2.0-alpha.50 → 0.2.0-alpha.51

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@khipu/design-system/beercss",
3
- "version": "0.2.0-alpha.50",
3
+ "version": "0.2.0-alpha.51",
4
4
  "description": "Khipu BeerCSS bundle with Material Design 3 and Khipu customizations",
5
- "buildDate": "2026-06-16T20:37:43.877Z",
5
+ "buildDate": "2026-06-16T22:54:45.434Z",
6
6
  "includes": {
7
7
  "beercss": "4.0.1",
8
8
  "khipu-tokens": "latest",
@@ -19,8 +19,8 @@
19
19
  },
20
20
  "scopeClass": ".kds-theme-root",
21
21
  "cdn": {
22
- "css": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.50/dist/beercss/khipu-beercss.min.css",
23
- "cssScoped": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.50/dist/beercss/khipu-beercss.scoped.min.css",
24
- "js": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.50/dist/beercss/khipu-beercss.min.js"
22
+ "css": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.51/dist/beercss/khipu-beercss.min.css",
23
+ "cssScoped": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.51/dist/beercss/khipu-beercss.scoped.min.css",
24
+ "js": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.51/dist/beercss/khipu-beercss.min.js"
25
25
  }
26
26
  }
package/dist/index.d.mts CHANGED
@@ -2621,8 +2621,11 @@ declare const KdsTextField: React__default.ForwardRefExoticComponent<KdsTextFiel
2621
2621
  */
2622
2622
 
2623
2623
  interface KdsCheckboxProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'type'> {
2624
- /** Texto del label mostrado al lado del sprite. Opcional (puede usar aria-label). */
2625
- label?: string;
2624
+ /**
2625
+ * Contenido del label mostrado al lado del sprite. Opcional (puede usar aria-label).
2626
+ * Acepta texto o nodos (p. ej. un enlace embebido en "Acepto los términos…").
2627
+ */
2628
+ label?: React__default.ReactNode;
2626
2629
  }
2627
2630
  declare const KdsCheckbox: React__default.ForwardRefExoticComponent<KdsCheckboxProps & React__default.RefAttributes<HTMLInputElement>>;
2628
2631
 
@@ -2889,7 +2892,8 @@ declare const KdsTabPanel: React__default.ForwardRefExoticComponent<KdsTabPanelP
2889
2892
 
2890
2893
  interface KdsRadioOption {
2891
2894
  value: string;
2892
- label: string;
2895
+ /** Texto o nodo del label de la opción (permite contenido rico: montos, enlaces, tablas). */
2896
+ label: React__default.ReactNode;
2893
2897
  disabled?: boolean;
2894
2898
  }
2895
2899
  interface KdsRadioGroupProps extends Omit<React__default.FieldsetHTMLAttributes<HTMLFieldSetElement>, 'onChange'> {
@@ -3166,6 +3170,11 @@ declare const KdsCopyRow: React__default.ForwardRefExoticComponent<KdsCopyRowPro
3166
3170
  * Tabla compacta con filas que se copian individualmente al click, y un
3167
3171
  * botón "Copiar todos los datos" que cambia el color de todas las filas al copy.
3168
3172
  *
3173
+ * Variante `'grid'` (aditiva): grilla read-only de N celdas de texto por fila,
3174
+ * sin copy ni botón "Copiar todo". Las celdas reparten el ancho equitativamente.
3175
+ * Útil para mostrar datos dentro de opciones de radio. Soporta `disabled`
3176
+ * (atenúa el color del texto).
3177
+ *
3169
3178
  * Contrato HTML (matchea el CSS .kds-copyable-table del DS):
3170
3179
  * ```html
3171
3180
  * <div class="kds-copyable-table" id="destination-copy-list">
@@ -3197,7 +3206,27 @@ interface KdsCopyableTableRow {
3197
3206
  copy?: string;
3198
3207
  }
3199
3208
  interface KdsCopyableTableProps extends React__default.HTMLAttributes<HTMLDivElement> {
3200
- rows: KdsCopyableTableRow[];
3209
+ /**
3210
+ * Filas key/value copiables (modo `'copyable'`). Opcional: default `[]`.
3211
+ * En modo `'grid'` no se usa; usá `gridRows` en su lugar.
3212
+ */
3213
+ rows?: KdsCopyableTableRow[];
3214
+ /**
3215
+ * Variante de la tabla.
3216
+ * - `'copyable'` (default): filas key/value que se copian individualmente al click.
3217
+ * - `'grid'`: grilla read-only de N celdas de texto por fila, sin copy ni botón
3218
+ * "Copiar todo". Útil para mostrar datos dentro de opciones de radio.
3219
+ */
3220
+ variant?: 'copyable' | 'grid';
3221
+ /**
3222
+ * Datos de la grilla en modo `'grid'`: cada fila es un array de textos de celda.
3223
+ * Las celdas se reparten el ancho equitativamente. Ignorado en modo `'copyable'`.
3224
+ */
3225
+ gridRows?: string[][];
3226
+ /**
3227
+ * Atenúa el color del texto de la grilla (modo `'grid'`). Sin efecto en `'copyable'`.
3228
+ */
3229
+ disabled?: boolean;
3201
3230
  /** Texto del botón "Copiar todo". Default: "Copiar todos los datos". */
3202
3231
  copyAllLabel?: string;
3203
3232
  /** Texto cuando se copió todo. Default: "Datos copiados". */
package/dist/index.d.ts CHANGED
@@ -2621,8 +2621,11 @@ declare const KdsTextField: React__default.ForwardRefExoticComponent<KdsTextFiel
2621
2621
  */
2622
2622
 
2623
2623
  interface KdsCheckboxProps extends Omit<React__default.InputHTMLAttributes<HTMLInputElement>, 'type'> {
2624
- /** Texto del label mostrado al lado del sprite. Opcional (puede usar aria-label). */
2625
- label?: string;
2624
+ /**
2625
+ * Contenido del label mostrado al lado del sprite. Opcional (puede usar aria-label).
2626
+ * Acepta texto o nodos (p. ej. un enlace embebido en "Acepto los términos…").
2627
+ */
2628
+ label?: React__default.ReactNode;
2626
2629
  }
2627
2630
  declare const KdsCheckbox: React__default.ForwardRefExoticComponent<KdsCheckboxProps & React__default.RefAttributes<HTMLInputElement>>;
2628
2631
 
@@ -2889,7 +2892,8 @@ declare const KdsTabPanel: React__default.ForwardRefExoticComponent<KdsTabPanelP
2889
2892
 
2890
2893
  interface KdsRadioOption {
2891
2894
  value: string;
2892
- label: string;
2895
+ /** Texto o nodo del label de la opción (permite contenido rico: montos, enlaces, tablas). */
2896
+ label: React__default.ReactNode;
2893
2897
  disabled?: boolean;
2894
2898
  }
2895
2899
  interface KdsRadioGroupProps extends Omit<React__default.FieldsetHTMLAttributes<HTMLFieldSetElement>, 'onChange'> {
@@ -3166,6 +3170,11 @@ declare const KdsCopyRow: React__default.ForwardRefExoticComponent<KdsCopyRowPro
3166
3170
  * Tabla compacta con filas que se copian individualmente al click, y un
3167
3171
  * botón "Copiar todos los datos" que cambia el color de todas las filas al copy.
3168
3172
  *
3173
+ * Variante `'grid'` (aditiva): grilla read-only de N celdas de texto por fila,
3174
+ * sin copy ni botón "Copiar todo". Las celdas reparten el ancho equitativamente.
3175
+ * Útil para mostrar datos dentro de opciones de radio. Soporta `disabled`
3176
+ * (atenúa el color del texto).
3177
+ *
3169
3178
  * Contrato HTML (matchea el CSS .kds-copyable-table del DS):
3170
3179
  * ```html
3171
3180
  * <div class="kds-copyable-table" id="destination-copy-list">
@@ -3197,7 +3206,27 @@ interface KdsCopyableTableRow {
3197
3206
  copy?: string;
3198
3207
  }
3199
3208
  interface KdsCopyableTableProps extends React__default.HTMLAttributes<HTMLDivElement> {
3200
- rows: KdsCopyableTableRow[];
3209
+ /**
3210
+ * Filas key/value copiables (modo `'copyable'`). Opcional: default `[]`.
3211
+ * En modo `'grid'` no se usa; usá `gridRows` en su lugar.
3212
+ */
3213
+ rows?: KdsCopyableTableRow[];
3214
+ /**
3215
+ * Variante de la tabla.
3216
+ * - `'copyable'` (default): filas key/value que se copian individualmente al click.
3217
+ * - `'grid'`: grilla read-only de N celdas de texto por fila, sin copy ni botón
3218
+ * "Copiar todo". Útil para mostrar datos dentro de opciones de radio.
3219
+ */
3220
+ variant?: 'copyable' | 'grid';
3221
+ /**
3222
+ * Datos de la grilla en modo `'grid'`: cada fila es un array de textos de celda.
3223
+ * Las celdas se reparten el ancho equitativamente. Ignorado en modo `'copyable'`.
3224
+ */
3225
+ gridRows?: string[][];
3226
+ /**
3227
+ * Atenúa el color del texto de la grilla (modo `'grid'`). Sin efecto en `'copyable'`.
3228
+ */
3229
+ disabled?: boolean;
3201
3230
  /** Texto del botón "Copiar todo". Default: "Copiar todos los datos". */
3202
3231
  copyAllLabel?: string;
3203
3232
  /** Texto cuando se copió todo. Default: "Datos copiados". */
package/dist/index.js CHANGED
@@ -1922,125 +1922,194 @@ async function copyToClipboard(text) {
1922
1922
  }
1923
1923
  }
1924
1924
  var TRANSITION_MS = 300;
1925
- var KdsCopyableTable = (0, import_react25.forwardRef)(
1926
- ({
1927
- rows,
1928
- copyAllLabel = "Copiar todos los datos",
1929
- copiedAllLabel = "Datos copiados",
1930
- showCopyAll = true,
1931
- className,
1932
- ...props
1933
- }, ref) => {
1934
- const copiedTimers = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
1935
- const settlingTimers = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
1936
- const [copiedRows, setCopiedRows] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
1937
- const [settlingRows, setSettlingRows] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
1938
- const [allCopied, setAllCopied] = (0, import_react25.useState)(false);
1939
- const markCopied = (0, import_react25.useCallback)((indexes, duration = 1500) => {
1940
- setCopiedRows((prev) => {
1941
- const next = new Set(prev);
1942
- indexes.forEach((i) => next.add(i));
1943
- return next;
1944
- });
1945
- indexes.forEach((i) => {
1946
- const st = settlingTimers.current.get(i);
1947
- if (st) {
1948
- clearTimeout(st);
1949
- settlingTimers.current.delete(i);
1950
- }
1951
- });
1952
- setSettlingRows((prev) => {
1953
- const next = new Set(prev);
1954
- indexes.forEach((i) => next.delete(i));
1955
- return next;
1956
- });
1957
- indexes.forEach((i) => {
1958
- const existing = copiedTimers.current.get(i);
1959
- if (existing) clearTimeout(existing);
1960
- const t = setTimeout(() => {
1961
- setCopiedRows((prev) => {
1962
- const next = new Set(prev);
1963
- next.delete(i);
1964
- return next;
1965
- });
1925
+ function GridVariant({
1926
+ gridRows,
1927
+ disabled,
1928
+ className,
1929
+ forwardedRef,
1930
+ rest
1931
+ }) {
1932
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1933
+ "div",
1934
+ {
1935
+ ref: forwardedRef,
1936
+ className: (0, import_clsx.clsx)("kds-copyable-table", "kds-copyable-table--grid", className),
1937
+ ...rest,
1938
+ children: gridRows.map((cells, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1939
+ "div",
1940
+ {
1941
+ className: "kds-copyable-table-row kds-copyable-table-row--grid",
1942
+ "data-testid": "kds-grid-row",
1943
+ children: cells.map((text, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1944
+ "span",
1945
+ {
1946
+ className: (0, import_clsx.clsx)("kds-grid-cell", disabled && "kds-grid-cell--disabled"),
1947
+ children: text
1948
+ },
1949
+ cellIndex
1950
+ ))
1951
+ },
1952
+ rowIndex
1953
+ ))
1954
+ }
1955
+ );
1956
+ }
1957
+ function CopyableVariant({
1958
+ rows,
1959
+ copyAllLabel = "Copiar todos los datos",
1960
+ copiedAllLabel = "Datos copiados",
1961
+ showCopyAll = true,
1962
+ className,
1963
+ forwardedRef,
1964
+ rest
1965
+ }) {
1966
+ const copiedTimers = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
1967
+ const settlingTimers = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
1968
+ const [copiedRows, setCopiedRows] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
1969
+ const [settlingRows, setSettlingRows] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
1970
+ const [allCopied, setAllCopied] = (0, import_react25.useState)(false);
1971
+ const markCopied = (0, import_react25.useCallback)((indexes, duration = 1500) => {
1972
+ setCopiedRows((prev) => {
1973
+ const next = new Set(prev);
1974
+ indexes.forEach((i) => next.add(i));
1975
+ return next;
1976
+ });
1977
+ indexes.forEach((i) => {
1978
+ const st = settlingTimers.current.get(i);
1979
+ if (st) {
1980
+ clearTimeout(st);
1981
+ settlingTimers.current.delete(i);
1982
+ }
1983
+ });
1984
+ setSettlingRows((prev) => {
1985
+ const next = new Set(prev);
1986
+ indexes.forEach((i) => next.delete(i));
1987
+ return next;
1988
+ });
1989
+ indexes.forEach((i) => {
1990
+ const existing = copiedTimers.current.get(i);
1991
+ if (existing) clearTimeout(existing);
1992
+ const t = setTimeout(() => {
1993
+ setCopiedRows((prev) => {
1994
+ const next = new Set(prev);
1995
+ next.delete(i);
1996
+ return next;
1997
+ });
1998
+ setSettlingRows((prev) => {
1999
+ const next = new Set(prev);
2000
+ next.add(i);
2001
+ return next;
2002
+ });
2003
+ copiedTimers.current.delete(i);
2004
+ const settlingT = setTimeout(() => {
1966
2005
  setSettlingRows((prev) => {
1967
2006
  const next = new Set(prev);
1968
- next.add(i);
2007
+ next.delete(i);
1969
2008
  return next;
1970
2009
  });
1971
- copiedTimers.current.delete(i);
1972
- const settlingT = setTimeout(() => {
1973
- setSettlingRows((prev) => {
1974
- const next = new Set(prev);
1975
- next.delete(i);
1976
- return next;
1977
- });
1978
- settlingTimers.current.delete(i);
1979
- }, TRANSITION_MS);
1980
- settlingTimers.current.set(i, settlingT);
1981
- }, duration);
1982
- copiedTimers.current.set(i, t);
1983
- });
1984
- }, []);
1985
- const handleRowCopy = async (row, index) => {
1986
- const ok = await copyToClipboard(row.copy ?? row.value);
1987
- if (ok) markCopied([index]);
1988
- };
1989
- const handleCopyAll = async () => {
1990
- const text = rows.map((r) => `${r.label}: ${r.value}`).join("\n");
1991
- const ok = await copyToClipboard(text);
1992
- if (ok) {
1993
- markCopied(rows.map((_, i) => i));
1994
- setAllCopied(true);
1995
- setTimeout(() => setAllCopied(false), 2e3);
1996
- }
1997
- };
1998
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
1999
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref, className: (0, import_clsx.clsx)("kds-copyable-table", className), ...props, children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2000
- "div",
2001
- {
2002
- className: (0, import_clsx.clsx)(
2003
- "kds-copyable-table-row",
2004
- copiedRows.has(i) && "copied",
2005
- settlingRows.has(i) && "settling"
2006
- ),
2007
- role: "button",
2008
- tabIndex: 0,
2009
- onClick: () => handleRowCopy(row, i),
2010
- onKeyDown: (e) => {
2011
- if (e.key === "Enter" || e.key === " ") {
2012
- e.preventDefault();
2013
- handleRowCopy(row, i);
2014
- }
2015
- },
2016
- "aria-label": `Copiar ${row.label}: ${row.value}`,
2017
- children: [
2018
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kds-key", children: row.label }),
2019
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kds-value", children: row.value })
2020
- ]
2010
+ settlingTimers.current.delete(i);
2011
+ }, TRANSITION_MS);
2012
+ settlingTimers.current.set(i, settlingT);
2013
+ }, duration);
2014
+ copiedTimers.current.set(i, t);
2015
+ });
2016
+ }, []);
2017
+ const handleRowCopy = async (row, index) => {
2018
+ const ok = await copyToClipboard(row.copy ?? row.value);
2019
+ if (ok) markCopied([index]);
2020
+ };
2021
+ const handleCopyAll = async () => {
2022
+ const text = rows.map((r) => `${r.label}: ${r.value}`).join("\n");
2023
+ const ok = await copyToClipboard(text);
2024
+ if (ok) {
2025
+ markCopied(rows.map((_, i) => i));
2026
+ setAllCopied(true);
2027
+ setTimeout(() => setAllCopied(false), 2e3);
2028
+ }
2029
+ };
2030
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2031
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: forwardedRef, className: (0, import_clsx.clsx)("kds-copyable-table", className), ...rest, children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2032
+ "div",
2033
+ {
2034
+ className: (0, import_clsx.clsx)(
2035
+ "kds-copyable-table-row",
2036
+ copiedRows.has(i) && "copied",
2037
+ settlingRows.has(i) && "settling"
2038
+ ),
2039
+ role: "button",
2040
+ tabIndex: 0,
2041
+ onClick: () => handleRowCopy(row, i),
2042
+ onKeyDown: (e) => {
2043
+ if (e.key === "Enter" || e.key === " ") {
2044
+ e.preventDefault();
2045
+ handleRowCopy(row, i);
2046
+ }
2021
2047
  },
2022
- `${row.label}-${i}`
2023
- )) }),
2024
- showCopyAll && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2025
- "button",
2048
+ "aria-label": `Copiar ${row.label}: ${row.value}`,
2049
+ children: [
2050
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kds-key", children: row.label }),
2051
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kds-value", children: row.value })
2052
+ ]
2053
+ },
2054
+ `${row.label}-${i}`
2055
+ )) }),
2056
+ showCopyAll && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2057
+ "button",
2058
+ {
2059
+ type: "button",
2060
+ className: (0, import_clsx.clsx)(
2061
+ "kds-btn",
2062
+ "kds-btn-outlined",
2063
+ "kds-btn-block",
2064
+ "kds-copy-all-btn",
2065
+ allCopied && "copied"
2066
+ ),
2067
+ onClick: handleCopyAll,
2068
+ "aria-label": allCopied ? copiedAllLabel : copyAllLabel,
2069
+ children: [
2070
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kds-icon", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("i", { className: "material-symbols-outlined", children: allCopied ? "check" : "content_copy" }) }),
2071
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: allCopied ? copiedAllLabel : copyAllLabel })
2072
+ ]
2073
+ }
2074
+ )
2075
+ ] });
2076
+ }
2077
+ var KdsCopyableTable = (0, import_react25.forwardRef)(
2078
+ ({
2079
+ rows = [],
2080
+ variant = "copyable",
2081
+ gridRows = [],
2082
+ disabled = false,
2083
+ copyAllLabel,
2084
+ copiedAllLabel,
2085
+ showCopyAll,
2086
+ className,
2087
+ ...props
2088
+ }, ref) => {
2089
+ if (variant === "grid") {
2090
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2091
+ GridVariant,
2026
2092
  {
2027
- type: "button",
2028
- className: (0, import_clsx.clsx)(
2029
- "kds-btn",
2030
- "kds-btn-outlined",
2031
- "kds-btn-block",
2032
- "kds-copy-all-btn",
2033
- allCopied && "copied"
2034
- ),
2035
- onClick: handleCopyAll,
2036
- "aria-label": allCopied ? copiedAllLabel : copyAllLabel,
2037
- children: [
2038
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "kds-icon", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("i", { className: "material-symbols-outlined", children: allCopied ? "check" : "content_copy" }) }),
2039
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: allCopied ? copiedAllLabel : copyAllLabel })
2040
- ]
2093
+ gridRows,
2094
+ disabled,
2095
+ className,
2096
+ forwardedRef: ref,
2097
+ rest: props
2041
2098
  }
2042
- )
2043
- ] });
2099
+ );
2100
+ }
2101
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2102
+ CopyableVariant,
2103
+ {
2104
+ rows,
2105
+ copyAllLabel,
2106
+ copiedAllLabel,
2107
+ showCopyAll,
2108
+ className,
2109
+ forwardedRef: ref,
2110
+ rest: props
2111
+ }
2112
+ );
2044
2113
  }
2045
2114
  );
2046
2115
  KdsCopyableTable.displayName = "KdsCopyableTable";