next-recomponents 2.0.20 → 2.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -82,6 +82,8 @@ interface TableProps {
82
82
  footer?: FooterType;
83
83
  symbols?: any;
84
84
  currentCoin?: string;
85
+ className?: string;
86
+ fontSize?: string;
85
87
  [key: string]: any;
86
88
  }
87
89
  declare function Table(props: TableProps): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -82,6 +82,8 @@ interface TableProps {
82
82
  footer?: FooterType;
83
83
  symbols?: any;
84
84
  currentCoin?: string;
85
+ className?: string;
86
+ fontSize?: string;
85
87
  [key: string]: any;
86
88
  }
87
89
  declare function Table(props: TableProps): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -35845,13 +35845,21 @@ function useColumns(rows, currentCoin, options) {
35845
35845
  if (`${value}`.match(isDate)) {
35846
35846
  return value.toString().split("T")[0].split("-").reverse().join("/");
35847
35847
  }
35848
+ const splited = `${value}`.split(".");
35849
+ const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
35850
+ if (hasDecimals) {
35851
+ return [
35852
+ currentCoin,
35853
+ (+`${value}`).toLocaleString("en-US", {
35854
+ minimumFractionDigits: 2,
35855
+ maximumFractionDigits: 2
35856
+ })
35857
+ ].join(" ");
35858
+ }
35848
35859
  const isNumber = typeof value === "number";
35849
35860
  if (isNumber) {
35850
35861
  if (isNaN(value)) return value;
35851
- return currentCoin + " " + value.toLocaleString("en-US", {
35852
- minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
35853
- maximumFractionDigits: value % 1 !== 0 ? 2 : 0
35854
- });
35862
+ return value;
35855
35863
  }
35856
35864
  return value;
35857
35865
  },
