neogestify-ui-components 2.1.0 → 2.2.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.
Files changed (36) hide show
  1. package/README.md +46 -1
  2. package/dist/components/ElementLibraryBuilder/index.d.mts +5 -0
  3. package/dist/components/ElementLibraryBuilder/index.d.ts +5 -0
  4. package/dist/components/ElementLibraryBuilder/index.js +689 -0
  5. package/dist/components/ElementLibraryBuilder/index.js.map +1 -0
  6. package/dist/components/ElementLibraryBuilder/index.mjs +687 -0
  7. package/dist/components/ElementLibraryBuilder/index.mjs.map +1 -0
  8. package/dist/components/VenueMapEditor/index.d.mts +18 -2
  9. package/dist/components/VenueMapEditor/index.d.ts +18 -2
  10. package/dist/components/VenueMapEditor/index.js +75 -3
  11. package/dist/components/VenueMapEditor/index.js.map +1 -1
  12. package/dist/components/VenueMapEditor/index.mjs +75 -4
  13. package/dist/components/VenueMapEditor/index.mjs.map +1 -1
  14. package/dist/components/html/index.d.mts +37 -4
  15. package/dist/components/html/index.d.ts +37 -4
  16. package/dist/components/html/index.js +135 -12
  17. package/dist/components/html/index.js.map +1 -1
  18. package/dist/components/html/index.mjs +135 -12
  19. package/dist/components/html/index.mjs.map +1 -1
  20. package/dist/index.d.mts +2 -1
  21. package/dist/index.d.ts +2 -1
  22. package/dist/index.js +603 -15
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +602 -16
  25. package/dist/index.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/src/components/ElementLibraryBuilder/builder.tsx +400 -0
  28. package/src/components/ElementLibraryBuilder/index.ts +1 -0
  29. package/src/components/VenueMapEditor/components/ElementNode.tsx +22 -0
  30. package/src/components/VenueMapEditor/components/PropertiesPanel.tsx +17 -4
  31. package/src/components/VenueMapEditor/components/Toolbar.tsx +14 -4
  32. package/src/components/VenueMapEditor/index.ts +2 -0
  33. package/src/components/VenueMapEditor/types.ts +11 -1
  34. package/src/components/VenueMapEditor/utils/svgParser.ts +33 -0
  35. package/src/components/html/Table.tsx +205 -38
  36. package/src/index.ts +1 -0
@@ -1,4 +1,4 @@
1
- import React__default, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes } from 'react';
1
+ import React__default, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes, CSSProperties } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -51,15 +51,48 @@ interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'siz
51
51
  }
52
52
  declare const Select: FC<SelectProps>;
53
53
 
54
+ type TableVariant = 'default' | 'striped' | 'bordered' | 'minimal' | 'custom';
55
+ type TableSize = 'sm' | 'md' | 'lg';
56
+ interface ColumnDef {
57
+ /** Contenido del encabezado */
58
+ header: ReactNode;
59
+ /** Clase CSS adicional para toda la columna (th + td) */
60
+ className?: string;
61
+ /** Alinear el contenido de esta columna */
62
+ align?: 'left' | 'center' | 'right';
63
+ }
54
64
  interface TableProps {
55
- headers: ReactNode[];
65
+ /**
66
+ * Definición de columnas con encabezado y opciones por columna.
67
+ * Si pasas strings simples, los usa como encabezados sin configuración extra.
68
+ */
69
+ columns: (ColumnDef | ReactNode)[];
70
+ /** Filas de la tabla. Cada fila es un arreglo de celdas. */
56
71
  rows: ReactNode[][];
57
- variant?: 'default' | 'custom';
72
+ /** Estilo visual de la tabla. Default: 'default' */
73
+ variant?: TableVariant;
74
+ /** Tamaño de padding de celdas. Default: 'md' */
75
+ size?: TableSize;
76
+ /** Clase CSS adicional para el wrapper `<div>` externo */
58
77
  className?: string;
78
+ /** Clase CSS adicional para el `<table>` */
79
+ tableClassName?: string;
80
+ /** Clase CSS adicional para cada `<th>` */
59
81
  thClassName?: string;
82
+ /** Clase CSS adicional para cada `<td>` */
60
83
  tdClassName?: string;
84
+ /** Clase CSS adicional para cada `<tr>` del body */
85
+ trClassName?: string | ((rowIndex: number) => string);
86
+ /** Texto o nodo a mostrar cuando `rows` está vacío */
87
+ emptyState?: ReactNode;
88
+ /** Callback al hacer click en una fila */
89
+ onRowClick?: (rowIndex: number) => void;
90
+ /** Si true, no muestra thead */
91
+ hideHeader?: boolean;
92
+ /** Estilos inline para el `<table>` */
93
+ style?: CSSProperties;
61
94
  }
