@producteca/producteca-ui-kit 1.69.0 → 1.71.0
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/components/breadcrumb/breadcrumb.d.ts +0 -1
- package/dist/components/chip/chip.d.ts +3 -2
- package/dist/components/table/table/table.examples.d.ts +1 -0
- package/dist/components/table/tableBody/tableBody.d.ts +1 -1
- package/dist/components/table/tableBody/tableBody.types.d.ts +6 -1
- package/dist/locales/description.d.ts +3 -2
- package/dist/locales/es.d.ts +2 -0
- package/dist/producteca-ui-kit.es.js +111 -59
- package/dist/producteca-ui-kit.umd.js +6 -6
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type ChipVariant = 'primary' | 'success' | 'error' | 'secondary' | 'grey' | 'tab';
|
|
4
4
|
type ChipSize = 'sm' | 'lg';
|
|
@@ -11,6 +11,7 @@ export interface ChipProps {
|
|
|
11
11
|
variant?: ChipVariant;
|
|
12
12
|
size?: ChipSize;
|
|
13
13
|
isActive?: boolean;
|
|
14
|
+
onClick?: (event: MouseEvent<HTMLSpanElement> | KeyboardEvent<HTMLSpanElement>) => void;
|
|
14
15
|
}
|
|
15
|
-
export declare const Chip: ({ isActive, title, text, content, onRemove, disabled, variant, size }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const Chip: ({ isActive, title, text, content, onRemove, onClick, disabled, variant, size }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default Chip;
|
|
@@ -9,4 +9,5 @@ interface SampleRow {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const sampleData: SampleRow[];
|
|
11
11
|
export declare const TableDefaultExample: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TableWithAsyncContentExample: () => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TableBodyProps } from './tableBody.types';
|
|
2
2
|
|
|
3
|
-
export declare const TableBody: <T>({ data,
|
|
3
|
+
export declare const TableBody: <T>({ data, isLoading, error, empty, success }: TableBodyProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { AsyncContentErrorProps, AsyncContentEmptyProps, AsyncContentSuccessProps } from '../../patterns/asyncContent';
|
|
2
|
+
|
|
1
3
|
export interface TableBodyProps<T> {
|
|
2
4
|
data: T[];
|
|
3
|
-
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
error?: AsyncContentErrorProps;
|
|
7
|
+
empty?: Omit<AsyncContentEmptyProps, 'items'>;
|
|
8
|
+
success?: AsyncContentSuccessProps;
|
|
4
9
|
}
|
|
@@ -12,7 +12,7 @@ export declare const checkboxInputExample = "\n## Uso del componente\n\nEl compo
|
|
|
12
12
|
export declare const searcherExample = "\n## Uso del componente\n\nEl componente `Searcher` permite buscar y seleccionar opciones con soporte para carga as\u00EDncrona (`loadOptions`). `onChange` se dispara al seleccionar una opci\u00F3n; `onInputChange` al escribir (\u00FAtil como onSearch).\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<Searcher\n label=\"Buscar opci\u00F3n\"\n name=\"searcher\"\n placeholder=\"Escrib\u00ED para buscar...\"\n options={[\n { label: 'Opci\u00F3n 1', value: 1 },\n { label: 'Opci\u00F3n 2', value: 2 },\n ]}\n onChange={(event) => onSelectOption(event.target.value)}\n onInputChange={(event) => handleSearch(event.target.value)}\n/>\n```\n\n### Ejemplo con carga as\u00EDncrona:\n\n```tsx\n<Searcher\n name=\"api-searcher\"\n label=\"Buscar\"\n options={[]}\n loadOptions={(inputValue, callback) => {\n fetchOptions(inputValue).then(callback)\n }}\n cacheOptions\n defaultOptions\n onChange={(event) => setSelected(event.target.value)}\n/>\n```\n";
|
|
13
13
|
export declare const saveBarExample = "\n## Uso del componente\n\nEl componente `ActionBar` (SaveBar) muestra una barra de acciones con botones de guardar, cancelar y opcionalmente anterior. Soporta variantes `page`, `modal` y `fullPage`.\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<ActionBar\n saveProps={{\n onSave: () => handleSave(),\n label: 'Guardar',\n }}\n cancelProps={{\n onCancel: () => handleCancel(),\n label: 'Cancelar',\n }}\n/>\n```\n\n### Con bot\u00F3n anterior:\n\n```tsx\n<ActionBar\n saveProps={{\n onSave: () => handleSave(),\n label: 'Continuar',\n variant: 'primary',\n }}\n cancelProps={{\n onCancel: () => handleCancel(),\n label: 'Cancelar',\n }}\n previousProps={{\n onPrevious: () => handlePrevious(),\n label: 'Anterior',\n }}\n/>\n```\n";
|
|
14
14
|
export declare const checkboxInputReduxFormExample = "\n### Ejemplo con Redux Form (Field):\n\n```tsx\n<Field\n name=\"cancelSales\"\n component={CheckboxInput}\n props={{\n name: 'cancelSales',\n label: 'Cancelar ventas',\n title: 'Opciones de sincronizaci\u00F3n',\n }}\n/>\n```\n";
|
|
15
|
-
export declare const breadcrumbItemFormat = "\n ## Formato de BreadcrumbItem\n\n El componente Breadcrumb acepta un array de objetos `BreadcrumbItem` con las siguientes propiedades:\n\n ### Propiedades disponibles:\n\n - **`text`** (string, requerido): El texto que se muestra para el item del breadcrumb\n - **`onClick`** (function, opcional): Funci\u00F3n que se ejecuta al hacer click en el item\n - **`
|
|
15
|
+
export declare const breadcrumbItemFormat = "\n ## Formato de BreadcrumbItem\n\n El componente Breadcrumb acepta un array de objetos `BreadcrumbItem` con las siguientes propiedades:\n\n ### Propiedades disponibles:\n\n - **`text`** (string, requerido): El texto que se muestra para el item del breadcrumb\n - **`onClick`** (function, opcional): Funci\u00F3n que se ejecuta al hacer click en el item\n - **`href`** (string, opcional): URL del enlace (actualmente no implementado en el renderizado)\n\n ### Comportamiento:\n\n - Los items con `onClick` se renderizan como botones clickeables\n - Los items sin `onClick` se renderizan como texto est\u00E1tico\n - Cada item se separa autom\u00E1ticamente con el s\u00EDmbolo \">\"\n\n ### Ejemplo de uso:\n\n ```tsx\n const breadcrumbItems = [\n { text: 'Dashboard' },\n { text: 'Productos', onClick: () => navigate('/products') },\n { text: 'Detalles' }\n ]\n\n <Breadcrumb items={breadcrumbItems} />\n ```\n";
|
|
16
16
|
export declare const menuItems = "Lista de \u00EDtems que se mostrar\u00E1n en el men\u00FA.\n \n**Tipo:** `MenuActionItem[]`\n\n```ts\ninterface MenuActionItem {\n label: React.ReactNode\n icon?: React.ReactElement\n onClick?: () => void\n selected?: boolean\n disabled?: boolean\n}\n```\n";
|
|
17
17
|
export declare const draggableListExample = "\n## Uso del componente\n\nEl componente `DraggableList` permite crear listas de items arrastrables con un componente personalizado para cada item.\n\n**`value`** acepta dos formatos:\n- **string[]**: `[\"valor1\", \"valor2\"]` \u2014 `onChange` devuelve un array de strings.\n- **{ id, value }[]**: `[{ id: 'item-1', value: 'valor1' }, ...]` \u2014 `onChange` devuelve el mismo formato de objetos.\n\n**`canRemove`**: funci\u00F3n opcional `(item: DraggableItem) => boolean`. Se eval\u00FAa por cada item; si devuelve `false`, el bot\u00F3n de eliminar se muestra deshabilitado para ese item.\n\n**`showRemoveAction`**: si es `false`, no se muestra el bot\u00F3n de eliminar en ninguna fila. Por defecto `true`.\n\n### Ejemplo con objetos (id + value):\n\n```tsx\n<DraggableList\n label=\"Seleccionar un deposito\"\n addLabel=\"+ Agregar\"\n itemComponent={SelectField}\n componentProps={{\n placeholder: 'Seleccionar...',\n options: [\n { value: 'option1', label: 'Opci\u00F3n 1' },\n { value: 'option2', label: 'Opci\u00F3n 2' },\n ],\n size: 'md',\n }}\n value={[\n { id: 'item-1', value: 'option1' },\n { id: 'item-2', value: 'option2' },\n ]}\n onChange={(event) => console.log('Items actualizados:', event.target.value)}\n/>\n```\n\n### Ejemplo con array de strings:\n\n```tsx\n<DraggableList\n label=\"Nombres\"\n addLabel=\"+ Agregar\"\n itemComponent={FormField}\n componentProps={{ placeholder: 'Texto', size: 'md', type: 'text' }}\n value={['Uno', 'Dos']}\n onChange={(event) => setValues(event.target.value)}\n/>\n```\n\n### Ejemplo con Redux Form (Field):\n\n```tsx\n<Field\n name=\"warehouses\"\n component={DraggableList}\n itemComponent={FormField}\n label=\"Dep\u00F3sitos\"\n addLabel=\"+ Agregar\"\n componentProps={{\n placeholder: 'Nombre del dep\u00F3sito',\n size: 'md',\n type: 'text',\n }}\n value={[\n { id: 'item-1', value: 'Texto 1' },\n { id: 'item-2', value: 'Texto 2' },\n ]}\n/>\n```\n";
|
|
18
18
|
export declare const switchInputExample = "\n## Uso del componente\n\nEl componente `SwitchInput` / `SwitchInputGroup` muestra switches (toggle) individuales o en grupo. Soporta tama\u00F1os `sm`, `md`, `lg` e integraci\u00F3n con Redux Form.\n\n### Ejemplo b\u00E1sico (grupo):\n\n```tsx\n<SwitchInputGroup\n name=\"options\"\n title=\"Opciones\"\n size=\"md\"\n items={[\n { id: '1', label: 'Opci\u00F3n 1' },\n { id: '2', label: 'Opci\u00F3n 2' },\n { id: '3', label: 'Opci\u00F3n 3', disabled: true },\n ]}\n onChange={(event) => handleChange(event.target.value)}\n/>\n```\n\n### Ejemplo (un solo switch):\n\n```tsx\nconst [checked, setChecked] = React.useState(false)\n\n<SwitchInput\n name=\"toggle\"\n checked={checked}\n onChange={(e) => setChecked(e.target.checked)}\n label=\"Activar\"\n title=\"Configuraci\u00F3n\"\n/>\n```\n";
|
|
@@ -48,7 +48,8 @@ export declare const emptyStateExample = "\n## Uso del componente\n\nEl componen
|
|
|
48
48
|
export declare const asyncContentExample = "\n## Uso del componente\n\nEl componente `AsyncContent` maneja los estados de una operaci\u00F3n as\u00EDncrona deriv\u00E1ndolos de las props `isLoading`, `error` y `empty`. La prioridad es: `isLoading` \u2192 `error.value` \u2192 `empty.items` vac\u00EDo \u2192 `success`. Muestra el contenido solo en `success`.\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<AsyncContent\n isLoading={isLoading}\n error={{\n value: hasError,\n text: 'Ocurri\u00F3 un error',\n actionText: 'Reintentar',\n onClick: () => refetch(),\n }}\n empty={{\n items,\n text: 'No hay datos',\n }}\n>\n <div>Contenido cuando hay datos disponibles</div>\n</AsyncContent>\n```\n";
|
|
49
49
|
export declare const tooltipExample = "\n## Uso del componente\n\nLos componentes de tooltip (`WithTooltip`, `WithOverflowTooltip`) muestran un mensaje al hacer hover o click. `WithOverflowTooltip` solo muestra el tooltip cuando el contenido se desborda.\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<WithTooltip content=\"Texto del tooltip\" placement=\"top\">\n <span>Hover sobre m\u00ED</span>\n</WithTooltip>\n```\n\n### Solo si hay overflow:\n\n```tsx\n<WithOverflowTooltip maxWidth=\"200px\">\n <span>Texto que puede truncarse...</span>\n</WithOverflowTooltip>\n```\n";
|
|
50
50
|
export declare const tableHeaderExample = "\n## Uso del componente\n\n`Table.Header` renderiza el encabezado de la tabla. Lee las columnas del contexto provisto por `Table`. Opcionalmente acepta `columns` como prop para sobrescribir el contexto.\n\n### Usando el contexto de Table (recomendado):\n\n```tsx\nconst columns: TableColumn<MyRow>[] = [\n { key: 'name', header: 'Nombre' },\n { key: 'status', header: 'Estado', sx: { textAlign: 'center' } },\n { key: 'price', header: 'Precio', sx: { textAlign: 'right', width: 100 } },\n]\n\n<Table columns={columns}>\n <Table.Header />\n</Table>\n```\n\n### Pasando columns directamente como prop:\n\n```tsx\n<Table columns={columns}>\n <Table.Header columns={customColumns} />\n</Table>\n```\n";
|
|
51
|
-
export declare const tableBodyExample = "\n## Uso del componente\n\n`Table.Body` renderiza las filas de datos. Lee las columnas del contexto provisto por `Table`.
|
|
51
|
+
export declare const tableBodyExample = "\n## Uso del componente\n\n`Table.Body` renderiza las filas de datos. Lee las columnas del contexto provisto por `Table`. Integra `AsyncContent` internamente, por lo que acepta las props de estado (`isLoading`, `error`, `empty`, `success`) para mostrar el loader, el error o el estado vac\u00EDo dentro de la tabla.\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<Table columns={columns}>\n <Table.Body data={rows} />\n</Table>\n```\n\n### Con estados as\u00EDncronos:\n\n```tsx\n<Table columns={columns}>\n <Table.Header />\n <Table.Body\n data={rows}\n isLoading={isLoading}\n empty={{ text: 'No hay datos', actionText: 'Cargar', onClick: loadData }}\n />\n</Table>\n```\n";
|
|
52
52
|
export declare const tableExample = "\n## Uso del componente\n\nEl componente `Table` es un contenedor compuesto. Recibe `columns` y los distribuye por contexto a `Table.Header` y `Table.Body`, accesibles por dot-notation.\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<Table columns={columns}>\n <Table.Header />\n <Table.Body data={rows} />\n</Table>\n```\n\n### Definici\u00F3n de columnas:\n\n```tsx\nconst columns: TableColumn<MyRow>[] = [\n { key: 'name', header: 'Nombre' },\n { key: 'status', header: 'Estado', sx: { textAlign: 'center' } },\n {\n key: 'actions',\n header: 'Acciones',\n sx: { width: 80 },\n render: (row) => <Button label=\"Editar\" onClick={() => edit(row)} />,\n },\n]\n```\n";
|
|
53
|
+
export declare const tableAsyncContentExample = "\n`Table.Body` integra `AsyncContent` internamente: recibe las mismas props de estado (`isLoading`, `error`, `empty`, `success`) y resuelve el loader, el error y el estado vac\u00EDo **dentro** de la tabla, sin desmontar el `Table.Header`.\n\nEl estado vac\u00EDo se deriva de `data` (no hace falta pasar `items`). Cuando hay filas y no hay carga/error, se renderizan las filas normalmente.\n\n### Ejemplo:\n\n```tsx\n<Table columns={columns}>\n <Table.Header />\n <Table.Body\n data={rows}\n isLoading={isLoading}\n empty={{\n text: 'No hay datos disponibles',\n actionText: 'Cargar datos',\n onClick: loadData,\n }}\n />\n</Table>\n```\n";
|
|
53
54
|
export declare const spinnerExample = "\n## Uso del componente\n\nEl componente `Spinner` muestra un indicador de carga. Acepta `size` (`xs`, `sm`, `md`, `lg`).\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<Spinner size=\"md\" />\n```\n";
|
|
54
55
|
export declare const maintenanceExample = "\n## Uso del componente\n\nEl componente `Maintenance` muestra una vista de p\u00E1gina completa para indicar que el sistema est\u00E1 en mantenimiento. Acepta `title`, `description` y `subtitle` opcionales con valores por defecto en espa\u00F1ol.\n\n### Ejemplo b\u00E1sico:\n\n```tsx\n<Maintenance />\n```\n\n### Con contenido personalizado:\n\n```tsx\n<Maintenance\n title=\"Estamos mejorando\"\n description=\"Estamos haciendo algunos ajustes para brindarte una mejor experiencia.\"\n subtitle=\"Volvemos en unos minutos.\"\n/>\n```\n";
|
package/dist/locales/es.d.ts
CHANGED
|
@@ -245,6 +245,7 @@ declare const _default: {
|
|
|
245
245
|
};
|
|
246
246
|
table: {
|
|
247
247
|
example: string;
|
|
248
|
+
asyncContent: string;
|
|
248
249
|
};
|
|
249
250
|
tableHeader: {
|
|
250
251
|
example: string;
|
|
@@ -372,6 +373,7 @@ declare const _default: {
|
|
|
372
373
|
text: string;
|
|
373
374
|
title: string;
|
|
374
375
|
onRemove: string;
|
|
376
|
+
onClick: string;
|
|
375
377
|
disabled: string;
|
|
376
378
|
variant: string;
|
|
377
379
|
size: string;
|
|
@@ -10083,6 +10083,7 @@ const tab$1 = "chip-module_tab_TQ-ke";
|
|
|
10083
10083
|
const grey = "chip-module_grey_M9U8T";
|
|
10084
10084
|
const active$3 = "chip-module_active_uJfiq";
|
|
10085
10085
|
const disabled$8 = "chip-module_disabled_21ZO5";
|
|
10086
|
+
const clickable = "chip-module_clickable_M0dZ3";
|
|
10086
10087
|
const success$1 = "chip-module_success_BJKfz";
|
|
10087
10088
|
const error$3 = "chip-module_error_an-gm";
|
|
10088
10089
|
const secondary = "chip-module_secondary_3aQ1S";
|
|
@@ -10098,26 +10099,44 @@ const styles$H = {
|
|
|
10098
10099
|
grey,
|
|
10099
10100
|
active: active$3,
|
|
10100
10101
|
disabled: disabled$8,
|
|
10102
|
+
clickable,
|
|
10101
10103
|
success: success$1,
|
|
10102
10104
|
error: error$3,
|
|
10103
10105
|
secondary,
|
|
10104
10106
|
primary,
|
|
10105
10107
|
action: action$1
|
|
10106
10108
|
};
|
|
10107
|
-
const ChipBase = ({ isActive, title: title2, text: text2, content: content2, onRemove = void 0, disabled: disabled2 = false, variant = "primary", size: size2 = "lg" }) => {
|
|
10109
|
+
const ChipBase = ({ isActive, title: title2, text: text2, content: content2, onRemove = void 0, onClick = void 0, disabled: disabled2 = false, variant = "primary", size: size2 = "lg" }) => {
|
|
10108
10110
|
const canRemove = onRemove && !disabled2;
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
(
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10111
|
+
const isClickable = !!onClick && !disabled2;
|
|
10112
|
+
const handleKeyDown = (event) => {
|
|
10113
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
10114
|
+
event.preventDefault();
|
|
10115
|
+
onClick?.(event);
|
|
10116
|
+
}
|
|
10117
|
+
};
|
|
10118
|
+
return /* @__PURE__ */ jsx$1(Grow, { in: !!text2 || !!title2 || !!content2, unmountOnExit: true, children: /* @__PURE__ */ jsxs(
|
|
10119
|
+
"span",
|
|
10120
|
+
{
|
|
10121
|
+
className: clsx(styles$H.chip, styles$H[variant], styles$H[size2], { [styles$H.disabled]: disabled2, [styles$H.active]: isActive, [styles$H.clickable]: isClickable }),
|
|
10122
|
+
role: isClickable ? "button" : void 0,
|
|
10123
|
+
tabIndex: isClickable ? 0 : void 0,
|
|
10124
|
+
onClick: isClickable ? onClick : void 0,
|
|
10125
|
+
onKeyDown: isClickable ? handleKeyDown : void 0,
|
|
10126
|
+
children: [
|
|
10127
|
+
content2,
|
|
10128
|
+
(!!title2 || !!text2) && /* @__PURE__ */ jsxs("span", { children: [
|
|
10129
|
+
!!title2 && /* @__PURE__ */ jsxs("span", { className: styles$H.title, children: [
|
|
10130
|
+
title2,
|
|
10131
|
+
" ",
|
|
10132
|
+
text2 && ": "
|
|
10133
|
+
] }),
|
|
10134
|
+
!!text2 && /* @__PURE__ */ jsx$1("span", { className: styles$H.text, children: text2 })
|
|
10135
|
+
] }),
|
|
10136
|
+
canRemove && /* @__PURE__ */ jsx$1(CustomIcon, { className: styles$H.action, size: "8", onClick: canRemove ? onRemove : void 0, color: getColor("grey", "700"), children: /* @__PURE__ */ jsx$1(CloseRoundedIcon, {}) })
|
|
10137
|
+
]
|
|
10138
|
+
}
|
|
10139
|
+
) });
|
|
10121
10140
|
};
|
|
10122
10141
|
const Chip$1 = withDebugHandlers(ChipBase, "Chip");
|
|
10123
10142
|
const defaultColor$c = getColor("grey", "500");
|
|
@@ -19086,14 +19105,12 @@ const breadcrumbItemFormat = `
|
|
|
19086
19105
|
|
|
19087
19106
|
- **\`text\`** (string, requerido): El texto que se muestra para el item del breadcrumb
|
|
19088
19107
|
- **\`onClick\`** (function, opcional): Función que se ejecuta al hacer click en el item
|
|
19089
|
-
- **\`isActive\`** (boolean, opcional): Indica si el item está activo. Por defecto, el último item se considera activo
|
|
19090
19108
|
- **\`href\`** (string, opcional): URL del enlace (actualmente no implementado en el renderizado)
|
|
19091
19109
|
|
|
19092
19110
|
### Comportamiento:
|
|
19093
19111
|
|
|
19094
19112
|
- Los items con \`onClick\` se renderizan como botones clickeables
|
|
19095
19113
|
- Los items sin \`onClick\` se renderizan como texto estático
|
|
19096
|
-
- El último item siempre se considera activo (a menos que se especifique \`isActive: true\` en otro item)
|
|
19097
19114
|
- Cada item se separa automáticamente con el símbolo ">"
|
|
19098
19115
|
|
|
19099
19116
|
### Ejemplo de uso:
|
|
@@ -19102,7 +19119,7 @@ const breadcrumbItemFormat = `
|
|
|
19102
19119
|
const breadcrumbItems = [
|
|
19103
19120
|
{ text: 'Dashboard' },
|
|
19104
19121
|
{ text: 'Productos', onClick: () => navigate('/products') },
|
|
19105
|
-
{ text: 'Detalles'
|
|
19122
|
+
{ text: 'Detalles' }
|
|
19106
19123
|
]
|
|
19107
19124
|
|
|
19108
19125
|
<Breadcrumb items={breadcrumbItems} />
|
|
@@ -19807,7 +19824,7 @@ const columns: TableColumn<MyRow>[] = [
|
|
|
19807
19824
|
const tableBodyExample = `
|
|
19808
19825
|
## Uso del componente
|
|
19809
19826
|
|
|
19810
|
-
\`Table.Body\` renderiza las filas de datos. Lee las columnas del contexto provisto por \`Table\`.
|
|
19827
|
+
\`Table.Body\` renderiza las filas de datos. Lee las columnas del contexto provisto por \`Table\`. Integra \`AsyncContent\` internamente, por lo que acepta las props de estado (\`isLoading\`, \`error\`, \`empty\`, \`success\`) para mostrar el loader, el error o el estado vacío dentro de la tabla.
|
|
19811
19828
|
|
|
19812
19829
|
### Ejemplo básico:
|
|
19813
19830
|
|
|
@@ -19817,13 +19834,15 @@ const tableBodyExample = `
|
|
|
19817
19834
|
</Table>
|
|
19818
19835
|
\`\`\`
|
|
19819
19836
|
|
|
19820
|
-
###
|
|
19837
|
+
### Con estados asíncronos:
|
|
19821
19838
|
|
|
19822
19839
|
\`\`\`tsx
|
|
19823
19840
|
<Table columns={columns}>
|
|
19841
|
+
<Table.Header />
|
|
19824
19842
|
<Table.Body
|
|
19825
|
-
data={
|
|
19826
|
-
|
|
19843
|
+
data={rows}
|
|
19844
|
+
isLoading={isLoading}
|
|
19845
|
+
empty={{ text: 'No hay datos', actionText: 'Cargar', onClick: loadData }}
|
|
19827
19846
|
/>
|
|
19828
19847
|
</Table>
|
|
19829
19848
|
\`\`\`
|
|
@@ -19857,6 +19876,28 @@ const columns: TableColumn<MyRow>[] = [
|
|
|
19857
19876
|
]
|
|
19858
19877
|
\`\`\`
|
|
19859
19878
|
`;
|
|
19879
|
+
const tableAsyncContentExample = `
|
|
19880
|
+
\`Table.Body\` integra \`AsyncContent\` internamente: recibe las mismas props de estado (\`isLoading\`, \`error\`, \`empty\`, \`success\`) y resuelve el loader, el error y el estado vacío **dentro** de la tabla, sin desmontar el \`Table.Header\`.
|
|
19881
|
+
|
|
19882
|
+
El estado vacío se deriva de \`data\` (no hace falta pasar \`items\`). Cuando hay filas y no hay carga/error, se renderizan las filas normalmente.
|
|
19883
|
+
|
|
19884
|
+
### Ejemplo:
|
|
19885
|
+
|
|
19886
|
+
\`\`\`tsx
|
|
19887
|
+
<Table columns={columns}>
|
|
19888
|
+
<Table.Header />
|
|
19889
|
+
<Table.Body
|
|
19890
|
+
data={rows}
|
|
19891
|
+
isLoading={isLoading}
|
|
19892
|
+
empty={{
|
|
19893
|
+
text: 'No hay datos disponibles',
|
|
19894
|
+
actionText: 'Cargar datos',
|
|
19895
|
+
onClick: loadData,
|
|
19896
|
+
}}
|
|
19897
|
+
/>
|
|
19898
|
+
</Table>
|
|
19899
|
+
\`\`\`
|
|
19900
|
+
`;
|
|
19860
19901
|
const spinnerExample = `
|
|
19861
19902
|
## Uso del componente
|
|
19862
19903
|
|
|
@@ -20135,7 +20176,8 @@ const es$3 = {
|
|
|
20135
20176
|
example: spinnerExample
|
|
20136
20177
|
},
|
|
20137
20178
|
table: {
|
|
20138
|
-
example: tableExample
|
|
20179
|
+
example: tableExample,
|
|
20180
|
+
asyncContent: tableAsyncContentExample
|
|
20139
20181
|
},
|
|
20140
20182
|
tableHeader: {
|
|
20141
20183
|
example: tableHeaderExample
|
|
@@ -20263,6 +20305,7 @@ const es$3 = {
|
|
|
20263
20305
|
text: "Texto",
|
|
20264
20306
|
title: "Título",
|
|
20265
20307
|
onRemove: "Función que se ejecuta al hacer clic en el ícono de cerrar",
|
|
20308
|
+
onClick: "Callback que se ejecuta al hacer clic en el chip. Cuando se define, el chip se vuelve interactivo (clickable, accesible por teclado)",
|
|
20266
20309
|
disabled: "Deshabilita el chip y oculta el ícono de cerrar",
|
|
20267
20310
|
variant: "Variante visual del chip que cambia el color de fondo (default, success, error, warning, info)",
|
|
20268
20311
|
size: "Tamaño del chip (sm: pequeño, lg: grande, undefined: tamaño por defecto)"
|
|
@@ -30836,11 +30879,11 @@ const useUtilityClasses$W = (ownerState) => {
|
|
|
30836
30879
|
size: size2,
|
|
30837
30880
|
color: color2,
|
|
30838
30881
|
onDelete,
|
|
30839
|
-
clickable,
|
|
30882
|
+
clickable: clickable2,
|
|
30840
30883
|
variant
|
|
30841
30884
|
} = ownerState;
|
|
30842
30885
|
const slots = {
|
|
30843
|
-
root: ["root", variant, disabled2 && "disabled", `size${capitalize$1(size2)}`, `color${capitalize$1(color2)}`,
|
|
30886
|
+
root: ["root", variant, disabled2 && "disabled", `size${capitalize$1(size2)}`, `color${capitalize$1(color2)}`, clickable2 && "clickable", onDelete && "deletable"],
|
|
30844
30887
|
label: ["label"],
|
|
30845
30888
|
avatar: ["avatar"],
|
|
30846
30889
|
icon: ["icon"],
|
|
@@ -30858,7 +30901,7 @@ const ChipRoot = styled("div", {
|
|
|
30858
30901
|
} = props;
|
|
30859
30902
|
const {
|
|
30860
30903
|
color: color2,
|
|
30861
|
-
clickable,
|
|
30904
|
+
clickable: clickable2,
|
|
30862
30905
|
onDelete,
|
|
30863
30906
|
size: size2,
|
|
30864
30907
|
variant
|
|
@@ -30869,7 +30912,7 @@ const ChipRoot = styled("div", {
|
|
|
30869
30912
|
[`& .${chipClasses.icon}`]: styles2.icon
|
|
30870
30913
|
}, {
|
|
30871
30914
|
[`& .${chipClasses.deleteIcon}`]: styles2.deleteIcon
|
|
30872
|
-
}, styles2.root, styles2[`size${capitalize$1(size2)}`], styles2[`color${capitalize$1(color2)}`],
|
|
30915
|
+
}, styles2.root, styles2[`size${capitalize$1(size2)}`], styles2[`color${capitalize$1(color2)}`], clickable2 && styles2.clickable, onDelete && styles2.deletable, styles2[variant]];
|
|
30873
30916
|
}
|
|
30874
30917
|
})(memoTheme(({
|
|
30875
30918
|
theme
|
|
@@ -31207,8 +31250,8 @@ const Chip = /* @__PURE__ */ React.forwardRef(function Chip2(inProps, ref) {
|
|
|
31207
31250
|
onKeyUp(event);
|
|
31208
31251
|
}
|
|
31209
31252
|
};
|
|
31210
|
-
const
|
|
31211
|
-
const component =
|
|
31253
|
+
const clickable2 = clickableProp !== false && onClick ? true : clickableProp;
|
|
31254
|
+
const component = clickable2 || onDelete ? ButtonBase : ComponentProp || "div";
|
|
31212
31255
|
const ownerState = {
|
|
31213
31256
|
...props,
|
|
31214
31257
|
component,
|
|
@@ -31217,7 +31260,7 @@ const Chip = /* @__PURE__ */ React.forwardRef(function Chip2(inProps, ref) {
|
|
|
31217
31260
|
color: color2,
|
|
31218
31261
|
iconColor: /* @__PURE__ */ React.isValidElement(iconProp) ? iconProp.props.color || color2 : color2,
|
|
31219
31262
|
onDelete: !!onDelete,
|
|
31220
|
-
clickable,
|
|
31263
|
+
clickable: clickable2,
|
|
31221
31264
|
variant
|
|
31222
31265
|
};
|
|
31223
31266
|
const classes = useUtilityClasses$W(ownerState);
|
|
@@ -31275,7 +31318,7 @@ const Chip = /* @__PURE__ */ React.forwardRef(function Chip2(inProps, ref) {
|
|
|
31275
31318
|
ref: handleRef,
|
|
31276
31319
|
className: clsx(classes.root, className),
|
|
31277
31320
|
additionalProps: {
|
|
31278
|
-
disabled:
|
|
31321
|
+
disabled: clickable2 && disabled2 ? true : void 0,
|
|
31279
31322
|
tabIndex: skipFocusWhenDisabled && disabled2 ? -1 : tabIndex,
|
|
31280
31323
|
...moreProps
|
|
31281
31324
|
},
|
|
@@ -68221,38 +68264,19 @@ const AlertBase = ({
|
|
|
68221
68264
|
);
|
|
68222
68265
|
};
|
|
68223
68266
|
const Alert = withDebugHandlers(AlertBase, "Alert");
|
|
68224
|
-
var baseKeys = _baseKeys, getTag = _getTag, isArrayLike$1 = isArrayLike_1, isString = isString_1, stringSize = _stringSize;
|
|
68225
|
-
var mapTag = "[object Map]", setTag = "[object Set]";
|
|
68226
|
-
function size(collection) {
|
|
68227
|
-
if (collection == null) {
|
|
68228
|
-
return 0;
|
|
68229
|
-
}
|
|
68230
|
-
if (isArrayLike$1(collection)) {
|
|
68231
|
-
return isString(collection) ? stringSize(collection) : collection.length;
|
|
68232
|
-
}
|
|
68233
|
-
var tag = getTag(collection);
|
|
68234
|
-
if (tag == mapTag || tag == setTag) {
|
|
68235
|
-
return collection.size;
|
|
68236
|
-
}
|
|
68237
|
-
return baseKeys(collection).length;
|
|
68238
|
-
}
|
|
68239
|
-
var size_1 = size;
|
|
68240
|
-
const size$1 = /* @__PURE__ */ getDefaultExportFromCjs(size_1);
|
|
68241
68267
|
const breadcrumb = "breadcrumb-module_breadcrumb_r-ILp";
|
|
68242
68268
|
const styles$8 = {
|
|
68243
68269
|
breadcrumb,
|
|
68244
68270
|
"breadcrumb-item": "breadcrumb-module_breadcrumb-item_suTUF"
|
|
68245
68271
|
};
|
|
68246
68272
|
const BreadcrumbItemComponent = ({ item: item2, index: index2, items }) => {
|
|
68247
|
-
const isLast = index2 === size$1(items) - 1;
|
|
68248
68273
|
const text2 = `${item2.text} >`;
|
|
68249
|
-
return item2
|
|
68250
|
-
|
|
68274
|
+
return item2?.onClick || item2?.href ? /* @__PURE__ */ jsx$1(
|
|
68275
|
+
Link,
|
|
68251
68276
|
{
|
|
68252
|
-
|
|
68253
|
-
|
|
68254
|
-
|
|
68255
|
-
onClick: item2.onClick
|
|
68277
|
+
href: `${item2?.href}`,
|
|
68278
|
+
onClick: item2?.onClick,
|
|
68279
|
+
children: text2
|
|
68256
68280
|
}
|
|
68257
68281
|
) : /* @__PURE__ */ jsxs("div", { className: styles$8["breadcrumb-item"], children: [
|
|
68258
68282
|
" ",
|
|
@@ -68509,11 +68533,11 @@ const WarningModalBase = ({
|
|
|
68509
68533
|
}
|
|
68510
68534
|
);
|
|
68511
68535
|
const WarningModal = withDebugHandlers(WarningModalBase, "WarningModal");
|
|
68512
|
-
var baseIteratee$1 = _baseIteratee, isArrayLike = isArrayLike_1, keys = keys_1;
|
|
68536
|
+
var baseIteratee$1 = _baseIteratee, isArrayLike$1 = isArrayLike_1, keys = keys_1;
|
|
68513
68537
|
function createFind$1(findIndexFunc) {
|
|
68514
68538
|
return function(collection, predicate, fromIndex) {
|
|
68515
68539
|
var iterable = Object(collection);
|
|
68516
|
-
if (!isArrayLike(collection)) {
|
|
68540
|
+
if (!isArrayLike$1(collection)) {
|
|
68517
68541
|
var iteratee = baseIteratee$1(predicate);
|
|
68518
68542
|
collection = keys(collection);
|
|
68519
68543
|
predicate = function(key) {
|
|
@@ -77111,6 +77135,23 @@ const DraggableListBase = ({
|
|
|
77111
77135
|
] });
|
|
77112
77136
|
};
|
|
77113
77137
|
const DraggableList = withDebugHandlers(DraggableListBase, "DraggableList");
|
|
77138
|
+
var baseKeys = _baseKeys, getTag = _getTag, isArrayLike = isArrayLike_1, isString = isString_1, stringSize = _stringSize;
|
|
77139
|
+
var mapTag = "[object Map]", setTag = "[object Set]";
|
|
77140
|
+
function size(collection) {
|
|
77141
|
+
if (collection == null) {
|
|
77142
|
+
return 0;
|
|
77143
|
+
}
|
|
77144
|
+
if (isArrayLike(collection)) {
|
|
77145
|
+
return isString(collection) ? stringSize(collection) : collection.length;
|
|
77146
|
+
}
|
|
77147
|
+
var tag = getTag(collection);
|
|
77148
|
+
if (tag == mapTag || tag == setTag) {
|
|
77149
|
+
return collection.size;
|
|
77150
|
+
}
|
|
77151
|
+
return baseKeys(collection).length;
|
|
77152
|
+
}
|
|
77153
|
+
var size_1 = size;
|
|
77154
|
+
const size$1 = /* @__PURE__ */ getDefaultExportFromCjs(size_1);
|
|
77114
77155
|
const CheckRoundedIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
|
|
77115
77156
|
d: "M9 16.17 5.53 12.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.18 4.18c.39.39 1.02.39 1.41 0L20.29 7.71c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0z"
|
|
77116
77157
|
}), "CheckRounded");
|
|
@@ -77199,12 +77240,23 @@ const styles = {
|
|
|
77199
77240
|
"header-row": "table-module_header-row_ry6Lv",
|
|
77200
77241
|
"body-row": "table-module_body-row_OMOX0",
|
|
77201
77242
|
"header-cell": "table-module_header-cell_0FEWz",
|
|
77202
|
-
"body-cell": "table-module_body-cell_p4019"
|
|
77243
|
+
"body-cell": "table-module_body-cell_p4019",
|
|
77244
|
+
"body-async": "table-module_body-async_21Z7L"
|
|
77203
77245
|
};
|
|
77204
|
-
const TableBody = ({ data,
|
|
77246
|
+
const TableBody = ({ data, isLoading, error: error2, empty, success: success2 }) => {
|
|
77205
77247
|
const columns = useContext(TableContext);
|
|
77206
|
-
|
|
77207
|
-
|
|
77248
|
+
const showContent = !isLoading && !error2?.value && !success2?.value && data.length > 0;
|
|
77249
|
+
if (!showContent) {
|
|
77250
|
+
return /* @__PURE__ */ jsx$1("tbody", { children: /* @__PURE__ */ jsx$1("tr", { children: /* @__PURE__ */ jsx$1("td", { colSpan: columns.length, className: styles["body-async"], children: /* @__PURE__ */ jsx$1(
|
|
77251
|
+
AsyncContent,
|
|
77252
|
+
{
|
|
77253
|
+
isLoading,
|
|
77254
|
+
error: error2,
|
|
77255
|
+
success: success2,
|
|
77256
|
+
empty: { ...empty, items: data },
|
|
77257
|
+
children: /* @__PURE__ */ jsx$1(Fragment$1, {})
|
|
77258
|
+
}
|
|
77259
|
+
) }) }) });
|
|
77208
77260
|
}
|
|
77209
77261
|
return /* @__PURE__ */ jsx$1("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsx$1("tr", { className: styles["body-row"], children: columns.map((col) => {
|
|
77210
77262
|
const value = row[col.key];
|