@kapiuara/ui 0.15.3 → 0.17.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 +505 -13
- package/dist/components/chat/KapiChatThread.js +4 -4
- package/dist/components/chat/KapiComposer.js +8 -8
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +25 -25
- 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/KapiSparkline.d.ts +2 -1
- package/dist/components/data/KapiSparkline.js +29 -26
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFilter.js +6 -6
- 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 +17 -5
- package/dist/components/data/tableCells.js +52 -53
- 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 +29 -25
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiAnnotation.js +68 -63
- package/dist/components/display/KapiAvatar.d.ts +6 -4
- package/dist/components/display/KapiAvatar.js +33 -28
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiCodeBlock.d.ts +48 -0
- package/dist/components/display/KapiCodeBlock.js +44 -0
- package/dist/components/display/KapiCommentComposer.js +6 -6
- package/dist/components/display/KapiDiff.d.ts +62 -0
- package/dist/components/display/KapiDiff.js +118 -0
- package/dist/components/display/KapiHighlight.d.ts +27 -0
- package/dist/components/display/KapiHighlight.js +21 -0
- package/dist/components/display/KapiIconTile.d.ts +2 -1
- package/dist/components/display/KapiIconTile.js +23 -21
- package/dist/components/display/KapiStat.d.ts +3 -2
- package/dist/components/display/KapiStat.js +32 -26
- package/dist/components/display/KapiTag.d.ts +4 -3
- package/dist/components/display/KapiTag.js +29 -24
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTimeline.d.ts +5 -2
- package/dist/components/display/KapiTimeline.js +31 -23
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/annotationLogic.d.ts +2 -1
- package/dist/components/display/annotationLogic.js +7 -6
- package/dist/components/display/codeBlockSlots.d.ts +10 -0
- package/dist/components/display/codeBlockSlots.js +13 -0
- package/dist/components/display/diffLogic.d.ts +58 -0
- package/dist/components/display/diffLogic.js +96 -0
- package/dist/components/display/diffSlots.d.ts +14 -0
- package/dist/components/display/diffSlots.js +17 -0
- package/dist/components/display/highlightLogic.d.ts +18 -0
- package/dist/components/display/highlightLogic.js +26 -0
- package/dist/components/display/highlightSlots.d.ts +5 -0
- package/dist/components/display/highlightSlots.js +8 -0
- package/dist/components/display/iconTileLogic.d.ts +2 -2
- package/dist/components/display/iconTileLogic.js +7 -6
- package/dist/components/display/index.d.ts +15 -0
- package/dist/components/display/statLogic.d.ts +2 -1
- package/dist/components/display/statLogic.js +7 -6
- package/dist/components/display/tagLogic.d.ts +2 -1
- package/dist/components/display/tagLogic.js +7 -6
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/display/timelineLogic.d.ts +20 -2
- package/dist/components/display/timelineLogic.js +10 -2
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/feedback/KapiFab.js +108 -108
- package/dist/components/feedback/KapiProgress.js +63 -54
- package/dist/components/feedback/KapiToastContainer.js +9 -9
- package/dist/components/feedback/KapiTour.js +12 -12
- package/dist/components/feedback/progressLogic.d.ts +2 -1
- package/dist/components/feedback/progressLogic.js +9 -8
- package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
- package/dist/components/inputs/KapiAutocomplete.js +86 -85
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiChecklist.d.ts +7 -1
- package/dist/components/inputs/KapiChecklist.js +53 -52
- package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
- package/dist/components/inputs/KapiCopyButton.js +35 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDatePicker.js +118 -116
- package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDateRangePicker.js +136 -135
- package/dist/components/inputs/KapiFacetedSearch.js +5 -5
- package/dist/components/inputs/KapiField.d.ts +9 -1
- package/dist/components/inputs/KapiField.js +43 -42
- package/dist/components/inputs/KapiFileUpload.js +6 -6
- package/dist/components/inputs/KapiInput.d.ts +29 -1
- package/dist/components/inputs/KapiInput.js +74 -51
- package/dist/components/inputs/KapiMaskedInput.js +26 -26
- package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
- package/dist/components/inputs/KapiNumberStepper.js +24 -23
- package/dist/components/inputs/KapiPinInput.d.ts +72 -0
- package/dist/components/inputs/KapiPinInput.js +75 -0
- package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
- package/dist/components/inputs/KapiPropsForm.js +78 -0
- package/dist/components/inputs/KapiRating.d.ts +7 -1
- package/dist/components/inputs/KapiRating.js +39 -38
- package/dist/components/inputs/KapiSearchChip.js +5 -5
- package/dist/components/inputs/KapiSegmented.d.ts +13 -5
- package/dist/components/inputs/KapiSegmented.js +81 -77
- package/dist/components/inputs/KapiSelect.d.ts +21 -1
- package/dist/components/inputs/KapiSelect.js +251 -245
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/KapiSlider.d.ts +10 -3
- package/dist/components/inputs/KapiSlider.js +67 -63
- package/dist/components/inputs/KapiTagInput.d.ts +7 -1
- package/dist/components/inputs/KapiTagInput.js +70 -69
- package/dist/components/inputs/KapiTextarea.d.ts +7 -1
- package/dist/components/inputs/KapiTextarea.js +51 -50
- package/dist/components/inputs/copyLogic.d.ts +1 -0
- package/dist/components/inputs/copyLogic.js +12 -0
- package/dist/components/inputs/fieldLogic.d.ts +21 -1
- package/dist/components/inputs/fieldLogic.js +18 -11
- package/dist/components/inputs/index.d.ts +9 -1
- package/dist/components/inputs/inputLogic.d.ts +16 -1
- package/dist/components/inputs/inputLogic.js +3 -3
- package/dist/components/inputs/ownField.d.ts +3 -1
- package/dist/components/inputs/ownField.js +28 -27
- package/dist/components/inputs/pinInputLogic.d.ts +34 -0
- package/dist/components/inputs/pinInputLogic.js +37 -0
- package/dist/components/inputs/propsFormLogic.d.ts +53 -0
- package/dist/components/inputs/propsFormLogic.js +11 -0
- package/dist/components/inputs/segmentedLogic.d.ts +7 -0
- package/dist/components/inputs/segmentedLogic.js +2 -2
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiAccessCard.d.ts +5 -1
- package/dist/components/layout/KapiAccessCard.js +43 -39
- package/dist/components/layout/KapiAccountMenu.js +7 -7
- 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/KapiCollapse.d.ts +39 -0
- package/dist/components/layout/KapiCollapse.js +20 -0
- package/dist/components/layout/KapiContextSlot.js +4 -4
- package/dist/components/layout/KapiDivider.d.ts +11 -2
- package/dist/components/layout/KapiDivider.js +30 -24
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiNotificationBell.js +10 -10
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +94 -92
- 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 +125 -122
- package/dist/components/layout/KapiRoot.d.ts +55 -5
- package/dist/components/layout/KapiRoot.js +57 -38
- package/dist/components/layout/KapiShell.d.ts +44 -3
- package/dist/components/layout/KapiShell.js +54 -50
- package/dist/components/layout/accessCardLogic.d.ts +8 -1
- package/dist/components/layout/accessCardLogic.js +11 -7
- 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 +13 -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/locale/labelRegistry.d.ts +10 -0
- package/dist/components/navigation/KapiAccordion.js +9 -9
- 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 +152 -136
- package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
- package/dist/components/navigation/KapiNavBadge.js +26 -22
- 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/KapiToc.d.ts +48 -0
- package/dist/components/navigation/KapiToc.js +66 -0
- package/dist/components/navigation/KapiTree.js +10 -10
- 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/index.d.ts +3 -0
- 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/navigation/tocLogic.d.ts +35 -0
- package/dist/components/navigation/tocLogic.js +11 -0
- package/dist/components/navigation/tocSlots.d.ts +8 -0
- package/dist/components/navigation/tocSlots.js +11 -0
- package/dist/components/overlays/KapiCommandPalette.js +6 -6
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiContextMenu.js +5 -5
- package/dist/components/overlays/KapiMenuButton.js +7 -7
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +79 -77
- package/dist/components/overlays/KapiOffcanvas.js +24 -24
- package/dist/components/overlays/KapiPhotoView.js +10 -10
- package/dist/components/overlays/KapiPopover.js +6 -6
- package/dist/components/overlays/KapiShapeSheet.js +4 -4
- package/dist/components/overlays/KapiTooltip.js +18 -18
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +127 -117
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +123 -0
- package/dist/components/slotCatalog.js +27 -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/KapiAnnotation.css +1 -1
- package/dist/css/components/display/KapiCodeBlock.css +1 -0
- package/dist/css/components/display/KapiDiff.css +1 -0
- 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/inputs/KapiPinInput.css +1 -0
- package/dist/css/components/inputs/KapiSelect.css +1 -1
- package/dist/css/components/inputs/inputsExtra.css +1 -1
- package/dist/css/components/layout/KapiAccessCard.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiCollapse.css +1 -0
- package/dist/css/components/layout/KapiDivider.css +1 -1
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/KapiToc.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/asyncResourceLogic.d.ts +11 -0
- package/dist/hooks/asyncResourceLogic.js +4 -0
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +7 -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 +146 -0
- package/dist/hooks/toneFamilyLogic.js +164 -0
- package/dist/hooks/useAsyncResource.d.ts +45 -0
- package/dist/hooks/useAsyncResource.js +24 -0
- package/dist/hooks/useKapiTheme.d.ts +16 -3
- package/dist/hooks/useKapiTheme.js +130 -117
- package/dist/hooks/useToneFamilies.d.ts +40 -0
- package/dist/hooks/useToneFamilies.js +50 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +227 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/logic.d.ts +41 -0
- package/dist/logic.js +42 -0
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +14 -3
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
1
|
+
import { type HTMLAttributes, type MouseEvent, type ReactNode, type Ref } from "react";
|
|
2
|
+
import type { KapiRender } from "../renderSlot.js";
|
|
2
3
|
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
4
|
+
/**
|
|
5
|
+
* Un nivel de la ruta. Con `render`, `href` o `onClick` es un enlace; sin ninguno, texto. El último nivel es
|
|
6
|
+
* siempre la ubicación actual y nunca es un enlace.
|
|
7
|
+
*/
|
|
3
8
|
export type KapiBreadcrumbItem = {
|
|
9
|
+
/** Texto del nivel. */
|
|
4
10
|
label: ReactNode;
|
|
5
|
-
onClick
|
|
11
|
+
/** Se llama al activar el nivel. Con `render` corre DESPUÉS del `onClick` del elemento que pasaste. */
|
|
12
|
+
onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;
|
|
13
|
+
/** Destino como `<a>` nativo: navega con carga COMPLETA de página. Para navegar sin recargar, usa `render`. Con `render` se ignora. */
|
|
14
|
+
href?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* El elemento que dibuja el nivel: el `<Link>` de tu router. Las clases se unen, los estilos se funden y los
|
|
17
|
+
* handlers corren los dos (primero el tuyo). La librería no le pone `href`.
|
|
18
|
+
*
|
|
19
|
+
* { label: "Inicio", render: <Link to="/" /> }
|
|
20
|
+
*/
|
|
21
|
+
render?: KapiRender | undefined;
|
|
6
22
|
};
|
|
7
23
|
export type KapiBreadcrumbLabels = {
|
|
8
24
|
/** Nombre accesible del `<nav>` (sin `aria-label`). */
|
|
@@ -3,31 +3,38 @@ import "#kapi-css/components/navigation/navigation.css";
|
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
4
|
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { renderNavLink as n } from "./navLink.js";
|
|
7
|
+
import { breadcrumbKinds as r } from "./breadcrumbLogic.js";
|
|
8
|
+
import { Fragment as i } from "react";
|
|
9
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/navigation/KapiBreadcrumb.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
...
|
|
15
|
-
ref:
|
|
16
|
-
className: e("kapi-breadcrumb",
|
|
17
|
-
"aria-label":
|
|
18
|
-
children:
|
|
11
|
+
var s = { navigation: "Ubicación" };
|
|
12
|
+
function c({ items: c, "aria-label": l, labels: u, className: d, ref: f, ...p }) {
|
|
13
|
+
let m = t("breadcrumb", s, u), h = r(c);
|
|
14
|
+
return /* @__PURE__ */ a("nav", {
|
|
15
|
+
...p,
|
|
16
|
+
ref: f,
|
|
17
|
+
className: e("kapi-breadcrumb", d),
|
|
18
|
+
"aria-label": l ?? m.navigation,
|
|
19
|
+
children: c.map((e, t) => /* @__PURE__ */ o(i, { children: [t > 0 && /* @__PURE__ */ a("span", {
|
|
19
20
|
"aria-hidden": !0,
|
|
20
21
|
children: " · "
|
|
21
|
-
}),
|
|
22
|
+
}), h[t] === "link" ? e.render !== void 0 || e.href !== void 0 ? n({
|
|
23
|
+
render: e.render,
|
|
24
|
+
href: e.href,
|
|
25
|
+
className: "kapi-link",
|
|
26
|
+
onClick: e.onClick,
|
|
27
|
+
children: e.label
|
|
28
|
+
}) : /* @__PURE__ */ a("button", {
|
|
22
29
|
type: "button",
|
|
23
30
|
className: "kapi-link",
|
|
24
31
|
onClick: e.onClick,
|
|
25
32
|
children: e.label
|
|
26
|
-
}) :
|
|
33
|
+
}) : h[t] === "current" ? /* @__PURE__ */ a("b", {
|
|
27
34
|
"aria-current": "page",
|
|
28
35
|
children: e.label
|
|
29
|
-
}) : /* @__PURE__ */
|
|
36
|
+
}) : /* @__PURE__ */ a("span", { children: e.label })] }, t))
|
|
30
37
|
});
|
|
31
38
|
}
|
|
32
39
|
//#endregion
|
|
33
|
-
export {
|
|
40
|
+
export { s as DEFAULT_BREADCRUMB_LABELS, c as KapiBreadcrumb };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import { type KapiRender } from "../renderSlot.js";
|
|
2
3
|
import { type KapiLinkLabels } from "../locale/linkLabels.js";
|
|
3
4
|
import type { KapiPanelCollapsedMode } from "./panelMiniLogic.js";
|
|
4
5
|
import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
|
|
@@ -25,11 +26,23 @@ export type KapiContextPanelItem<Id extends string = string> = {
|
|
|
25
26
|
badgeLabel?: string | undefined;
|
|
26
27
|
/** No se puede elegir (botón deshabilitado o enlace `aria-disabled`). */
|
|
27
28
|
disabled?: boolean | undefined;
|
|
28
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Si se pasa (y el ítem no es "reciente"), se dibuja un enlace real `<a>` en vez de un botón. Es un enlace
|
|
31
|
+
* NATIVO: navega con carga completa de página. Para navegar dentro de una SPA sin recargar, usa `render`.
|
|
32
|
+
*/
|
|
29
33
|
href?: string | undefined;
|
|
30
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* El elemento que dibuja el ítem: el `<Link>` de tu router. Navega sin recargar la página; sirve también
|
|
36
|
+
* en un ítem "reciente" (con `detail`/`initials`) y con el panel plegado en modo `mini`. Las clases se
|
|
37
|
+
* unen, los estilos se funden y los handlers corren los dos (primero el tuyo); la librería no le pone `href`
|
|
38
|
+
* y `href` se ignora. `onSelect(id)` NO se llama: un enlace navega solo (igual que con `href`), así que no hay doble navegación si tu `onSelect` ya navega para los ítems que son botones.
|
|
39
|
+
*
|
|
40
|
+
* { id: "altas", label: "Altas", render: <Link to="/altas" /> }
|
|
41
|
+
*/
|
|
42
|
+
render?: KapiRender | undefined;
|
|
43
|
+
/** Destino en otro sistema: agrega el ícono ↗ a la derecha (sólo con `href` o `render`). */
|
|
31
44
|
external?: boolean | undefined;
|
|
32
|
-
/** Abrir el enlace en una pestaña nueva (sólo con `href`). */
|
|
45
|
+
/** Abrir el enlace en una pestaña nueva (sólo con `href` o `render`). */
|
|
33
46
|
newTab?: boolean | undefined;
|
|
34
47
|
};
|
|
35
48
|
export type KapiContextPanelSection<Id extends string = string> = {
|
|
@@ -54,7 +67,7 @@ export type KapiContextSectionsProps<Id extends string = string> = {
|
|
|
54
67
|
* para todo el panel: marca la página actual, no una selección por sección.
|
|
55
68
|
*/
|
|
56
69
|
activeId?: Id | undefined;
|
|
57
|
-
/** Se llama con el `id` del ítem clickeado (no aplica a los enlaces con `href`). */
|
|
70
|
+
/** Se llama con el `id` del ítem clickeado (no aplica a los enlaces: ni con `href` ni con `render`). */
|
|
58
71
|
onSelect?: ((id: Id) => void) | undefined;
|
|
59
72
|
/** Buscador opcional sobre las secciones. */
|
|
60
73
|
search?: KapiContextPanelSearch | undefined;
|
|
@@ -1,239 +1,255 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/navigation/navigation.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { renderSlot as t } from "../renderSlot.js";
|
|
5
|
+
import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
|
|
6
|
+
import { useLabels as r } from "../locale/KapiLocaleProvider.js";
|
|
7
|
+
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
8
|
+
import { directionOf as a, physicalSide as o } from "../../hooks/directionLogic.js";
|
|
9
|
+
import { DEFAULT_LINK_LABELS as s } from "../locale/linkLabels.js";
|
|
9
10
|
import "./navBadgeLogic.js";
|
|
10
|
-
import { KapiNavBadge as
|
|
11
|
-
import { CtxSlidingList as
|
|
11
|
+
import { KapiNavBadge as c } from "./KapiNavBadge.js";
|
|
12
|
+
import { CtxSlidingList as l } from "./CtxSlidingList.js";
|
|
12
13
|
/* empty css */
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
14
|
+
import { renderNavLink as u } from "./navLink.js";
|
|
15
|
+
import { KapiPanelMiniContext as ee, useKapiPanelMini as d } from "./panelMini.js";
|
|
16
|
+
import { MiniNavItem as f } from "./MiniNavItem.js";
|
|
17
|
+
import { KapiPanelSearch as p } from "../layout/KapiPanelParts.js";
|
|
18
|
+
import { canCollapse as m, clampCtxPanelWidth as te, ctxPanelClasses as h, ctxPanelWidthFromDrag as g, stepCtxPanelWidth as _ } from "./contextPanelLogic.js";
|
|
19
|
+
import { activeIdIn as v } from "./activeItemLogic.js";
|
|
20
|
+
import { useLayoutEffect as y, useMemo as ne, useRef as b, useState as x } from "react";
|
|
21
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
22
|
+
import { ChevronsLeft as T, ChevronsRight as E, ExternalLink as D } from "lucide-react";
|
|
21
23
|
//#region src/components/navigation/KapiContextPanel.tsx
|
|
22
|
-
var
|
|
23
|
-
let { mini:
|
|
24
|
-
|
|
24
|
+
var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
25
|
+
let { mini: a } = d(), o = e.detail !== void 0 || e.initials !== void 0, s = () => r?.(e.id);
|
|
26
|
+
if (a) return /* @__PURE__ */ C(f, {
|
|
25
27
|
label: e.label,
|
|
26
28
|
icon: e.icon,
|
|
27
29
|
initials: e.initials,
|
|
28
|
-
active:
|
|
30
|
+
active: n,
|
|
29
31
|
badge: e.badge,
|
|
30
32
|
badgeTone: e.badgeTone,
|
|
31
33
|
badgeLabel: e.badgeLabel,
|
|
32
34
|
disabled: e.disabled,
|
|
33
|
-
|
|
35
|
+
...e.render === void 0 ? !o && e.href !== void 0 ? {
|
|
34
36
|
href: e.href,
|
|
35
37
|
newTab: e.newTab,
|
|
36
|
-
newTabLabel:
|
|
37
|
-
} : { onClick:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
children: [
|
|
45
|
-
e.initials !== void 0 && /* @__PURE__ */
|
|
38
|
+
newTabLabel: i
|
|
39
|
+
} : { onClick: s } : {
|
|
40
|
+
render: e.render,
|
|
41
|
+
newTab: e.newTab,
|
|
42
|
+
newTabLabel: i
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (o) {
|
|
46
|
+
let r = /* @__PURE__ */ w(S, { children: [
|
|
47
|
+
e.initials !== void 0 && /* @__PURE__ */ C("span", {
|
|
46
48
|
className: "kapi-ctxrec__av kapi-ctxrec__av--tone",
|
|
47
49
|
children: e.initials
|
|
48
50
|
}),
|
|
49
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ w("span", {
|
|
50
52
|
className: "kapi-ctxrec__txt",
|
|
51
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ C("span", {
|
|
52
54
|
className: "kapi-ctxrec__name",
|
|
53
55
|
children: e.label
|
|
54
|
-
}), e.detail !== void 0 && /* @__PURE__ */
|
|
56
|
+
}), e.detail !== void 0 && /* @__PURE__ */ C("span", {
|
|
55
57
|
className: "kapi-ctxrec__sub",
|
|
56
58
|
children: e.detail
|
|
57
59
|
})]
|
|
58
60
|
}),
|
|
59
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ C(c, {
|
|
60
62
|
value: e.badge,
|
|
61
63
|
tone: e.badgeTone,
|
|
62
64
|
label: e.badgeLabel,
|
|
63
65
|
max: 999
|
|
64
66
|
}),
|
|
65
67
|
e.trailing
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
] }), i = `kapi-ctxrec${n ? " kapi-ctxrec--on" : ""}`;
|
|
69
|
+
return e.render === void 0 ? /* @__PURE__ */ C("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
className: i,
|
|
72
|
+
"aria-current": n ? "page" : void 0,
|
|
73
|
+
disabled: e.disabled,
|
|
74
|
+
onClick: s,
|
|
75
|
+
children: r
|
|
76
|
+
}) : t(e.render, { className: i }, {
|
|
77
|
+
"aria-current": n ? "page" : void 0,
|
|
78
|
+
"aria-disabled": e.disabled || void 0,
|
|
79
|
+
...e.disabled ? { onClick: (e) => e.preventDefault() } : {},
|
|
80
|
+
children: r
|
|
81
|
+
}, (e) => /* @__PURE__ */ C("a", { ...e }));
|
|
82
|
+
}
|
|
83
|
+
return e.href !== void 0 || e.render !== void 0 ? u({
|
|
84
|
+
render: e.render,
|
|
85
|
+
href: e.href,
|
|
86
|
+
newTab: e.newTab,
|
|
71
87
|
disabled: e.disabled,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
active: n,
|
|
89
|
+
className: `kapi-ctxitem kapi-ctxitem--link${n ? " kapi-ctxitem--on" : ""}`,
|
|
90
|
+
children: /* @__PURE__ */ w(S, { children: [
|
|
91
|
+
/* @__PURE__ */ w("span", {
|
|
75
92
|
className: "kapi-ctxitem__main",
|
|
76
93
|
children: [e.icon, e.label]
|
|
77
94
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ C(c, {
|
|
79
96
|
value: e.badge,
|
|
80
97
|
tone: e.badgeTone,
|
|
81
98
|
label: e.badgeLabel,
|
|
82
99
|
max: 999
|
|
83
100
|
}),
|
|
84
|
-
e.trailing
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
e.trailing,
|
|
102
|
+
e.external && /* @__PURE__ */ C(D, {
|
|
103
|
+
className: "kapi-ctxitem__ext",
|
|
104
|
+
size: 14,
|
|
105
|
+
"aria-hidden": "true"
|
|
106
|
+
}),
|
|
107
|
+
e.newTab && /* @__PURE__ */ C("span", {
|
|
108
|
+
className: "kapi-ctxitem__sr",
|
|
109
|
+
children: i
|
|
110
|
+
})
|
|
111
|
+
] })
|
|
112
|
+
}) : /* @__PURE__ */ w("button", {
|
|
113
|
+
type: "button",
|
|
114
|
+
className: `kapi-ctxitem${n ? " kapi-ctxitem--on" : ""}`,
|
|
115
|
+
"aria-current": n ? "page" : void 0,
|
|
116
|
+
disabled: e.disabled,
|
|
117
|
+
onClick: s,
|
|
93
118
|
children: [
|
|
94
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ w("span", {
|
|
95
120
|
className: "kapi-ctxitem__main",
|
|
96
121
|
children: [e.icon, e.label]
|
|
97
122
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ C(c, {
|
|
99
124
|
value: e.badge,
|
|
100
125
|
tone: e.badgeTone,
|
|
101
126
|
label: e.badgeLabel,
|
|
102
127
|
max: 999
|
|
103
128
|
}),
|
|
104
|
-
e.trailing
|
|
105
|
-
e.external && /* @__PURE__ */ b(w, {
|
|
106
|
-
className: "kapi-ctxitem__ext",
|
|
107
|
-
size: 14,
|
|
108
|
-
"aria-hidden": "true"
|
|
109
|
-
}),
|
|
110
|
-
e.newTab && /* @__PURE__ */ b("span", {
|
|
111
|
-
className: "kapi-ctxitem__sr",
|
|
112
|
-
children: r
|
|
113
|
-
})
|
|
129
|
+
e.trailing
|
|
114
130
|
]
|
|
115
131
|
});
|
|
116
|
-
},
|
|
117
|
-
let
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
i && /* @__PURE__ */
|
|
132
|
+
}, k = ({ sections: e, activeId: t, onSelect: n, search: i, hint: a, labels: o }) => {
|
|
133
|
+
let c = r("link", s, o);
|
|
134
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
135
|
+
i && /* @__PURE__ */ C(p, {
|
|
120
136
|
placeholder: i.placeholder,
|
|
121
137
|
value: i.value,
|
|
122
138
|
...i["aria-label"] === void 0 ? {} : { "aria-label": i["aria-label"] },
|
|
123
139
|
onChange: (e) => i.onChange?.(e.target.value)
|
|
124
140
|
}),
|
|
125
|
-
e.map((e,
|
|
141
|
+
e.map((e, r) => /* @__PURE__ */ w("div", {
|
|
126
142
|
className: "kapi-ctxsection",
|
|
127
143
|
children: [
|
|
128
|
-
|
|
129
|
-
e.label && /* @__PURE__ */
|
|
144
|
+
r > 0 && /* @__PURE__ */ C("div", { className: "kapi-ctxdivider" }),
|
|
145
|
+
e.label && /* @__PURE__ */ C("div", {
|
|
130
146
|
className: "kapi-ct",
|
|
131
147
|
children: e.label
|
|
132
148
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
active:
|
|
135
|
-
children: e.items.map((e) => /* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ C(l, {
|
|
150
|
+
active: v(e.items, t),
|
|
151
|
+
children: e.items.map((e) => /* @__PURE__ */ C(O, {
|
|
136
152
|
item: e,
|
|
137
|
-
active: e.id ===
|
|
138
|
-
onSelect:
|
|
139
|
-
newTabLabel:
|
|
153
|
+
active: e.id === t,
|
|
154
|
+
onSelect: n,
|
|
155
|
+
newTabLabel: c.newTab
|
|
140
156
|
}, e.id))
|
|
141
157
|
})
|
|
142
158
|
]
|
|
143
159
|
}, e.id)),
|
|
144
|
-
a && /* @__PURE__ */
|
|
160
|
+
a && /* @__PURE__ */ C("div", {
|
|
145
161
|
className: "kapi-hint",
|
|
146
162
|
children: a
|
|
147
163
|
})
|
|
148
164
|
] });
|
|
149
|
-
},
|
|
165
|
+
}, A = {
|
|
150
166
|
resize: "Redimensionar panel",
|
|
151
167
|
collapse: "Plegar panel",
|
|
152
168
|
expand: "Desplegar panel",
|
|
153
169
|
region: "Panel contextual"
|
|
154
|
-
},
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
J && (
|
|
158
|
-
}, [J,
|
|
170
|
+
}, j = ({ title: t, actions: s, collapsed: c, defaultCollapsed: l, onCollapsedChange: u, collapseLabel: d, expandLabel: f, side: p = "left", collapsedMode: v = "hidden", resizable: S = !1, minWidth: D = 200, maxWidth: O = 420, "aria-label": j, labels: M, className: N, style: P, id: F, ref: I, ...L }) => {
|
|
171
|
+
let R = r("contextPanel", A, M), re = d ?? R.collapse, ie = f ?? R.expand, z = j ?? R.region, [B, ae] = i(c, l ?? !1, u), [V, H] = x(null), [oe, U] = x(!1), W = b(null), G = b(null), K = n(G, I), q = b(null), [J, Y] = x(null);
|
|
172
|
+
y(() => {
|
|
173
|
+
J && (B === J.next && q.current?.focus(), Y(null));
|
|
174
|
+
}, [J, B]);
|
|
159
175
|
let X = (e) => {
|
|
160
|
-
Y({ next: e }),
|
|
161
|
-
}, Z =
|
|
162
|
-
|
|
176
|
+
Y({ next: e }), ae(e);
|
|
177
|
+
}, Z = b(X);
|
|
178
|
+
y(() => {
|
|
163
179
|
Z.current = X;
|
|
164
180
|
});
|
|
165
|
-
let se =
|
|
181
|
+
let se = ne(() => ({
|
|
166
182
|
mini: !0,
|
|
167
183
|
expand: () => Z.current(!1),
|
|
168
|
-
tooltipSide:
|
|
169
|
-
}), [
|
|
184
|
+
tooltipSide: p === "right" ? "start" : "end"
|
|
185
|
+
}), [p]), ce = p === "right" ? E : T, le = p === "right" ? T : E, Q = () => V ?? G.current?.offsetWidth ?? 258, ue = (e) => {
|
|
170
186
|
e.button === 0 && (W.current = {
|
|
171
187
|
startX: e.clientX,
|
|
172
188
|
startWidth: Q()
|
|
173
189
|
}, e.currentTarget.setPointerCapture(e.pointerId), U(!0), e.preventDefault());
|
|
174
190
|
}, de = (e) => {
|
|
175
191
|
let t = W.current;
|
|
176
|
-
t && H(
|
|
192
|
+
t && H(g(o(p, a(e.currentTarget)), t.startWidth, t.startX, e.clientX, D, O));
|
|
177
193
|
}, $ = (e) => {
|
|
178
194
|
W.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), U(!1);
|
|
179
195
|
}, fe = (e) => {
|
|
180
|
-
let t =
|
|
196
|
+
let t = _(o(p, a(e.currentTarget)), Q(), e.key, D, O);
|
|
181
197
|
t !== null && (e.preventDefault(), H(t));
|
|
182
198
|
};
|
|
183
|
-
if (
|
|
184
|
-
let t =
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
ref:
|
|
187
|
-
id:
|
|
188
|
-
className: e(
|
|
189
|
-
side:
|
|
199
|
+
if (B) {
|
|
200
|
+
let t = v === "mini";
|
|
201
|
+
return /* @__PURE__ */ w("aside", {
|
|
202
|
+
ref: I,
|
|
203
|
+
id: F,
|
|
204
|
+
className: e(h({
|
|
205
|
+
side: p,
|
|
190
206
|
collapsed: !0
|
|
191
|
-
}), t && "is-mini kapi-navmini",
|
|
192
|
-
style:
|
|
193
|
-
"aria-label":
|
|
194
|
-
children: [/* @__PURE__ */
|
|
207
|
+
}), t && "is-mini kapi-navmini", N),
|
|
208
|
+
style: P,
|
|
209
|
+
"aria-label": z,
|
|
210
|
+
children: [/* @__PURE__ */ C("button", {
|
|
195
211
|
ref: q,
|
|
196
212
|
type: "button",
|
|
197
213
|
className: "kapi-paneltoggle",
|
|
198
214
|
onClick: () => X(!1),
|
|
199
|
-
"aria-label":
|
|
200
|
-
children: /* @__PURE__ */
|
|
215
|
+
"aria-label": ie,
|
|
216
|
+
children: /* @__PURE__ */ C(le, {
|
|
201
217
|
className: "kapi-flip-rtl",
|
|
202
218
|
size: 16,
|
|
203
219
|
strokeWidth: 2,
|
|
204
220
|
"aria-hidden": "true"
|
|
205
221
|
})
|
|
206
|
-
}), t && /* @__PURE__ */
|
|
222
|
+
}), t && /* @__PURE__ */ C(ee.Provider, {
|
|
207
223
|
value: se,
|
|
208
|
-
children: /* @__PURE__ */
|
|
209
|
-
...
|
|
210
|
-
labels:
|
|
224
|
+
children: /* @__PURE__ */ C(k, {
|
|
225
|
+
...L,
|
|
226
|
+
labels: M
|
|
211
227
|
})
|
|
212
228
|
})]
|
|
213
229
|
});
|
|
214
230
|
}
|
|
215
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ w("aside", {
|
|
216
232
|
ref: K,
|
|
217
|
-
id:
|
|
218
|
-
className: e(
|
|
219
|
-
side:
|
|
233
|
+
id: F,
|
|
234
|
+
className: e(h({
|
|
235
|
+
side: p,
|
|
220
236
|
resizing: oe
|
|
221
|
-
}),
|
|
222
|
-
"aria-label":
|
|
223
|
-
"data-resizable":
|
|
224
|
-
style:
|
|
225
|
-
...
|
|
237
|
+
}), N),
|
|
238
|
+
"aria-label": z,
|
|
239
|
+
"data-resizable": S || void 0,
|
|
240
|
+
style: S && V !== null ? {
|
|
241
|
+
...P,
|
|
226
242
|
width: V
|
|
227
|
-
} :
|
|
243
|
+
} : P,
|
|
228
244
|
children: [
|
|
229
|
-
|
|
245
|
+
S && /* @__PURE__ */ C("div", {
|
|
230
246
|
className: "kapi-ctxpanel__resize",
|
|
231
247
|
role: "separator",
|
|
232
248
|
"aria-orientation": "vertical",
|
|
233
|
-
"aria-label":
|
|
234
|
-
"aria-valuemin":
|
|
235
|
-
"aria-valuemax":
|
|
236
|
-
"aria-valuenow": te(V ?? 258,
|
|
249
|
+
"aria-label": R.resize,
|
|
250
|
+
"aria-valuemin": D,
|
|
251
|
+
"aria-valuemax": O,
|
|
252
|
+
"aria-valuenow": te(V ?? 258, D, O),
|
|
237
253
|
tabIndex: 0,
|
|
238
254
|
onPointerDown: ue,
|
|
239
255
|
onPointerMove: de,
|
|
@@ -241,21 +257,21 @@ var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
|
|
|
241
257
|
onPointerCancel: $,
|
|
242
258
|
onKeyDown: fe
|
|
243
259
|
}),
|
|
244
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ w("div", {
|
|
245
261
|
className: "kapi-ctxpanel__head",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
262
|
+
children: [/* @__PURE__ */ C("span", { children: t }), /* @__PURE__ */ w("div", {
|
|
247
263
|
className: "kapi-ctxpanel__actions",
|
|
248
|
-
children: [s,
|
|
264
|
+
children: [s, m({
|
|
249
265
|
collapsed: c,
|
|
250
|
-
defaultCollapsed:
|
|
251
|
-
onCollapsedChange:
|
|
252
|
-
}) && /* @__PURE__ */
|
|
266
|
+
defaultCollapsed: l,
|
|
267
|
+
onCollapsedChange: u
|
|
268
|
+
}) && /* @__PURE__ */ C("button", {
|
|
253
269
|
ref: q,
|
|
254
270
|
type: "button",
|
|
255
271
|
className: "kapi-paneltoggle",
|
|
256
272
|
onClick: () => X(!0),
|
|
257
|
-
"aria-label":
|
|
258
|
-
children: /* @__PURE__ */
|
|
273
|
+
"aria-label": re,
|
|
274
|
+
children: /* @__PURE__ */ C(ce, {
|
|
259
275
|
className: "kapi-flip-rtl",
|
|
260
276
|
size: 16,
|
|
261
277
|
strokeWidth: 2,
|
|
@@ -264,12 +280,12 @@ var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
|
|
|
264
280
|
})]
|
|
265
281
|
})]
|
|
266
282
|
}),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
...
|
|
269
|
-
labels:
|
|
283
|
+
/* @__PURE__ */ C(k, {
|
|
284
|
+
...L,
|
|
285
|
+
labels: M
|
|
270
286
|
})
|
|
271
287
|
]
|
|
272
288
|
});
|
|
273
289
|
};
|
|
274
290
|
//#endregion
|
|
275
|
-
export {
|
|
291
|
+
export { A as DEFAULT_CONTEXT_PANEL_LABELS, j as KapiContextPanel, k as KapiContextSections };
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { CSSProperties, Ref } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { KapiToneName } from "../tone.js";
|
|
3
3
|
import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
|
|
4
4
|
export type KapiNavBadgeProps = {
|
|
5
5
|
/** Contador o `"dot"` (aviso sin número). Sin valor o 0 no dibuja nada. */
|
|
6
6
|
value?: KapiNavBadgeValue | undefined;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Color por rol, igual que `KapiBadge` (`danger` para vencidos, `warning` para por vencer…), o
|
|
9
|
+
* una familia propia de la app (`toneFamilies`). @default "primary"
|
|
10
|
+
*/
|
|
11
|
+
tone?: KapiToneName | undefined;
|
|
9
12
|
/** Texto accesible (p. ej. "3 trámites vencidos"); sin él se lee el número. */
|
|
10
13
|
label?: string | undefined;
|
|
11
14
|
/** `inline`: al final de un ítem de lista. `corner`: burbuja sobre la esquina del ícono (rail). @default "inline" */
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/navigation/KapiNavBadge.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useToneLook as e } from "../../hooks/useToneFamilies.js";
|
|
4
|
+
import { joinClasses as t } from "../rootProps.js";
|
|
5
|
+
import { badgeClasses as n } from "../display/KapiBadge.js";
|
|
6
|
+
import { navBadgeA11yText as r, navBadgeView as i } from "./navBadgeLogic.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { Fragment as
|
|
8
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/navigation/KapiNavBadge.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
max:
|
|
12
|
-
showZero:
|
|
10
|
+
var c = ({ value: c, tone: l = "primary", label: u, placement: d = "inline", max: f, showZero: p, announce: m = !0, className: h, style: g, ref: _ }) => {
|
|
11
|
+
let v = e("KapiNavBadge", l), y = i(c, {
|
|
12
|
+
max: f,
|
|
13
|
+
showZero: p
|
|
13
14
|
});
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
ref:
|
|
18
|
-
style:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
if (y === null) return null;
|
|
16
|
+
let b = m ? r(c, u, { showZero: p }) : null, x = y.kind === "dot";
|
|
17
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
|
|
18
|
+
ref: _,
|
|
19
|
+
style: v.style ? {
|
|
20
|
+
...v.style,
|
|
21
|
+
...g
|
|
22
|
+
} : g,
|
|
23
|
+
className: t(n({
|
|
24
|
+
tone: v.tone,
|
|
25
|
+
variant: d === "corner" || x ? "solid" : "subtle",
|
|
22
26
|
size: "sm"
|
|
23
|
-
}), "kapi-navbadge", `kapi-navbadge--${
|
|
27
|
+
}), "kapi-navbadge", `kapi-navbadge--${d}`, x && "kapi-navbadge--dot", h),
|
|
24
28
|
"aria-hidden": "true",
|
|
25
|
-
children:
|
|
26
|
-
}),
|
|
29
|
+
children: x ? null : y.text
|
|
30
|
+
}), b !== null && /* @__PURE__ */ s(a, { children: [
|
|
27
31
|
" ",
|
|
28
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ o("span", {
|
|
29
33
|
className: "kapi-navbadge__sr",
|
|
30
|
-
children:
|
|
34
|
+
children: b
|
|
31
35
|
}),
|
|
32
36
|
" "
|
|
33
37
|
] })] });
|
|
34
38
|
};
|
|
35
39
|
//#endregion
|
|
36
|
-
export {
|
|
40
|
+
export { c as KapiNavBadge };
|