62
- declare function Table({ headers, rows, variant, className, thClassName, tdClassName }: TableProps): react_jsx_runtime.JSX.Element;
95
+ declare function Table({ columns, rows, variant, size, className, tableClassName, thClassName, tdClassName, trClassName, emptyState, onRowClick, hideHeader, style, }: TableProps): react_jsx_runtime.JSX.Element;
63
96
 
64
97
  interface ModalProps {
65
98
  onClose: () => void;
@@ -1,4 +1,4 @@
1
- import React__default, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes } from 'react';
1
+ import React__default, { FC, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, FormHTMLAttributes, FormEvent, SelectHTMLAttributes, CSSProperties } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -51,15 +51,48 @@ interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'siz
51
51
  }
52
52
  declare const Select: FC<SelectProps>;
53
53
 
54
+ type TableVariant = 'default' | 'striped' | 'bordered' | 'minimal' | 'custom';
55
+ type TableSize = 'sm' | 'md' | 'lg';
56
+ interface ColumnDef {
57
+ /** Contenido del encabezado */
58
+ header: ReactNode;
59
+ /** Clase CSS adicional para toda la columna (th + td) */
60
+ className?: string;
61
+ /** Alinear el contenido de esta columna */
62
+ align?: 'left' | 'center' | 'right';
63
+ }
54
64
  interface TableProps {
55
- headers: ReactNode[];
65
+ /**
66
+ * Definición de columnas con encabezado y opciones por columna.
67
+ * Si pasas strings simples, los usa como encabezados sin configuración extra.
68
+ */
69
+ columns: (ColumnDef | ReactNode)[];
70
+ /** Filas de la tabla. Cada fila es un arreglo de celdas. */
56
71
  rows: ReactNode[][];
57
- variant?: 'default' | 'custom';
72
+ /** Estilo visual de la tabla. Default: 'default' */
73
+ variant?: TableVariant;
74
+ /** Tamaño de padding de celdas. Default: 'md' */
75
+ size?: TableSize;
76
+ /** Clase CSS adicional para el wrapper `<div>` externo */
58
77
  className?: string;
78
+ /** Clase CSS adicional para el `<table>` */
79
+ tableClassName?: string;
80
+ /** Clase CSS adicional para cada `<th>` */
59
81
  thClassName?: string;
82
+ /** Clase CSS adicional para cada `<td>` */
60
83
  tdClassName?: string;
84
+ /** Clase CSS adicional para cada `<tr>` del body */
85
+ trClassName?: string | ((rowIndex: number) => string);
86
+ /** Texto o nodo a mostrar cuando `rows` está vacío */
87
+ emptyState?: ReactNode;
88
+ /** Callback al hacer click en una fila */
89
+ onRowClick?: (rowIndex: number) => void;
90
+ /** Si true, no muestra thead */
91
+ hideHeader?: boolean;
92
+ /** Estilos inline para el `<table>` */
93
+ style?: CSSProperties;
61
94
  }
