lkd-web-kit 0.10.1 → 0.10.3

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 (63) hide show
  1. package/.agents/skills/mantine-combobox/SKILL.md +73 -0
  2. package/.agents/skills/mantine-combobox/references/api.md +199 -0
  3. package/.agents/skills/mantine-combobox/references/patterns.md +279 -0
  4. package/.agents/skills/mantine-custom-components/SKILL.md +112 -0
  5. package/.agents/skills/mantine-custom-components/references/api.md +407 -0
  6. package/.agents/skills/mantine-custom-components/references/patterns.md +431 -0
  7. package/.agents/skills/publish-lkd-web-kit/SKILL.md +172 -0
  8. package/.agents/skills/publish-lkd-web-kit/agents/openai.yaml +4 -0
  9. package/.agents/skills/publish-lkd-web-kit/references/npm-trusted-publishing.md +82 -0
  10. package/.agents/skills/update-lkd-dependencies/SKILL.md +88 -0
  11. package/.agents/skills/update-lkd-dependencies/agents/openai.yaml +4 -0
  12. package/.agents/skills/update-lkd-dependencies/scripts/collect-npm-metadata.mjs +73 -0
  13. package/dist/components/MyTable/MyTable.cjs +172 -0
  14. package/dist/components/MyTable/MyTable.d.ts +18 -0
  15. package/dist/components/MyTable/MyTable.d.ts.map +1 -0
  16. package/dist/components/MyTable/MyTable.js +170 -0
  17. package/dist/components/MyTable/index.d.ts +3 -0
  18. package/dist/components/MyTable/index.d.ts.map +1 -0
  19. package/dist/components/TableWrapper/TableWrapper.cjs +13 -0
  20. package/dist/components/TableWrapper/TableWrapper.d.ts +8 -0
  21. package/dist/components/TableWrapper/TableWrapper.d.ts.map +1 -0
  22. package/dist/components/TableWrapper/TableWrapper.js +11 -0
  23. package/dist/components/TableWrapper/TableWrapperFooter.cjs +11 -0
  24. package/dist/components/TableWrapper/TableWrapperFooter.d.ts +5 -0
  25. package/dist/components/TableWrapper/TableWrapperFooter.d.ts.map +1 -0
  26. package/dist/components/TableWrapper/TableWrapperFooter.js +9 -0
  27. package/dist/components/TableWrapper/TableWrapperHeader.cjs +11 -0
  28. package/dist/components/TableWrapper/TableWrapperHeader.d.ts +5 -0
  29. package/dist/components/TableWrapper/TableWrapperHeader.d.ts.map +1 -0
  30. package/dist/components/TableWrapper/TableWrapperHeader.js +9 -0
  31. package/dist/components/TableWrapper/TableWrapperPagination.cjs +31 -0
  32. package/dist/components/TableWrapper/TableWrapperPagination.d.ts +16 -0
  33. package/dist/components/TableWrapper/TableWrapperPagination.d.ts.map +1 -0
  34. package/dist/components/TableWrapper/TableWrapperPagination.js +30 -0
  35. package/dist/components/TableWrapper/TableWrapperTitle.cjs +11 -0
  36. package/dist/components/TableWrapper/TableWrapperTitle.d.ts +5 -0
  37. package/dist/components/TableWrapper/TableWrapperTitle.d.ts.map +1 -0
  38. package/dist/components/TableWrapper/TableWrapperTitle.js +9 -0
  39. package/dist/components/TableWrapper/index.d.ts +11 -0
  40. package/dist/components/TableWrapper/index.d.ts.map +1 -0
  41. package/dist/components/index.d.ts +2 -0
  42. package/dist/components/index.d.ts.map +1 -1
  43. package/dist/index.cjs +14 -0
  44. package/dist/index.js +8 -1
  45. package/dist/mantine/breakpoints-with-px.cjs +3 -2
  46. package/dist/mantine/breakpoints-with-px.d.ts +2 -1
  47. package/dist/mantine/breakpoints-with-px.d.ts.map +1 -1
  48. package/dist/mantine/breakpoints-with-px.js +3 -2
  49. package/dist/mantine/create-lkd-theme.cjs +7 -0
  50. package/dist/mantine/create-lkd-theme.d.ts +3 -0
  51. package/dist/mantine/create-lkd-theme.d.ts.map +1 -0
  52. package/dist/mantine/create-lkd-theme.js +6 -0
  53. package/dist/mantine/index.d.ts +1 -0
  54. package/dist/mantine/index.d.ts.map +1 -1
  55. package/package.json +5 -3
  56. package/scripts/{install-codex-skills.mjs → install-agent-skills.mjs} +1 -1
  57. package/codex/skills/create-modal-component/SKILL.md +0 -168
  58. package/codex/skills/create-modal-component/agents/openai.yaml +0 -4
  59. package/codex/skills/create-svg-icon/SKILL.md +0 -41
  60. package/codex/skills/create-svg-icon/agents/openai.yaml +0 -3
  61. package/codex/skills/create-table-component/SKILL.md +0 -187
  62. package/codex/skills/create-table-component/agents/openai.yaml +0 -3
  63. package/codex/skills/rhf-lkd-forms/SKILL.md +0 -186
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: update-lkd-dependencies
3
+ description: Audita y actualiza con cautela solo las peerDependencies de lkd-web-kit. Usar cuando el usuario pida revisar versiones disponibles, actualizar peers del paquete, evaluar breaking changes de React/Mantine/Next/Zod/React Hook Form/TanStack/Ky, sincronizar package-lock o preparar una recomendacion SemVer sin publicar.
4
+ ---
5
+
6
+ # Actualizar dependencias LKD
7
+
8
+ ## Principio
9
+
10
+ Trabaja como auditor de compatibilidad de una libreria React corporativa. No actualices a ciegas: primero descubre versiones, peers, engines y riesgos; despues edita de forma acotada y valida el paquete.
11
+
12
+ Esta skill no sube la version de `lkd-web-kit`, no crea tags y no publica en npm. Para publicar usa `$publish-lkd-web-kit`.
13
+
14
+ Esta skill es solo para `peerDependencies`. No actualices `devDependencies`, `dependencies` ni tooling interno salvo que sea estrictamente necesario para que el lockfile resuelva los peers actualizados y el usuario lo haya pedido.
15
+
16
+ ## Contexto obligatorio
17
+
18
+ Antes de proponer o editar dependencias, lee:
19
+
20
+ - `AGENTS.md`
21
+ - `package.json`
22
+ - `package-lock.json`
23
+ - `docs/generated/lkd-web-kit.md`
24
+
25
+ Usa `docs/generated/lkd-web-kit.md` como fuente de verdad del catalogo publico de componentes. Si un cambio de dependencia puede afectar props, wrappers Mantine, formularios o hooks publicos, tratalo como riesgo de compatibilidad.
26
+
27
+ ## Auditoria de versiones
28
+
29
+ 1. Identifica todas las entradas de `peerDependencies`.
30
+ 2. Consulta metadata de npm para cada paquete relevante:
31
+
32
+ ```bash
33
+ npm view <pkg> version peerDependencies dependencies engines --json
34
+ ```
35
+
36
+ 3. Para un reporte inicial no mutante, puedes ejecutar:
37
+
38
+ ```bash
39
+ node .agents/skills/update-lkd-dependencies/scripts/collect-npm-metadata.mjs
40
+ ```
41
+
42
+ 4. Actualiza solo a versiones estables publicadas. Evita prereleases, canary, alpha, beta, rc y next salvo instruccion explicita.
43
+ 5. Mantiene alineadas familias peer que deben avanzar juntas: `react`/`react-dom`, paquetes `@mantine/*` y paquetes `@tanstack/*` cuando compartan contrato.
44
+
45
+ ## Politica de riesgo
46
+
47
+ Detente y reporta antes de aplicar si encuentras:
48
+
49
+ - Cambio major en React, Mantine, Next, Zod, React Hook Form, TanStack Query o Ky.
50
+ - Cambio de `engines.node` que exceda el `>=22.12.0` actual o reduzca compatibilidad razonable.
51
+ - Peer ranges incompatibles entre dependencias del kit.
52
+ - Migraciones que obliguen a cambiar APIs publicas, props exportadas, tipos o comportamiento de componentes.
53
+
54
+ Puedes aplicar patch/minor compatibles cuando las pruebas y peers lo respalden. Para majors, aplica solo si el usuario pidio explicitamente aceptar el breaking change o si el analisis demuestra que el rango actual ya era incompatible.
55
+
56
+ Si por un breaking change tuviste que modificar props, componentes, formularios, hooks exportados o utilidades documentadas, regenera `docs/generated/lkd-web-kit.md` siguiendo estrictamente `docs/generate-lkd-web-kit-docs.md`. No edites el documento generado a mano salvo correcciones mecanicas posteriores al diff.
57
+
58
+ ## Edicion y validacion
59
+
60
+ Cuando edites:
61
+
62
+ - Actualiza solo `peerDependencies` en `package.json` y sincroniza `package-lock.json`.
63
+ - Corrige drift de version entre `package.json` y `package-lock.json`; en este repo se ha visto `package.json` en `0.8.4` y lockfile en `0.8.3`.
64
+ - No cambies `version` del paquete salvo que el usuario lo pida explicitamente fuera de esta skill.
65
+ - No ejecutes `npm publish`, no crees tags y no automatices login.
66
+
67
+ Validacion minima:
68
+
69
+ ```bash
70
+ npm install --package-lock-only
71
+ npm run lint
72
+ npm run test
73
+ npm run build
74
+ npm pack --dry-run
75
+ ```
76
+
77
+ Si una validacion falla, arregla solo lo necesario para la actualizacion o reporta el bloqueo con el paquete responsable.
78
+
79
+ ## Reporte final
80
+
81
+ Termina siempre con un resumen en espanol:
82
+
83
+ - Peer dependencies actualizadas.
84
+ - Peer dependencies retenidas y motivo.
85
+ - Breaking changes o riesgos detectados.
86
+ - Si se regenero `docs/generated/lkd-web-kit.md`, indica por que cambio la superficie publica.
87
+ - Validaciones ejecutadas y resultado.
88
+ - Recomendacion SemVer para una futura publicacion: `major`, `minor` o `patch`, con una frase de justificacion.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Actualizar dependencias LKD"
3
+ short_description: "Audita y actualiza peer deps del kit"
4
+ default_prompt: "Usa $update-lkd-dependencies para auditar y actualizar solo las peerDependencies de lkd-web-kit con cautela."
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ import { execFile } from 'node:child_process'
3
+ import { readFile } from 'node:fs/promises'
4
+ import { promisify } from 'node:util'
5
+
6
+ const execFileAsync = promisify(execFile)
7
+ const packageJsonPath = new URL('../../../../package.json', import.meta.url)
8
+ const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'
9
+
10
+ function parseMaybeJson(value) {
11
+ try {
12
+ return JSON.parse(value)
13
+ } catch {
14
+ return value.trim()
15
+ }
16
+ }
17
+
18
+ async function npmView(packageName) {
19
+ const { stdout } = await execFileAsync(
20
+ npmCommand,
21
+ ['view', packageName, 'version', 'peerDependencies', 'dependencies', 'engines', '--json'],
22
+ { shell: process.platform === 'win32', windowsHide: true },
23
+ )
24
+
25
+ return parseMaybeJson(stdout)
26
+ }
27
+
28
+ async function main() {
29
+ const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8'))
30
+ const names = Object.keys(packageJson.peerDependencies ?? {}).sort()
31
+ const results = []
32
+
33
+ for (const name of names) {
34
+ const currentRange = packageJson.peerDependencies?.[name] ?? null
35
+
36
+ try {
37
+ results.push({
38
+ name,
39
+ section: 'peerDependencies',
40
+ currentRange,
41
+ npm: await npmView(name),
42
+ })
43
+ } catch (error) {
44
+ results.push({
45
+ name,
46
+ section: 'peerDependencies',
47
+ currentRange,
48
+ error: error instanceof Error ? error.message : String(error),
49
+ })
50
+ }
51
+ }
52
+
53
+ console.log(
54
+ JSON.stringify(
55
+ {
56
+ package: {
57
+ name: packageJson.name,
58
+ version: packageJson.version,
59
+ engines: packageJson.engines ?? {},
60
+ },
61
+ generatedAt: new Date().toISOString(),
62
+ dependencies: results,
63
+ },
64
+ null,
65
+ 2,
66
+ ),
67
+ )
68
+ }
69
+
70
+ main().catch((error) => {
71
+ console.error(error instanceof Error ? error.message : String(error))
72
+ process.exitCode = 1
73
+ })
@@ -0,0 +1,172 @@
1
+ "use client";
2
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
3
+ let _mantine_core = require("@mantine/core");
4
+ let react = require("react");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ let clsx = require("clsx");
7
+ clsx = require_runtime.__toESM(clsx, 1);
8
+ let _tanstack_react_table = require("@tanstack/react-table");
9
+ //#region src/components/MyTable/MyTable.tsx
10
+ var MyTable = ({ data, columns, highlightOnHover, isLoading, onRowClick, minWidth = 720, emptyMessage = "Sin datos", enableSorting, variant, layout, manualSorting, onSortingChange, sorting, ...props }) => {
11
+ const [theadHeight, setTheadHeight] = (0, react.useState)(0);
12
+ const setTheadRef = (0, react.useCallback)((node) => {
13
+ if (node) setTheadHeight(node.offsetHeight);
14
+ }, []);
15
+ const isSortingEnabled = enableSorting ?? (Boolean(sorting) || Boolean(onSortingChange));
16
+ const table = (0, _tanstack_react_table.useReactTable)({
17
+ data,
18
+ columns,
19
+ enableSorting: isSortingEnabled,
20
+ getCoreRowModel: (0, _tanstack_react_table.getCoreRowModel)(),
21
+ getSortedRowModel: isSortingEnabled && !manualSorting ? (0, _tanstack_react_table.getSortedRowModel)() : void 0,
22
+ manualSorting,
23
+ onSortingChange,
24
+ state: sorting ? { sorting } : void 0
25
+ });
26
+ const rows = table.getRowModel().rows;
27
+ const isVertical = variant === "vertical";
28
+ const headersByColumnId = new Map(table.getFlatHeaders().map((header) => [header.column.id, header]));
29
+ const cellClassName = (0, clsx.default)(onRowClick && "cursor-pointer");
30
+ const renderHeaderContent = (header) => {
31
+ const content = (0, _tanstack_react_table.flexRender)(header.column.columnDef.header, header.getContext());
32
+ if (!isSortingEnabled || !header.column.getCanSort()) return content;
33
+ const sorted = header.column.getIsSorted();
34
+ const sortLabel = sorted === "asc" ? "Orden ascendente" : "Orden descendente";
35
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
36
+ className: "flex items-center gap-1",
37
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
38
+ className: "whitespace-nowrap font-semibold text-grey-9 text-sm",
39
+ onClick: header.column.getToggleSortingHandler(),
40
+ type: "button",
41
+ children: content
42
+ }), sorted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Tooltip, {
43
+ label: sortLabel,
44
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.ActionIcon, {
45
+ "aria-label": sortLabel,
46
+ onClick: header.column.getToggleSortingHandler(),
47
+ size: "sm",
48
+ variant: "subtle",
49
+ children: sorted === "asc" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconOrderAscending, {
50
+ "aria-hidden": "true",
51
+ className: "size-4"
52
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconOrderDescending, {
53
+ "aria-hidden": "true",
54
+ className: "size-4"
55
+ })
56
+ })
57
+ }) : null]
58
+ });
59
+ };
60
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Table.ScrollContainer, {
61
+ minWidth,
62
+ className: "relative",
63
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.LoadingOverlay, {
64
+ visible: isLoading,
65
+ loaderProps: { type: "bars" },
66
+ overlayProps: { backgroundOpacity: .35 },
67
+ style: { top: isVertical ? 0 : theadHeight }
68
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Table, {
69
+ variant,
70
+ layout: layout ?? (isVertical ? "fixed" : void 0),
71
+ highlightOnHover: !isLoading && highlightOnHover,
72
+ ...props,
73
+ children: [isVertical ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Thead, {
74
+ ref: setTheadRef,
75
+ children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Tr, { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Th, { children: header.isPlaceholder ? null : renderHeaderContent(header) }, header.id)) }, headerGroup.id))
76
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Table.Tbody, { children: [
77
+ rows.length === 0 && isLoading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Tr, {
78
+ "aria-hidden": "true",
79
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
80
+ colSpan: isVertical ? 2 : columns.length,
81
+ className: "py-5",
82
+ children: "\xA0"
83
+ })
84
+ }),
85
+ isVertical ? rows.flatMap((row) => row.getVisibleCells().map((cell) => {
86
+ const header = headersByColumnId.get(cell.column.id);
87
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Table.Tr, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Th, { children: header?.isPlaceholder || !header ? null : (0, _tanstack_react_table.flexRender)(header.column.columnDef.header, header.getContext()) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
88
+ onClick: () => onRowClick?.(cell.row),
89
+ className: cellClassName,
90
+ children: (0, _tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
91
+ })] }, cell.id);
92
+ })) : rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Tr, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
93
+ onClick: () => onRowClick?.(cell.row),
94
+ className: cellClassName,
95
+ children: (0, _tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
96
+ }, cell.id)) }, row.id)),
97
+ rows.length === 0 && !isLoading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Tr, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Table.Td, {
98
+ colSpan: isVertical ? 2 : columns.length,
99
+ className: "py-5",
100
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Text, {
101
+ c: "dimmed",
102
+ size: "sm",
103
+ ta: "center",
104
+ children: emptyMessage
105
+ })
106
+ }) })
107
+ ] })]
108
+ })]
109
+ });
110
+ };
111
+ var IconOrderAscending = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
112
+ width: "24",
113
+ height: "24",
114
+ viewBox: "0 0 24 24",
115
+ fill: "none",
116
+ xmlns: "http://www.w3.org/2000/svg",
117
+ ...props,
118
+ children: [
119
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
120
+ d: "M11 5.25C11.4142 5.25 11.75 5.58579 11.75 6C11.75 6.41421 11.4142 6.75 11 6.75H4C3.58579 6.75 3.25 6.41421 3.25 6C3.25 5.58579 3.58579 5.25 4 5.25H11Z",
121
+ fill: "currentColor"
122
+ }),
123
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
124
+ d: "M11 11.25C11.4142 11.25 11.75 11.5858 11.75 12C11.75 12.4142 11.4142 12.75 11 12.75H4C3.58579 12.75 3.25 12.4142 3.25 12C3.25 11.5858 3.58579 11.25 4 11.25H11Z",
125
+ fill: "currentColor"
126
+ }),
127
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
128
+ d: "M13 17.25C13.4142 17.25 13.75 17.5858 13.75 18C13.75 18.4142 13.4142 18.75 13 18.75H4C3.58579 18.75 3.25 18.4142 3.25 18C3.25 17.5858 3.58579 17.25 4 17.25H13Z",
129
+ fill: "currentColor"
130
+ }),
131
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
132
+ d: "M17.5264 5.41796C17.821 5.17765 18.2557 5.19512 18.5303 5.46972L21.5303 8.46972C21.8232 8.76261 21.8232 9.23738 21.5303 9.53027C21.2374 9.82316 20.7626 9.82316 20.4697 9.53027L18 7.06054L15.5303 9.53027C15.2374 9.82316 14.7626 9.82316 14.4697 9.53027C14.1768 9.23738 14.1768 8.76261 14.4697 8.46972L17.4697 5.46972L17.5264 5.41796Z",
133
+ fill: "currentColor"
134
+ }),
135
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
136
+ d: "M17.25 18V6C17.25 5.58579 17.5858 5.25 18 5.25C18.4142 5.25 18.75 5.58579 18.75 6V18C18.75 18.4142 18.4142 18.75 18 18.75C17.5858 18.75 17.25 18.4142 17.25 18Z",
137
+ fill: "currentColor"
138
+ })
139
+ ]
140
+ });
141
+ var IconOrderDescending = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
142
+ width: "24",
143
+ height: "24",
144
+ viewBox: "0 0 24 24",
145
+ fill: "none",
146
+ xmlns: "http://www.w3.org/2000/svg",
147
+ ...props,
148
+ children: [
149
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
150
+ d: "M13 5.25C13.4142 5.25 13.75 5.58579 13.75 6C13.75 6.41421 13.4142 6.75 13 6.75H4C3.58579 6.75 3.25 6.41421 3.25 6C3.25 5.58579 3.58579 5.25 4 5.25H13Z",
151
+ fill: "currentColor"
152
+ }),
153
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
154
+ d: "M11 11.25C11.4142 11.25 11.75 11.5858 11.75 12C11.75 12.4142 11.4142 12.75 11 12.75H4C3.58579 12.75 3.25 12.4142 3.25 12C3.25 11.5858 3.58579 11.25 4 11.25H11Z",
155
+ fill: "currentColor"
156
+ }),
157
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
158
+ d: "M11 17.25C11.4142 17.25 11.75 17.5858 11.75 18C11.75 18.4142 11.4142 18.75 11 18.75H4C3.58579 18.75 3.25 18.4142 3.25 18C3.25 17.5858 3.58579 17.25 4 17.25H11Z",
159
+ fill: "currentColor"
160
+ }),
161
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
162
+ d: "M20.4697 14.4697C20.7626 14.1768 21.2374 14.1768 21.5303 14.4697C21.8232 14.7626 21.8232 15.2374 21.5303 15.5303L18.5303 18.5303C18.2374 18.8232 17.7626 18.8232 17.4697 18.5303L14.4697 15.5303C14.1768 15.2374 14.1768 14.7626 14.4697 14.4697C14.7626 14.1768 15.2374 14.1768 15.5303 14.4697L18 16.9395L20.4697 14.4697Z",
163
+ fill: "currentColor"
164
+ }),
165
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
166
+ d: "M17.25 18V6C17.25 5.58579 17.5858 5.25 18 5.25C18.4142 5.25 18.75 5.58579 18.75 6V18C18.75 18.4142 18.4142 18.75 18 18.75C17.5858 18.75 17.25 18.4142 17.25 18Z",
167
+ fill: "currentColor"
168
+ })
169
+ ]
170
+ });
171
+ //#endregion
172
+ exports.default = MyTable;
@@ -0,0 +1,18 @@
1
+ import { TableProps } from '@mantine/core';
2
+ import { OnChangeFn, Row, SortingState, TableOptions } from '@tanstack/react-table';
3
+ import { ReactNode } from 'react';
4
+ export interface MyTableProps<T> extends Omit<TableProps, 'data'> {
5
+ data: T[];
6
+ columns: TableOptions<T>['columns'];
7
+ isLoading?: boolean;
8
+ onRowClick?: (row: Row<T>) => void;
9
+ minWidth?: number;
10
+ emptyMessage?: ReactNode;
11
+ enableSorting?: boolean;
12
+ manualSorting?: boolean;
13
+ onSortingChange?: OnChangeFn<SortingState>;
14
+ sorting?: SortingState;
15
+ }
16
+ declare const MyTable: <T>({ data, columns, highlightOnHover, isLoading, onRowClick, minWidth, emptyMessage, enableSorting, variant, layout, manualSorting, onSortingChange, sorting, ...props }: MyTableProps<T>) => import("react/jsx-runtime").JSX.Element;
17
+ export default MyTable;
18
+ //# sourceMappingURL=MyTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MyTable.d.ts","sourceRoot":"","sources":["../../../src/components/MyTable/MyTable.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqC,UAAU,EAAiB,MAAM,eAAe,CAAA;AAC5F,OAAO,EAML,UAAU,EACV,GAAG,EACH,YAAY,EACZ,YAAY,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAkB,SAAS,EAAyB,MAAM,OAAO,CAAA;AAExE,MAAM,WAAW,YAAY,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;IAC/D,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAA;IAC1C,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,QAAA,MAAM,OAAO,GAAI,CAAC,EAAG,uKAelB,YAAY,CAAC,CAAC,CAAC,4CA4IjB,CAAA;AAkED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,170 @@
1
+ "use client";
2
+ import { ActionIcon, LoadingOverlay, Table, Text, Tooltip } from "@mantine/core";
3
+ import { useCallback, useState } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import clsx from "clsx";
6
+ import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
7
+ //#region src/components/MyTable/MyTable.tsx
8
+ var MyTable = ({ data, columns, highlightOnHover, isLoading, onRowClick, minWidth = 720, emptyMessage = "Sin datos", enableSorting, variant, layout, manualSorting, onSortingChange, sorting, ...props }) => {
9
+ const [theadHeight, setTheadHeight] = useState(0);
10
+ const setTheadRef = useCallback((node) => {
11
+ if (node) setTheadHeight(node.offsetHeight);
12
+ }, []);
13
+ const isSortingEnabled = enableSorting ?? (Boolean(sorting) || Boolean(onSortingChange));
14
+ const table = useReactTable({
15
+ data,
16
+ columns,
17
+ enableSorting: isSortingEnabled,
18
+ getCoreRowModel: getCoreRowModel(),
19
+ getSortedRowModel: isSortingEnabled && !manualSorting ? getSortedRowModel() : void 0,
20
+ manualSorting,
21
+ onSortingChange,
22
+ state: sorting ? { sorting } : void 0
23
+ });
24
+ const rows = table.getRowModel().rows;
25
+ const isVertical = variant === "vertical";
26
+ const headersByColumnId = new Map(table.getFlatHeaders().map((header) => [header.column.id, header]));
27
+ const cellClassName = clsx(onRowClick && "cursor-pointer");
28
+ const renderHeaderContent = (header) => {
29
+ const content = flexRender(header.column.columnDef.header, header.getContext());
30
+ if (!isSortingEnabled || !header.column.getCanSort()) return content;
31
+ const sorted = header.column.getIsSorted();
32
+ const sortLabel = sorted === "asc" ? "Orden ascendente" : "Orden descendente";
33
+ return /* @__PURE__ */ jsxs("span", {
34
+ className: "flex items-center gap-1",
35
+ children: [/* @__PURE__ */ jsx("button", {
36
+ className: "whitespace-nowrap font-semibold text-grey-9 text-sm",
37
+ onClick: header.column.getToggleSortingHandler(),
38
+ type: "button",
39
+ children: content
40
+ }), sorted ? /* @__PURE__ */ jsx(Tooltip, {
41
+ label: sortLabel,
42
+ children: /* @__PURE__ */ jsx(ActionIcon, {
43
+ "aria-label": sortLabel,
44
+ onClick: header.column.getToggleSortingHandler(),
45
+ size: "sm",
46
+ variant: "subtle",
47
+ children: sorted === "asc" ? /* @__PURE__ */ jsx(IconOrderAscending, {
48
+ "aria-hidden": "true",
49
+ className: "size-4"
50
+ }) : /* @__PURE__ */ jsx(IconOrderDescending, {
51
+ "aria-hidden": "true",
52
+ className: "size-4"
53
+ })
54
+ })
55
+ }) : null]
56
+ });
57
+ };
58
+ return /* @__PURE__ */ jsxs(Table.ScrollContainer, {
59
+ minWidth,
60
+ className: "relative",
61
+ children: [/* @__PURE__ */ jsx(LoadingOverlay, {
62
+ visible: isLoading,
63
+ loaderProps: { type: "bars" },
64
+ overlayProps: { backgroundOpacity: .35 },
65
+ style: { top: isVertical ? 0 : theadHeight }
66
+ }), /* @__PURE__ */ jsxs(Table, {
67
+ variant,
68
+ layout: layout ?? (isVertical ? "fixed" : void 0),
69
+ highlightOnHover: !isLoading && highlightOnHover,
70
+ ...props,
71
+ children: [isVertical ? null : /* @__PURE__ */ jsx(Table.Thead, {
72
+ ref: setTheadRef,
73
+ children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(Table.Tr, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(Table.Th, { children: header.isPlaceholder ? null : renderHeaderContent(header) }, header.id)) }, headerGroup.id))
74
+ }), /* @__PURE__ */ jsxs(Table.Tbody, { children: [
75
+ rows.length === 0 && isLoading && /* @__PURE__ */ jsx(Table.Tr, {
76
+ "aria-hidden": "true",
77
+ children: /* @__PURE__ */ jsx(Table.Td, {
78
+ colSpan: isVertical ? 2 : columns.length,
79
+ className: "py-5",
80
+ children: "\xA0"
81
+ })
82
+ }),
83
+ isVertical ? rows.flatMap((row) => row.getVisibleCells().map((cell) => {
84
+ const header = headersByColumnId.get(cell.column.id);
85
+ return /* @__PURE__ */ jsxs(Table.Tr, { children: [/* @__PURE__ */ jsx(Table.Th, { children: header?.isPlaceholder || !header ? null : flexRender(header.column.columnDef.header, header.getContext()) }), /* @__PURE__ */ jsx(Table.Td, {
86
+ onClick: () => onRowClick?.(cell.row),
87
+ className: cellClassName,
88
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
89
+ })] }, cell.id);
90
+ })) : rows.map((row) => /* @__PURE__ */ jsx(Table.Tr, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(Table.Td, {
91
+ onClick: () => onRowClick?.(cell.row),
92
+ className: cellClassName,
93
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
94
+ }, cell.id)) }, row.id)),
95
+ rows.length === 0 && !isLoading && /* @__PURE__ */ jsx(Table.Tr, { children: /* @__PURE__ */ jsx(Table.Td, {
96
+ colSpan: isVertical ? 2 : columns.length,
97
+ className: "py-5",
98
+ children: /* @__PURE__ */ jsx(Text, {
99
+ c: "dimmed",
100
+ size: "sm",
101
+ ta: "center",
102
+ children: emptyMessage
103
+ })
104
+ }) })
105
+ ] })]
106
+ })]
107
+ });
108
+ };
109
+ var IconOrderAscending = (props) => /* @__PURE__ */ jsxs("svg", {
110
+ width: "24",
111
+ height: "24",
112
+ viewBox: "0 0 24 24",
113
+ fill: "none",
114
+ xmlns: "http://www.w3.org/2000/svg",
115
+ ...props,
116
+ children: [
117
+ /* @__PURE__ */ jsx("path", {
118
+ d: "M11 5.25C11.4142 5.25 11.75 5.58579 11.75 6C11.75 6.41421 11.4142 6.75 11 6.75H4C3.58579 6.75 3.25 6.41421 3.25 6C3.25 5.58579 3.58579 5.25 4 5.25H11Z",
119
+ fill: "currentColor"
120
+ }),
121
+ /* @__PURE__ */ jsx("path", {
122
+ d: "M11 11.25C11.4142 11.25 11.75 11.5858 11.75 12C11.75 12.4142 11.4142 12.75 11 12.75H4C3.58579 12.75 3.25 12.4142 3.25 12C3.25 11.5858 3.58579 11.25 4 11.25H11Z",
123
+ fill: "currentColor"
124
+ }),
125
+ /* @__PURE__ */ jsx("path", {
126
+ d: "M13 17.25C13.4142 17.25 13.75 17.5858 13.75 18C13.75 18.4142 13.4142 18.75 13 18.75H4C3.58579 18.75 3.25 18.4142 3.25 18C3.25 17.5858 3.58579 17.25 4 17.25H13Z",
127
+ fill: "currentColor"
128
+ }),
129
+ /* @__PURE__ */ jsx("path", {
130
+ d: "M17.5264 5.41796C17.821 5.17765 18.2557 5.19512 18.5303 5.46972L21.5303 8.46972C21.8232 8.76261 21.8232 9.23738 21.5303 9.53027C21.2374 9.82316 20.7626 9.82316 20.4697 9.53027L18 7.06054L15.5303 9.53027C15.2374 9.82316 14.7626 9.82316 14.4697 9.53027C14.1768 9.23738 14.1768 8.76261 14.4697 8.46972L17.4697 5.46972L17.5264 5.41796Z",
131
+ fill: "currentColor"
132
+ }),
133
+ /* @__PURE__ */ jsx("path", {
134
+ d: "M17.25 18V6C17.25 5.58579 17.5858 5.25 18 5.25C18.4142 5.25 18.75 5.58579 18.75 6V18C18.75 18.4142 18.4142 18.75 18 18.75C17.5858 18.75 17.25 18.4142 17.25 18Z",
135
+ fill: "currentColor"
136
+ })
137
+ ]
138
+ });
139
+ var IconOrderDescending = (props) => /* @__PURE__ */ jsxs("svg", {
140
+ width: "24",
141
+ height: "24",
142
+ viewBox: "0 0 24 24",
143
+ fill: "none",
144
+ xmlns: "http://www.w3.org/2000/svg",
145
+ ...props,
146
+ children: [
147
+ /* @__PURE__ */ jsx("path", {
148
+ d: "M13 5.25C13.4142 5.25 13.75 5.58579 13.75 6C13.75 6.41421 13.4142 6.75 13 6.75H4C3.58579 6.75 3.25 6.41421 3.25 6C3.25 5.58579 3.58579 5.25 4 5.25H13Z",
149
+ fill: "currentColor"
150
+ }),
151
+ /* @__PURE__ */ jsx("path", {
152
+ d: "M11 11.25C11.4142 11.25 11.75 11.5858 11.75 12C11.75 12.4142 11.4142 12.75 11 12.75H4C3.58579 12.75 3.25 12.4142 3.25 12C3.25 11.5858 3.58579 11.25 4 11.25H11Z",
153
+ fill: "currentColor"
154
+ }),
155
+ /* @__PURE__ */ jsx("path", {
156
+ d: "M11 17.25C11.4142 17.25 11.75 17.5858 11.75 18C11.75 18.4142 11.4142 18.75 11 18.75H4C3.58579 18.75 3.25 18.4142 3.25 18C3.25 17.5858 3.58579 17.25 4 17.25H11Z",
157
+ fill: "currentColor"
158
+ }),
159
+ /* @__PURE__ */ jsx("path", {
160
+ d: "M20.4697 14.4697C20.7626 14.1768 21.2374 14.1768 21.5303 14.4697C21.8232 14.7626 21.8232 15.2374 21.5303 15.5303L18.5303 18.5303C18.2374 18.8232 17.7626 18.8232 17.4697 18.5303L14.4697 15.5303C14.1768 15.2374 14.1768 14.7626 14.4697 14.4697C14.7626 14.1768 15.2374 14.1768 15.5303 14.4697L18 16.9395L20.4697 14.4697Z",
161
+ fill: "currentColor"
162
+ }),
163
+ /* @__PURE__ */ jsx("path", {
164
+ d: "M17.25 18V6C17.25 5.58579 17.5858 5.25 18 5.25C18.4142 5.25 18.75 5.58579 18.75 6V18C18.75 18.4142 18.4142 18.75 18 18.75C17.5858 18.75 17.25 18.4142 17.25 18Z",
165
+ fill: "currentColor"
166
+ })
167
+ ]
168
+ });
169
+ //#endregion
170
+ export { MyTable as default };
@@ -0,0 +1,3 @@
1
+ export type { MyTableProps } from './MyTable';
2
+ export { default as MyTable } from './MyTable';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MyTable/index.tsx"],"names":[],"mappings":"AAEA,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA"}
@@ -0,0 +1,13 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ let _mantine_core = require("@mantine/core");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ let clsx = require("clsx");
5
+ clsx = require_runtime.__toESM(clsx, 1);
6
+ //#region src/components/TableWrapper/TableWrapper.tsx
7
+ var TableWrapper = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Paper, {
8
+ component: "section",
9
+ className: (0, clsx.default)("flex flex-col px-1 py-0.5", className),
10
+ ...props
11
+ });
12
+ //#endregion
13
+ exports.default = TableWrapper;
@@ -0,0 +1,8 @@
1
+ import { PaperProps } from '@mantine/core';
2
+ import { ReactNode } from 'react';
3
+ export interface TableWrapperProps extends PaperProps {
4
+ children?: ReactNode;
5
+ }
6
+ declare const TableWrapper: ({ className, ...props }: TableWrapperProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default TableWrapper;
8
+ //# sourceMappingURL=TableWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/TableWrapper/TableWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,QAAA,MAAM,YAAY,GAAI,yBAAyB,iBAAiB,4CAE/D,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { Paper } from "@mantine/core";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import clsx from "clsx";
4
+ //#region src/components/TableWrapper/TableWrapper.tsx
5
+ var TableWrapper = ({ className, ...props }) => /* @__PURE__ */ jsx(Paper, {
6
+ component: "section",
7
+ className: clsx("flex flex-col px-1 py-0.5", className),
8
+ ...props
9
+ });
10
+ //#endregion
11
+ export { TableWrapper as default };
@@ -0,0 +1,11 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ let clsx = require("clsx");
4
+ clsx = require_runtime.__toESM(clsx, 1);
5
+ //#region src/components/TableWrapper/TableWrapperFooter.tsx
6
+ var TableWrapperFooter = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
7
+ className: (0, clsx.default)("mt-3 flex justify-center p-2", className),
8
+ ...props
9
+ });
10
+ //#endregion
11
+ exports.default = TableWrapperFooter;
@@ -0,0 +1,5 @@
1
+ import { ComponentProps } from 'react';
2
+ export type TableWrapperFooterProps = ComponentProps<'footer'>;
3
+ declare const TableWrapperFooter: ({ className, ...props }: TableWrapperFooterProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default TableWrapperFooter;
5
+ //# sourceMappingURL=TableWrapperFooter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableWrapperFooter.d.ts","sourceRoot":"","sources":["../../../src/components/TableWrapper/TableWrapperFooter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAE9D,QAAA,MAAM,kBAAkB,GAAI,yBAAyB,uBAAuB,4CAE3E,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ //#region src/components/TableWrapper/TableWrapperFooter.tsx
4
+ var TableWrapperFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("footer", {
5
+ className: clsx("mt-3 flex justify-center p-2", className),
6
+ ...props
7
+ });
8
+ //#endregion
9
+ export { TableWrapperFooter as default };
@@ -0,0 +1,11 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ let clsx = require("clsx");
4
+ clsx = require_runtime.__toESM(clsx, 1);
5
+ //#region src/components/TableWrapper/TableWrapperHeader.tsx
6
+ var TableWrapperHeader = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
7
+ className: (0, clsx.default)("p-2", className),
8
+ ...props
9
+ });
10
+ //#endregion
11
+ exports.default = TableWrapperHeader;
@@ -0,0 +1,5 @@
1
+ import { ComponentProps } from 'react';
2
+ export type TableWrapperHeaderProps = ComponentProps<'header'>;
3
+ declare const TableWrapperHeader: ({ className, ...props }: TableWrapperHeaderProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default TableWrapperHeader;
5
+ //# sourceMappingURL=TableWrapperHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableWrapperHeader.d.ts","sourceRoot":"","sources":["../../../src/components/TableWrapper/TableWrapperHeader.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;AAE9D,QAAA,MAAM,kBAAkB,GAAI,yBAAyB,uBAAuB,4CAE3E,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ //#region src/components/TableWrapper/TableWrapperHeader.tsx
4
+ var TableWrapperHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("header", {
5
+ className: clsx("p-2", className),
6
+ ...props
7
+ });
8
+ //#endregion
9
+ export { TableWrapperHeader as default };