@m4l/widgets 0.0.2-beta-add-widget-piechart.0 → 0.0.2

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,9 +1,9 @@
1
1
  import { PieProps } from './types';
2
2
  /**
3
- * Componente Pie para el gráfico de pastel (Pie chart).
4
- * @param values - Valores para el gráfico
5
- * @param size - Tamaño del componente
6
- * @returns Componente Pie
3
+ * Pie component for the pie chart.
4
+ * @param values - Values for the chart
5
+ * @param size - Component size
6
+ * @returns Pie component
7
7
  */
8
8
  export declare function Pie({ values, size }: PieProps): import("@emotion/react/jsx-runtime").JSX.Element;
9
9
  export default Pie;
@@ -1 +1 @@
1
- {"version":3,"file":"Pie.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/Pie.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC,eAAO,MAAM,SAAS,EAAE,SAgNvB,CAAC"}
1
+ {"version":3,"file":"Pie.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/Pie.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC,eAAO,MAAM,SAAS,EAAE,SAkNvB,CAAC"}
@@ -2,7 +2,7 @@ import { getTypographyStyles as i } from "@m4l/components";
2
2
  const a = {
3
3
  /**
4
4
  * ***************************************************************
5
- * Contenedor raíz: contexto de consulta de contenedores para el diseño responsivo.
5
+ * Root container: container query context for responsive layout.
6
6
  * ***************************************************************
7
7
  */
8
8
  pieRoot: () => ({
@@ -13,7 +13,7 @@ const a = {
13
13
  }),
14
14
  /**
15
15
  * ******************************************************************
16
- * Contenedor flex interno que envuelve el gráfico y la leyenda.
16
+ * Inner flex container wrapping the chart and the legend.
17
17
  * ******************************************************************
18
18
  */
19
19
  pieParent: () => ({
@@ -25,7 +25,7 @@ const a = {
25
25
  }),
26
26
  /**
27
27
  * *******************************************************************
28
- * Caja izquierda: contenedor del gráfico. ReactECharts se renderiza dentro.
28
+ * Left box: chart container. ReactECharts is rendered inside.
29
29
  * *******************************************************************
30
30
  */
31
31
  chartContainer: () => ({
@@ -62,9 +62,10 @@ const a = {
62
62
  }),
63
63
  /**
64
64
  * ********************************************************************
65
- * Caja derecha: contenedor de la leyenda. CustomLegend se renderiza dentro.
65
+ * Right box: legend container. CustomLegend is rendered inside.
66
66
  * ********************************************************************
67
67
  */
68
+ /** Returns style object for the legend grid based on theme and ownerState. */
68
69
  legendContainer: ({ theme: e, ownerState: t }) => ({
69
70
  display: "grid",
70
71
  gridAutoFlow: "row",
@@ -98,7 +99,7 @@ const a = {
98
99
  }),
99
100
  /**
100
101
  * ******************************************************************
101
- * Elemento de la leyenda (Grid).
102
+ * Legend item (Grid).
102
103
  * ******************************************************************
103
104
  */
104
105
  legendItem: ({ theme: e }) => ({
@@ -112,7 +113,7 @@ const a = {
112
113
  }),
113
114
  /**
114
115
  * ******************************************************************
115
- * Punto de color del elemento de la leyenda.
116
+ * Color dot of the legend item.
116
117
  * ******************************************************************
117
118
  */
118
119
  legendItemColor: ({ theme: e, ownerState: t }) => ({
@@ -124,7 +125,7 @@ const a = {
124
125
  }),
125
126
  /**
126
127
  * ******************************************************************
127
- * Contenedor de texto del elemento de la leyenda.
128
+ * Text container of the legend item.
128
129
  * ******************************************************************
129
130
  */
130
131
  legendItemTextContainer: ({ theme: e }) => ({
@@ -136,7 +137,7 @@ const a = {
136
137
  }),
137
138
  /**
138
139
  * ******************************************************************
139
- * Contenedor de texto sub del elemento de la leyenda.
140
+ * Sub text container of the legend item.
140
141
  * ******************************************************************
141
142
  */
142
143
  legendItemTextSubContainer: ({ theme: e }) => ({
@@ -147,7 +148,7 @@ const a = {
147
148
  }),
148
149
  /**
149
150
  * ******************************************************************
150
- * Nombre del elemento de la leyenda.
151
+ * Name of the legend item.
151
152
  * ******************************************************************
152
153
  */
153
154
  legendItemName: ({ theme: e, ownerState: t }) => ({
@@ -159,7 +160,7 @@ const a = {
159
160
  }),
160
161
  /**
161
162
  * ******************************************************************
162
- * Badge de valor del elemento de la leyenda.
163
+ * Value badge of the legend item.
163
164
  * ******************************************************************
164
165
  */
165
166
  legendItemValueBadge: ({ theme: e, ownerState: t }) => ({
@@ -176,7 +177,7 @@ const a = {
176
177
  }),
177
178
  /**
178
179
  * ******************************************************************
179
- * Categoría del elemento de la leyenda.
180
+ * Category of the legend item.
180
181
  * ******************************************************************
181
182
  */
182
183
  legendItemCategory: ({ theme: e, ownerState: t }) => ({
@@ -1,7 +1,7 @@
1
1
  import { PieChartData } from '../types';
2
2
  import { Theme } from '@mui/material/styles';
3
3
  /**
4
- * Construye la configuración de opciones de ECharts para el gráfico de pastel desde los datos y el tema.
4
+ * Builds the ECharts options configuration for the pie chart from data and theme.
5
5
  */
6
6
  export declare function generateOptions(data: PieChartData[], theme: Theme): {
7
7
  baseOption: {
@@ -1,8 +1,8 @@
1
1
  import { default as ReactECharts } from 'echarts-for-react';
2
2
  /**
3
- * Custom hook para redimensionar el gráfico cuando el tamaño del contenedor cambia
4
- * @param chartRef - Referencia al elemento del gráfico
5
- * @returns Referencia al elemento padre del gráfico
3
+ * Custom hook to resize the chart when the container size changes.
4
+ * @param chartRef - Reference to the chart element
5
+ * @returns Reference setter for the chart parent element
6
6
  */
7
7
  export declare function useChartResize(chartRef: React.RefObject<ReactECharts | null>): (node: HTMLDivElement | null) => void;
8
8
  //# sourceMappingURL=useChartResize.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { PieProps } from '../types';
2
2
  /**
3
- * Retorna los datos remapeados del gráfico de pastel y las opciones de ECharts para los valores dados y el tema actual.
3
+ * Returns the remapped pie chart data and ECharts options for the given values and current theme.
4
4
  */
5
5
  export declare function usePieChartData(values: PieProps['values']): {
6
6
  data: import('..').PieChartData[];
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Nombres de los slots para el componente de gráfico circular (Pie chart).
3
- * Deben coincidir con las claves en Pie.styles.ts.
2
+ * Slot names for the pie chart component.
3
+ * Must match the keys in Pie.styles.ts.
4
4
  */
5
5
  export declare enum PieSlots {
6
6
  pieRoot = "pieRoot",
@@ -1,12 +1,12 @@
1
1
  import { CustomLegendProps } from './types';
2
2
  /**
3
- * Componente CustomLegend para el gráfico de pastel (Pie chart). Muestra las etiquetas y valores de los segmentos.
4
- * Los elementos se disponen en una fila cuando hay suficiente espacio y se envuelven a la siguiente línea (en una pila vertical) cuando no lo hay.
5
- * @param data - Datos para el gráfico
6
- * @param onLegendClick - Función para manejar el clic en la leyenda
7
- * @param selectedLegendName - Nombre de la leyenda seleccionada
8
- * @param size - Tamaño del componente
9
- * @returns Componente CustomLegend
3
+ * CustomLegend component for the pie chart. Displays segment labels and values.
4
+ * Items are laid out in a row when there is enough space and wrap to the next line (vertical stack) when not.
5
+ * @param data - Data for the chart
6
+ * @param onLegendClick - Handler for legend click
7
+ * @param selectedLegendName - Name of the selected legend
8
+ * @param size - Component size
9
+ * @returns CustomLegend component
10
10
  */
11
11
  export declare function CustomLegend({ data, size }: CustomLegendProps): import("@emotion/react/jsx-runtime").JSX.Element[];
12
12
  //# sourceMappingURL=CustomLegend.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { Sizes } from '@m4l/styles';
2
2
  import { PieChartData } from '../../types';
3
3
  /**
4
- * Props para el subcomponente CustomLegend.
4
+ * Props for the CustomLegend subcomponent.
5
5
  */
6
6
  export interface CustomLegendProps {
7
7
  data: PieChartData[];
@@ -4,44 +4,44 @@ import { PIE_KEY_COMPONENT } from './constants';
4
4
  import { M4LOverridesStyleRules } from '@m4l/components';
5
5
  import { Theme } from '@mui/material/styles';
6
6
  /**
7
- * Item para el gráfico de Pie (API shape).
7
+ * Item for the Pie chart (API shape).
8
8
  */
9
9
  export interface PieValueItem {
10
- /** Muestra el nombre de la categoría. */
10
+ /** Displays the category name. */
11
11
  title: string;
12
- /** Muestra el valor formateado de la categoría. */
12
+ /** Displays the formatted value of the category. */
13
13
  v: string;
14
- /** Muestra el valor numérico de la categoría. */
14
+ /** Displays the numeric value of the category. */
15
15
  r: number;
16
- /** Muestra el color de la categoría. */
16
+ /** Displays the category color. */
17
17
  palletColor: string;
18
18
  }
19
19
  /**
20
- * Props para el componente de gráfico de Pie.
20
+ * Props for the Pie chart component.
21
21
  */
22
22
  export interface PieProps {
23
- /** Valores del gráfico (nombre, valor formateado, valor numérico, color). */
23
+ /** Chart values (name, formatted value, numeric value, color). */
24
24
  values: PieValueItem[];
25
- /** Tamaño del componente. */
25
+ /** Component size. */
26
26
  size?: Extract<Sizes, 'small' | 'medium'>;
27
27
  }
28
28
  /**
29
- * Datos para el gráfico de Pie (nombre, valor, itemStyle).
29
+ * Data for the Pie chart (name, value, itemStyle).
30
30
  */
31
31
  export interface PieChartData {
32
- /** Muestra el nombre de la categoría. */
32
+ /** Displays the category name. */
33
33
  name: string;
34
- /** Muestra el valor numérico de la categoría. */
34
+ /** Displays the numeric value of the category. */
35
35
  value: number;
36
- /** Muestra el valor formateado de la categoría. */
36
+ /** Displays the formatted value of the category. */
37
37
  valueFormatted: string;
38
- /** Muestra el color de la categoría. */
38
+ /** Displays the category color. */
39
39
  itemStyle: {
40
40
  color: string;
41
41
  };
42
- /** Muestra el color de la categoría. */
42
+ /** Displays the category color. */
43
43
  colorName: string;
44
- /** Muestra el largo de los datos. */
44
+ /** Displays the data length. */
45
45
  lenght: number;
46
46
  }
47
47
  export type PieOwnerState = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/Pie/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC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IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,YAAY,GAAI,MAAM,OAAO,QAAQ,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,sBAAsB,CAAC,YAAY,EAAE,OAAO,iBAAiB,EAAE,KAAK,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/widgets",
3
- "version": "0.0.2-beta-add-widget-piechart.0",
3
+ "version": "0.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,9 +24,6 @@
24
24
  "peerDependencies": {
25
25
  "@emotion/react": "11.14.0",
26
26
  "@emotion/styled": "11.14.1",
27
- "@mui/material": "^5.0.0",
28
- "echarts": "^6.0.0",
29
- "echarts-for-react": "^3.0.0",
30
27
  "react": "^18.0.0 || ^19.0.0",
31
28
  "react-dom": "^18.0.0 || ^19.0.0"
32
29
  },