62
- declare function Table({ headers, rows, variant, className, thClassName, tdClassName }: TableProps): react_jsx_runtime.JSX.Element;
95
+ declare function Table({ columns, rows, variant, size, className, tableClassName, thClassName, tdClassName, trClassName, emptyState, onRowClick, hideHeader, style, }: TableProps): react_jsx_runtime.JSX.Element;
63
96
 
64
97
  interface ModalProps {
65
98
  onClose: () => void;
@@ -261,24 +261,147 @@ var Select = ({
261
261
  helperText && /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-sm ${error ? "text-red-600 dark:text-red-400" : "text-gray-500 dark:text-gray-400"}`, children: helperText })
262
262
  ] });
263
263
  };
264
+ function isColumnDef(col) {
265
+ return typeof col === "object" && col !== null && "header" in col;
266
+ }
267
+ function resolveColumn(col) {
268
+ if (isColumnDef(col)) return col;
269
+ return { header: col };
270
+ }
271
+ var ALIGN_CLASS = {
272
+ left: "text-left",
273
+ center: "text-center",
274
+ right: "text-right"
275
+ };
276
+ var SIZE_TH = {
277
+ sm: "px-2 py-1.5 text-xs",
278
+ md: "px-3 py-2.5 text-xs",
279
+ lg: "px-4 py-3.5 text-sm"
280
+ };
281
+ var SIZE_TD = {
282
+ sm: "px-2 py-1.5 text-xs",
283
+ md: "px-3 py-2.5 text-sm",
284
+ lg: "px-4 py-3.5 text-sm"
285
+ };
286
+ var VARIANT_TABLE = {
287
+ default: "w-full min-w-full table-auto",
288
+ striped: "w-full min-w-full table-auto",
289
+ bordered: "w-full min-w-full table-auto border border-gray-300 dark:border-gray-600",
290
+ minimal: "w-full min-w-full table-auto",
291
+ custom: "w-full min-w-full table-auto"
292
+ };
293
+ var VARIANT_THEAD = {
294
+ default: "bg-gray-100 dark:bg-gray-700",
295
+ striped: "bg-gray-100 dark:bg-gray-700",
296
+ bordered: "bg-gray-100 dark:bg-gray-700",
297
+ minimal: "",
298
+ custom: ""
299
+ };
300
+ var VARIANT_TH = {
301
+ default: "font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300",
302
+ striped: "font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300",
303
+ bordered: "font-semibold uppercase tracking-wider text-gray-600 dark:text-gray-300 border border-gray-300 dark:border-gray-600",
304
+ minimal: "font-semibold text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-700",
305
+ custom: ""
306
+ };
307
+ var VARIANT_TR = {
308
+ default: () => "bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/60 transition-colors",
309
+ striped: (i) => `${i % 2 === 0 ? "bg-white dark:bg-gray-800" : "bg-gray-50 dark:bg-gray-700/40"} hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-colors`,
310
+ bordered: () => "bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700/60 transition-colors",
311
+ minimal: () => "hover:bg-gray-50 dark:hover:bg-gray-800/60 transition-colors",
312
+ custom: () => ""
313
+ };
314
+ var VARIANT_TD = {
315
+ default: "text-gray-700 dark:text-gray-300",
316
+ striped: "text-gray-700 dark:text-gray-300",
317
+ bordered: "text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-gray-700",
318
+ minimal: "text-gray-700 dark:text-gray-300 border-b border-gray-100 dark:border-gray-800",
319
+ custom: ""
320
+ };
321
+ var VARIANT_TBODY_DIVIDER = {
322
+ default: "divide-y divide-gray-200 dark:divide-gray-700",
323
+ striped: "",
324
+ bordered: "",
325
+ minimal: "",
326
+ custom: ""
327
+ };
264
328
  function Table({
265
- headers,
329
+ columns,
266
330
  rows,
267
331
  variant = "default",
332
+ size = "md",
268
333
  className = "",
334
+ tableClassName = "",
269
335
  thClassName = "",
270
- tdClassName = ""
336
+ tdClassName = "",
337
+ trClassName,
338
+ emptyState,
339
+ onRowClick,
340
+ hideHeader = false,
341
+ style
271
342
  }) {
272
- const baseTableClass = variant === "default" ? "w-full table-auto border-collapse border border-gray-300 dark:border-gray-600 min-w-full" : "";
273
- const baseThClass = variant === "default" ? "border border-gray-300 dark:border-gray-600 px-4 py-2 text-left text-gray-900 dark:text-white" : "";
274
- const baseTdClass = variant === "default" ? "border border-gray-300 dark:border-gray-600 px-4 py-2 text-gray-900 dark:text-white" : "";
275
- const tableClass = `${baseTableClass} ${className}`.trim();
276
- const thClass = `${baseThClass} ${thClassName}`.trim();
277
- const tdClass = `${baseTdClass} ${tdClassName}`.trim();
278
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto w-full", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: tableClass, children: [
279
- /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { className: variant === "default" ? "bg-gray-100 dark:bg-gray-700" : "", children: headers.map((header, index) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: thClass, children: header }, index)) }) }),
280
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: variant === "default" ? "hover:bg-gray-50 dark:hover:bg-gray-600" : "", children: row.map((cell, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx("td", { className: tdClass, children: cell }, cellIndex)) }, rowIndex)) })
281
- ] }) });
343
+ const cols = columns.map(resolveColumn);
344
+ const resolvedTrClass = (i) => {
345
+ const variantCls = VARIANT_TR[variant](i);
346
+ const clickCls = onRowClick ? "cursor-pointer" : "";
347
+ const customCls = typeof trClassName === "function" ? trClassName(i) : trClassName ?? "";
348
+ return `${variantCls} ${clickCls} ${customCls}`.trim();
349
+ };
350
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `overflow-x-auto w-full ${className}`.trim(), children: /* @__PURE__ */ jsxRuntime.jsxs(
351
+ "table",
352
+ {
353
+ className: `${VARIANT_TABLE[variant]} ${tableClassName}`.trim(),
354
+ style,
355
+ children: [
356
+ !hideHeader && /* @__PURE__ */ jsxRuntime.jsx("thead", { className: VARIANT_THEAD[variant], children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: cols.map((col, i) => /* @__PURE__ */ jsxRuntime.jsx(
357
+ "th",
358
+ {
359
+ className: [
360
+ SIZE_TH[size],
361
+ VARIANT_TH[variant],
362
+ ALIGN_CLASS[col.align ?? "left"],
363
+ col.className ?? "",
364
+ thClassName
365
+ ].filter(Boolean).join(" "),
366
+ children: col.header
367
+ },
368
+ i
369
+ )) }) }),
370
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: VARIANT_TBODY_DIVIDER[variant], children: rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
371
+ "td",
372
+ {
373
+ colSpan: cols.length,
374
+ className: `${SIZE_TD[size]} text-center text-gray-400 dark:text-gray-500 py-8`,
375
+ children: emptyState ?? "Sin datos"
376
+ }
377
+ ) }) : rows.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(
378
+ "tr",
379
+ {
380
+ className: resolvedTrClass(rowIndex),
381
+ onClick: onRowClick ? () => onRowClick(rowIndex) : void 0,
382
+ children: row.map((cell, cellIndex) => {
383
+ const col = cols[cellIndex];
384
+ return /* @__PURE__ */ jsxRuntime.jsx(
385
+ "td",
386
+ {
387
+ className: [
388
+ SIZE_TD[size],
389
+ VARIANT_TD[variant],
390
+ ALIGN_CLASS[col?.align ?? "left"],
391
+ col?.className ?? "",
392
+ tdClassName
393
+ ].filter(Boolean).join(" "),
394
+ children: cell
395
+ },
396
+ cellIndex
397
+ );
398
+ })
399
+ },
400
+ rowIndex
401
+ )) })
402
+ ]
403
+ }
404
+ ) });
282
405
  }
283
406
  var Modal = react.forwardRef(({
284
407
  onClose,