@m4l/components 9.1.144 → 9.1.146

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.
@@ -2,7 +2,8 @@ import { RowKey } from '../../types';
2
2
  import { DataGridContextProps, DataGridProviderProps } from './types';
3
3
  declare const DataGridContext: import('react').Context<DataGridContextProps<any, any, any> | null>;
4
4
  /**
5
- * TODO: Documentar
5
+ * Proveedor que se encarga de manejar el estado de las columnas y las filas
6
+ * del DataGrid.
6
7
  */
7
8
  declare function DataGridProvider<TRow, TSummaryRow, TKey extends RowKey = RowKey>(props: DataGridProviderProps<TRow, TSummaryRow, TKey>): import("react/jsx-runtime").JSX.Element;
8
9
  export { DataGridProvider, DataGridContext };
@@ -1,6 +1,7 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import { HeaderRendererProps } from 'react-data-grid';
3
3
  /**
4
- * TODO: Documentar
4
+ * Función encargada de retornar el componente de renderizado de cabecera con la capacidad de arrastrar columnas
5
+ * @param handleColumnsReorder - Función que se ejecuta al reordenar columnas
5
6
  */
6
7
  export declare const getDragHeaderRenderer: <TRow, TSummaryRow>(handleColumnsReorder: (sourceKey: string, targetKey: string) => void) => FunctionComponent<HeaderRendererProps<TRow, TSummaryRow>>;
@@ -1,6 +1,7 @@
1
1
  import { Column, SortColumn } from 'react-data-grid';
2
2
  /**
3
- * TODO: Documentar
3
+ * Hook encargado de ordenar datos de las columnas y las filas.
4
+ * Se utiliza para ordenar las columnas y las filas de un DataGrid.
4
5
  */
5
6
  export declare const useSortColumnsRows: <TRow, TSummaryRow>(sourceColumns: readonly Column<TRow, TSummaryRow>[], sourceRows: readonly TRow[]) => {
6
7
  finalColumns: readonly Column<TRow, TSummaryRow>[];
@@ -1,4 +1,5 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import React, { useId } from "react";
2
3
  import clsx from "clsx";
3
4
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.js";
4
5
  import { P as PROPERTY_VALUE_KEY_COMPONENT, T as TEST_PROPS_DATA, C as COMPONENT_PREFIX } from "./constants.js";
@@ -6,7 +7,6 @@ import { g as getPropDataTestId, a as getNameDataTestId } from "../../test/getNa
6
7
  import { P as PropertyValueRootStyled, N as NameStyled, V as ValueStyled } from "./slots/PropertyValueSlots.js";
7
8
  import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
8
9
  import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
9
- import React from "react";
10
10
  import { L as Label } from "../Label/Label.js";
11
11
  import { I as Icon } from "../Icon/Icon.js";
12
12
  import { T as Typography } from "../mui_extended/Typography/Typography.js";
@@ -27,6 +27,8 @@ function PropertyValue(props) {
27
27
  size = "medium",
28
28
  valueHeight
29
29
  } = props;
30
+ const uniqueId = useId();
31
+ const inputId = `property-value-${uniqueId}`;
30
32
  const { currentSize } = useComponentSize(size);
31
33
  const normalizedSize = currentSize === "large" ? "medium" : currentSize;
32
34
  const ownerState = {
@@ -53,10 +55,10 @@ function PropertyValue(props) {
53
55
  };
54
56
  const renderValue = () => {
55
57
  if (typeof value === "string" || typeof value === "number") {
56
- return /* @__PURE__ */ jsx(Typography, { size: normalizedSize, variant: "body", children: value });
58
+ return /* @__PURE__ */ jsx(Typography, { id: inputId, size: normalizedSize, variant: "body", children: value });
57
59
  }
58
60
  if (React.isValidElement(value)) {
59
- return React.cloneElement(value, { size: normalizedSize });
61
+ return React.cloneElement(value, { size: normalizedSize, id: inputId });
60
62
  }
61
63
  return value;
62
64
  };
@@ -81,7 +83,8 @@ function PropertyValue(props) {
81
83
  label: property,
82
84
  mandatory,
83
85
  mandatoryMessage,
84
- helperMessage
86
+ helperMessage,
87
+ htmlFor: inputId
85
88
  }
86
89
  )
87
90
  ] }),
@@ -82,6 +82,8 @@ export interface PropertyValueProps extends PropertyProps, ValueProps, Omit<Labe
82
82
  * Propiedad de tamaño para el componente `PropertyValue`.
83
83
  */
84
84
  size?: Extract<Sizes, 'small' | 'medium'>;
85
+ /** Propiedades adicionales que se pasarán al componente valor. */
86
+ inputProps?: Record<string, unknown>;
85
87
  }
86
88
  /**
87
89
  * Estado del propietario para el componente `PropertyValue`, utilizado para personalizar estilos y comportamientos.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.144",
3
+ "version": "9.1.146",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"