@m4l/components 9.3.36 → 9.3.37

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.
Files changed (35) hide show
  1. package/@types/export.d.ts +3 -0
  2. package/@types/types.d.ts +33 -6
  3. package/components/DataGrid/DataGrid.js +2 -0
  4. package/components/DataGrid/Datagrid.styles.js +11 -2
  5. package/components/DataGrid/contexts/DataGridContext/index.js +2 -0
  6. package/components/DataGrid/contexts/DataGridContext/types.d.ts +2 -2
  7. package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +15 -7
  8. package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +4 -1
  9. package/components/DataGrid/subcomponents/Table/hooks/useSortColumnsRows.js +6 -2
  10. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.d.ts +6 -0
  11. package/components/DataGrid/subcomponents/Table/subcomponents/RadioButtonFormatter.js +12 -0
  12. package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.d.ts +64 -0
  13. package/components/DataGrid/subcomponents/Table/subcomponents/RadioSelectColumn.js +46 -0
  14. package/components/DataGrid/tests/table/subcomponents/RadioButtonFormatter.test.d.ts +1 -0
  15. package/components/DataGrid/tests/table/subcomponents/RadioSelectColumn.test.d.ts +1 -0
  16. package/components/DataGrid/types.d.ts +7 -0
  17. package/components/mui_extended/RadioButton/RadioButton.d.ts +24 -0
  18. package/components/mui_extended/RadioButton/RadioButton.js +110 -0
  19. package/components/mui_extended/RadioButton/RadioButton.styles.d.ts +2 -0
  20. package/components/mui_extended/RadioButton/RadioButton.styles.js +126 -0
  21. package/components/mui_extended/RadioButton/constants.d.ts +1 -0
  22. package/components/mui_extended/RadioButton/constants.js +4 -0
  23. package/components/mui_extended/RadioButton/icons.d.ts +4 -0
  24. package/components/mui_extended/RadioButton/icons.js +7 -0
  25. package/components/mui_extended/RadioButton/index.d.ts +1 -0
  26. package/components/mui_extended/RadioButton/index.js +1 -0
  27. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.d.ts +8 -0
  28. package/components/mui_extended/RadioButton/slots/RadioButtonEnum.js +12 -0
  29. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.d.ts +20 -0
  30. package/components/mui_extended/RadioButton/slots/RadioButtonSlots.js +39 -0
  31. package/components/mui_extended/RadioButton/tests/RadioButton.test.d.ts +1 -0
  32. package/components/mui_extended/RadioButton/types.d.ts +50 -0
  33. package/components/mui_extended/index.d.ts +1 -0
  34. package/index.js +44 -42
  35. package/package.json +1 -1
