@dubix/ui 0.9.0 → 0.11.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/README.md +466 -15
- package/dist/checkbox/Checkbox.d.ts +61 -0
- package/dist/checkbox/Checkbox.js +41 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/filter-bar/AppliedFilters.d.ts +41 -0
- package/dist/filter-bar/AppliedFilters.js +123 -0
- package/dist/filter-bar/FilterAmountRange.d.ts +27 -0
- package/dist/filter-bar/FilterAmountRange.js +86 -0
- package/dist/filter-bar/FilterBar.d.ts +32 -0
- package/dist/filter-bar/FilterBar.js +21 -0
- package/dist/filter-bar/FilterOptions.d.ts +71 -0
- package/dist/filter-bar/FilterOptions.js +181 -0
- package/dist/filter-bar/FilterPanel.d.ts +63 -0
- package/dist/filter-bar/FilterPanel.js +50 -0
- package/dist/filter-bar/FilterPeriod.d.ts +25 -0
- package/dist/filter-bar/FilterPeriod.js +71 -0
- package/dist/filter-bar/FilterSearch.d.ts +54 -0
- package/dist/filter-bar/FilterSearch.js +100 -0
- package/dist/filter-bar/FilterToggle.d.ts +16 -0
- package/dist/filter-bar/FilterToggle.js +24 -0
- package/dist/filter-bar/format.d.ts +53 -0
- package/dist/filter-bar/format.js +104 -0
- package/dist/filter-bar/index.d.ts +18 -0
- package/dist/filter-bar/index.js +9 -0
- package/dist/pagination/Pagination.d.ts +11 -8
- package/dist/pagination/Pagination.js +7 -2
- package/dist/popover/Popover.d.ts +65 -0
- package/dist/popover/Popover.js +87 -0
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.js +1 -0
- package/dist/select/Select.d.ts +5 -1
- package/dist/select/Select.js +2 -2
- package/dist/select/index.d.ts +1 -1
- package/dist/styles.css +965 -72
- package/dist/table/Table.d.ts +14 -3
- package/dist/table/Table.js +10 -4
- package/dist/tooltip/Tooltip.d.ts +6 -1
- package/dist/tooltip/Tooltip.js +5 -4
- package/package.json +13 -1
package/dist/table/Table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef } from 'react';
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
2
|
/** Densidad de las filas: va como `data-density` en la tabla, y los tokens fijan `--dx-row-h` (40, 34 y 46 px). */
|
|
3
3
|
export type TableDensity = 'default' | 'compact' | 'comfortable';
|
|
4
4
|
/** Alineación horizontal de una celda: `end` para cifras (a la derecha). */
|
|
@@ -22,6 +22,14 @@ export interface TableCellProps extends Omit<ComponentPropsWithRef<'td'>, 'align
|
|
|
22
22
|
align?: TableAlign | undefined;
|
|
23
23
|
/** Texto secundario (`--dx-fg-2`). */
|
|
24
24
|
muted?: boolean | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Segundo renglón, debajo del contenido (en `compact`, al lado): texto que completa al principal, como el nombre de
|
|
27
|
+
* fantasía bajo la razón social o el importe sin bonificar bajo el neto. `--dx-text-xs` en `--dx-fg-3`, peso 400. La fila
|
|
28
|
+
* no crece. Con `null`, `undefined`, un booleano o `''`, la celda queda en un renglón y sin envoltorio; `0` sí se muestra.
|
|
29
|
+
*/
|
|
30
|
+
secondary?: ReactNode;
|
|
31
|
+
/** Peso 500 en el renglón principal (el secundario queda en 400): la celda que identifica a la fila. */
|
|
32
|
+
strong?: boolean | undefined;
|
|
25
33
|
}
|
|
26
34
|
/**
|
|
27
35
|
* Tabla densa de D2 sobre `<table>` nativa: cabecera sin fondo propio con una regla, divisores suaves y cifras con dígitos
|
|
@@ -36,5 +44,8 @@ export declare function TableBody({ className, ...rest }: TableBodyProps): impor
|
|
|
36
44
|
export declare function TableRow({ className, ...rest }: TableRowProps): import("react").JSX.Element;
|
|
37
45
|
/** `<th>` de la cabecera, con `scope="col"` por defecto. */
|
|
38
46
|
export declare function TableHead({ align, scope, className, ...rest }: TableHeadProps): import("react").JSX.Element;
|
|
39
|
-
/**
|
|
40
|
-
|
|
47
|
+
/**
|
|
48
|
+
* `<td>` del cuerpo: una línea con elipsis, en la fuente de datos. Con `secondary`, dos renglones (`dx-table__lines` con
|
|
49
|
+
* `dx-table__primary` y `dx-table__secondary`), cada uno con su elipsis.
|
|
50
|
+
*/
|
|
51
|
+
export declare function TableCell({ align, muted, strong, secondary, className, children, ...rest }: TableCellProps): import("react").JSX.Element;
|
package/dist/table/Table.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
const cx = (own, className) => (className ? `${own} ${className}` : own);
|
|
3
|
+
/** Lo que React no muestra (null, undefined y booleanos) y el texto vacío: con eso no hay segundo renglón. 0 sí se muestra. */
|
|
4
|
+
const isBlank = (node) => node === null || node === undefined || typeof node === 'boolean' || node === '';
|
|
3
5
|
/**
|
|
4
6
|
* Tabla densa de D2 sobre `<table>` nativa: cabecera sin fondo propio con una regla, divisores suaves y cifras con dígitos
|
|
5
7
|
* tabulares. `className` se suma a `dx-table`; `ref` y el resto de las props van a la `<table>`.
|
|
@@ -23,7 +25,11 @@ export function TableRow({ className, ...rest }) {
|
|
|
23
25
|
export function TableHead({ align, scope = 'col', className, ...rest }) {
|
|
24
26
|
return _jsx("th", { ...rest, scope: scope, className: cx('dx-table__head', className), "data-align": align === 'end' ? 'end' : undefined });
|
|
25
27
|
}
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* `<td>` del cuerpo: una línea con elipsis, en la fuente de datos. Con `secondary`, dos renglones (`dx-table__lines` con
|
|
30
|
+
* `dx-table__primary` y `dx-table__secondary`), cada uno con su elipsis.
|
|
31
|
+
*/
|
|
32
|
+
export function TableCell({ align, muted, strong, secondary, className, children, ...rest }) {
|
|
33
|
+
const stacked = !isBlank(secondary);
|
|
34
|
+
return (_jsx("td", { ...rest, className: cx('dx-table__cell', className), "data-align": align === 'end' ? 'end' : undefined, "data-muted": muted ? 'true' : undefined, "data-strong": strong ? 'true' : undefined, "data-lines": stacked ? '2' : undefined, children: stacked ? (_jsxs("div", { className: "dx-table__lines", children: [_jsx("div", { className: "dx-table__primary", children: children }), _jsx("div", { className: "dx-table__secondary", children: secondary })] })) : children }));
|
|
29
35
|
}
|
|
@@ -16,6 +16,11 @@ export interface TooltipProps {
|
|
|
16
16
|
shortcut?: string | undefined;
|
|
17
17
|
/** Milisegundos de hover antes de abrir. Por defecto, el de TooltipProvider o 700 (el de Radix). El foco abre sin espera. */
|
|
18
18
|
delayDuration?: number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Apagado: no abre (y si estaba abierto, se cierra) y no agrega `aria-describedby`. No cambia nada más: el disparador sigue
|
|
21
|
+
* envuelto igual, así que prenderlo o apagarlo no lo vuelve a montar (no pierde el foco ni lo que tenga abierto).
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean | undefined;
|
|
19
24
|
}
|
|
20
25
|
export interface TooltipProviderProps {
|
|
21
26
|
children: ReactNode;
|
|
@@ -31,4 +36,4 @@ export declare function TooltipProvider({ children, delayDuration, skipDelayDura
|
|
|
31
36
|
* salir o al hacer clic. Envuelve a un único hijo focalizable, que conserva su nombre accesible; el tooltip lo describe
|
|
32
37
|
* (`aria-describedby`) salvo que repita ese nombre. Funciona sin TooltipProvider.
|
|
33
38
|
*/
|
|
34
|
-
export declare function Tooltip({ content, children, side, align, shortcut, delayDuration }: TooltipProps): import("react").JSX.Element;
|
|
39
|
+
export declare function Tooltip({ content, children, side, align, shortcut, delayDuration, disabled }: TooltipProps): import("react").JSX.Element;
|
package/dist/tooltip/Tooltip.js
CHANGED
|
@@ -34,7 +34,7 @@ function TriggerSlot({ children, drop, add, 'aria-describedby': describedby, ...
|
|
|
34
34
|
* salir o al hacer clic. Envuelve a un único hijo focalizable, que conserva su nombre accesible; el tooltip lo describe
|
|
35
35
|
* (`aria-describedby`) salvo que repita ese nombre. Funciona sin TooltipProvider.
|
|
36
36
|
*/
|
|
37
|
-
export function Tooltip({ content, children, side = 'top', align = 'center', shortcut, delayDuration }) {
|
|
37
|
+
export function Tooltip({ content, children, side = 'top', align = 'center', shortcut, delayDuration, disabled = false }) {
|
|
38
38
|
if (!isValidElement(children))
|
|
39
39
|
throw new Error('Tooltip: children tiene que ser un único elemento focalizable (p. ej. un <button>).');
|
|
40
40
|
const inProvider = useContext(InProvider);
|
|
@@ -45,15 +45,16 @@ export function Tooltip({ content, children, side = 'top', align = 'center', sho
|
|
|
45
45
|
// El nombre y el tema se leen al abrir, del disparador ya montado: así valen también los aria-label que cambian.
|
|
46
46
|
const onOpenChange = (open) => {
|
|
47
47
|
const el = trigger.current;
|
|
48
|
-
if (!open || !el) {
|
|
48
|
+
if (!open || !el || disabled) {
|
|
49
49
|
setState((s) => ({ ...s, open: false }));
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const text = typeof content === 'string' || typeof content === 'number' ? normalize(String(content)) : null;
|
|
53
53
|
setState({ open: true, repeats: text !== null && text !== '' && text === normalize(accessibleName(el)), container: themeRoot(el) });
|
|
54
54
|
};
|
|
55
|
-
const {
|
|
55
|
+
const { repeats, container } = state;
|
|
56
|
+
const open = state.open && !disabled;
|
|
56
57
|
const hasShortcut = shortcut !== undefined && shortcut !== '';
|
|
57
|
-
const tooltip = (_jsxs(TooltipPrimitive.Root, { open: open, onOpenChange: onOpenChange, ...(delayDuration === undefined ? {} : { delayDuration }), children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, ref: trigger, children: _jsx(TriggerSlot, { drop: repeats ? contentId : undefined, add: repeats && hasShortcut ? shortcutId : undefined, children: children }) }), _jsx(TooltipPrimitive.Portal, { container: container, children: _jsxs(TooltipPrimitive.Content, { className: "dx-tooltip", id: contentId, side: side, align: align, sideOffset: SIDE_OFFSET, collisionPadding: COLLISION_PADDING, "aria-hidden": repeats || undefined, children: [content, hasShortcut && _jsx("kbd", { className: "dx-tooltip__shortcut", id: shortcutId, children: shortcut })] }) })] }));
|
|
58
|
+
const tooltip = (_jsxs(TooltipPrimitive.Root, { open: open, onOpenChange: onOpenChange, ...(delayDuration === undefined ? {} : { delayDuration }), children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, ref: trigger, children: _jsx(TriggerSlot, { drop: repeats ? contentId : undefined, add: !disabled && repeats && hasShortcut ? shortcutId : undefined, children: children }) }), _jsx(TooltipPrimitive.Portal, { container: container, children: _jsxs(TooltipPrimitive.Content, { className: "dx-tooltip", id: contentId, side: side, align: align, sideOffset: SIDE_OFFSET, collisionPadding: COLLISION_PADDING, "aria-hidden": repeats || undefined, children: [content, hasShortcut && _jsx("kbd", { className: "dx-tooltip__shortcut", id: shortcutId, children: shortcut })] }) })] }));
|
|
58
59
|
return inProvider ? tooltip : _jsx(TooltipPrimitive.Provider, { children: tooltip });
|
|
59
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dubix/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Componentes React 19 de Dubix (D2 · Tinta, referencia D2.1) con CSS propio sobre las variables --dx-* de @dubix/tokens.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./dist/card/index.d.ts",
|
|
41
41
|
"default": "./dist/card/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./checkbox": {
|
|
44
|
+
"types": "./dist/checkbox/index.d.ts",
|
|
45
|
+
"default": "./dist/checkbox/index.js"
|
|
46
|
+
},
|
|
43
47
|
"./confirm-dialog": {
|
|
44
48
|
"types": "./dist/confirm-dialog/index.d.ts",
|
|
45
49
|
"default": "./dist/confirm-dialog/index.js"
|
|
@@ -60,6 +64,10 @@
|
|
|
60
64
|
"types": "./dist/field/index.d.ts",
|
|
61
65
|
"default": "./dist/field/index.js"
|
|
62
66
|
},
|
|
67
|
+
"./filter-bar": {
|
|
68
|
+
"types": "./dist/filter-bar/index.d.ts",
|
|
69
|
+
"default": "./dist/filter-bar/index.js"
|
|
70
|
+
},
|
|
63
71
|
"./icon-button": {
|
|
64
72
|
"types": "./dist/icon-button/index.d.ts",
|
|
65
73
|
"default": "./dist/icon-button/index.js"
|
|
@@ -80,6 +88,10 @@
|
|
|
80
88
|
"types": "./dist/pagination/index.d.ts",
|
|
81
89
|
"default": "./dist/pagination/index.js"
|
|
82
90
|
},
|
|
91
|
+
"./popover": {
|
|
92
|
+
"types": "./dist/popover/index.d.ts",
|
|
93
|
+
"default": "./dist/popover/index.js"
|
|
94
|
+
},
|
|
83
95
|
"./product-mark": {
|
|
84
96
|
"types": "./dist/product-mark/index.d.ts",
|
|
85
97
|
"default": "./dist/product-mark/index.js"
|