@kapiuara/ui 0.15.1 → 0.15.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.
- package/README.md +112 -2
- package/dist/components/data/KapiTable.js +278 -278
- package/dist/components/data/tableTypes.d.ts +1 -1
- package/dist/components/inputs/KapiSelect.js +4 -1
- package/dist/components/layout/KapiContextSlot.js +10 -10
- package/dist/components/layout/KapiPanelParts.d.ts +25 -1
- package/dist/components/layout/KapiPanelParts.js +44 -26
- package/dist/components/layout/KapiStack.d.ts +13 -1
- package/dist/components/layout/KapiStack.js +6 -5
- package/dist/components/layout/index.d.ts +2 -2
- package/dist/components/layout/layoutPrimitives.d.ts +2 -1
- package/dist/components/layout/layoutPrimitives.js +3 -3
- package/dist/components/navigation/KapiContextPanel.js +80 -81
- package/dist/components/navigation/KapiPanelGroup.js +9 -9
- package/dist/css/components/data/KapiTable.css +1 -1
- package/dist/css/components/inputs/KapiSelect.css +1 -1
- package/dist/css/components/layout/layout-primitives.css +1 -1
- package/dist/index.js +54 -54
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +1 -1
|
@@ -397,7 +397,7 @@ export type KapiTableProps<T, K extends KapiTableKeyField<T> = KapiTableKeyField
|
|
|
397
397
|
dataset?: KapiTableDataset | undefined;
|
|
398
398
|
/** Reemplaza las filas por un estado de carga. */
|
|
399
399
|
loading?: boolean | undefined;
|
|
400
|
-
/** Cantidad de filas skeleton durante la carga
|
|
400
|
+
/** Cantidad de filas skeleton durante la carga. Default: el `pageSize` del paginado, para que el esqueleto ocupe el mismo alto que los datos que vienen y no haya salto; sin paginado, 5. Con `0` se muestra el spinner con `loadingMessage`. */
|
|
401
401
|
loadingRows?: number | undefined;
|
|
402
402
|
/** Envuelve la tabla (y su paginación) en una card. Default `false`. */
|
|
403
403
|
card?: boolean | undefined;
|
|
@@ -243,7 +243,10 @@ var Re = 6, ze = [], f = "\0kapisel-all", p = (e, t) => `${e} “${t.trim()}”`
|
|
|
243
243
|
style: mt,
|
|
244
244
|
onMouseDown: fn,
|
|
245
245
|
children: [
|
|
246
|
-
x && Ye,
|
|
246
|
+
x && Ye ? /* @__PURE__ */ u("span", {
|
|
247
|
+
className: "kapisel__icon",
|
|
248
|
+
children: Ye
|
|
249
|
+
}) : null,
|
|
247
250
|
x && Et && /* @__PURE__ */ d("span", {
|
|
248
251
|
className: "kapisel__chiplabel",
|
|
249
252
|
"aria-hidden": "true",
|
|
@@ -5,10 +5,10 @@ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
|
5
5
|
import { useControllableState as n } from "../../hooks/useControllableState.js";
|
|
6
6
|
import { directionOf as r, physicalSide as i } from "../../hooks/directionLogic.js";
|
|
7
7
|
import { useMergedRefs as ee } from "../../hooks/mergeRefs.js";
|
|
8
|
-
import { clampCtxPanelWidth as a, ctxPanelWidthFromDrag as o, stepCtxPanelWidth as te } from "../navigation/contextPanelLogic.js";
|
|
9
8
|
/* empty css */
|
|
10
|
-
import { KapiPanelMiniContext as
|
|
11
|
-
import { resolveGone as
|
|
9
|
+
import { KapiPanelMiniContext as te } from "../navigation/panelMini.js";
|
|
10
|
+
import { resolveGone as a, resolveMini as ne } from "../navigation/panelMiniLogic.js";
|
|
11
|
+
import { clampCtxPanelWidth as o, ctxPanelWidthFromDrag as re, stepCtxPanelWidth as ie } from "../navigation/contextPanelLogic.js";
|
|
12
12
|
import { useHydrated as ae } from "../../hooks/useHydrated.js";
|
|
13
13
|
import { SHELL_MOBILE_QUERY as oe, SHELL_NARROW_QUERY as se, matchesQuery as ce, useMediaQuery as s } from "../../hooks/useMediaQuery.js";
|
|
14
14
|
import { useReopenBus as le } from "./reopenBus.js";
|
|
@@ -34,7 +34,7 @@ var _ = {
|
|
|
34
34
|
]), u(() => {
|
|
35
35
|
L === "wide" && (z.current = P);
|
|
36
36
|
}, [L, P]);
|
|
37
|
-
let [B, we] = n(ve, ye ?? null, be), [Te, V] = de(!1), H = f(null), Ee = ee(H, k), U = f(null), W = B === null ? null :
|
|
37
|
+
let [B, we] = n(ve, ye ?? null, be), [Te, V] = de(!1), H = f(null), Ee = ee(H, k), U = f(null), W = B === null ? null : o(B, S, C), G = () => W ?? H.current?.offsetWidth ?? 258, K = (e) => {
|
|
38
38
|
e !== W && we(e);
|
|
39
39
|
}, De = (e) => {
|
|
40
40
|
e.button === 0 && (U.current = {
|
|
@@ -43,20 +43,20 @@ var _ = {
|
|
|
43
43
|
}, e.currentTarget.setPointerCapture(e.pointerId), V(!0), e.preventDefault());
|
|
44
44
|
}, Oe = (e) => {
|
|
45
45
|
let t = U.current;
|
|
46
|
-
t && K(
|
|
46
|
+
t && K(re(i(b, r(e.currentTarget)), t.startWidth, t.startX, e.clientX, S, C));
|
|
47
47
|
}, q = (e) => {
|
|
48
48
|
U.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), V(!1);
|
|
49
49
|
}, J = (e) => {
|
|
50
|
-
let t =
|
|
50
|
+
let t = ie(i(b, r(e.currentTarget)), G(), e.key, S, C);
|
|
51
51
|
t !== null && (e.preventDefault(), K(t));
|
|
52
52
|
}, ke = W === null ? D : {
|
|
53
53
|
...D,
|
|
54
54
|
"--kapi-ctxslot-w": `${W}px`
|
|
55
|
-
}, Y =
|
|
55
|
+
}, Y = ne({
|
|
56
56
|
collapsedMode: x,
|
|
57
57
|
open: P,
|
|
58
58
|
mobile: I
|
|
59
|
-
}), X =
|
|
59
|
+
}), X = a({
|
|
60
60
|
collapsedMode: x,
|
|
61
61
|
open: P,
|
|
62
62
|
mobile: I
|
|
@@ -101,7 +101,7 @@ var _ = {
|
|
|
101
101
|
"aria-label": A.resize,
|
|
102
102
|
"aria-valuemin": S,
|
|
103
103
|
"aria-valuemax": C,
|
|
104
|
-
"aria-valuenow":
|
|
104
|
+
"aria-valuenow": o(W ?? 258, S, C),
|
|
105
105
|
tabIndex: 0,
|
|
106
106
|
onPointerDown: De,
|
|
107
107
|
onPointerMove: Oe,
|
|
@@ -132,7 +132,7 @@ var _ = {
|
|
|
132
132
|
})
|
|
133
133
|
})]
|
|
134
134
|
})]
|
|
135
|
-
}), /* @__PURE__ */ p(
|
|
135
|
+
}), /* @__PURE__ */ p(te.Provider, {
|
|
136
136
|
value: je,
|
|
137
137
|
children: me
|
|
138
138
|
})]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type KapiNavBadgeValue } from "../navigation/navBadgeLogic.js";
|
|
2
2
|
import type { KapiTone } from "../tone.js";
|
|
3
|
-
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode, Ref } from "react";
|
|
3
|
+
import type { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
4
4
|
type DivProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
/** Ref al `<div>` raíz. */
|
|
6
6
|
ref?: Ref<HTMLDivElement> | undefined;
|
|
@@ -11,6 +11,30 @@ export declare const KapiPanelLabel: ({ className, ...rest }: DivProps) => impor
|
|
|
11
11
|
export declare const KapiPanelDivider: ({ className, ...rest }: Omit<DivProps, "children">) => import("react").JSX.Element;
|
|
12
12
|
/** Texto de ayuda al pie del panel. Atributos nativos al `<div>`. */
|
|
13
13
|
export declare const KapiPanelHint: ({ className, ...rest }: DivProps) => import("react").JSX.Element;
|
|
14
|
+
/** Atributos nativos (`name`, `disabled`, `data-*`…) van al `<input>`. */
|
|
15
|
+
export type KapiPanelSearchProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
16
|
+
/** Ref al `<input>`. */
|
|
17
|
+
ref?: Ref<HTMLInputElement> | undefined;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Buscador del panel contextual, con la misma caja que el de `KapiContextSections`.
|
|
21
|
+
*
|
|
22
|
+
* POR QUÉ EXISTE. El panel tenía TODAS sus piezas como componente —`KapiPanelList`,
|
|
23
|
+
* `KapiPanelItem`, `KapiPanelDivider`, `KapiPanelLabel`, `KapiPanelHint`— menos el buscador: ése
|
|
24
|
+
* sólo salía de `KapiContextSections`, que toma los ítems como DATOS. Quien componía el panel a
|
|
25
|
+
* mano no tenía forma de llegar a él, así que escribía `className="kapi-ctxsearch
|
|
26
|
+
* kapi-ctxsearch--input"` a dedo. Pasó en una app real, y el síntoma de que faltaba una pieza es
|
|
27
|
+
* que el consumidor termina sabiendo el nombre de una clase interna.
|
|
28
|
+
*
|
|
29
|
+
* El nombre accesible se deriva del `placeholder` con la misma regla que `KapiSearchChip`
|
|
30
|
+
* (`searchChipName`), sin su elipsis: el marcado a mano escribía la frase dos veces y las dos se
|
|
31
|
+
* desincronizan en cuanto alguien edita una.
|
|
32
|
+
*
|
|
33
|
+
* Pasa el EVENTO en `onChange`, como el resto de los envoltorios de un control nativo
|
|
34
|
+
* (`KapiInput`, `KapiSearchChip`). `KapiContextSections` sigue recibiendo el texto en su prop
|
|
35
|
+
* `search.onChange`, que es API publicada y no cambia.
|
|
36
|
+
*/
|
|
37
|
+
export declare const KapiPanelSearch: ({ className, placeholder, "aria-label": ariaLabel, ...rest }: KapiPanelSearchProps) => import("react").JSX.Element;
|
|
14
38
|
/** Lista vertical de ítems del panel. Atributos nativos al contenedor `.kapi-ctxlist`. */
|
|
15
39
|
export declare const KapiPanelList: ({ children, ...rest }: Omit<DivProps, "children"> & {
|
|
16
40
|
/** Ítems de la lista (`KapiPanelItem`). */
|
|
@@ -1,64 +1,82 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiPanelParts.css";
|
|
3
|
+
import "#kapi-css/components/navigation/navigation.css";
|
|
3
4
|
import { joinClasses as e } from "../rootProps.js";
|
|
5
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { searchChipName as n } from "../inputs/searchChipLogic.js";
|
|
7
|
+
import { DEFAULT_SEARCH_CHIP_LABELS as r } from "../inputs/KapiSearchChip.js";
|
|
4
8
|
import "../navigation/navBadgeLogic.js";
|
|
5
|
-
import { KapiNavBadge as
|
|
6
|
-
import { CtxSlidingList as
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
+
import { KapiNavBadge as i } from "../navigation/KapiNavBadge.js";
|
|
10
|
+
import { CtxSlidingList as a } from "../navigation/CtxSlidingList.js";
|
|
11
|
+
/* empty css */
|
|
12
|
+
import { useKapiPanelMini as o } from "../navigation/panelMini.js";
|
|
13
|
+
import { MiniNavItem as s } from "../navigation/MiniNavItem.js";
|
|
9
14
|
/* empty css */
|
|
10
|
-
import { jsx as
|
|
15
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
11
16
|
//#region src/components/layout/KapiPanelParts.tsx
|
|
12
|
-
var
|
|
17
|
+
var u = ({ className: t, ...n }) => /* @__PURE__ */ c("div", {
|
|
13
18
|
...n,
|
|
14
19
|
className: e("kapi-ct", t)
|
|
15
|
-
}),
|
|
20
|
+
}), d = ({ className: t, ...n }) => /* @__PURE__ */ c("div", {
|
|
16
21
|
...n,
|
|
17
22
|
className: e("kapi-ctxdivider", t)
|
|
18
|
-
}),
|
|
23
|
+
}), f = ({ className: t, ...n }) => /* @__PURE__ */ c("div", {
|
|
19
24
|
...n,
|
|
20
25
|
className: e("kapi-hint", t)
|
|
21
|
-
}),
|
|
26
|
+
}), p = ({ className: i, placeholder: a, "aria-label": o, ...s }) => {
|
|
27
|
+
let l = t("searchChip", r, void 0);
|
|
28
|
+
return /* @__PURE__ */ c("input", {
|
|
29
|
+
...s,
|
|
30
|
+
type: "search",
|
|
31
|
+
className: e("kapi-ctxsearch kapi-ctxsearch--input", i),
|
|
32
|
+
placeholder: a,
|
|
33
|
+
"aria-label": n({
|
|
34
|
+
ariaLabel: o,
|
|
35
|
+
placeholder: a,
|
|
36
|
+
fallback: l.search
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}, m = ({ children: e, ...t }) => /* @__PURE__ */ c(a, {
|
|
22
40
|
...t,
|
|
23
41
|
children: e
|
|
24
|
-
}),
|
|
25
|
-
let { mini: g } =
|
|
26
|
-
return g ? /* @__PURE__ */
|
|
42
|
+
}), h = ({ active: t = !1, trailing: n, badge: r, badgeTone: a, badgeLabel: u, icon: d, className: f, type: p = "button", children: m, ...h }) => {
|
|
43
|
+
let { mini: g } = o();
|
|
44
|
+
return g ? /* @__PURE__ */ c(s, {
|
|
27
45
|
...h,
|
|
28
46
|
type: p,
|
|
29
47
|
className: f,
|
|
30
48
|
label: m,
|
|
31
49
|
icon: d,
|
|
32
|
-
active:
|
|
33
|
-
badge:
|
|
34
|
-
badgeTone:
|
|
50
|
+
active: t,
|
|
51
|
+
badge: r,
|
|
52
|
+
badgeTone: a,
|
|
35
53
|
badgeLabel: u
|
|
36
|
-
}) : /* @__PURE__ */
|
|
54
|
+
}) : /* @__PURE__ */ l("button", {
|
|
37
55
|
...h,
|
|
38
56
|
type: p,
|
|
39
|
-
className: e("kapi-ctxitem",
|
|
40
|
-
"aria-current":
|
|
57
|
+
className: e("kapi-ctxitem", t && "kapi-ctxitem--on", f),
|
|
58
|
+
"aria-current": t ? "page" : void 0,
|
|
41
59
|
children: [
|
|
42
|
-
d == null || d === !1 ? m : /* @__PURE__ */
|
|
60
|
+
d == null || d === !1 ? m : /* @__PURE__ */ l("span", {
|
|
43
61
|
className: "kapi-ctxitem__lead",
|
|
44
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ c("span", {
|
|
45
63
|
className: "kapi-ctxitem__icon",
|
|
46
64
|
"aria-hidden": "true",
|
|
47
65
|
children: d
|
|
48
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ c("span", {
|
|
49
67
|
className: "kapi-ctxitem__label",
|
|
50
68
|
children: m
|
|
51
69
|
})]
|
|
52
70
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
value:
|
|
55
|
-
tone:
|
|
71
|
+
/* @__PURE__ */ c(i, {
|
|
72
|
+
value: r,
|
|
73
|
+
tone: a,
|
|
56
74
|
label: u,
|
|
57
75
|
max: 999
|
|
58
76
|
}),
|
|
59
|
-
|
|
77
|
+
n
|
|
60
78
|
]
|
|
61
79
|
});
|
|
62
80
|
};
|
|
63
81
|
//#endregion
|
|
64
|
-
export {
|
|
82
|
+
export { d as KapiPanelDivider, f as KapiPanelHint, h as KapiPanelItem, u as KapiPanelLabel, m as KapiPanelList, p as KapiPanelSearch };
|
|
@@ -7,6 +7,18 @@ export type KapiStackProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
7
7
|
gap?: KapiGap | undefined;
|
|
8
8
|
/** Alineación en el eje horizontal (`align-items`). */
|
|
9
9
|
align?: KapiAlign | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Ocupa el alto que le deja su padre flex, para que UN hijo crezca y scrollee adentro en vez de
|
|
12
|
+
* empujar el scroll a la página.
|
|
13
|
+
*
|
|
14
|
+
* Es el chasis de una pantalla de listado: con `fill` acá y `fill` en `KapiTable`, el pie con el
|
|
15
|
+
* total y el paginador queda SIEMPRE a la vista. Sin esto hay que escribir a mano
|
|
16
|
+
* `flex: 1; min-height: 0`, y el `min-height` es el que nadie recuerda: sin él la pila no puede
|
|
17
|
+
* encogerse y el scroll se va a la página.
|
|
18
|
+
*
|
|
19
|
+
* El padre tiene que tener alto. `KapiShell` ya se lo da a su contenido.
|
|
20
|
+
*/
|
|
21
|
+
fill?: boolean | undefined;
|
|
10
22
|
};
|
|
11
23
|
/** Pila vertical (flex column). */
|
|
12
|
-
export declare function KapiStack({ gap, align, className, style, children, ...rest }: KapiStackProps): import("react").JSX.Element;
|
|
24
|
+
export declare function KapiStack({ gap, align, fill, className, style, children, ...rest }: KapiStackProps): import("react").JSX.Element;
|
|
@@ -4,16 +4,17 @@ import { stackProps as e } from "./layoutPrimitives.js";
|
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/layout/KapiStack.tsx
|
|
7
|
-
function n({ gap: n, align: r,
|
|
7
|
+
function n({ gap: n, align: r, fill: i, className: a, style: o, children: s, ...c }) {
|
|
8
8
|
return /* @__PURE__ */ t("div", {
|
|
9
|
-
...
|
|
9
|
+
...c,
|
|
10
10
|
...e({
|
|
11
11
|
gap: n,
|
|
12
12
|
align: r,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
fill: i,
|
|
14
|
+
className: a,
|
|
15
|
+
style: o
|
|
15
16
|
}),
|
|
16
|
-
children:
|
|
17
|
+
children: s
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
//#endregion
|
|
@@ -10,8 +10,8 @@ export type { KapiRailAccountProps } from "./KapiRailAccount.js";
|
|
|
10
10
|
export type { KapiRailItem, KapiRailLabels, KapiRailProps, KapiRailEntry, KapiRailPinned, KapiRailSeparator, KapiRailVariant, KapiRailZone } from "./KapiRail.js";
|
|
11
11
|
export { KapiContextSlot, DEFAULT_CONTEXT_SLOT_LABELS } from "./KapiContextSlot.js";
|
|
12
12
|
export type { KapiContextSlotProps, KapiContextSlotLabels } from "./KapiContextSlot.js";
|
|
13
|
-
export { KapiPanelDivider, KapiPanelHint, KapiPanelItem, KapiPanelLabel, KapiPanelList } from "./KapiPanelParts.js";
|
|
14
|
-
export type { KapiPanelItemProps } from "./KapiPanelParts.js";
|
|
13
|
+
export { KapiPanelDivider, KapiPanelHint, KapiPanelItem, KapiPanelLabel, KapiPanelList, KapiPanelSearch } from "./KapiPanelParts.js";
|
|
14
|
+
export type { KapiPanelItemProps, KapiPanelSearchProps } from "./KapiPanelParts.js";
|
|
15
15
|
export { KapiCard, KapiCardBody, KapiCardFooter, KapiCardHeader } from "./KapiCard.js";
|
|
16
16
|
export type { KapiCardHeaderProps, KapiCardProps } from "./KapiCard.js";
|
|
17
17
|
export {
|
|
@@ -15,9 +15,10 @@ type PrimitiveProps = {
|
|
|
15
15
|
style: CSSProperties;
|
|
16
16
|
};
|
|
17
17
|
/** Clases + estilo de KapiStack. `style` del usuario pisa al resuelto. */
|
|
18
|
-
export declare const stackProps: ({ gap, align, className, style }?: {
|
|
18
|
+
export declare const stackProps: ({ gap, align, fill, className, style }?: {
|
|
19
19
|
gap?: KapiGap | undefined;
|
|
20
20
|
align?: KapiAlign | undefined;
|
|
21
|
+
fill?: boolean | undefined;
|
|
21
22
|
className?: string | undefined;
|
|
22
23
|
style?: CSSProperties | undefined;
|
|
23
24
|
}) => PrimitiveProps;
|
|
@@ -10,14 +10,14 @@ var e = {
|
|
|
10
10
|
center: "center",
|
|
11
11
|
end: "flex-end",
|
|
12
12
|
between: "space-between"
|
|
13
|
-
}, n = (e) => e === void 0 ? void 0 : typeof e == "number" ? `${e}px` : e, r = (e) => Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0)), i = (...e) => e.filter(Boolean).join(" "), a = ({ gap: t, align: a,
|
|
14
|
-
className: i("kapi-stackx", o),
|
|
13
|
+
}, n = (e) => e === void 0 ? void 0 : typeof e == "number" ? `${e}px` : e, r = (e) => Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0)), i = (...e) => e.filter(Boolean).join(" "), a = ({ gap: t, align: a, fill: o, className: s, style: c } = {}) => ({
|
|
14
|
+
className: i("kapi-stackx", o === !0 && "kapi-stackx--fill", s),
|
|
15
15
|
style: {
|
|
16
16
|
...r({
|
|
17
17
|
gap: n(t),
|
|
18
18
|
alignItems: a && e[a]
|
|
19
19
|
}),
|
|
20
|
-
...
|
|
20
|
+
...c
|
|
21
21
|
}
|
|
22
22
|
}), o = ({ gap: a, justify: o, align: s, wrap: c = !0, className: l, style: u } = {}) => ({
|
|
23
23
|
className: i("kapi-clusterx", l),
|