@@ -35913,7 +35921,9 @@ function IHTable({
35913
35921
  header,
35914
35922
  hideColumns = [],
35915
35923
  footer = {},
35916
- currentCoin = "$"
35924
+ currentCoin = "$",
35925
+ fontSize = "1rem",
35926
+ className
35917
35927
  }) {
35918
35928
  var _a;
35919
35929
  if (modal && onSelect)
@@ -35999,12 +36009,21 @@ function IHTable({
35999
36009
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
36000
36010
  import_x_data_grid.DataGrid,
36001
36011
  {
36012
+ className,
36002
36013
  rows,
36003
36014
  columns,
36004
36015
  checkboxSelection: Boolean(onSelect),
36005
36016
  rowSelectionModel: selectedRows,
36006
36017
  onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
36007
36018
  sx: {
36019
+ fontSize,
36020
+ // equivalente a text-xs
36021
+ "& .MuiDataGrid-cell": {
36022
+ fontSize
36023
+ },
36024
+ "& .MuiDataGrid-columnHeader": {
36025
+ fontSize
36026
+ },
36008
36027
  "& .MuiDataGrid-cell--editable": {
36009
36028
  backgroundColor: "#c6d8f0",
36010
36029
  fontWeight: 500
@@ -36991,15 +37010,21 @@ function PopupOverlay({
36991
37010
  iconText: c.iconText
36992
37011
  }
36993
37012
  ),
36994
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "relative w-full flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
36995
- Button,
37013
+ !(popup == null ? void 0 : popup.icons) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
37014
+ "div",
36996
37015
  {
36997
- color: "danger",
36998
- className: "fixed text-xs font-bold",
36999
- onClick: (e) => onClose(false),
37000
- children: "x"
37016
+ className: `w-full h-12 rounded-full flex items-start justify-end`,
37017
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
37018
+ Button,
37019
+ {
37020
+ color: "danger",
37021
+ className: "fixed text-xs font-bold",
37022
+ onClick: (e) => onClose(false),
37023
+ children: "x"
37024
+ }
37025
+ )
37001
37026
  }
37002
- ) }),
37027
+ ),
37003
37028
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
37004
37029
  "div",
37005
37030
  {
@@ -37079,7 +37104,7 @@ function usePopup() {
37079
37104
  [open]
37080
37105
  );
37081
37106
  const modal = (0, import_react9.useCallback)(
37082
- (message, color = "primary", icons = true, full = false) => new Promise(
37107
+ (message, color = "primary", icons = false, full = false) => new Promise(
37083
37108
  (resolve) => open({
37084
37109
  type: "modal",
37085
37110
  message,
package/dist/index.mjs CHANGED
@@ -35825,13 +35825,21 @@ function useColumns(rows, currentCoin, options) {
35825
35825
  if (`${value}`.match(isDate)) {
35826
35826
  return value.toString().split("T")[0].split("-").reverse().join("/");
35827
35827
  }
35828
+ const splited = `${value}`.split(".");
35829
+ const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
35830
+ if (hasDecimals) {
35831
+ return [
35832
+ currentCoin,
35833
+ (+`${value}`).toLocaleString("en-US", {
35834
+ minimumFractionDigits: 2,
35835
+ maximumFractionDigits: 2
35836
+ })
35837
+ ].join(" ");
35838
+ }
35828
35839
  const isNumber = typeof value === "number";
35829
35840
  if (isNumber) {
35830
35841
  if (isNaN(value)) return value;
35831
- return currentCoin + " " + value.toLocaleString("en-US", {
35832
- minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
35833
- maximumFractionDigits: value % 1 !== 0 ? 2 : 0
35834
- });
35842
+ return value;
35835
35843
  }
35836
35844
  return value;
35837
35845
  },
@@ -35893,7 +35901,9 @@ function IHTable({
35893
35901
  header,
35894
35902
  hideColumns = [],
35895
35903
  footer = {},
35896
- currentCoin = "$"
35904
+ currentCoin = "$",
35905
+ fontSize = "1rem",
35906
+ className
35897
35907
  }) {
35898
35908
  var _a;
35899
35909
  if (modal && onSelect)
@@ -35979,12 +35989,21 @@ function IHTable({
35979
35989
  /* @__PURE__ */ jsx6(
35980
35990
  DataGrid,
35981
35991
  {
35992
+ className,
35982
35993
  rows,
35983
35994
  columns,
35984
35995
  checkboxSelection: Boolean(onSelect),
35985
35996
  rowSelectionModel: selectedRows,
35986
35997
  onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
35987
35998
  sx: {
35999
+ fontSize,
36000
+ // equivalente a text-xs
36001
+ "& .MuiDataGrid-cell": {
36002
+ fontSize
36003
+ },
36004
+ "& .MuiDataGrid-columnHeader": {
36005
+ fontSize
36006
+ },
35988
36007
  "& .MuiDataGrid-cell--editable": {
35989
36008
  backgroundColor: "#c6d8f0",
35990
36009
  fontWeight: 500
@@ -36977,15 +36996,21 @@ function PopupOverlay({
36977
36996
  iconText: c.iconText
36978
36997
  }
36979
36998
  ),
36980
- /* @__PURE__ */ jsx14("div", { className: "relative w-full flex justify-end", children: /* @__PURE__ */ jsx14(
36981
- Button,
36999
+ !(popup == null ? void 0 : popup.icons) && /* @__PURE__ */ jsx14(
37000
+ "div",
36982
37001
  {
36983
- color: "danger",
36984
- className: "fixed text-xs font-bold",
36985
- onClick: (e) => onClose(false),
36986
- children: "x"
37002
+ className: `w-full h-12 rounded-full flex items-start justify-end`,
37003
+ children: /* @__PURE__ */ jsx14(
37004
+ Button,
37005
+ {
37006
+ color: "danger",
37007
+ className: "fixed text-xs font-bold",
37008
+ onClick: (e) => onClose(false),
37009
+ children: "x"
37010
+ }
37011
+ )
36987
37012
  }
36988
- ) }),
37013
+ ),
36989
37014
  /* @__PURE__ */ jsx14(
36990
37015
  "div",
36991
37016
  {
@@ -37065,7 +37090,7 @@ function usePopup() {
37065
37090
  [open]
37066
37091
  );
37067
37092
  const modal = useCallback(
37068
- (message, color = "primary", icons = true, full = false) => new Promise(
37093
+ (message, color = "primary", icons = false, full = false) => new Promise(
37069
37094
  (resolve) => open({
37070
37095
  type: "modal",
37071
37096
  message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/pop/index.tsx CHANGED
@@ -56,7 +56,7 @@ export default function usePopup() {
56
56
  (
57
57
  message: ReactNode,
58
58
  color: PopupColor = "primary",
59
- icons: boolean = true,
59
+ icons: boolean = false,
60
60
  full: boolean = false,
61
61
  ): Promise<void> =>
62
62
  new Promise((resolve) =>
@@ -45,8 +45,10 @@ export function PopupOverlay({
45
45
  iconText={c.iconText}
46
46
  />
47
47
  )}
48
- {
49
- <div className="relative w-full flex justify-end">
48
+ {!popup?.icons && (
49
+ <div
50
+ className={`w-full h-12 rounded-full flex items-start justify-end`}
51
+ >
50
52
  <Button
51
53
  color="danger"
52
54
  className="fixed text-xs font-bold"
@@ -55,7 +57,7 @@ export function PopupOverlay({
55
57
  x
56
58
  </Button>
57
59
  </div>
58
- }
60
+ )}
59
61
  <div
60
62
  className={"text-gray-800 text-[15px] font-medium leading-snug "}
61
63
  >
@@ -5,6 +5,7 @@ import { Box, Dialog } from "@mui/material";
5
5
  import React, { useEffect, useMemo, useRef, useState } from "react";
6
6
  import useExcel from "../use-excel";
7
7
  import Button from "../button";
8
+ import regularExpresions from "../regular-expresions";
8
9
 
9
10
  // ─── Types ────────────────────────────────────────────────────────────────────
10
11
 
@@ -37,6 +38,8 @@ interface TableProps {
37
38
  footer?: FooterType;
38
39
  symbols?: any;
39
40
  currentCoin?: string;
41
+ className?: string;
42
+ fontSize?: string;
40
43
  [key: string]: any;
41
44
  }
42
45
 
@@ -282,18 +285,27 @@ function useColumns(
282
285
  .join("/");
283
286
  }
284
287
 
288
+ const splited = `${value}`.split(".");
289
+ const hasDecimals =
290
+ splited.length == 2 &&
291
+ splited.every((v: any) => `${v}`.match(regularExpresions.number));
292
+
293
+ if (hasDecimals) {
294
+ return [
295
+ currentCoin,
296
+ (+`${value}`).toLocaleString("en-US", {
297
+ minimumFractionDigits: 2,
298
+ maximumFractionDigits: 2,
299
+ }),
300
+ ].join(" ");
301
+ }
302
+
285
303
  const isNumber = typeof value === "number";
286
304
 
287
305
  if (isNumber) {
288
306
  if (isNaN(value)) return value;
289
- return (
290
- currentCoin +
291
- " " +
292
- value.toLocaleString("en-US", {
293
- minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
294
- maximumFractionDigits: value % 1 !== 0 ? 2 : 0,
295
- })
296
- );
307
+
308
+ return value;
297
309
  }
298
310
 
299
311
  return value;
@@ -359,6 +371,8 @@ function IHTable({
359
371
  hideColumns = [],
360
372
  footer = {},
361
373
  currentCoin = "$",
374
+ fontSize = "1rem",
375
+ className,
362
376
  }: TableProps) {
363
377
  if (modal && onSelect)
364
378
  throw new Error("Solo se puede usar modal o onSelect por separado");
@@ -448,12 +462,20 @@ function IHTable({
448
462
  )}
449
463
 
450
464
  <DataGrid
465
+ className={className}
451
466
  rows={rows}
452
467
  columns={columns as any}
453
468
  checkboxSelection={Boolean(onSelect)}
454
469
  rowSelectionModel={selectedRows}
455
470
  onRowSelectionModelChange={!modal ? setSelectedRows : undefined}
456
471
  sx={{
472
+ fontSize, // equivalente a text-xs
473
+ "& .MuiDataGrid-cell": {
474
+ fontSize,
475
+ },
476
+ "& .MuiDataGrid-columnHeader": {
477
+ fontSize,
478
+ },
457
479
  "& .MuiDataGrid-cell--editable": {
458
480
  backgroundColor: "#c6d8f0",
459
481
  fontWeight: 500,