@kapiuara/ui 0.15.3 → 0.16.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/LICENSE +19 -15
- package/README.md +338 -6
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +22 -22
- package/dist/components/data/KapiPaginationFooter.js +1 -1
- package/dist/components/data/KapiSheet.d.ts +105 -0
- package/dist/components/data/KapiSheet.js +75 -0
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFooter.d.ts +22 -0
- package/dist/components/data/KapiTableFooter.js +55 -0
- package/dist/components/data/KapiTableRow.js +53 -52
- package/dist/components/data/KapiTableToolbar.d.ts +4 -2
- package/dist/components/data/KapiTableToolbar.js +71 -69
- package/dist/components/data/index.d.ts +3 -1
- package/dist/components/data/tableCells.d.ts +5 -4
- package/dist/components/data/tableCells.js +42 -41
- package/dist/components/data/tableLogic.d.ts +2 -0
- package/dist/components/data/tableLogic.js +66 -66
- package/dist/components/data/tableSlots.d.ts +9 -0
- package/dist/components/data/tableSlots.js +12 -0
- package/dist/components/data/tableSpanLogic.d.ts +35 -0
- package/dist/components/data/tableSpanLogic.js +47 -0
- package/dist/components/data/tableTypes.d.ts +54 -1
- package/dist/components/data/useTableSelection.d.ts +4 -2
- package/dist/components/data/useTableSelection.js +27 -23
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/index.d.ts +7 -0
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiSelect.d.ts +12 -0
- package/dist/components/inputs/KapiSelect.js +215 -212
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/fieldLogic.d.ts +2 -2
- package/dist/components/inputs/index.d.ts +1 -1
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiBox.d.ts +31 -0
- package/dist/components/layout/KapiBox.js +26 -0
- package/dist/components/layout/KapiCard.d.ts +16 -4
- package/dist/components/layout/KapiCard.js +46 -34
- package/dist/components/layout/KapiCenter.d.ts +13 -0
- package/dist/components/layout/KapiCenter.js +23 -0
- package/dist/components/layout/KapiCol.d.ts +22 -0
- package/dist/components/layout/KapiCol.js +23 -0
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +82 -80
- package/dist/components/layout/KapiPanelParts.d.ts +11 -2
- package/dist/components/layout/KapiPanelParts.js +73 -56
- package/dist/components/layout/KapiRail.d.ts +10 -1
- package/dist/components/layout/KapiRail.js +123 -120
- package/dist/components/layout/KapiRoot.d.ts +35 -5
- package/dist/components/layout/KapiRoot.js +54 -39
- package/dist/components/layout/KapiShell.d.ts +36 -3
- package/dist/components/layout/KapiShell.js +53 -50
- package/dist/components/layout/cardSlots.d.ts +9 -0
- package/dist/components/layout/cardSlots.js +12 -0
- package/dist/components/layout/gridSpanLogic.d.ts +46 -0
- package/dist/components/layout/gridSpanLogic.js +39 -0
- package/dist/components/layout/index.d.ts +11 -4
- package/dist/components/layout/layoutPrimitives.d.ts +11 -0
- package/dist/components/layout/layoutPrimitives.js +12 -1
- package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
- package/dist/components/layout/pageHeaderSlots.js +15 -0
- package/dist/components/layout/railLogic.d.ts +16 -3
- package/dist/components/layout/railSlots.d.ts +12 -0
- package/dist/components/layout/railSlots.js +15 -0
- package/dist/components/layout/shellSlots.d.ts +6 -0
- package/dist/components/layout/shellSlots.js +9 -0
- package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
- package/dist/components/layout/useGridBreakpoint.js +35 -0
- package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
- package/dist/components/navigation/KapiBreadcrumb.js +23 -16
- package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
- package/dist/components/navigation/KapiContextPanel.js +151 -135
- package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
- package/dist/components/navigation/KapiPanelGroup.js +66 -65
- package/dist/components/navigation/KapiTabs.d.ts +12 -0
- package/dist/components/navigation/KapiTabs.js +87 -71
- package/dist/components/navigation/MiniNavItem.d.ts +7 -2
- package/dist/components/navigation/MiniNavItem.js +41 -36
- package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
- package/dist/components/navigation/breadcrumbLogic.js +1 -1
- package/dist/components/navigation/navLink.d.ts +21 -0
- package/dist/components/navigation/navLink.js +26 -0
- package/dist/components/navigation/navLinkLogic.d.ts +18 -0
- package/dist/components/navigation/navLinkLogic.js +22 -0
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +77 -75
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +123 -113
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +90 -0
- package/dist/components/slotCatalog.js +19 -0
- package/dist/components/slotsLogic.d.ts +34 -0
- package/dist/components/slotsLogic.js +18 -0
- package/dist/components/tone.d.ts +26 -0
- package/dist/components/tone.js +15 -14
- package/dist/css/base.css +1 -1
- package/dist/css/components/data/KapiEventCalendar.css +1 -1
- package/dist/css/components/data/KapiTable.css +1 -1
- package/dist/css/components/display/display.css +1 -1
- package/dist/css/components/display/typography.css +1 -0
- package/dist/css/components/feedback/feedback.css +1 -1
- package/dist/css/components/inputs/KapiButton.css +1 -1
- package/dist/css/components/inputs/KapiDatePicker.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/themeColorsLogic.d.ts +19 -0
- package/dist/hooks/themeColorsLogic.js +4 -2
- package/dist/hooks/themeDeriveLogic.d.ts +16 -0
- package/dist/hooks/themeDeriveLogic.js +27 -17
- package/dist/hooks/toneFamilyLogic.d.ts +122 -0
- package/dist/hooks/toneFamilyLogic.js +151 -0
- package/dist/hooks/useKapiTheme.d.ts +8 -2
- package/dist/hooks/useKapiTheme.js +116 -103
- package/dist/hooks/useToneFamilies.d.ts +30 -0
- package/dist/hooks/useToneFamilies.js +46 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +213 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HTMLAttributes, Ref } from "react";
|
|
2
|
+
import { type KapiColOrder, type KapiResponsive } from "./gridSpanLogic.js";
|
|
3
|
+
export type KapiColProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/** Ref al `<div>` raíz. */
|
|
5
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Pistas que ocupa. Un número vale desde `xs`; un objeto, por breakpoint y mobile-first
|
|
8
|
+
* (`{ xs: 6, md: 4 }`: 6 hasta `md`, 4 desde `md`). Sin valor ocupa toda la fila. Un valor sobre
|
|
9
|
+
* `columns` crea pistas implícitas: no lo hagas.
|
|
10
|
+
*/
|
|
11
|
+
span?: KapiResponsive<number> | undefined;
|
|
12
|
+
/** Pistas vacías antes de la columna. Mismo formato que `span`; `0` cancela un offset de un breakpoint menor. */
|
|
13
|
+
offset?: KapiResponsive<number> | undefined;
|
|
14
|
+
/** Posición visual en la fila: un número, o `"first"` / `"last"`. Mismo formato que `span`. Default 0. */
|
|
15
|
+
order?: KapiResponsive<KapiColOrder> | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Columna de un `KapiGrid` con `columns`. Escribe sólo custom properties (`--kapi-col-span-md`…): el
|
|
19
|
+
* layout lo resuelve `gridSpan.css`, así una app puede pisarlo con CSS común en un breakpoint.
|
|
20
|
+
* Tiene que ser hijo directo de la grilla.
|
|
21
|
+
*/
|
|
22
|
+
export declare const KapiCol: ({ span, offset, order, className, style, ref, children, ...rest }: KapiColProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "#kapi-css/components/layout/gridSpan.css";
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { colStyle as t } from "./gridSpanLogic.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/layout/KapiCol.tsx
|
|
8
|
+
var r = ({ span: r, offset: i, order: a, className: o, style: s, ref: c, children: l, ...u }) => /* @__PURE__ */ n("div", {
|
|
9
|
+
...u,
|
|
10
|
+
ref: c,
|
|
11
|
+
className: e("kapi-col", o),
|
|
12
|
+
style: {
|
|
13
|
+
...t({
|
|
14
|
+
span: r,
|
|
15
|
+
offset: i,
|
|
16
|
+
order: a
|
|
17
|
+
}),
|
|
18
|
+
...s
|
|
19
|
+
},
|
|
20
|
+
children: l
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { r as KapiCol };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HTMLAttributes, type Ref } from "react";
|
|
2
|
+
import { type KapiBreakpoint } from "./gridSpanLogic.js";
|
|
2
3
|
import { type KapiGap } from "./layoutPrimitives.js";
|
|
3
4
|
export type KapiGridProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
5
|
/** Ref al `<div>` raíz de la grilla. */
|
|
@@ -15,6 +16,31 @@ export type KapiGridProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
15
16
|
* (`container: kapi-grid`), que también pueden consultar los hijos. Default `false`.
|
|
16
17
|
*/
|
|
17
18
|
responsive?: boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Grilla por columnas (12 es el valor de Bootstrap): los hijos son `KapiCol` con `span`, `offset` y
|
|
21
|
+
* `order` por breakpoint. Gana sobre `cols`, `min` y `responsive`. Los breakpoints miden el ancho de
|
|
22
|
+
* la propia grilla, no el de la ventana (salvo con `viewport`). Todo pasa por custom properties, no por `grid-template-columns`.
|
|
23
|
+
*/
|
|
24
|
+
columns?: number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Umbrales propios (px de ancho de la grilla) para los breakpoints de `columns`; los que falten
|
|
27
|
+
* quedan en 0 / 576 / 768 / 992 / 1200 / 1400. Sólo cuentan con `columns`. Con esto la grilla se mide
|
|
28
|
+
* con `ResizeObserver` y escribe `data-kapi-bp`; sin esto lo decide CSS y no hay JS.
|
|
29
|
+
*/
|
|
30
|
+
breakpoints?: Partial<Record<KapiBreakpoint, number>> | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Los breakpoints de `columns` miden el ancho de la VENTANA y no el de la grilla, como el
|
|
33
|
+
* `<Col md>` de Bootstrap. Es para código migrado que se escribió contra el viewport; el código
|
|
34
|
+
* nuevo se queda con el default (el contenedor), que responde al espacio que de verdad tiene.
|
|
35
|
+
* Con los umbrales por defecto lo decide `@media` (sin JS); con `breakpoints` propios se mide la
|
|
36
|
+
* ventana con `onViewportChange` (un listener compartido). Sólo cuenta con `columns`: sin él avisa
|
|
37
|
+
* en desarrollo. Se declara en la grilla, así sus columnas nunca mezclan los dos modos.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
viewport?: boolean | undefined;
|
|
18
41
|
};
|
|
19
|
-
/**
|
|
20
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Grilla responsive: columnas fijas (`cols`), fluidas por ancho mínimo (`min`) o por columnas con
|
|
44
|
+
* `span` por breakpoint (`columns` + `KapiCol`).
|
|
45
|
+
*/
|
|
46
|
+
export declare function KapiGrid({ gap, min, cols, responsive, columns, breakpoints, viewport, className, style, ref, children, ...rest }: KapiGridProps): import("react").JSX.Element;
|
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/layout-primitives.css";
|
|
3
|
-
import
|
|
3
|
+
import "#kapi-css/components/layout/gridSpan.css";
|
|
4
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
5
|
+
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
6
|
+
import { gridProps as n } from "./layoutPrimitives.js";
|
|
4
7
|
/* empty css */
|
|
5
|
-
import {
|
|
8
|
+
import { gridSpanStyle as r, normalizeColumns as i } from "./gridSpanLogic.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
import { useGridBreakpoint as a } from "./useGridBreakpoint.js";
|
|
11
|
+
import { useEffect as o, useRef as s } from "react";
|
|
12
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
6
13
|
//#region src/components/layout/KapiGrid.tsx
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function l({ gap: l, min: u, cols: d, responsive: f = !1, columns: p, breakpoints: m, viewport: h = !1, className: g, style: _, ref: v, children: y, ...b }) {
|
|
15
|
+
let x = s(null), S = t(x, v), C = i(p), w = a(x, C === void 0 ? void 0 : m, h), T = h && C === void 0;
|
|
16
|
+
if (o(() => {
|
|
17
|
+
T && process.env.NODE_ENV !== "production" && console.warn("KapiGrid: `viewport` sólo funciona con `columns`; sin `columns` no hace nada.");
|
|
18
|
+
}, [T]), C !== void 0) return /* @__PURE__ */ c("div", {
|
|
19
|
+
...b,
|
|
20
|
+
ref: S,
|
|
21
|
+
className: e("kapi-gridx", "kapi-gridx--span", h && "kapi-gridx--viewport", g),
|
|
22
|
+
"data-kapi-bp": w,
|
|
23
|
+
style: {
|
|
24
|
+
...r(C, l),
|
|
25
|
+
..._
|
|
26
|
+
},
|
|
27
|
+
children: y
|
|
28
|
+
});
|
|
29
|
+
let E = /* @__PURE__ */ c("div", {
|
|
30
|
+
ref: S,
|
|
31
|
+
...b,
|
|
32
|
+
...n({
|
|
33
|
+
gap: l,
|
|
34
|
+
min: u,
|
|
35
|
+
cols: d,
|
|
36
|
+
responsive: f,
|
|
37
|
+
className: g,
|
|
38
|
+
style: _
|
|
17
39
|
}),
|
|
18
|
-
children:
|
|
40
|
+
children: y
|
|
19
41
|
});
|
|
20
|
-
return
|
|
42
|
+
return f ? /* @__PURE__ */ c("div", {
|
|
21
43
|
className: "kapi-gridx-cq",
|
|
22
|
-
children:
|
|
23
|
-
}) :
|
|
44
|
+
children: E
|
|
45
|
+
}) : E;
|
|
24
46
|
}
|
|
25
47
|
//#endregion
|
|
26
|
-
export {
|
|
48
|
+
export { l as KapiGrid };
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { type Ref } from "react";
|
|
2
2
|
import type { HTMLAttributes, ReactNode } from "react";
|
|
3
3
|
import { type KapiBreadcrumbItem } from "../navigation/KapiBreadcrumb.js";
|
|
4
|
+
import type { KapiClassNames } from "../slotCatalog.js";
|
|
5
|
+
/** Partes de `KapiPageHeader` que acepta `classNames`: `root`, `reopen`, `main`, `breadcrumb`, `titleRow`, `title`, `subtitle`, `meta` y `actions`. */
|
|
6
|
+
export type KapiPageHeaderClassNames = KapiClassNames<"pageheader">;
|
|
4
7
|
/** Atributos nativos (`id`, `style`, `data-*`…) van al `<header>` (no al centinela de scroll). */
|
|
5
8
|
export type KapiPageHeaderProps = Omit<HTMLAttributes<HTMLElement>, "title" | "children"> & {
|
|
6
9
|
/** Ref al `<header>` raíz. */
|
|
7
10
|
ref?: Ref<HTMLElement> | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Clases por parte: `classNames={{ title: "mi-titulo", actions: "mis-acciones" }}`. Se suman a las
|
|
13
|
+
* propias. `root` es el `<header>` (lo mismo que `className`). Cada parte además lleva
|
|
14
|
+
* `data-slot="pageheader-<parte>"`.
|
|
15
|
+
*/
|
|
16
|
+
classNames?: KapiPageHeaderClassNames | undefined;
|
|
8
17
|
/** Título de la página (`<h1>`). */
|
|
9
18
|
title: ReactNode;
|
|
10
19
|
/** Texto secundario bajo el título. */
|
|
@@ -33,4 +42,4 @@ export type KapiPageHeaderProps = Omit<HTMLAttributes<HTMLElement>, "title" | "c
|
|
|
33
42
|
responsive?: boolean | undefined;
|
|
34
43
|
};
|
|
35
44
|
/** Cabecera de página que colapsa a barra sticky compacta al hacer scroll. */
|
|
36
|
-
export declare function KapiPageHeader({ title, subtitle, meta, actions, chip, breadcrumbs, collapseOnScroll, sticky, scrollRoot, responsive, className, ref, ...rest }: KapiPageHeaderProps): import("react").JSX.Element;
|
|
45
|
+
export declare function KapiPageHeader({ title, subtitle, meta, actions, chip, breadcrumbs, collapseOnScroll, sticky, scrollRoot, responsive, className, classNames, ref, ...rest }: KapiPageHeaderProps): import("react").JSX.Element;
|
|
@@ -3,52 +3,54 @@ import "#kapi-css/components/layout/KapiPageHeader.css";
|
|
|
3
3
|
import "#kapi-css/components/navigation/navigation.css";
|
|
4
4
|
import { computedStyleOf as e, docOf as t } from "../../hooks/ownerDocument.js";
|
|
5
5
|
import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { slot as r } from "../slotsLogic.js";
|
|
7
|
+
import { prefersReducedMotion as i } from "../../hooks/reducedMotion.js";
|
|
8
|
+
import { maxTransitionMs as a } from "../overlays/dialogUtils.js";
|
|
8
9
|
/* empty css */
|
|
9
|
-
import { KapiBreadcrumb as
|
|
10
|
-
import { useReopenBus as
|
|
11
|
-
import { useScrollCollapse as
|
|
12
|
-
import { pageHeaderBox as
|
|
10
|
+
import { KapiBreadcrumb as o } from "../navigation/KapiBreadcrumb.js";
|
|
11
|
+
import { useReopenBus as s } from "./reopenBus.js";
|
|
12
|
+
import { useScrollCollapse as c } from "../../hooks/useScrollCollapse.js";
|
|
13
|
+
import { pageHeaderBox as l } from "./pageHeaderLogic.js";
|
|
13
14
|
/* empty css */
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { PAGEHEADER_SLOTS as u } from "./pageHeaderSlots.js";
|
|
16
|
+
import { useEffect as d, useLayoutEffect as f, useRef as p } from "react";
|
|
17
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
18
|
+
import { ChevronsLeft as _, ChevronsRight as v } from "lucide-react";
|
|
17
19
|
//#region src/components/layout/KapiPageHeader.tsx
|
|
18
|
-
var
|
|
20
|
+
var y = "kapi-pageheader--collapsed", b = "kapi-pageheader--animating", x = "kapi-pageheader--measuring", S = 80, C = (e, t) => {
|
|
19
21
|
let n = e.style.height;
|
|
20
|
-
e.classList.add(
|
|
22
|
+
e.classList.add(x), e.style.height = "", e.classList.toggle(y, !1);
|
|
21
23
|
let r = e.getBoundingClientRect().height;
|
|
22
|
-
e.classList.toggle(
|
|
24
|
+
e.classList.toggle(y, !0);
|
|
23
25
|
let i = e.getBoundingClientRect().height;
|
|
24
|
-
return e.classList.toggle(
|
|
26
|
+
return e.classList.toggle(y, t), e.style.height = n, e.getBoundingClientRect(), e.classList.remove(x), {
|
|
25
27
|
expanded: r,
|
|
26
28
|
collapsed: i
|
|
27
29
|
};
|
|
28
|
-
},
|
|
29
|
-
let n =
|
|
30
|
+
}, w = (e, t) => {
|
|
31
|
+
let n = l(e, t);
|
|
30
32
|
return t ? n : {
|
|
31
33
|
height: null,
|
|
32
34
|
reserve: n.reserve
|
|
33
35
|
};
|
|
34
|
-
},
|
|
36
|
+
}, T = (e, t, n) => {
|
|
35
37
|
let r = () => {
|
|
36
38
|
t.height === null ? e.style.removeProperty("height") : e.style.height = `${t.height}px`, e.style.setProperty("--kapi-pageheader-reserve", `${t.reserve}px`);
|
|
37
39
|
};
|
|
38
40
|
n ? r() : (e.style.transition = "none", r(), e.getBoundingClientRect(), e.style.transition = "");
|
|
39
41
|
};
|
|
40
|
-
function
|
|
41
|
-
let { collapsed:
|
|
42
|
+
function E({ title: y, subtitle: x, meta: E, actions: D, chip: O, breadcrumbs: k, collapseOnScroll: A = !0, sticky: j = !0, scrollRoot: M = null, responsive: N = !0, className: P, classNames: F, ref: I, ...L }) {
|
|
43
|
+
let { collapsed: R, sentinelRef: z } = c({ root: M }), B = A && R, V = p(null), H = n(V, I), U = p({
|
|
42
44
|
expanded: 0,
|
|
43
45
|
collapsed: 0
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
let e =
|
|
46
|
+
}), W = p(B);
|
|
47
|
+
W.current = B;
|
|
48
|
+
let G = p(!1), K = p(!1);
|
|
49
|
+
f(() => {
|
|
50
|
+
let e = V.current;
|
|
49
51
|
if (!e) return;
|
|
50
52
|
let n = () => {
|
|
51
|
-
|
|
53
|
+
K.current || (U.current = C(e, W.current), T(e, w(U.current, W.current), !1));
|
|
52
54
|
};
|
|
53
55
|
n();
|
|
54
56
|
let r = !0;
|
|
@@ -67,96 +69,96 @@ function w({ title: _, subtitle: y, meta: w, actions: T, chip: E, breadcrumbs: D
|
|
|
67
69
|
r = !1, a.disconnect();
|
|
68
70
|
};
|
|
69
71
|
}, [
|
|
70
|
-
_,
|
|
71
72
|
y,
|
|
72
|
-
|
|
73
|
-
T,
|
|
73
|
+
x,
|
|
74
74
|
E,
|
|
75
75
|
D,
|
|
76
76
|
O,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
k,
|
|
78
|
+
A,
|
|
79
|
+
N
|
|
80
|
+
]), f(() => {
|
|
81
|
+
let t = V.current;
|
|
80
82
|
if (!t) return;
|
|
81
|
-
let { expanded: n } =
|
|
82
|
-
|
|
83
|
+
let { expanded: n } = U.current, r = l(U.current, B), o = G.current && !i(t);
|
|
84
|
+
G.current = !0;
|
|
83
85
|
let s = () => {
|
|
84
|
-
|
|
86
|
+
K.current = !1, t.classList.remove(b), B || t.style.removeProperty("height");
|
|
85
87
|
};
|
|
86
88
|
if (!o) {
|
|
87
|
-
|
|
89
|
+
T(t, w(U.current, B), !1);
|
|
88
90
|
return;
|
|
89
91
|
}
|
|
90
|
-
t.style.height === "" && n > 0 && (t.style.height = `${n}px`, t.getBoundingClientRect()),
|
|
91
|
-
let
|
|
92
|
+
t.style.height === "" && n > 0 && (t.style.height = `${n}px`, t.getBoundingClientRect()), K.current = !0, t.classList.add(b), T(t, r, !0);
|
|
93
|
+
let c = (e) => {
|
|
92
94
|
e.target === t && e.propertyName === "height" && s();
|
|
93
95
|
};
|
|
94
|
-
t.addEventListener("transitionend",
|
|
95
|
-
let u = e(t), d = window.setTimeout(s,
|
|
96
|
+
t.addEventListener("transitionend", c);
|
|
97
|
+
let u = e(t), d = window.setTimeout(s, a(u.transitionDuration, u.transitionDelay) + S);
|
|
96
98
|
return () => {
|
|
97
|
-
t.removeEventListener("transitionend",
|
|
99
|
+
t.removeEventListener("transitionend", c), window.clearTimeout(d);
|
|
98
100
|
};
|
|
99
|
-
}, [
|
|
100
|
-
let
|
|
101
|
+
}, [B]);
|
|
102
|
+
let q = [
|
|
101
103
|
"kapi-pageheader",
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
].filter(Boolean).join(" "),
|
|
107
|
-
|
|
108
|
-
let
|
|
109
|
-
return /* @__PURE__ */ m
|
|
110
|
-
ref:
|
|
104
|
+
j && "kapi-pageheader--sticky",
|
|
105
|
+
N && "kapi-pageheader--cq",
|
|
106
|
+
B && "kapi-pageheader--collapsed",
|
|
107
|
+
P
|
|
108
|
+
].filter(Boolean).join(" "), J = s(), Y = J?.addHost;
|
|
109
|
+
d(() => Y?.(), [Y]);
|
|
110
|
+
let X = J?.info ?? null, Z = X?.side === "right" ? _ : v;
|
|
111
|
+
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
112
|
+
ref: z,
|
|
111
113
|
className: "kapi-pageheader__sentinel",
|
|
112
114
|
"aria-hidden": !0
|
|
113
|
-
}), /* @__PURE__ */
|
|
114
|
-
...
|
|
115
|
-
ref:
|
|
116
|
-
|
|
115
|
+
}), /* @__PURE__ */ g("header", {
|
|
116
|
+
...L,
|
|
117
|
+
ref: H,
|
|
118
|
+
...r(u, "root", F, q),
|
|
117
119
|
children: [
|
|
118
|
-
|
|
120
|
+
X && /* @__PURE__ */ h("button", {
|
|
119
121
|
type: "button",
|
|
120
|
-
|
|
121
|
-
onClick:
|
|
122
|
-
"aria-label":
|
|
123
|
-
children: /* @__PURE__ */
|
|
122
|
+
...r(u, "reopen", F, "kapi-paneltoggle"),
|
|
123
|
+
onClick: X.expand,
|
|
124
|
+
"aria-label": X.label,
|
|
125
|
+
children: /* @__PURE__ */ h(Z, {
|
|
124
126
|
className: "kapi-flip-rtl",
|
|
125
127
|
size: 16,
|
|
126
128
|
strokeWidth: 2,
|
|
127
129
|
"aria-hidden": "true"
|
|
128
130
|
})
|
|
129
131
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
|
|
132
|
+
/* @__PURE__ */ g("div", {
|
|
133
|
+
...r(u, "main", F),
|
|
132
134
|
children: [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
items:
|
|
135
|
+
k && k.length > 0 && /* @__PURE__ */ h(o, {
|
|
136
|
+
...r(u, "breadcrumb", F),
|
|
137
|
+
items: k
|
|
136
138
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
|
|
139
|
-
children: [/* @__PURE__ */
|
|
140
|
-
|
|
141
|
-
children:
|
|
142
|
-
}),
|
|
139
|
+
/* @__PURE__ */ g("div", {
|
|
140
|
+
...r(u, "titleRow", F),
|
|
141
|
+
children: [/* @__PURE__ */ h("h1", {
|
|
142
|
+
...r(u, "title", F),
|
|
143
|
+
children: y
|
|
144
|
+
}), O]
|
|
143
145
|
}),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
children:
|
|
146
|
+
x && /* @__PURE__ */ h("div", {
|
|
147
|
+
...r(u, "subtitle", F),
|
|
148
|
+
children: x
|
|
147
149
|
}),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
children:
|
|
150
|
+
E && /* @__PURE__ */ h("div", {
|
|
151
|
+
...r(u, "meta", F),
|
|
152
|
+
children: E
|
|
151
153
|
})
|
|
152
154
|
]
|
|
153
155
|
}),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
children:
|
|
156
|
+
D && /* @__PURE__ */ h("div", {
|
|
157
|
+
...r(u, "actions", F),
|
|
158
|
+
children: D
|
|
157
159
|
})
|
|
158
160
|
]
|
|
159
161
|
})] });
|
|
160
162
|
}
|
|
161
163
|
//#endregion
|
|
162
|
-
export {
|
|
164
|
+
export { E as KapiPageHeader };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type KapiNavBadgeValue } from "../navigation/navBadgeLogic.js";
|
|
2
2
|
import type { KapiTone } from "../tone.js";
|
|
3
3
|
import type { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
4
|
+
import { type KapiRender } from "../renderSlot.js";
|
|
4
5
|
type DivProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
6
|
/** Ref al `<div>` raíz. */
|
|
6
7
|
ref?: Ref<HTMLDivElement> | undefined;
|
|
@@ -41,8 +42,16 @@ export declare const KapiPanelList: ({ children, ...rest }: Omit<DivProps, "chil
|
|
|
41
42
|
children: ReactNode;
|
|
42
43
|
}) => import("react").JSX.Element;
|
|
43
44
|
export type KapiPanelItemProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
44
|
-
/** Ref al `<button>` del ítem. */
|
|
45
|
+
/** Ref al `<button>` del ítem (o al elemento de `render`). */
|
|
45
46
|
ref?: Ref<HTMLButtonElement> | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Dibuja OTRO elemento con el aspecto del ítem: el `<Link>` de tu router, para navegar sin recargar la
|
|
49
|
+
* página. Las clases se unen, los estilos se funden y los handlers corren los dos (primero el tuyo).
|
|
50
|
+
* `aria-current` sale de `active`; `disabled` pasa a `aria-disabled` y frena el clic.
|
|
51
|
+
*
|
|
52
|
+
* <KapiPanelItem render={<Link to="/listado" />}>Listado</KapiPanelItem>
|
|
53
|
+
*/
|
|
54
|
+
render?: KapiRender | undefined;
|
|
46
55
|
/** Marca el ítem actual (resaltado y `aria-current="page"`). */
|
|
47
56
|
active?: boolean | undefined;
|
|
48
57
|
/** Contenido a la derecha (badge, contador…). */
|
|
@@ -59,5 +68,5 @@ export type KapiPanelItemProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "
|
|
|
59
68
|
children: ReactNode;
|
|
60
69
|
};
|
|
61
70
|
/** Ítem de navegación del panel contextual. `aria-current` sale de `active`; `icon` va antes del texto. */
|
|
62
|
-
export declare const KapiPanelItem: ({ active, trailing, badge, badgeTone, badgeLabel, icon, className, type, children, ...rest }: KapiPanelItemProps) => import("react").JSX.Element;
|
|
71
|
+
export declare const KapiPanelItem: ({ active, trailing, badge, badgeTone, badgeLabel, icon, className, type, children, render, disabled, ref, ...rest }: KapiPanelItemProps) => import("react").JSX.Element;
|
|
63
72
|
export {};
|
|
@@ -2,81 +2,98 @@
|
|
|
2
2
|
import "#kapi-css/components/layout/KapiPanelParts.css";
|
|
3
3
|
import "#kapi-css/components/navigation/navigation.css";
|
|
4
4
|
import { joinClasses as e } from "../rootProps.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { renderSlot as t } from "../renderSlot.js";
|
|
6
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
7
|
+
import { searchChipName as r } from "../inputs/searchChipLogic.js";
|
|
8
|
+
import { DEFAULT_SEARCH_CHIP_LABELS as i } from "../inputs/KapiSearchChip.js";
|
|
8
9
|
import "../navigation/navBadgeLogic.js";
|
|
9
|
-
import { KapiNavBadge as
|
|
10
|
-
import { CtxSlidingList as
|
|
10
|
+
import { KapiNavBadge as a } from "../navigation/KapiNavBadge.js";
|
|
11
|
+
import { CtxSlidingList as o } from "../navigation/CtxSlidingList.js";
|
|
11
12
|
/* empty css */
|
|
12
|
-
import { useKapiPanelMini as
|
|
13
|
-
import { MiniNavItem as
|
|
13
|
+
import { useKapiPanelMini as s } from "../navigation/panelMini.js";
|
|
14
|
+
import { MiniNavItem as c } from "../navigation/MiniNavItem.js";
|
|
14
15
|
/* empty css */
|
|
15
|
-
import { jsx as
|
|
16
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
16
17
|
//#region src/components/layout/KapiPanelParts.tsx
|
|
17
|
-
var
|
|
18
|
+
var f = ({ className: t, ...n }) => /* @__PURE__ */ u("div", {
|
|
18
19
|
...n,
|
|
19
20
|
className: e("kapi-ct", t)
|
|
20
|
-
}),
|
|
21
|
+
}), p = ({ className: t, ...n }) => /* @__PURE__ */ u("div", {
|
|
21
22
|
...n,
|
|
22
23
|
className: e("kapi-ctxdivider", t)
|
|
23
|
-
}),
|
|
24
|
+
}), m = ({ className: t, ...n }) => /* @__PURE__ */ u("div", {
|
|
24
25
|
...n,
|
|
25
26
|
className: e("kapi-hint", t)
|
|
26
|
-
}),
|
|
27
|
-
let
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
}), h = ({ className: t, placeholder: a, "aria-label": o, ...s }) => {
|
|
28
|
+
let c = n("searchChip", i, void 0);
|
|
29
|
+
return /* @__PURE__ */ u("input", {
|
|
29
30
|
...s,
|
|
30
31
|
type: "search",
|
|
31
|
-
className: e("kapi-ctxsearch kapi-ctxsearch--input",
|
|
32
|
+
className: e("kapi-ctxsearch kapi-ctxsearch--input", t),
|
|
32
33
|
placeholder: a,
|
|
33
|
-
"aria-label":
|
|
34
|
+
"aria-label": r({
|
|
34
35
|
ariaLabel: o,
|
|
35
36
|
placeholder: a,
|
|
36
|
-
fallback:
|
|
37
|
+
fallback: c.search
|
|
37
38
|
})
|
|
38
39
|
});
|
|
39
|
-
},
|
|
40
|
+
}, g = ({ children: e, ...t }) => /* @__PURE__ */ u(o, {
|
|
40
41
|
...t,
|
|
41
42
|
children: e
|
|
42
|
-
}),
|
|
43
|
-
let { mini:
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className: e("kapi-ctxitem", t && "kapi-ctxitem--on", f),
|
|
58
|
-
"aria-current": t ? "page" : void 0,
|
|
59
|
-
children: [
|
|
60
|
-
d == null || d === !1 ? m : /* @__PURE__ */ l("span", {
|
|
61
|
-
className: "kapi-ctxitem__lead",
|
|
62
|
-
children: [/* @__PURE__ */ c("span", {
|
|
63
|
-
className: "kapi-ctxitem__icon",
|
|
64
|
-
"aria-hidden": "true",
|
|
65
|
-
children: d
|
|
66
|
-
}), /* @__PURE__ */ c("span", {
|
|
67
|
-
className: "kapi-ctxitem__label",
|
|
68
|
-
children: m
|
|
69
|
-
})]
|
|
70
|
-
}),
|
|
71
|
-
/* @__PURE__ */ c(i, {
|
|
72
|
-
value: r,
|
|
73
|
-
tone: a,
|
|
74
|
-
label: u,
|
|
75
|
-
max: 999
|
|
76
|
-
}),
|
|
77
|
-
n
|
|
78
|
-
]
|
|
43
|
+
}), _ = ({ active: n = !1, trailing: r, badge: i, badgeTone: o, badgeLabel: f, icon: p, className: m, type: h = "button", children: g, render: _, disabled: v, ref: y, ...b }) => {
|
|
44
|
+
let { mini: x } = s();
|
|
45
|
+
if (x) return /* @__PURE__ */ u(c, {
|
|
46
|
+
...b,
|
|
47
|
+
ref: y,
|
|
48
|
+
type: h,
|
|
49
|
+
className: m,
|
|
50
|
+
disabled: v,
|
|
51
|
+
render: _,
|
|
52
|
+
label: g,
|
|
53
|
+
icon: p,
|
|
54
|
+
active: n,
|
|
55
|
+
badge: i,
|
|
56
|
+
badgeTone: o,
|
|
57
|
+
badgeLabel: f
|
|
79
58
|
});
|
|
59
|
+
let S = e("kapi-ctxitem", n && "kapi-ctxitem--on", m), C = /* @__PURE__ */ d(l, { children: [
|
|
60
|
+
p == null || p === !1 ? g : /* @__PURE__ */ d("span", {
|
|
61
|
+
className: "kapi-ctxitem__lead",
|
|
62
|
+
children: [/* @__PURE__ */ u("span", {
|
|
63
|
+
className: "kapi-ctxitem__icon",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
children: p
|
|
66
|
+
}), /* @__PURE__ */ u("span", {
|
|
67
|
+
className: "kapi-ctxitem__label",
|
|
68
|
+
children: g
|
|
69
|
+
})]
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ u(a, {
|
|
72
|
+
value: i,
|
|
73
|
+
tone: o,
|
|
74
|
+
label: f,
|
|
75
|
+
max: 999
|
|
76
|
+
}),
|
|
77
|
+
r
|
|
78
|
+
] });
|
|
79
|
+
return _ === void 0 ? /* @__PURE__ */ u("button", {
|
|
80
|
+
...b,
|
|
81
|
+
ref: y,
|
|
82
|
+
type: h,
|
|
83
|
+
disabled: v,
|
|
84
|
+
className: S,
|
|
85
|
+
"aria-current": n ? "page" : void 0,
|
|
86
|
+
children: C
|
|
87
|
+
}) : t(_, {
|
|
88
|
+
...b,
|
|
89
|
+
className: S
|
|
90
|
+
}, {
|
|
91
|
+
"aria-current": n ? "page" : void 0,
|
|
92
|
+
"aria-disabled": v || void 0,
|
|
93
|
+
...v ? { onClick: (e) => e.preventDefault() } : {},
|
|
94
|
+
ref: y,
|
|
95
|
+
children: C
|
|
96
|
+
}, (e) => /* @__PURE__ */ u("a", { ...e }));
|
|
80
97
|
};
|
|
81
98
|
//#endregion
|
|
82
|
-
export {
|
|
99
|
+
export { p as KapiPanelDivider, m as KapiPanelHint, _ as KapiPanelItem, f as KapiPanelLabel, g as KapiPanelList, h as KapiPanelSearch };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
2
|
import { type KapiRailEntry, type KapiRailItem, type KapiRailPinned, type KapiRailSeparator, type KapiRailZone, type KapiRailVariant } from "./railLogic.js";
|
|
3
|
+
import type { KapiClassNames } from "../slotCatalog.js";
|
|
3
4
|
import { type KapiLinkLabels } from "../locale/linkLabels.js";
|
|
4
5
|
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
5
6
|
export type { KapiRailEntry, KapiRailItem, KapiRailPinned, KapiRailSeparator, KapiRailVariant, KapiRailZone };
|
|
@@ -15,6 +16,8 @@ export type KapiRailLabels = {
|
|
|
15
16
|
};
|
|
16
17
|
export declare const DEFAULT_RAIL_LABELS: KapiRailLabels;
|
|
17
18
|
/** Atributos nativos (`id`, `style`, `data-*`…) van al `<nav>`. `Id` se infiere de `items`. */
|
|
19
|
+
/** Partes de `KapiRail` que acepta `classNames`: `root`, `brand`, `start`, `scroll`, `indicator`, `item`, `label`, `separator` y `end`. */
|
|
20
|
+
export type KapiRailClassNames = KapiClassNames<"rail">;
|
|
18
21
|
export type KapiRailProps<Id extends string = string> = Omit<HTMLAttributes<HTMLElement>, "children" | "onSelect"> & {
|
|
19
22
|
/**
|
|
20
23
|
* Ítems del rail. Intercala `{ separator: true }` para dibujar un divisor entre grupos. Con `pinned: "start"`
|
|
@@ -22,6 +25,12 @@ export type KapiRailProps<Id extends string = string> = Omit<HTMLAttributes<HTML
|
|
|
22
25
|
* (en vertical) y la única que, en la barra inferior del celular, esconde en «Más» lo que no entra.
|
|
23
26
|
*/
|
|
24
27
|
items: readonly KapiRailEntry<Id>[];
|
|
28
|
+
/**
|
|
29
|
+
* Clases por parte: `classNames={{ item: "mi-item", indicator: "mi-pildora" }}`. Se suman a las propias.
|
|
30
|
+
* `root` es el `<nav>` (lo mismo que `className`). Cada parte además lleva `data-slot="rail-<parte>"`;
|
|
31
|
+
* el ítem activo se alcanza con `[data-slot="rail-item"][aria-current="page"]`.
|
|
32
|
+
*/
|
|
33
|
+
classNames?: KapiRailClassNames | undefined;
|
|
25
34
|
/** id del ítem activo (controlado por la app: derívalo de tu router). */
|
|
26
35
|
activeId?: Id | undefined;
|
|
27
36
|
/** Se llama con el `id` del ítem clickeado (la app navega y actualiza `activeId`). */
|
|
@@ -49,4 +58,4 @@ export type KapiRailProps<Id extends string = string> = Omit<HTMLAttributes<HTML
|
|
|
49
58
|
* En móvil se convierte en barra inferior (shell.css): muestra los ítems del medio que entran y manda el
|
|
50
59
|
* resto a un ítem «Más» que abre un menú hacia arriba. Los ítems fijos y el footer no se tocan.
|
|
51
60
|
*/
|
|
52
|
-
export declare const KapiRail: <Id extends string = string>({ items, activeId, onSelect, brand, footer, variant, "aria-label": ariaLabel, labels, className, ref, ...rest }: KapiRailProps<Id>) => import("react").JSX.Element;
|
|
61
|
+
export declare const KapiRail: <Id extends string = string>({ items, activeId, onSelect, brand, footer, variant, "aria-label": ariaLabel, labels, className, classNames, ref, ...rest }: KapiRailProps<Id>) => import("react").JSX.Element;
|