@@ -55,6 +55,9 @@ declare module '@mui/material/styles' {
55
55
  M4LCheckBox?: {
56
56
  styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
57
57
  };
58
+ M4LRadioButton?: {
59
+ styleOverrides?: ComponentsOverrides<Theme>['M4LRadioButton'];
60
+ };
58
61
  M4LDataGrid?: {
59
62
  styleOverrides?: ComponentsOverrides<Theme>['M4LDataGrid'];
60
63
  };
package/@types/types.d.ts CHANGED
@@ -76,6 +76,10 @@ import {
76
76
  CheckBoxOwnerState,
77
77
  CheckBoxSlotsType,
78
78
  } from '../components/mui_extended/CheckBox/types';
79
+ import {
80
+ RadioButtonOwnerState,
81
+ RadioButtonSlotsType,
82
+ } from '../components/mui_extended/RadioButton/types';
79
83
  import {
80
84
  RHFNumberInputOwnerState,
81
85
  RHFNumberInputSlotsType,
@@ -292,11 +296,26 @@ import {
292
296
  ImageTextOwnerState,
293
297
  ImageTextSlotsType,
294
298
  } from '../components/ImageText/types';
295
- import { FormContainerOwnerState, FormContainerSlotsType } from '../components/FormContainer/types';
296
- import { ActionsGroupOwnerState, ActionsGroupSlotsType } from '../components/ActionsGroup/types';
297
- import { TabsNavigatorSlotsType, TabsNavigatorOwnerState } from '../components/TabsNavigator/types';
298
- import { EditLabelOwnerState, EditLabelSlotsType } from '../components/EditLabel/types';
299
- import { MFIsolationAppOwnerState, MFIsolationAppSlotsType } from '../components/MFIsolationApp/types';
299
+ import {
300
+ FormContainerOwnerState,
301
+ FormContainerSlotsType,
302
+ } from '../components/FormContainer/types';
303
+ import {
304
+ ActionsGroupOwnerState,
305
+ ActionsGroupSlotsType,
306
+ } from '../components/ActionsGroup/types';
307
+ import {
308
+ TabsNavigatorSlotsType,
309
+ TabsNavigatorOwnerState,
310
+ } from 'src/components/TabsNavigator/types';
311
+ import {
312
+ EditLabelOwnerState,
313
+ EditLabelSlotsType,
314
+ } from '../components/EditLabel/types';
315
+ import {
316
+ MFIsolationAppOwnerState,
317
+ MFIsolationAppSlotsType,
318
+ } from '../components/MFIsolationApp/types';
300
319
  import {
301
320
  TagsFormatterOwnerState,
302
321
  TagsFormatterSlotsType,
@@ -333,6 +352,7 @@ declare module '@mui/material/styles' {
333
352
  M4LSelect: SelectSlotsType;
334
353
  M4LTypography: TypographySlotsType;
335
354
  M4LCheckBox: CheckBoxSlotsType;
355
+ M4LRadioButton: RadioButtonSlotsType;
336
356
  M4LRHFNumberInput: RHFNumberInputSlotsType;
337
357
  M4LTab: TabSlotsType;
338
358
  M4LButton: ButtonSlotsType;
@@ -347,7 +367,8 @@ declare module '@mui/material/styles' {
347
367
  M4LChip: ChipSlotsType;
348
368
  M4LCircularProgress: CircularProgressSlotsType;
349
369
  M4LPaperForm: PaperFormSlotsType;
350
- M4LWindowBase: WindowBaseType;a
370
+ M4LWindowBase: WindowBaseType;
371
+ a;
351
372
  M4LWindowConfirm: WindowConfirmType;
352
373
  M4LAppBar: AppBarSlotsType;
353
374
  M4LDialog: DialogType;
@@ -427,6 +448,7 @@ declare module '@mui/material/styles' {
427
448
  M4LSelect: Partial<SelectOwnerState>;
428
449
  M4LTypography: Partial<TypographyOwnerState>;
429
450
  M4LCheckBox: Partial<CheckBoxOwnerState>;
451
+ M4LRadioButton: Partial<RadioButtonOwnerState>;
430
452
  M4LRHFNumberInput: Partial<RHFNumberInputOwnerState>;
431
453
  M4LTab: Partial<TabOwnerState>;
432
454
  M4LButton: Partial<ButtonOwnerState>;
@@ -620,6 +642,11 @@ declare module '@mui/material/styles' {
620
642
  styleOverrides?: ComponentsOverrides<Theme>['M4LCheckBox'];
621
643
  variants?: ComponentsVariants['M4LCheckBox'];
622
644
  };
645
+ M4LRadioButton?: {
646
+ defaultProps?: ComponentsPropsList['M4LRadioButton'];
647
+ styleOverrides?: ComponentsOverrides<Theme>['M4LRadioButton'];
648
+ variants?: ComponentsVariants['M4LRadioButton'];
649
+ };
623
650
  M4LActionCancel?: {
624
651
  defaultProps?: ComponentsPropsList['M4LActionCancel'];
625
652
  styleOverrides?: ComponentsOverrides<Theme>['M4LActionCancel'];
@@ -30,6 +30,7 @@ function DataGrid(props) {
30
30
  initialRowHeightVariant,
31
31
  checkedRows,
32
32
  onCheckedRowsChange,
33
+ checkedRowsMultiple,
33
34
  dataTestId = "",
34
35
  customHeader: CustomHeader,
35
36
  visibleCustomHeader = true,
@@ -87,6 +88,7 @@ function DataGrid(props) {
87
88
  checkedRows,
88
89
  rowActionsGetter,
89
90
  onCheckedRowsChange,
91
+ checkedRowsMultiple,
90
92
  rowKeyGetter,
91
93
  rows,
92
94
  onChangeUserColumns,
@@ -424,6 +424,10 @@ const dataGridStyles = {
424
424
  borderColor: `${theme.vars.palette?.border.disabled} !important`,
425
425
  ...theme.colorSchemes.finalTheme.typography.body
426
426
  },
427
+ "&:has(> .M4LRadioButton-root)": {
428
+ overflow: "visible",
429
+ paddingInline: 0
430
+ },
427
431
  "&.rdg-cell-frozen": {
428
432
  display: "flex",
429
433
  boxShadow: "unset",
@@ -734,7 +738,10 @@ const dataGridStyles = {
734
738
  */
735
739
  cardsContainer: () => ({
736
740
  height: "auto",
737
- overflow: "auto"
741
+ overflow: "auto",
742
+ "& > .M4LContainerFlow-root": {
743
+ alignItems: "start"
744
+ }
738
745
  }),
739
746
  /**
740
747
  * Card de la vista cards
@@ -746,6 +753,8 @@ const dataGridStyles = {
746
753
  minWidth: "280px",
747
754
  maxWidth: "580px",
748
755
  cursor: "pointer",
756
+ padding: theme.vars.size.baseSpacings["sp2-5"],
757
+ gap: "0 !important",
749
758
  // Si está checked (pero no selected), border de checked
750
759
  ...ownerState?.checked && !ownerState?.selected && {
751
760
  borderColor: theme.vars.palette.primary.activeOpacity
@@ -786,7 +795,7 @@ const dataGridStyles = {
786
795
  cardHeaderRight: ({ theme }) => ({
787
796
  display: "flex",
788
797
  alignItems: "center",
789
- gap: theme.vars.size.baseSpacings.sp1
798
+ gap: theme.vars.size.baseSpacings["sp0-5"]
790
799
  }),
791
800
  /**
792
801
  * Contenido de la card (body)
@@ -155,6 +155,7 @@ function DataGridProvider(props) {
155
155
  initialRowHeightVariant = "standard",
156
156
  checkedRows,
157
157
  onCheckedRowsChange,
158
+ checkedRowsMultiple,
158
159
  rowKeyGetter,
159
160
  onChangeUserColumns,
160
161
  externalSortSettings: sortSettings,
@@ -530,6 +531,7 @@ function DataGridProvider(props) {
530
531
  rowActionsGetter,
531
532
  setRowHeightVariant: setCurrentRowHeightInternal,
532
533
  onCheckedRowsChange,
534
+ checkedRowsMultiple,
533
535
  rowKeyGetter,
534
536
  onChangeUserColumns,
535
537
  sortColumns,
@@ -79,7 +79,7 @@ export interface IGridConfig {
79
79
  export interface IGridConfigExtended extends IGridConfig {
80
80
  columnsConfigCards?: BaseConfigColumnCards[];
81
81
  }
82
- export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'defaultViewMode' | 'cardsViewConfig'> {
82
+ export interface DataGridProviderProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<GridProps<TRow, TSummaryRow, TKey>, 'rows' | 'columns' | 'rowActionsGetter' | 'rowHeaderHeights' | 'rowHeights' | 'initialRowHeightVariant' | 'checkedRows' | 'onCheckedRowsChange' | 'checkedRowsMultiple' | 'rowKeyGetter' | 'onChangeUserColumns' | 'defaultUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'defaultViewMode' | 'cardsViewConfig'> {
83
83
  id: number | string;
84
84
  children: ReactNode;
85
85
  rowsCount: number;
@@ -92,7 +92,7 @@ export type RowHeightState = {
92
92
  rowHeight: number;
93
93
  rowHeaderHeight: number;
94
94
  };
95
- export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<DataGridProviderProps<TRow, TSummaryRow, TKey>, 'rows' | 'checkedRows' | 'onCheckedRowsChange' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'viewMode' | 'onViewModeChange' | 'defaultViewMode' | 'cardsViewConfig'> {
95
+ export interface DataGridContextProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> extends Pick<DataGridProviderProps<TRow, TSummaryRow, TKey>, 'rows' | 'checkedRows' | 'onCheckedRowsChange' | 'checkedRowsMultiple' | 'rowHeights' | 'rowsCount' | 'rowActionsGetter' | 'rowKeyGetter' | 'onChangeUserColumns' | 'externalSortSettings' | 'externalFilterSettings' | 'viewMode' | 'onViewModeChange' | 'defaultViewMode' | 'cardsViewConfig'> {
96
96
  getConfigColumns: (viewMode: ViewMode) => IViewConfig[];
97
97
  onChangeColumnsConfig: (viewMode: ViewMode, config: IViewConfig[]) => void;
98
98
  onChangeColumnsOrder: (viewMode: ViewMode, sourceKey: string, targetKey: string) => void;
@@ -15,7 +15,7 @@ function CardHeader({
15
15
  checkedRows,
16
16
  onCheckedRowsChange
17
17
  }) {
18
- const { rowKeyGetter, rowActionsGetter, size } = useDataGrid();
18
+ const { rowKeyGetter, rowActionsGetter, size, checkedRowsMultiple } = useDataGrid();
19
19
  const { host_static_assets, environment_assets } = useEnvironment();
20
20
  const rowKey = useMemo(() => rowKeyGetter(row), [rowKeyGetter, row]);
21
21
  const onChange = useCallback(
@@ -23,15 +23,23 @@ function CardHeader({
23
23
  if (!onCheckedRowsChange || !checkedRows) {
24
24
  return;
25
25
  }
26
- const newCheckedRows = new Set(checkedRows);
27
- if (checked) {
28
- newCheckedRows.add(rowKey);
26
+ if (checkedRowsMultiple === false) {
27
+ if (checked) {
28
+ onCheckedRowsChange(/* @__PURE__ */ new Set([rowKey]));
29
+ } else {
30
+ onCheckedRowsChange(/* @__PURE__ */ new Set());
31
+ }
29
32
  } else {
30
- newCheckedRows.delete(rowKey);
33
+ const newCheckedRows = new Set(checkedRows);
34
+ if (checked) {
35
+ newCheckedRows.add(rowKey);
36
+ } else {
37
+ newCheckedRows.delete(rowKey);
38
+ }
39
+ onCheckedRowsChange(newCheckedRows);
31
40
  }
32
- onCheckedRowsChange(newCheckedRows);
33
41
  },
34
- [checkedRows, onCheckedRowsChange, rowKey]
42
+ [checkedRows, onCheckedRowsChange, rowKey, checkedRowsMultiple]
35
43
  );
36
44
  const anchorOrigin = useMemo(
37
45
  () => ({
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext } from "react";
3
3
  import { SelectCellFormatter } from "react-data-grid";
4
4
  import { C as CheckboxFormatter } from "../Table/subcomponents/CheckboxFormatter.js";
5
+ import { R as RadioButtonFormatter } from "../Table/subcomponents/RadioButtonFormatter.js";
5
6
  import { a as DataGridContext } from "../../contexts/DataGridContext/index.js";
6
7
  import { l as CheckboxCellWrapperStyled } from "../../slots/DataGridSlot.js";
7
8
  const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref) {
@@ -14,12 +15,14 @@ const CheckboxCellAdapter = forwardRef(function CheckboxCellAdapter2(props, ref)
14
15
  } = props;
15
16
  const context = useContext(DataGridContext);
16
17
  const viewMode = context?.viewMode ?? "cards";
18
+ const checkedRowsMultiple = context?.checkedRowsMultiple;
17
19
  if (viewMode !== "table") {
18
20
  const handleClick = (e) => {
19
21
  e.stopPropagation();
20
22
  };
23
+ const FormatterComponent = checkedRowsMultiple === false ? RadioButtonFormatter : CheckboxFormatter;
21
24
  return /* @__PURE__ */ jsx(CheckboxCellWrapperStyled, { onClick: handleClick, children: /* @__PURE__ */ jsx(
22
- CheckboxFormatter,
25
+ FormatterComponent,
23
26
  {
24
27
  ref,
25
28
  checked: value,
@@ -2,6 +2,7 @@ import { useState, useEffect, useMemo } from "react";
2
2
  import { g as getDragHeaderRenderer } from "./getDragHeaderRenderer.js";
3
3
  import { A as ActionsColumn } from "../subcomponents/ActionsColumn.js";
4
4
  import { f as filterColumnClassName, S as SelectColumn } from "../subcomponents/SelectColumn.js";
5
+ import { R as RadioSelectColumn } from "../subcomponents/RadioSelectColumn.js";
5
6
  import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
6
7
  import { u as useFilters } from "../../../hooks/useFilters.js";
7
8
  import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
@@ -38,7 +39,7 @@ function getComparator(columns, sortColumn) {
38
39
  }
39
40
  }
40
41
  const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
41
- const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths, rowActionsGetter) => {
42
+ const getInOrderColumns = (columns, hasCheckedRows, checkedRowsMultiple, columnsConfig, columnsWidths, rowActionsGetter) => {
42
43
  let filteredSortedColumns = columns.filter((column) => {
43
44
  const columnConfigIndex = getColumIndex(column.key, columnsConfig);
44
45
  const visible = columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].visible : true;
@@ -64,7 +65,8 @@ const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths
64
65
  filteredSortedColumns = [ActionsColumn, ...filteredSortedColumns];
65
66
  }
66
67
  if (hasCheckedRows) {
67
- filteredSortedColumns = [SelectColumn, ...filteredSortedColumns];
68
+ const selectionColumn = checkedRowsMultiple === false ? RadioSelectColumn : SelectColumn;
69
+ filteredSortedColumns = [selectionColumn, ...filteredSortedColumns];
68
70
  }
69
71
  return filteredSortedColumns;
70
72
  };
@@ -89,6 +91,7 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
89
91
  rowActionsGetter,
90
92
  checkedRows,
91
93
  onCheckedRowsChange,
94
+ checkedRowsMultiple,
92
95
  sortColumns,
93
96
  setSortColumns
94
97
  } = useDataGrid();
@@ -109,6 +112,7 @@ const useSortColumnsRows = (sourceColumns, sourceRows, popoverHandlers) => {
109
112
  sourceColumns,
110
113
  !!checkedRows && !!onCheckedRowsChange,
111
114
  //Si están seteados se habilita el múltipe
115
+ checkedRowsMultiple,
112
116
  columnsConfig,
113
117
  columnsWidths,
114
118
  rowActionsGetter
@@ -0,0 +1,6 @@
1
+ import { RenderCheckboxProps } from 'react-data-grid';
2
+ /**
3
+ * Componente visual del RadioButton que se renderiza dentro de cada celda del DataGrid.
4
+ * ¿Para que sirve? Es un wrapper alrededor del componente Radio del MUI que adapta las props de react-data-grid
5
+ */
6
+ export declare const RadioButtonFormatter: import('react').ForwardRefExoticComponent<RenderCheckboxProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { R as RadioButton } from "../../../../mui_extended/RadioButton/RadioButton.js";
4
+ const RadioButtonFormatter = forwardRef(function RadioFormatter({ onChange, checked, ...props }, _ref) {
5
+ function handleChange(e) {
6
+ onChange(e.target.checked, e.nativeEvent.shiftKey);
7
+ }
8
+ return /* @__PURE__ */ jsx(RadioButton, { checked, onChange: handleChange, ...props });
9
+ });
10
+ export {
11
+ RadioButtonFormatter as R
12
+ };
@@ -0,0 +1,64 @@
1
+ import { Column, RenderCellProps, RenderGroupCellProps, RenderHeaderCellProps } from 'react-data-grid';
2
+ export declare const filterColumnClassName = "filter-cell";
3
+ export declare const filterHeight = 35;
4
+ /**
5
+ * Formateador para la celda de selección con radio button en filas agrupadas.
6
+ *
7
+ * **Nota:** Para radio buttons (selección única), no tiene sentido seleccionar grupos completos,
8
+ * por lo que este formateador retorna `null` y no renderiza ningún control.
9
+ * @param _props - Propiedades para renderizar la celda de grupo (no utilizadas).
10
+ * @returns `null` - No se renderiza ningún control de selección en grupos.
11
+ * @example
12
+ * // En un DataGrid con grupos, las filas de grupo no tendrán radio button
13
+ * // Solo las filas individuales tendrán radio buttons
14
+ */
15
+ export declare function RadioSelectGroupFormatter(_props: RenderGroupCellProps<unknown>): null;
16
+ /**
17
+ * Formateador para la celda de selección con radio button en filas individuales.
18
+ *
19
+ * Este componente maneja la lógica de **selección única**: cuando el usuario hace click
20
+ * en un radio button, se REEMPLAZA completamente la selección anterior con solo la fila actual.
21
+ *
22
+ * **Comportamiento:**
23
+ * - Si `checked` es `true`: El Set de `checkedRows` se reemplaza con `[rowKey actual]`
24
+ * - Si `checked` es `false`: El Set de `checkedRows` se vacía (deselección)
25
+ * @param props - Propiedades para renderizar la celda, incluyendo la fila actual.
26
+ * @returns Un componente `SelectCellFormatter` configurado como radio button.
27
+ * @example
28
+ * // Cuando el usuario hace click en el radio de la fila con ID=5:
29
+ * // checkedRows antes: Set([3])
30
+ * // checkedRows después: Set([5]) ← Reemplaza, no agrega
31
+ */
32
+ export declare function RadioSelectFormatter(props: RenderCellProps<any, any>): import("react/jsx-runtime").JSX.Element;
33
+ /**
34
+ * Renderizador para la celda de cabecera (header) de la columna de selección con radio buttons.
35
+ *
36
+ * **Nota:** A diferencia de los checkboxes, los radio buttons NO tienen funcionalidad de
37
+ * "Seleccionar Todo", ya que solo se puede seleccionar una fila a la vez. Por lo tanto,
38
+ * este renderizador retorna `null` y no muestra ningún control en el header.
39
+ * @param _props - Propiedades para renderizar la celda de cabecera (no utilizadas).
40
+ * @returns `null` - No se renderiza ningún control en la cabecera.
41
+ * @example
42
+ * // La cabecera de la columna estará vacía (sin checkbox "Select All")
43
+ */
44
+ export declare function RadioSelectColumnHeaderRenderer(_props: RenderHeaderCellProps<any, any>): null;
45
+ /**
46
+ * Definición de la columna de selección con radio buttons para el DataGrid.
47
+ *
48
+ * Esta columna permite **selección única** de filas mediante radio buttons.
49
+ *
50
+ * **Características:**
51
+ * - **Ancho fijo:** 32px (igual que la columna de checkboxes)
52
+ * - **No redimensionable:** `resizable: false`
53
+ * - **No draggable:** `isDraggable: false`
54
+ * - **No sortable:** `sortable: false`
55
+ * - **Congelada:** `frozen: true` (siempre visible al hacer scroll horizontal)
56
+ * - **Header vacío:** No tiene control "Select All"
57
+ * - **Selección única:** Solo una fila puede estar seleccionada a la vez
58
+ * @example
59
+ * // En useSortColumnsRows.tsx:
60
+ * const selectionColumn = checkedRowsMultiple === false
61
+ * ? RadioSelectColumn // ← Selección única con radio buttons
62
+ * : SelectColumn; // ← Selección múltiple con checkboxes
63
+ */
64
+ export declare const RadioSelectColumn: Column<any, any>;
@@ -0,0 +1,46 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { u as useDataGrid } from "../../../hooks/useDataGrid.js";
3
+ import { d as DATAGRID_SELECT_COLUMN_KEY } from "../../../constants.js";
4
+ import { R as RadioButtonFormatter } from "./RadioButtonFormatter.js";
5
+ function RadioSelectGroupFormatter(_props) {
6
+ return null;
7
+ }
8
+ function RadioSelectFormatter(props) {
9
+ const { checkedRows, onCheckedRowsChange, rowKeyGetter } = useDataGrid();
10
+ const onChange = (checked, _isShiftClick) => {
11
+ if (checked) {
12
+ onCheckedRowsChange && onCheckedRowsChange(/* @__PURE__ */ new Set([rowKeyGetter(props.row)]));
13
+ } else {
14
+ onCheckedRowsChange && onCheckedRowsChange(/* @__PURE__ */ new Set());
15
+ }
16
+ };
17
+ return /* @__PURE__ */ jsx(
18
+ RadioButtonFormatter,
19
+ {
20
+ checked: checkedRows?.has(rowKeyGetter(props.row)) || false,
21
+ tabIndex: props.tabIndex,
22
+ onChange,
23
+ "aria-label": "Select"
24
+ }
25
+ );
26
+ }
27
+ function RadioSelectColumnHeaderRenderer(_props) {
28
+ return null;
29
+ }
30
+ const RadioSelectColumn = {
31
+ key: DATAGRID_SELECT_COLUMN_KEY,
32
+ name: "",
33
+ width: 32,
34
+ minWidth: 32,
35
+ isDraggable: false,
36
+ resizable: false,
37
+ sortable: false,
38
+ frozen: true,
39
+ type: "boolean",
40
+ renderHeaderCell: RadioSelectColumnHeaderRenderer,
41
+ renderCell: RadioSelectFormatter,
42
+ renderGroupCell: RadioSelectGroupFormatter
43
+ };
44
+ export {
45
+ RadioSelectColumn as R
46
+ };
@@ -137,6 +137,13 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
137
137
  onSelectedRowsChange?: (mapRowsSelected: ReadonlySet<TKey>) => void;
138
138
  checkedRows?: ReadonlySet<TKey>;
139
139
  onCheckedRowsChange?: (mapRowsSelected: ReadonlySet<TKey>) => void;
140
+ /**
141
+ * Define si la selección de filas es múltiple (checkboxes) o única (radio buttons).
142
+ *
143
+ * - `true` (default): Permite seleccionar múltiples filas con checkboxes
144
+ * - `false`: Permite seleccionar solo una fila con radio buttons
145
+ */
146
+ checkedRowsMultiple?: boolean;
140
147
  onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, TSummaryRow>) => void>;
141
148
  /**
142
149
  * Propiedad opcional que recibe la configuración de las columnas
@@ -0,0 +1,24 @@
1
+ import { RadioButtonProps } from './types';
2
+ /**
3
+ * Componente RadioButton 🔘
4
+ *
5
+ * Este componente representa un radio button personalizado que puede ser utilizado en formularios y otros lugares donde se necesite una opción de selección única.
6
+ * @param {RadioButtonProps} props - Las propiedades del componente.
7
+ * @param {React.Ref<HTMLButtonElement>} ref - La referencia al elemento raíz del componente.
8
+ * @returns {JSX.Element} El componente RadioButton renderizado.
9
+ * @example
10
+ * ```tsx
11
+ * <RadioButton
12
+ * size="medium"
13
+ * disabled={false}
14
+ * color="primary"
15
+ * inlineText="Opción 1"
16
+ * mandatory={true}
17
+ * mandatoryMessage="Este campo es obligatorio"
18
+ * helperMessage="Más información"
19
+ * htmlFor="radio-id"
20
+ * error={false}
21
+ * />
22
+ * ```
23
+ */
24
+ export declare const RadioButton: import('react').ForwardRefExoticComponent<Omit<RadioButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,110 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useId } from "react";
3
+ import { useModuleSkeleton, useEnvironment } from "@m4l/core";
4
+ import { R as RadioButtonRootStyled, M as MUIRadioStyled, I as IconStyled, a as IconCheckedStyled, T as TypographyStyled, S as SkeletonStyled } from "./slots/RadioButtonSlots.js";
5
+ import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
6
+ import { R as RADIO_BUTTON_KEY_COMPONENT } from "./constants.js";
7
+ import clsx from "clsx";
8
+ import { p as pathIcons } from "./icons.js";
9
+ import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
10
+ const RadioButton = forwardRef(
11
+ (props, ref) => {
12
+ const {
13
+ className,
14
+ size = "medium",
15
+ disabled,
16
+ color = "default",
17
+ mandatory,
18
+ mandatoryMessage,
19
+ helperMessage,
20
+ id,
21
+ htmlFor,
22
+ error,
23
+ inlineText,
24
+ checked = false,
25
+ ...others
26
+ } = props;
27
+ const { currentSize } = useComponentSize(size);
28
+ const isSkeleton = useModuleSkeleton();
29
+ const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
30
+ const classes = getComponentSlotRoot(RADIO_BUTTON_KEY_COMPONENT);
31
+ const { host_static_assets, environment_assets } = useEnvironment();
32
+ const hookId = useId();
33
+ const finalId = id || hookId;
34
+ const ownerState = {
35
+ disabled,
36
+ color,
37
+ error,
38
+ size,
39
+ checked
40
+ };
41
+ return /* @__PURE__ */ jsx(
42
+ RadioButtonRootStyled,
43
+ {
44
+ ownerState: { ...ownerState },
45
+ className: clsx(className, classes),
46
+ children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ /* @__PURE__ */ jsx(
48
+ MUIRadioStyled,
49
+ {
50
+ ref,
51
+ ownerState: { ...ownerState },
52
+ disableRipple: true,
53
+ id: finalId,
54
+ checked,
55
+ checkedIcon: /* @__PURE__ */ jsx(
56
+ IconCheckedStyled,
57
+ {
58
+ src: `${host_static_assets}/${environment_assets}/${pathIcons.checked}`,
59
+ size: currentSize,
60
+ color: disabled ? "text.disabled" : error ? "error.enabled" : "primary.enabled",
61
+ ownerState: { ...ownerState }
62
+ }
63
+ ),
64
+ icon: /* @__PURE__ */ jsx(
65
+ IconStyled,
66
+ {
67
+ src: `${host_static_assets}/${environment_assets}/${pathIcons.unchecked}`,
68
+ size: currentSize,
69
+ ownerState: { ...ownerState },
70
+ color: disabled ? "text.disabled" : error ? "error.enabled" : "text.secondary"
71
+ }
72
+ ),
73
+ disabled,
74
+ inputProps: {
75
+ "aria-labelledby": finalId,
76
+ "aria-invalid": error ? "true" : void 0
77
+ },
78
+ ...others
79
+ }
80
+ ),
81
+ inlineText && /* @__PURE__ */ jsx(
82
+ TypographyStyled,
83
+ {
84
+ component: "label",
85
+ htmlFor: finalId,
86
+ variant: "body",
87
+ ownerState: { ...ownerState },
88
+ size: adjustedSize,
89
+ disabled,
90
+ ellipsis: true,
91
+ children: inlineText
92
+ }
93
+ )
94
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
95
+ /* @__PURE__ */ jsx(SkeletonStyled, { variant: "rounded", className: "radioSkeleton" }),
96
+ inlineText ? /* @__PURE__ */ jsx(
97
+ SkeletonStyled,
98
+ {
99
+ variant: "rectangular",
100
+ className: "radioSkeletonInlineText"
101
+ }
102
+ ) : null
103
+ ] })
104
+ }
105
+ );
106
+ }
107
+ );
108
+ export {
109
+ RadioButton as R
110
+ };
@@ -0,0 +1,2 @@
1
+ import { RadioButtonStyles } from './types';
2
+ export declare const radioButtonStyles: RadioButtonStyles;
@@ -0,0 +1,126 @@
1
+ import { g as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
2
+ const radioButtonStyles = {
3
+ /**
4
+ * Estilos generales para el radio button 🟦
5
+ * @param {object} theme - El tema de MUI.
6
+ * @returns {object} - Los estilos aplicados al root del radio button.
7
+ */
8
+ root: ({ theme }) => ({
9
+ display: "flex",
10
+ alignItems: "center",
11
+ outline: "none",
12
+ overflow: "visible",
13
+ boxSizing: "border-box",
14
+ gap: theme.vars.size.baseSpacings.sp1,
15
+ width: "fit-content"
16
+ }),
17
+ /**
18
+ * Componente MuiRadio, FocusVisible para cuando está seleccionado el RadioButton 🟩
19
+ * @param {object} theme - El tema de MUI.
20
+ * @param {object} ownerState - El estado del componente.
21
+ * @returns {object} - Los estilos aplicados al MuiRadio.
22
+ */
23
+ muiRadio: ({ theme, ownerState }) => {
24
+ const color = ownerState?.error ? "error" : "primary";
25
+ const opacityColor = ownerState?.error ? "error" : "default";
26
+ return {
27
+ overflow: "visible",
28
+ ...getSizeStyles(
29
+ theme,
30
+ ownerState?.size || "medium",
31
+ "action",
32
+ (size) => {
33
+ return {
34
+ width: size,
35
+ height: size
36
+ };
37
+ }
38
+ ),
39
+ borderRadius: theme.size.borderRadius.r4,
40
+ "&:hover": {
41
+ backgroundColor: theme.vars.palette[opacityColor].hoverOpacity
42
+ },
43
+ "&:active": {
44
+ backgroundColor: theme.vars.palette[opacityColor].activeOpacity
45
+ },
46
+ "&.Mui-checked": {
47
+ "&:hover": {
48
+ backgroundColor: theme.vars.palette[color].hoverOpacity,
49
+ "& .M4LIcon-icon": {
50
+ backgroundColor: theme.vars.palette[color].hover
51
+ }
52
+ },
53
+ "&:active": {
54
+ backgroundColor: theme.vars.palette[color].activeOpacity,
55
+ "& .M4LIcon-icon": {
56
+ backgroundColor: theme.vars.palette[color].active
57
+ }
58
+ }
59
+ },
60
+ "&.Mui-focusVisible, &:focus-visible": {
61
+ outline: `1px solid ${theme.vars.palette.primary.focusVisible}`
62
+ },
63
+ ...ownerState?.disabled && {
64
+ pointerEvents: ownerState?.disabled ? "none" : "auto",
65
+ "&:hover": {
66
+ pointerEvents: ownerState?.disabled ? "none" : "auto"
67
+ }
68
+ }
69
+ };
70
+ },
71
+ /**
72
+ * Estilos para el skeleton del RadioButton 📝
73
+ * @param {object} theme - El tema de MUI.
74
+ * @param {object} ownerState - El estado del componente.
75
+ * @returns {object} - Los estilos aplicados al skeletonStyled.
76
+ */
77
+ skeletonStyled: ({ theme, ownerState }) => {
78
+ return {
79
+ borderRadius: theme.vars.size.borderRadius.r1,
80
+ backgroundColor: theme.vars.palette?.skeleton.default,
81
+ "&.radioSkeleton": {
82
+ ...getSizeStyles(
83
+ theme,
84
+ ownerState?.size || "medium",
85
+ "action",
86
+ (size) => {
87
+ return {
88
+ width: size
89
+ };
90
+ }
91
+ ),
92
+ ...getSizeStyles(
93
+ theme,
94
+ ownerState?.size || "small",
95
+ "action",
96
+ (size) => {
97
+ return {
98
+ width: size
99
+ };
100
+ }
101
+ )
102
+ },
103
+ "&.radioSkeletonInlineText": {
104
+ width: theme.vars.size.baseSpacings.sp12,
105
+ borderRadius: theme.vars.size.borderRadius.r1,
106
+ ...getSizeStyles(theme, ownerState?.size || "medium", "base"),
107
+ ...getSizeStyles(theme, ownerState?.size || "small", "base")
108
+ }
109
+ };
110
+ },
111
+ /**
112
+ * Estilos para el inline-text del RadioButton 📝
113
+ */
114
+ typographyStyled: {},
115
+ /**
116
+ * El estilado de este slot, se hace en muiRadio, debido a que el input absorbe los pseudo selectores, entonces hay que hacerlos desde el nodo padre. 🟨
117
+ */
118
+ icon: {},
119
+ /**
120
+ * El estilado de este slot, se hace en muiRadio, debido a que el input absorbe los pseudo selectores, entonces hay que hacerlos desde el nodo padre. 🟨
121
+ */
122
+ iconChecked: {}
123
+ };
124
+ export {
125
+ radioButtonStyles as r
126
+ };
@@ -0,0 +1 @@
1
+ export declare const RADIO_BUTTON_KEY_COMPONENT = "M4LRadioButton";
@@ -0,0 +1,4 @@
1
+ const RADIO_BUTTON_KEY_COMPONENT = "M4LRadioButton";
2
+ export {
3
+ RADIO_BUTTON_KEY_COMPONENT as R
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare const pathIcons: {
2
+ checked: string;
3
+ unchecked: string;
4
+ };
@@ -0,0 +1,7 @@
1
+ const pathIcons = {
2
+ checked: "frontend/components/radio_button/assets/icons/checked.svg",
3
+ unchecked: "frontend/components/radio_button/assets/icons/noCheked.svg"
4
+ };
5
+ export {
6
+ pathIcons as p
7
+ };
@@ -0,0 +1 @@
1
+ export { RadioButton } from './RadioButton';
@@ -0,0 +1,8 @@
1
+ export declare enum RadioButtonSlots {
2
+ root = "root",
3
+ muiRadio = "muiRadio",
4
+ typographyStyled = "typographyStyled",
5
+ skeletonStyled = "skeletonStyled",
6
+ iconChecked = "iconChecked",
7
+ icon = "icon"
8
+ }
@@ -0,0 +1,12 @@
1
+ var RadioButtonSlots = /* @__PURE__ */ ((RadioButtonSlots2) => {
2
+ RadioButtonSlots2["root"] = "root";
3
+ RadioButtonSlots2["muiRadio"] = "muiRadio";
4
+ RadioButtonSlots2["typographyStyled"] = "typographyStyled";
5
+ RadioButtonSlots2["skeletonStyled"] = "skeletonStyled";
6
+ RadioButtonSlots2["iconChecked"] = "iconChecked";
7
+ RadioButtonSlots2["icon"] = "icon";
8
+ return RadioButtonSlots2;
9
+ })(RadioButtonSlots || {});
10
+ export {
11
+ RadioButtonSlots as R
12
+ };
@@ -0,0 +1,20 @@
1
+ export declare const RadioButtonRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
2
+ ownerState?: (Partial<import('../types').RadioButtonOwnerState> & Record<string, unknown>) | undefined;
3
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
4
+ export declare const MUIRadioStyled: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').RadioProps, keyof import('@mui/material').RadioProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
5
+ ownerState?: (Partial<import('../types').RadioButtonOwnerState> & Record<string, unknown>) | undefined;
6
+ }, {}, {}>;
7
+ export declare const TypographyStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../Typography/types').TypographyProps, "ref"> & import('react').RefAttributes<HTMLSpanElement>, "size" | "children" | "title" | "component" | "zIndex" | "id" | "disabled" | "paragraph" | "border" | "fontWeight" | "lineHeight" | "letterSpacing" | "fontSize" | "textTransform" | "fontFamily" | "typography" | "flex" | "hidden" | "color" | "left" | "right" | "bottom" | "top" | "content" | "style" | "position" | "ellipsis" | "padding" | "variant" | "borderRadius" | "width" | "display" | "borderColor" | "height" | "gap" | "minHeight" | "margin" | "overflow" | "boxShadow" | "minWidth" | "justifyContent" | "alignItems" | "paddingLeft" | "borderLeft" | "borderTop" | "maxWidth" | "flexDirection" | "paddingRight" | "borderRight" | "flexGrow" | "marginLeft" | "textOverflow" | "borderBottom" | "gridTemplateColumns" | "marginBottom" | "dataTestid" | "alignContent" | "alignSelf" | "boxSizing" | "columnGap" | "flexBasis" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateRows" | "justifyItems" | "justifySelf" | "marginBlockEnd" | "marginBlockStart" | "marginInlineEnd" | "marginInlineStart" | "marginRight" | "marginTop" | "maxHeight" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingTop" | "rowGap" | "textAlign" | "translate" | "visibility" | "whiteSpace" | "gridArea" | "gridColumn" | "gridRow" | "marginBlock" | "marginInline" | "paddingBlock" | "paddingInline" | "className" | "classes" | "sx" | "p" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "align" | "htmlFor" | "gutterBottom" | "noWrap" | "variantMapping" | "skeletonWidth" | "skeletonRows" | keyof import('react').RefAttributes<HTMLSpanElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
8
+ ownerState?: (Partial<import('../types').RadioButtonOwnerState> & Record<string, unknown>) | undefined;
9
+ }, {}, {}>;
10
+ export declare const SkeletonStyled: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').SkeletonOwnProps & import('@mui/material/OverridableComponent').CommonProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
11
+ ref?: ((instance: HTMLSpanElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLSpanElement> | null | undefined;
12
+ }, "children" | "style" | "variant" | "width" | "height" | "animation" | "className" | "classes" | "sx">, "children" | "ref" | "title" | "id" | "hidden" | "color" | "content" | "style" | "variant" | "width" | "height" | "translate" | "animation" | "className" | "classes" | "sx" | "slot" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
13
+ ownerState?: (Partial<import('../types').RadioButtonOwnerState> & Record<string, unknown>) | undefined;
14
+ }, {}, {}>;
15
+ export declare const IconCheckedStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
16
+ ownerState?: (Partial<import('../types').RadioButtonOwnerState> & Record<string, unknown>) | undefined;
17
+ }, {}, {}>;
18
+ export declare const IconStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
19
+ ownerState?: (Partial<import('../types').RadioButtonOwnerState> & Record<string, unknown>) | undefined;
20
+ }, {}, {}>;
@@ -0,0 +1,39 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { Radio, Skeleton } from "@mui/material";
3
+ import { R as RadioButtonSlots } from "./RadioButtonEnum.js";
4
+ import { R as RADIO_BUTTON_KEY_COMPONENT } from "../constants.js";
5
+ import { r as radioButtonStyles } from "../RadioButton.styles.js";
6
+ import { T as Typography } from "../../Typography/Typography.js";
7
+ import { I as Icon } from "../../../Icon/Icon.js";
8
+ const RadioButtonRootStyled = styled("div", {
9
+ name: RADIO_BUTTON_KEY_COMPONENT,
10
+ slot: RadioButtonSlots.root
11
+ })(radioButtonStyles.root);
12
+ const MUIRadioStyled = styled(Radio, {
13
+ name: RADIO_BUTTON_KEY_COMPONENT,
14
+ slot: RadioButtonSlots.muiRadio
15
+ })(radioButtonStyles.muiRadio);
16
+ const TypographyStyled = styled(Typography, {
17
+ name: RADIO_BUTTON_KEY_COMPONENT,
18
+ slot: RadioButtonSlots.typographyStyled
19
+ })(radioButtonStyles.typographyStyled);
20
+ const SkeletonStyled = styled(Skeleton, {
21
+ name: RADIO_BUTTON_KEY_COMPONENT,
22
+ slot: RadioButtonSlots.skeletonStyled
23
+ })(radioButtonStyles.skeletonStyled);
24
+ const IconCheckedStyled = styled(Icon, {
25
+ name: RADIO_BUTTON_KEY_COMPONENT,
26
+ slot: RadioButtonSlots.iconChecked
27
+ })(radioButtonStyles.iconChecked);
28
+ const IconStyled = styled(Icon, {
29
+ name: RADIO_BUTTON_KEY_COMPONENT,
30
+ slot: RadioButtonSlots.icon
31
+ })(radioButtonStyles.icon);
32
+ export {
33
+ IconStyled as I,
34
+ MUIRadioStyled as M,
35
+ RadioButtonRootStyled as R,
36
+ SkeletonStyled as S,
37
+ TypographyStyled as T,
38
+ IconCheckedStyled as a
39
+ };
@@ -0,0 +1,50 @@
1
+ import { RadioProps as MUIRadioProps, Theme } from '@mui/material';
2
+ import { RadioButtonSlots } from './slots/RadioButtonEnum';
3
+ import { ComponentPalletColor, Sizes } from '@m4l/styles';
4
+ import { M4LOverridesStyleRules } from '../../../@types/augmentations';
5
+ import { RADIO_BUTTON_KEY_COMPONENT } from './constants';
6
+ import { LabelProps } from '../../Label/types';
7
+ export interface RadioButtonProps extends MUIRadioProps, Omit<LabelProps, 'label' | 'size'> {
8
+ /**
9
+ * El texto que se muestra junto al radio button
10
+ */
11
+ inlineText?: string;
12
+ /**
13
+ * Tamaño
14
+ */
15
+ size?: Extract<Sizes, 'small' | 'medium'>;
16
+ /**
17
+ * Color
18
+ */
19
+ color?: Extract<ComponentPalletColor, 'default'>;
20
+ }
21
+ export interface RadioButtonOwnerState {
22
+ /**
23
+ * Indica si el RadioButton está marcado.
24
+ */
25
+ checked?: boolean;
26
+ /**
27
+ * Indica si el RadioButton está deshabilitado.
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * El tamaño del RadioButton.
32
+ */
33
+ size: Extract<Sizes, 'small' | 'medium'>;
34
+ /**
35
+ * El color del RadioButton.
36
+ */
37
+ color: Extract<ComponentPalletColor, 'default'>;
38
+ /**
39
+ * Indica si hay un error en el RadioButton.
40
+ */
41
+ error?: boolean;
42
+ }
43
+ /**
44
+ * Tipos de slots de RadioButton
45
+ */
46
+ export type RadioButtonSlotsType = keyof typeof RadioButtonSlots;
47
+ /**
48
+ * Estilos del RadioButton
49
+ */
50
+ export type RadioButtonStyles = M4LOverridesStyleRules<RadioButtonSlotsType, typeof RADIO_BUTTON_KEY_COMPONENT, Theme>;
@@ -8,6 +8,7 @@ export { Breadcrumbs } from './Breadcrumbs';
8
8
  export type { TLink } from './Breadcrumbs/types';
9
9
  export * from './Button/Button';
10
10
  export * from './CheckBox';
11
+ export * from './RadioButton';
11
12
  export { CircularProgress } from './CircularProgress';
12
13
  export { Badge } from './Badge';
13
14
  export * from './ImageButton/ImageButton';
package/index.js CHANGED
@@ -97,6 +97,7 @@ import { T as T3 } from "./components/mui_extended/Tooltip/Tooltip.js";
97
97
  import { I as I2 } from "./components/mui_extended/IconButton/IconButton.js";
98
98
  import { B as B5 } from "./components/mui_extended/Button/Button.js";
99
99
  import { C as C19 } from "./components/mui_extended/CheckBox/CheckBox.js";
100
+ import { R as R4 } from "./components/mui_extended/RadioButton/RadioButton.js";
100
101
  import { I as I3 } from "./components/mui_extended/ImageButton/ImageButton.js";
101
102
  import { P as P2 } from "./components/mui_extended/Popover/Popover.js";
102
103
  import { S as S4 } from "./components/mui_extended/Select/Select.js";
@@ -137,38 +138,38 @@ import { u as u17 } from "./components/formatters/DistanceToNowFormatter/hooks/u
137
138
  import { g as g18 } from "./components/formatters/dictionary.js";
138
139
  import { F as F2 } from "./components/FormContainer/FormContainer.js";
139
140
  import { G } from "./components/GridLayout/GridLayout.js";
140
- import { R as R4 } from "./components/GridLayout/subcomponents/Responsive/index.js";
141
+ import { R as R5 } from "./components/GridLayout/subcomponents/Responsive/index.js";
141
142
  import { c as c2, e, d as d3 } from "./components/GridLayout/subcomponents/Responsive/responsiveUtils.js";
142
143
  import { i, k } from "./components/GridLayout/utils.js";
143
144
  import { w } from "./components/GridLayout/subcomponents/withSizeProvider/index.js";
144
145
  import { H as H2 } from "./components/HelmetPage/index.js";
145
146
  import { H as H3 } from "./components/HelperError/HelperError.js";
146
- import { R as R5 } from "./components/hook-form/RHFAutocomplete/RHFAutocomplete.js";
147
+ import { R as R6 } from "./components/hook-form/RHFAutocomplete/RHFAutocomplete.js";
147
148
  import { g as g19 } from "./components/hook-form/RHFAutocomplete/dictionary.js";
148
- import { R as R6 } from "./components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js";
149
+ import { R as R7 } from "./components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js";
149
150
  import { g as g20 } from "./components/hook-form/RHFAutocompleteAsync/dictionary.js";
150
- import { R as R7 } from "./components/hook-form/RHFDateTime/RHFDateTime.js";
151
- import { R as R8 } from "./components/hook-form/RHFMultiCheckbox/index.js";
152
- import { R as R9 } from "./components/hook-form/RHFSelect/RHFSelect.js";
153
- import { R as R10 } from "./components/hook-form/RHFHelperError/index.js";
154
- import { R as R11 } from "./components/hook-form/RHFRadioGroup/RHFRadioGroup.js";
155
- import { R as R12 } from "./components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js";
156
- import { R as R13 } from "./components/hook-form/RHFColorPicker/RFHColorPicker.js";
157
- import { R as R14 } from "./components/hook-form/RHFCheckbox/RHFCheckbox.js";
158
- import { R as R15 } from "./components/hook-form/RHFTextField/RHFTextField.js";
159
- import { R as R16 } from "./components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
151
+ import { R as R8 } from "./components/hook-form/RHFDateTime/RHFDateTime.js";
152
+ import { R as R9 } from "./components/hook-form/RHFMultiCheckbox/index.js";
153
+ import { R as R10 } from "./components/hook-form/RHFSelect/RHFSelect.js";
154
+ import { R as R11 } from "./components/hook-form/RHFHelperError/index.js";
155
+ import { R as R12 } from "./components/hook-form/RHFRadioGroup/RHFRadioGroup.js";
156
+ import { R as R13 } from "./components/hook-form/RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile.js";
157
+ import { R as R14 } from "./components/hook-form/RHFColorPicker/RFHColorPicker.js";
158
+ import { R as R15 } from "./components/hook-form/RHFCheckbox/RHFCheckbox.js";
159
+ import { R as R16 } from "./components/hook-form/RHFTextField/RHFTextField.js";
160
+ import { R as R17 } from "./components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.js";
160
161
  import { g as g21 } from "./components/hook-form/RHFPeriod/subcomponents/Period/dictionary.js";
161
162
  import { r } from "./components/hook-form/RHFPeriod/RHFPeriod.styles.js";
162
- import { R as R17 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
163
- import { R as R18 } from "./components/hook-form/RHFPeriod/constants.js";
164
- import { R as R19 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js";
165
- import { N as N3, P as P6, R as R20, S as S7 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodSlots.js";
166
- import { R as R21 } from "./components/hook-form/RHFNumberInput/RHFNumberInput.js";
167
- import { R as R22 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
163
+ import { R as R18 } from "./components/hook-form/RHFPeriod/RHFPeriod.js";
164
+ import { R as R19 } from "./components/hook-form/RHFPeriod/constants.js";
165
+ import { R as R20 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.js";
166
+ import { N as N3, P as P6, R as R21, S as S7 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodSlots.js";
167
+ import { R as R22 } from "./components/hook-form/RHFNumberInput/RHFNumberInput.js";
168
+ import { R as R23 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
168
169
  import { V as V2, b as b4, a as a9 } from "./components/hook-form/RHFormProvider/types.js";
169
- import { F as F3, R as R23, u as u18 } from "./components/hook-form/RHFormProvider/RHFormProvider.js";
170
+ import { F as F3, R as R24, u as u18 } from "./components/hook-form/RHFormProvider/RHFormProvider.js";
170
171
  import { d as d4, a as a10, b as b5, c as c3 } from "./components/hook-form/RHFormProvider/schema.js";
171
- import { R as R24 } from "./components/hook-form/RHFActionsGroup/RHFActionsGroup.js";
172
+ import { R as R25 } from "./components/hook-form/RHFActionsGroup/RHFActionsGroup.js";
172
173
  import { I as I5 } from "./components/Icon/Icon.js";
173
174
  import { I as I6 } from "./components/Image/Image.js";
174
175
  import { L as L6 } from "./components/Label/Label.js";
@@ -381,30 +382,31 @@ export {
381
382
  P11 as PrintingSystem,
382
383
  P as PropagateLoaderSpinner,
383
384
  P12 as PropertyValue,
384
- R24 as RHFActionsGroup,
385
- R5 as RHFAutocomplete,
386
- R6 as RHFAutocompleteAsync,
387
- R14 as RHFCheckbox,
388
- R13 as RHFColorPicker,
389
- R7 as RHFDateTime,
390
- R10 as RHFHelperError,
391
- R8 as RHFMultiCheckbox,
392
- R21 as RHFNumberInput,
393
- R17 as RHFPeriod,
394
- R20 as RHFPeriodRootStyled,
395
- R19 as RHFPeriodSlots,
396
- R11 as RHFRadioGroup,
397
- R9 as RHFSelect,
398
- R15 as RHFTextField,
399
- R16 as RHFTextFieldPassword,
400
- R22 as RHFUploadImage,
401
- R12 as RHFUploadSingleFile,
402
- R18 as RHF_PERIOD_KEY_COMPONENT,
403
- R23 as RHFormProvider,
385
+ R25 as RHFActionsGroup,
386
+ R6 as RHFAutocomplete,
387
+ R7 as RHFAutocompleteAsync,
388
+ R15 as RHFCheckbox,
389
+ R14 as RHFColorPicker,
390
+ R8 as RHFDateTime,
391
+ R11 as RHFHelperError,
392
+ R9 as RHFMultiCheckbox,
393
+ R22 as RHFNumberInput,
394
+ R18 as RHFPeriod,
395
+ R21 as RHFPeriodRootStyled,
396
+ R20 as RHFPeriodSlots,
397
+ R12 as RHFRadioGroup,
398
+ R10 as RHFSelect,
399
+ R16 as RHFTextField,
400
+ R17 as RHFTextFieldPassword,
401
+ R23 as RHFUploadImage,
402
+ R13 as RHFUploadSingleFile,
403
+ R19 as RHF_PERIOD_KEY_COMPONENT,
404
+ R24 as RHFormProvider,
405
+ R4 as RadioButton,
404
406
  R3 as ReactJsonViewer,
405
407
  R as Resizable,
406
408
  R2 as ResizableBox,
407
- R4 as Responsive,
409
+ R5 as Responsive,
408
410
  S21 as SKELETON_SVG_ICON,
409
411
  S8 as ScrollBar,
410
412
  S as SectionCommercial,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.36",
3
+ "version": "9.3.37",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {