@kapiuara/ui 0.16.0 → 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.
Files changed (181) hide show
  1. package/README.md +171 -11
  2. package/dist/components/chat/KapiChatThread.js +4 -4
  3. package/dist/components/chat/KapiComposer.js +8 -8
  4. package/dist/components/data/KapiDataTable.js +4 -4
  5. package/dist/components/data/KapiSparkline.d.ts +2 -1
  6. package/dist/components/data/KapiSparkline.js +29 -26
  7. package/dist/components/data/KapiTableFilter.js +6 -6
  8. package/dist/components/data/tableCells.d.ts +12 -1
  9. package/dist/components/data/tableCells.js +49 -51
  10. package/dist/components/data/useTableSelection.js +3 -3
  11. package/dist/components/display/KapiAnnotation.js +68 -63
  12. package/dist/components/display/KapiAvatar.d.ts +6 -4
  13. package/dist/components/display/KapiAvatar.js +33 -28
  14. package/dist/components/display/KapiCodeBlock.d.ts +48 -0
  15. package/dist/components/display/KapiCodeBlock.js +44 -0
  16. package/dist/components/display/KapiCommentComposer.js +6 -6
  17. package/dist/components/display/KapiDiff.d.ts +62 -0
  18. package/dist/components/display/KapiDiff.js +118 -0
  19. package/dist/components/display/KapiHighlight.d.ts +27 -0
  20. package/dist/components/display/KapiHighlight.js +21 -0
  21. package/dist/components/display/KapiIconTile.d.ts +2 -1
  22. package/dist/components/display/KapiIconTile.js +23 -21
  23. package/dist/components/display/KapiStat.d.ts +3 -2
  24. package/dist/components/display/KapiStat.js +32 -26
  25. package/dist/components/display/KapiTag.d.ts +4 -3
  26. package/dist/components/display/KapiTag.js +29 -24
  27. package/dist/components/display/KapiTimeline.d.ts +5 -2
  28. package/dist/components/display/KapiTimeline.js +31 -23
  29. package/dist/components/display/annotationLogic.d.ts +2 -1
  30. package/dist/components/display/annotationLogic.js +7 -6
  31. package/dist/components/display/codeBlockSlots.d.ts +10 -0
  32. package/dist/components/display/codeBlockSlots.js +13 -0
  33. package/dist/components/display/diffLogic.d.ts +58 -0
  34. package/dist/components/display/diffLogic.js +96 -0
  35. package/dist/components/display/diffSlots.d.ts +14 -0
  36. package/dist/components/display/diffSlots.js +17 -0
  37. package/dist/components/display/highlightLogic.d.ts +18 -0
  38. package/dist/components/display/highlightLogic.js +26 -0
  39. package/dist/components/display/highlightSlots.d.ts +5 -0
  40. package/dist/components/display/highlightSlots.js +8 -0
  41. package/dist/components/display/iconTileLogic.d.ts +2 -2
  42. package/dist/components/display/iconTileLogic.js +7 -6
  43. package/dist/components/display/index.d.ts +8 -0
  44. package/dist/components/display/statLogic.d.ts +2 -1
  45. package/dist/components/display/statLogic.js +7 -6
  46. package/dist/components/display/tagLogic.d.ts +2 -1
  47. package/dist/components/display/tagLogic.js +7 -6
  48. package/dist/components/display/timelineLogic.d.ts +20 -2
  49. package/dist/components/display/timelineLogic.js +10 -2
  50. package/dist/components/feedback/KapiFab.js +108 -108
  51. package/dist/components/feedback/KapiProgress.js +63 -54
  52. package/dist/components/feedback/KapiToastContainer.js +9 -9
  53. package/dist/components/feedback/KapiTour.js +12 -12
  54. package/dist/components/feedback/progressLogic.d.ts +2 -1
  55. package/dist/components/feedback/progressLogic.js +9 -8
  56. package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
  57. package/dist/components/inputs/KapiAutocomplete.js +86 -85
  58. package/dist/components/inputs/KapiChecklist.d.ts +7 -1
  59. package/dist/components/inputs/KapiChecklist.js +53 -52
  60. package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
  61. package/dist/components/inputs/KapiCopyButton.js +35 -0
  62. package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
  63. package/dist/components/inputs/KapiDatePicker.js +118 -116
  64. package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
  65. package/dist/components/inputs/KapiDateRangePicker.js +136 -135
  66. package/dist/components/inputs/KapiFacetedSearch.js +5 -5
  67. package/dist/components/inputs/KapiField.d.ts +9 -1
  68. package/dist/components/inputs/KapiField.js +43 -42
  69. package/dist/components/inputs/KapiFileUpload.js +6 -6
  70. package/dist/components/inputs/KapiInput.d.ts +29 -1
  71. package/dist/components/inputs/KapiInput.js +74 -51
  72. package/dist/components/inputs/KapiMaskedInput.js +26 -26
  73. package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
  74. package/dist/components/inputs/KapiNumberStepper.js +24 -23
  75. package/dist/components/inputs/KapiPinInput.d.ts +72 -0
  76. package/dist/components/inputs/KapiPinInput.js +75 -0
  77. package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
  78. package/dist/components/inputs/KapiPropsForm.js +78 -0
  79. package/dist/components/inputs/KapiRating.d.ts +7 -1
  80. package/dist/components/inputs/KapiRating.js +39 -38
  81. package/dist/components/inputs/KapiSearchChip.js +5 -5
  82. package/dist/components/inputs/KapiSegmented.d.ts +13 -5
  83. package/dist/components/inputs/KapiSegmented.js +81 -77
  84. package/dist/components/inputs/KapiSelect.d.ts +9 -1
  85. package/dist/components/inputs/KapiSelect.js +236 -233
  86. package/dist/components/inputs/KapiSlider.d.ts +10 -3
  87. package/dist/components/inputs/KapiSlider.js +67 -63
  88. package/dist/components/inputs/KapiTagInput.d.ts +7 -1
  89. package/dist/components/inputs/KapiTagInput.js +70 -69
  90. package/dist/components/inputs/KapiTextarea.d.ts +7 -1
  91. package/dist/components/inputs/KapiTextarea.js +51 -50
  92. package/dist/components/inputs/copyLogic.d.ts +1 -0
  93. package/dist/components/inputs/copyLogic.js +12 -0
  94. package/dist/components/inputs/fieldLogic.d.ts +23 -3
  95. package/dist/components/inputs/fieldLogic.js +18 -11
  96. package/dist/components/inputs/index.d.ts +8 -0
  97. package/dist/components/inputs/inputLogic.d.ts +16 -1
  98. package/dist/components/inputs/inputLogic.js +3 -3
  99. package/dist/components/inputs/ownField.d.ts +3 -1
  100. package/dist/components/inputs/ownField.js +28 -27
  101. package/dist/components/inputs/pinInputLogic.d.ts +34 -0
  102. package/dist/components/inputs/pinInputLogic.js +37 -0
  103. package/dist/components/inputs/propsFormLogic.d.ts +53 -0
  104. package/dist/components/inputs/propsFormLogic.js +11 -0
  105. package/dist/components/inputs/segmentedLogic.d.ts +7 -0
  106. package/dist/components/inputs/segmentedLogic.js +2 -2
  107. package/dist/components/layout/KapiAccessCard.d.ts +5 -1
  108. package/dist/components/layout/KapiAccessCard.js +43 -39
  109. package/dist/components/layout/KapiAccountMenu.js +7 -7
  110. package/dist/components/layout/KapiCollapse.d.ts +39 -0
  111. package/dist/components/layout/KapiCollapse.js +20 -0
  112. package/dist/components/layout/KapiContextSlot.js +4 -4
  113. package/dist/components/layout/KapiDivider.d.ts +11 -2
  114. package/dist/components/layout/KapiDivider.js +30 -24
  115. package/dist/components/layout/KapiGrid.js +2 -2
  116. package/dist/components/layout/KapiNotificationBell.js +10 -10
  117. package/dist/components/layout/KapiPageHeader.js +22 -22
  118. package/dist/components/layout/KapiRail.js +4 -4
  119. package/dist/components/layout/KapiRoot.d.ts +22 -2
  120. package/dist/components/layout/KapiRoot.js +33 -29
  121. package/dist/components/layout/KapiShell.d.ts +9 -1
  122. package/dist/components/layout/KapiShell.js +28 -27
  123. package/dist/components/layout/accessCardLogic.d.ts +8 -1
  124. package/dist/components/layout/accessCardLogic.js +11 -7
  125. package/dist/components/layout/index.d.ts +2 -0
  126. package/dist/components/locale/labelRegistry.d.ts +10 -0
  127. package/dist/components/navigation/KapiAccordion.js +9 -9
  128. package/dist/components/navigation/KapiContextPanel.js +12 -12
  129. package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
  130. package/dist/components/navigation/KapiNavBadge.js +26 -22
  131. package/dist/components/navigation/KapiTabs.js +9 -9
  132. package/dist/components/navigation/KapiToc.d.ts +48 -0
  133. package/dist/components/navigation/KapiToc.js +66 -0
  134. package/dist/components/navigation/KapiTree.js +10 -10
  135. package/dist/components/navigation/index.d.ts +3 -0
  136. package/dist/components/navigation/tocLogic.d.ts +35 -0
  137. package/dist/components/navigation/tocLogic.js +11 -0
  138. package/dist/components/navigation/tocSlots.d.ts +8 -0
  139. package/dist/components/navigation/tocSlots.js +11 -0
  140. package/dist/components/overlays/KapiCommandPalette.js +6 -6
  141. package/dist/components/overlays/KapiContextMenu.js +5 -5
  142. package/dist/components/overlays/KapiMenuButton.js +7 -7
  143. package/dist/components/overlays/KapiModal.js +3 -3
  144. package/dist/components/overlays/KapiOffcanvas.js +24 -24
  145. package/dist/components/overlays/KapiPhotoView.js +10 -10
  146. package/dist/components/overlays/KapiPopover.js +6 -6
  147. package/dist/components/overlays/KapiShapeSheet.js +4 -4
  148. package/dist/components/overlays/KapiTooltip.js +18 -18
  149. package/dist/components/overlays/menuList.js +22 -22
  150. package/dist/components/slotCatalog.d.ts +33 -0
  151. package/dist/components/slotCatalog.js +18 -10
  152. package/dist/css/base.css +1 -1
  153. package/dist/css/components/display/KapiAnnotation.css +1 -1
  154. package/dist/css/components/display/KapiCodeBlock.css +1 -0
  155. package/dist/css/components/display/KapiDiff.css +1 -0
  156. package/dist/css/components/display/display.css +1 -1
  157. package/dist/css/components/feedback/feedback.css +1 -1
  158. package/dist/css/components/inputs/KapiPinInput.css +1 -0
  159. package/dist/css/components/inputs/KapiSelect.css +1 -1
  160. package/dist/css/components/inputs/inputsExtra.css +1 -1
  161. package/dist/css/components/layout/KapiAccessCard.css +1 -1
  162. package/dist/css/components/layout/KapiCollapse.css +1 -0
  163. package/dist/css/components/layout/KapiDivider.css +1 -1
  164. package/dist/css/components/navigation/KapiToc.css +1 -0
  165. package/dist/hooks/asyncResourceLogic.d.ts +11 -0
  166. package/dist/hooks/asyncResourceLogic.js +4 -0
  167. package/dist/hooks/index.d.ts +3 -0
  168. package/dist/hooks/toneFamilyLogic.d.ts +26 -2
  169. package/dist/hooks/toneFamilyLogic.js +19 -6
  170. package/dist/hooks/useAsyncResource.d.ts +45 -0
  171. package/dist/hooks/useAsyncResource.js +24 -0
  172. package/dist/hooks/useKapiTheme.d.ts +8 -1
  173. package/dist/hooks/useKapiTheme.js +57 -57
  174. package/dist/hooks/useToneFamilies.d.ts +14 -4
  175. package/dist/hooks/useToneFamilies.js +27 -23
  176. package/dist/index.js +221 -207
  177. package/dist/kapi.css +1 -1
  178. package/dist/kapi.layered.css +1 -1
  179. package/dist/logic.d.ts +41 -0
  180. package/dist/logic.js +42 -0
  181. package/package.json +13 -2
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import "#kapi-css/components/layout/KapiCollapse.css";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ /* empty css */
5
+ import { jsx as t } from "react/jsx-runtime";
6
+ //#region src/components/layout/KapiCollapse.tsx
7
+ function n({ open: n = !1, children: r, className: i, ...a }) {
8
+ return /* @__PURE__ */ t("div", {
9
+ ...a,
10
+ className: e("kapi-collapse", i),
11
+ "data-open": n ? "" : void 0,
12
+ inert: !n,
13
+ children: /* @__PURE__ */ t("div", {
14
+ className: "kapi-collapse__clip",
15
+ children: r
16
+ })
17
+ });
18
+ }
19
+ //#endregion
20
+ export { n as KapiCollapse };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/navigation/navigation.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
4
+ import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
5
+ import { useLabels as ee } from "../locale/KapiLocaleProvider.js";
5
6
  import { useControllableState as n } from "../../hooks/useControllableState.js";
6
7
  import { directionOf as r, physicalSide as i } from "../../hooks/directionLogic.js";
7
- import { useMergedRefs as ee } from "../../hooks/mergeRefs.js";
8
8
  /* empty css */
9
9
  import { KapiPanelMiniContext as te } from "../navigation/panelMini.js";
10
10
  import { resolveGone as a, resolveMini as ne } from "../navigation/panelMiniLogic.js";
@@ -23,7 +23,7 @@ var _ = {
23
23
  region: "Panel contextual",
24
24
  resize: "Redimensionar panel"
25
25
  }, v = ({ title: v, actions: pe, children: me, open: he, defaultOpen: y, onOpenChange: ge, side: b = "left", collapsedMode: x = "hidden", resizable: _e = !1, width: ve, defaultWidth: ye, onWidthChange: be, minWidth: S = 200, maxWidth: C = 420, "aria-label": w, labels: T, className: E, style: D, id: O, ref: k }) => {
26
- let A = t("contextSlot", _, T), j = w ?? A.region, M = b === "right", N = M ? g : h, xe = M ? h : g, Se = ae(), [P, F] = n(he, () => y ?? (!Se || !ce("(max-width: 1024px)")), ge), I = s(oe), Ce = s(se), L = c(I, Ce), R = f(L), z = f(L === "wide" ? P : y ?? !0);
26
+ let A = ee("contextSlot", _, T), j = w ?? A.region, M = b === "right", N = M ? g : h, xe = M ? h : g, Se = ae(), [P, F] = n(he, () => y ?? (!Se || !ce("(max-width: 1024px)")), ge), I = s(oe), Ce = s(se), L = c(I, Ce), R = f(L), z = f(L === "wide" ? P : y ?? !0);
27
27
  u(() => {
28
28
  let e = ue(R.current, L, z.current);
29
29
  R.current = L, e !== null && e !== P && F(e);
@@ -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 : o(B, S, C), G = () => W ?? H.current?.offsetWidth ?? 258, K = (e) => {
37
+ let [B, we] = n(ve, ye ?? null, be), [Te, V] = de(!1), H = f(null), Ee = t(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 = {
@@ -8,10 +8,19 @@ export type KapiDividerProps = Omit<HTMLAttributes<HTMLDivElement>, "children">
8
8
  orientation?: KapiDividerOrientation | undefined;
9
9
  /** Texto centrado entre dos líneas (sólo horizontal). */
10
10
  label?: ReactNode | undefined;
11
+ /**
12
+ * Línea punteada, para separar grupos DENTRO de una tarjeta (donde la sólida ya separa las
13
+ * tarjetas entre sí): una lista de parámetros, de permisos, una ficha con secciones.
14
+ *
15
+ * Está acá porque desde afuera es una trampa: la línea se dibuja con `background` y
16
+ * `height: 1px`, NO con un borde, así que el `border-top: dashed` que uno escribiría se pinta
17
+ * ENCIMA de la sólida y quedan dos rayas.
18
+ */
19
+ dashed?: boolean | undefined;
11
20
  /** Clase del separador. */
12
21
  className?: string | undefined;
13
22
  };
14
23
  /** Clases del divisor. Pura y exportada. */
15
- export declare const dividerClasses: ({ orientation, className }?: Pick<KapiDividerProps, "orientation" | "className">) => string;
24
+ export declare const dividerClasses: ({ orientation, dashed, className }?: Pick<KapiDividerProps, "orientation" | "dashed" | "className">) => string;
16
25
  /** Separador horizontal (opcionalmente con texto) o vertical. */
17
- export declare function KapiDivider({ orientation, label, className, ...rest }: KapiDividerProps): import("react").JSX.Element;
26
+ export declare function KapiDivider({ orientation, dashed, label, className, ...rest }: KapiDividerProps): import("react").JSX.Element;
@@ -4,37 +4,43 @@ import { joinClasses as e } from "../rootProps.js";
4
4
  /* empty css */
5
5
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
6
6
  //#region src/components/layout/KapiDivider.tsx
7
- var r = ({ orientation: e = "horizontal", className: t = "" } = {}) => [
7
+ var r = ({ orientation: e = "horizontal", dashed: t = !1, className: n = "" } = {}) => [
8
8
  "kapi-divider",
9
9
  e === "vertical" && "kapi-divider--vertical",
10
- t
10
+ t && "kapi-divider--dashed",
11
+ n
11
12
  ].filter(Boolean).join(" ");
12
- function i({ orientation: i = "horizontal", label: a, className: o, ...s }) {
13
- return i === "horizontal" && a != null ? /* @__PURE__ */ n("div", {
14
- ...s,
15
- role: "separator",
16
- className: e("kapi-divider-labeled", o),
17
- children: [
18
- /* @__PURE__ */ t("span", {
19
- className: "kapi-divider",
20
- "aria-hidden": !0
21
- }),
22
- /* @__PURE__ */ t("span", {
23
- className: "kapi-divider-labeled__text",
24
- children: a
25
- }),
26
- /* @__PURE__ */ t("span", {
27
- className: "kapi-divider",
28
- "aria-hidden": !0
29
- })
30
- ]
31
- }) : /* @__PURE__ */ t("div", {
32
- ...s,
13
+ function i({ orientation: i = "horizontal", dashed: a = !1, label: o, className: s, ...c }) {
14
+ if (i === "horizontal" && o != null) {
15
+ let i = r({ dashed: a });
16
+ return /* @__PURE__ */ n("div", {
17
+ ...c,
18
+ role: "separator",
19
+ className: e("kapi-divider-labeled", s),
20
+ children: [
21
+ /* @__PURE__ */ t("span", {
22
+ className: i,
23
+ "aria-hidden": !0
24
+ }),
25
+ /* @__PURE__ */ t("span", {
26
+ className: "kapi-divider-labeled__text",
27
+ children: o
28
+ }),
29
+ /* @__PURE__ */ t("span", {
30
+ className: i,
31
+ "aria-hidden": !0
32
+ })
33
+ ]
34
+ });
35
+ }
36
+ return /* @__PURE__ */ t("div", {
37
+ ...c,
33
38
  role: "separator",
34
39
  "aria-orientation": i,
35
40
  className: r({
36
41
  orientation: i,
37
- className: o
42
+ dashed: a,
43
+ className: s
38
44
  })
39
45
  });
40
46
  }
@@ -4,10 +4,10 @@ import "#kapi-css/components/layout/gridSpan.css";
4
4
  import { joinClasses as e } from "../rootProps.js";
5
5
  import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
6
6
  import { gridProps as n } from "./layoutPrimitives.js";
7
- /* empty css */
8
7
  import { gridSpanStyle as r, normalizeColumns as i } from "./gridSpanLogic.js";
9
- /* empty css */
10
8
  import { useGridBreakpoint as a } from "./useGridBreakpoint.js";
9
+ /* empty css */
10
+ /* empty css */
11
11
  import { useEffect as o, useRef as s } from "react";
12
12
  import { jsx as c } from "react/jsx-runtime";
13
13
  //#region src/components/layout/KapiGrid.tsx
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/layout/KapiNotificationBell.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { assignRef as t, focusLeaves as n } from "../inputs/fieldLogic.js";
5
- import { useKapiFormatLocale as r, useLabels as i } from "../locale/KapiLocaleProvider.js";
6
- import { focusedMenuIndex as a, menuKeyIntent as o, nextEnabledIndex as s } from "../overlays/menuKeyboardLogic.js";
7
- import { useControllableState as ee } from "../../hooks/useControllableState.js";
8
- import { activeElementOf as c } from "../../hooks/ownerDocument.js";
4
+ import { useKapiFormatLocale as t, useLabels as n } from "../locale/KapiLocaleProvider.js";
5
+ import { activeElementOf as r } from "../../hooks/ownerDocument.js";
6
+ import { assignRef as i, focusLeaves as a } from "../inputs/fieldLogic.js";
7
+ import { useControllableState as o } from "../../hooks/useControllableState.js";
8
+ import { focusedMenuIndex as s, menuKeyIntent as ee, nextEnabledIndex as c } from "../overlays/menuKeyboardLogic.js";
9
9
  import { resolveKapiRoot as te } from "../../hooks/kapiRoot.js";
10
10
  import { usePlacement as l } from "../../hooks/usePlacement.js";
11
11
  import { useDismiss as u } from "../../hooks/useDismiss.js";
@@ -27,7 +27,7 @@ var S = {
27
27
  loading: "Cargando notificaciones…"
28
28
  }, C = "[data-menu-index]", w = (e) => (e?.querySelector(C) ?? e)?.focus();
29
29
  function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading: O = !1, emptyMessage: k, max: A = 9, open: j, defaultOpen: M = !1, onOpenChange: N, labels: P, now: F, ref: I, className: L, onClick: R, "aria-label": z, ...B }) {
30
- let V = i("notificationBell", S, P), H = r(), [U, W] = ee(j, M, N), G = m(), K = m(), q = g(null), J = g(null), [Y, ce] = _(null);
30
+ let V = n("notificationBell", S, P), H = t(), [U, W] = o(j, M, N), G = m(), K = m(), q = g(null), J = g(null), [Y, ce] = _(null);
31
31
  h(() => {
32
32
  ce(U ? te(q.current) : null);
33
33
  }, [U]);
@@ -52,19 +52,19 @@ function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading
52
52
  }, Q = p(T), $ = ie(Q, A), fe = (e) => {
53
53
  R?.(e), !e.defaultPrevented && W(!U);
54
54
  }, pe = (e) => {
55
- let t = o(e.key);
55
+ let t = ee(e.key);
56
56
  if (t.kind !== "move") return X(e);
57
57
  let n = ue();
58
- n.length !== 0 && (e.preventDefault(), n[s(a(c(e.currentTarget)), t.dir, n.map((e, t) => t))]?.focus());
58
+ n.length !== 0 && (e.preventDefault(), n[c(s(r(e.currentTarget)), t.dir, n.map((e, t) => t))]?.focus());
59
59
  }, me = (e) => {
60
- n(e.relatedTarget, J.current, q.current) && e.relatedTarget && W(!1);
60
+ a(e.relatedTarget, J.current, q.current) && e.relatedTarget && W(!1);
61
61
  }, he = () => {
62
62
  E?.(), de();
63
63
  }, ge = F ?? /* @__PURE__ */ new Date();
64
64
  return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("button", {
65
65
  ...B,
66
66
  ref: (e) => {
67
- q.current = e, t(I, e);
67
+ q.current = e, i(I, e);
68
68
  },
69
69
  type: "button",
70
70
  className: e("kapi-bell", L),
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/layout/KapiPageHeader.css";
3
3
  import "#kapi-css/components/navigation/navigation.css";
4
- import { computedStyleOf as e, docOf as t } from "../../hooks/ownerDocument.js";
5
- import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
4
+ import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
5
+ import { computedStyleOf as t, docOf as n } from "../../hooks/ownerDocument.js";
6
6
  import { slot as r } from "../slotsLogic.js";
7
7
  import { prefersReducedMotion as i } from "../../hooks/reducedMotion.js";
8
8
  import { maxTransitionMs as a } from "../overlays/dialogUtils.js";
@@ -40,7 +40,7 @@ var y = "kapi-pageheader--collapsed", b = "kapi-pageheader--animating", x = "kap
40
40
  n ? r() : (e.style.transition = "none", r(), e.getBoundingClientRect(), e.style.transition = "");
41
41
  };
42
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({
43
+ let { collapsed: R, sentinelRef: z } = c({ root: M }), B = A && R, V = p(null), H = e(V, I), U = p({
44
44
  expanded: 0,
45
45
  collapsed: 0
46
46
  }), W = p(B);
@@ -49,21 +49,21 @@ function E({ title: y, subtitle: x, meta: E, actions: D, chip: O, breadcrumbs: k
49
49
  f(() => {
50
50
  let e = V.current;
51
51
  if (!e) return;
52
- let n = () => {
52
+ let t = () => {
53
53
  K.current || (U.current = C(e, W.current), T(e, w(U.current, W.current), !1));
54
54
  };
55
- n();
55
+ t();
56
56
  let r = !0;
57
- if (t(e)?.fonts?.ready.then(() => {
58
- r && n();
57
+ if (n(e)?.fonts?.ready.then(() => {
58
+ r && t();
59
59
  }), typeof ResizeObserver > "u") return () => {
60
60
  r = !1;
61
61
  };
62
62
  let i = e.getBoundingClientRect().width, a = new ResizeObserver((e) => {
63
- let t = e[e.length - 1];
64
- if (!t) return;
65
- let r = t.borderBoxSize?.[0]?.inlineSize ?? t.contentRect.width;
66
- r !== i && (i = r, n());
63
+ let n = e[e.length - 1];
64
+ if (!n) return;
65
+ let r = n.borderBoxSize?.[0]?.inlineSize ?? n.contentRect.width;
66
+ r !== i && (i = r, t());
67
67
  });
68
68
  return a.observe(e), () => {
69
69
  r = !1, a.disconnect();
@@ -78,25 +78,25 @@ function E({ title: y, subtitle: x, meta: E, actions: D, chip: O, breadcrumbs: k
78
78
  A,
79
79
  N
80
80
  ]), f(() => {
81
- let t = V.current;
82
- if (!t) return;
83
- let { expanded: n } = U.current, r = l(U.current, B), o = G.current && !i(t);
81
+ let e = V.current;
82
+ if (!e) return;
83
+ let { expanded: n } = U.current, r = l(U.current, B), o = G.current && !i(e);
84
84
  G.current = !0;
85
85
  let s = () => {
86
- K.current = !1, t.classList.remove(b), B || t.style.removeProperty("height");
86
+ K.current = !1, e.classList.remove(b), B || e.style.removeProperty("height");
87
87
  };
88
88
  if (!o) {
89
- T(t, w(U.current, B), !1);
89
+ T(e, w(U.current, B), !1);
90
90
  return;
91
91
  }
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) => {
94
- e.target === t && e.propertyName === "height" && s();
92
+ e.style.height === "" && n > 0 && (e.style.height = `${n}px`, e.getBoundingClientRect()), K.current = !0, e.classList.add(b), T(e, r, !0);
93
+ let c = (t) => {
94
+ t.target === e && t.propertyName === "height" && s();
95
95
  };
96
- t.addEventListener("transitionend", c);
97
- let u = e(t), d = window.setTimeout(s, a(u.transitionDuration, u.transitionDelay) + S);
96
+ e.addEventListener("transitionend", c);
97
+ let u = t(e), d = window.setTimeout(s, a(u.transitionDuration, u.transitionDelay) + S);
98
98
  return () => {
99
- t.removeEventListener("transitionend", c), window.clearTimeout(d);
99
+ e.removeEventListener("transitionend", c), window.clearTimeout(d);
100
100
  };
101
101
  }, [B]);
102
102
  let q = [
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/layout/KapiRail.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { assignRef as t } from "../inputs/fieldLogic.js";
5
- import { useLabels as n } from "../locale/KapiLocaleProvider.js";
4
+ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
+ import { assignRef as n } from "../inputs/fieldLogic.js";
6
6
  import { slot as r } from "../slotsLogic.js";
7
7
  import { useSlidingIndicator as i } from "../../hooks/useSlidingIndicator.js";
8
8
  import { KapiTooltip as a } from "../overlays/KapiTooltip.js";
@@ -29,10 +29,10 @@ var k = {
29
29
  moreCurrent: "sección actual",
30
30
  account: "Cuenta"
31
31
  }, A = ({ items: A, activeId: j, onSelect: M, brand: N, footer: P, variant: F = "labeled", "aria-label": ie, labels: I, className: L, classNames: R, ref: z, ...ae }) => {
32
- let B = n("rail", k, I), oe = n("link", o, I), V = F === "compact", se = v(F), H = y(A), U = f(d), [W, G] = T(null);
32
+ let B = t("rail", k, I), oe = t("link", o, I), V = F === "compact", se = v(F), H = y(A), U = f(d), [W, G] = T(null);
33
33
  p(W, U);
34
34
  let ce = w((e) => {
35
- G(e), t(z, e);
35
+ G(e), n(z, e);
36
36
  }, [z]), { ref: K, edges: q } = u({ axis: "y" }), J = H.scroll, Y = J.filter((e) => !m(e)).length, le = x(K, {
37
37
  enabled: U,
38
38
  count: Y,
@@ -1,6 +1,7 @@
1
1
  import { type CSSProperties, type HTMLAttributes, type ReactNode, type Ref } from "react";
2
2
  import { type KapiThemeState } from "../../hooks/useKapiTheme.js";
3
3
  import type { KapiDensity } from "../../hooks/densityLogic.js";
4
+ import type { KapiTheme } from "../../hooks/useKapiTheme.js";
4
5
  import type { KapiDir } from "../../hooks/directionLogic.js";
5
6
  import type { KapiBrandTheme } from "../../hooks/themeColorsLogic.js";
6
7
  import type { KapiToneFamilies } from "../../hooks/toneFamilyLogic.js";
@@ -14,6 +15,8 @@ export type KapiRootWiringOptions = {
14
15
  toneFamilies?: KapiToneFamilies | undefined;
15
16
  /** Densidad de la interfaz (ver `KapiRootProps.density`). */
16
17
  density?: KapiDensity | undefined;
18
+ /** Tema impuesto por la app (ver `KapiRootProps.theme`). */
19
+ theme?: KapiTheme | undefined;
17
20
  /** `style` del consumidor; las variables del tema van encima. */
18
21
  style?: CSSProperties | undefined;
19
22
  /** `ref` del consumidor al `<div>` raíz. */
@@ -46,7 +49,7 @@ export type KapiRootWiring = {
46
49
  * `style`), `dir` y raíz de portales. Interno: lo comparten `KapiShell` y `KapiRoot`, que sólo
47
50
  * difieren en lo que dibujan adentro.
48
51
  */
49
- export declare const useKapiRootWiring: ({ storageNamespace, brandTheme, toneFamilies, density, style, ref }: KapiRootWiringOptions) => KapiRootWiring;
52
+ export declare const useKapiRootWiring: ({ storageNamespace, brandTheme, toneFamilies, density, theme, style, ref }: KapiRootWiringOptions) => KapiRootWiring;
50
53
  /**
51
54
  * Contextos que una raíz `.kapi` da a su subárbol: el tema y la raíz de portales. Los overlays sin
52
55
  * ancla (modal, offcanvas, paleta de comandos, toasts…) se montan en ESTA raíz y no en el primer
@@ -97,6 +100,23 @@ export type KapiRootProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
97
100
  * de la persona: no se guarda. No reemplaza a `size` (que elige un tamaño de UN control).
98
101
  */
99
102
  density?: KapiDensity | undefined;
103
+ /**
104
+ * Tema que impone la APP: `"light"` o `"dark"`. Gana sobre lo guardado y sobre el sistema.
105
+ *
106
+ * Es para una app host que ya tiene su propio modo oscuro. Sin esto la raíz decide sola —con
107
+ * `localStorage` y `prefers-color-scheme`— y las dos quedan desincronizadas: el host se va a
108
+ * oscuro y lo de la librería se queda en claro, con la tinta clara sobre el fondo oscuro. Medido
109
+ * en un front real: **2,87:1, por debajo del 4,5:1 de WCAG AA**; con el tema sincronizado, 7,00:1.
110
+ *
111
+ * NO SE GUARDA, igual que `density`: es un ajuste de la app, no una preferencia de la persona, y
112
+ * `preference` sigue siendo la que ella eligió. Sin esta prop nada cambia.
113
+ *
114
+ * Y OJO CON LOS INTERRUPTORES DE TEMA DE ADENTRO: con `theme` puesto, un `setTheme()` de un
115
+ * componente del subárbol guarda la preferencia pero no mueve nada, porque lo que se ve es esta
116
+ * prop. Un botón de tema propio parecería roto. Si la app impone el tema, el interruptor es suyo:
117
+ * escondelo o hacelo cambiar el valor que le pasás acá.
118
+ */
119
+ theme?: KapiTheme | undefined;
100
120
  };
101
121
  /**
102
122
  * Raíz mínima para embeber componentes en una página que ya existe (una isla en un sitio hecho con
@@ -112,4 +132,4 @@ export type KapiRootProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
112
132
  * <KapiButton onClick={…}>Inscribirme</KapiButton>
113
133
  * </KapiRoot>
114
134
  */
115
- export declare const KapiRoot: ({ children, className, storageNamespace, brandTheme, toneFamilies, density, style, ref, ...rest }: KapiRootProps) => import("react").JSX.Element;
135
+ export declare const KapiRoot: ({ children, className, storageNamespace, brandTheme, toneFamilies, density, theme, style, ref, ...rest }: KapiRootProps) => import("react").JSX.Element;
@@ -2,40 +2,43 @@
2
2
  import "#kapi-css/components/layout/KapiRoot.css";
3
3
  import { ToneFamilyNamesContext as e, useToneFamilyProblemWarning as t, useToneFamilyRegistry as n } from "../../hooks/useToneFamilies.js";
4
4
  import { joinClasses as r } from "../rootProps.js";
5
- import { useKapiDir as i } from "../locale/KapiLocaleProvider.js";
6
- import { KapiPortalRootProvider as a, usePortalRootOverride as o } from "../../hooks/portalRoot.js";
7
- import { useMergedRefs as s } from "../../hooks/mergeRefs.js";
5
+ import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
6
+ import { useKapiDir as a } from "../locale/KapiLocaleProvider.js";
7
+ import { KapiPortalRootProvider as o, usePortalRootOverride as s } from "../../hooks/portalRoot.js";
8
8
  import { KapiThemeContext as c, themeRootStyle as l, useKapiThemeState as u } from "../../hooks/useKapiTheme.js";
9
9
  import { densityAttribute as d } from "../../hooks/densityLogic.js";
10
10
  /* empty css */
11
11
  import { createContext as f, useContext as p, useMemo as m, useState as h } from "react";
12
12
  import { jsx as g } from "react/jsx-runtime";
13
13
  //#region src/components/layout/KapiRoot.tsx
14
- var _ = f(null), v = ({ storageNamespace: e, brandTheme: r, toneFamilies: a, density: c, style: f, ref: g }) => {
15
- let v = u({ namespace: e }), y = i(), b = m(() => l(v, r, a), [
16
- v,
14
+ var _ = f(null), v = ({ storageNamespace: e, brandTheme: r, toneFamilies: o, density: c, theme: f, style: g, ref: v }) => {
15
+ let y = u({
16
+ namespace: e,
17
+ theme: f
18
+ }), b = a(), x = m(() => l(y, r, o), [
19
+ y,
17
20
  r,
18
- a
19
- ]), { names: x, problems: S } = n(a);
20
- t(S);
21
- let [C, w] = h(null), T = s(w, g), E = o(), D = p(_), O = E && E !== D ? E : C;
21
+ o
22
+ ]), { names: S, problems: C } = n(o);
23
+ t(C);
24
+ let [w, T] = h(null), E = i(T, v), D = s(), O = p(_), k = D && D !== O ? D : w;
22
25
  return {
23
- themeState: v,
24
- toneNames: x,
25
- dir: y,
26
+ themeState: y,
27
+ toneNames: S,
28
+ dir: b,
26
29
  attrs: {
27
- ref: T,
28
- "data-theme": v.theme,
29
- "data-motion": v.motion === "reduced" ? "reduced" : void 0,
30
+ ref: E,
31
+ "data-theme": y.theme,
32
+ "data-motion": y.motion === "reduced" ? "reduced" : void 0,
30
33
  "data-density": d(c),
31
34
  style: {
32
- ...f,
33
- ...b
35
+ ...g,
36
+ ...x
34
37
  },
35
38
  suppressHydrationWarning: !0
36
39
  },
37
- element: C,
38
- portalRoot: O
40
+ element: w,
41
+ portalRoot: k
39
42
  };
40
43
  }, y = ({ wiring: t, children: n }) => /* @__PURE__ */ g(c.Provider, {
41
44
  value: t.themeState,
@@ -43,28 +46,29 @@ var _ = f(null), v = ({ storageNamespace: e, brandTheme: r, toneFamilies: a, den
43
46
  value: t.toneNames,
44
47
  children: /* @__PURE__ */ g(_.Provider, {
45
48
  value: t.element,
46
- children: /* @__PURE__ */ g(a, {
49
+ children: /* @__PURE__ */ g(o, {
47
50
  root: t.portalRoot,
48
51
  children: n
49
52
  })
50
53
  })
51
54
  })
52
- }), b = ({ children: e, className: t, storageNamespace: n, brandTheme: i, toneFamilies: a, density: o, style: s, ref: c, ...l }) => {
53
- let u = v({
55
+ }), b = ({ children: e, className: t, storageNamespace: n, brandTheme: i, toneFamilies: a, density: o, theme: s, style: c, ref: l, ...u }) => {
56
+ let d = v({
54
57
  storageNamespace: n,
55
58
  brandTheme: i,
56
59
  toneFamilies: a,
57
60
  density: o,
58
- style: s,
59
- ref: c
61
+ theme: s,
62
+ style: c,
63
+ ref: l
60
64
  });
61
65
  return /* @__PURE__ */ g(y, {
62
- wiring: u,
66
+ wiring: d,
63
67
  children: /* @__PURE__ */ g("div", {
64
- ...u.dir ? { dir: u.dir } : {},
65
- ...l,
68
+ ...d.dir ? { dir: d.dir } : {},
69
+ ...u,
66
70
  className: r("kapi", "kapi--embed", t),
67
- ...u.attrs,
71
+ ...d.attrs,
68
72
  children: e
69
73
  })
70
74
  });
@@ -1,5 +1,6 @@
1
1
  import { type HTMLAttributes, type ReactNode, type Ref } from "react";
2
2
  import type { KapiDensity } from "../../hooks/densityLogic.js";
3
+ import type { KapiTheme } from "../../hooks/useKapiTheme.js";
3
4
  import type { KapiBrandTheme } from "../../hooks/themeColorsLogic.js";
4
5
  import type { KapiToneFamilies } from "../../hooks/toneFamilyLogic.js";
5
6
  import { type KapiMenuItem } from "../overlays/KapiContextMenu.js";
@@ -71,6 +72,13 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
71
72
  * de la persona: no se guarda. No reemplaza a `size` (que elige un tamaño de UN control).
72
73
  */
73
74
  density?: KapiDensity | undefined;
75
+ /**
76
+ * Tema que impone la APP: `"light"` o `"dark"`. Gana sobre lo guardado y sobre el sistema.
77
+ *
78
+ * Para una app host que ya tiene su propio modo oscuro: sin esto la raíz decide sola y las dos
79
+ * quedan desincronizadas. No se guarda, igual que `density`. Ver `KapiRootProps.theme`.
80
+ */
81
+ theme?: KapiTheme | undefined;
74
82
  };
75
83
  /**
76
84
  * Marco de la app. Es la raíz `.kapi` (tokens, tema, fuente, raíz de portales) y compone:
@@ -98,4 +106,4 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
98
106
  * // sin rail (otra navegación, p. ej. tabs arriba o router propio)
99
107
  * <KapiShell><MiTopNav /><Pagina /></KapiShell>
100
108
  */
101
- export declare const KapiShell: ({ rail, panel, panelRight, children, contextMenuItems, rightClick, overlays, className, classNames, contentClassName, storageNamespace, brandTheme, toneFamilies, density, style, ref, ...rest }: KapiShellProps) => import("react").JSX.Element;
109
+ export declare const KapiShell: ({ rail, panel, panelRight, children, contextMenuItems, rightClick, overlays, className, classNames, contentClassName, storageNamespace, brandTheme, toneFamilies, density, theme, style, ref, ...rest }: KapiShellProps) => import("react").JSX.Element;
@@ -11,53 +11,54 @@ import { useCallback as s, useMemo as c, useState as l } from "react";
11
11
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
12
12
  import { ChevronsLeft as f, ChevronsRight as p } from "lucide-react";
13
13
  //#region src/components/layout/KapiShell.tsx
14
- var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, rightClick: y = !0, overlays: b, className: x, classNames: S, contentClassName: C = "", storageNamespace: w, brandTheme: T, toneFamilies: E, density: D, style: O, ref: k, ...A }) => {
15
- let j = a({
14
+ var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, rightClick: y = !0, overlays: b, className: x, classNames: S, contentClassName: C = "", storageNamespace: w, brandTheme: T, toneFamilies: E, density: D, theme: O, style: k, ref: A, ...j }) => {
15
+ let M = a({
16
16
  storageNamespace: w,
17
17
  brandTheme: T,
18
18
  toneFamilies: E,
19
19
  density: D,
20
- style: O,
21
- ref: k
22
- }), [M, N] = l(null);
20
+ theme: O,
21
+ style: k,
22
+ ref: A
23
+ }), [N, P] = l(null);
23
24
  n({
24
25
  enabled: y,
25
- onMenu: v?.length ? (e, t) => N({
26
+ onMenu: v?.length ? (e, t) => P({
26
27
  x: e,
27
28
  y: t
28
29
  }) : void 0
29
30
  });
30
- let [P, F] = l(null), [I, L] = l(0), R = s(() => (L((e) => e + 1), () => L((e) => e - 1)), []), z = c(() => ({
31
- info: P,
32
- publish: F,
33
- hosts: I,
34
- addHost: R
31
+ let [F, I] = l(null), [L, R] = l(0), z = s(() => (R((e) => e + 1), () => R((e) => e - 1)), []), B = c(() => ({
32
+ info: F,
33
+ publish: I,
34
+ hosts: L,
35
+ addHost: z
35
36
  }), [
36
- P,
37
- I,
38
- R
37
+ F,
38
+ L,
39
+ z
39
40
  ]);
40
41
  return /* @__PURE__ */ u(i, {
41
- wiring: j,
42
+ wiring: M,
42
43
  children: /* @__PURE__ */ u(o.Provider, {
43
- value: z,
44
+ value: B,
44
45
  children: /* @__PURE__ */ d("div", {
45
- ...j.dir ? { dir: j.dir } : {},
46
- ...A,
46
+ ...M.dir ? { dir: M.dir } : {},
47
+ ...j,
47
48
  ...e(r, "root", S, x),
48
- ...j.attrs,
49
+ ...M.attrs,
49
50
  children: [
50
51
  m,
51
52
  h,
52
53
  /* @__PURE__ */ d("main", {
53
54
  ...e(r, "content", S, C),
54
55
  tabIndex: 0,
55
- children: [P && I === 0 && /* @__PURE__ */ u("button", {
56
+ children: [F && L === 0 && /* @__PURE__ */ u("button", {
56
57
  type: "button",
57
58
  ...e(r, "reopen", S, "kapi-paneltoggle"),
58
- onClick: P.expand,
59
- "aria-label": P.label,
60
- children: P.side === "right" ? /* @__PURE__ */ u(f, {
59
+ onClick: F.expand,
60
+ "aria-label": F.label,
61
+ children: F.side === "right" ? /* @__PURE__ */ u(f, {
61
62
  className: "kapi-flip-rtl",
62
63
  size: 16,
63
64
  strokeWidth: 2,
@@ -72,12 +73,12 @@ var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, r
72
73
  }),
73
74
  g,
74
75
  b,
75
- M && v && /* @__PURE__ */ u(t, {
76
+ N && v && /* @__PURE__ */ u(t, {
76
77
  open: !0,
77
- x: M.x,
78
- y: M.y,
78
+ x: N.x,
79
+ y: N.y,
79
80
  items: v,
80
- onClose: () => N(null)
81
+ onClose: () => P(null)
81
82
  })
82
83
  ]
83
84
  })
@@ -1,4 +1,6 @@
1
- export type KapiAccessCardTone = "primary" | "success" | "warning" | "danger" | "info";
1
+ import { type KapiFamilyTone } from "../tone.js";
2
+ /** The semantic colours of an access card, or a tone family the app registered. */
3
+ export type KapiAccessCardTone = "primary" | "success" | "warning" | "danger" | "info" | KapiFamilyTone;
2
4
  export type KapiAccessCardAffordance = "external" | "chevron";
3
5
  /** Which trailing icon to show: a cross-system/new-tab link gets the arrow, in-app navigation the chevron. */
4
6
  export declare const accessCardAffordance: (external: boolean | undefined) => KapiAccessCardAffordance;
@@ -10,6 +12,11 @@ export declare const linkAttrs: (opts: {
10
12
  target?: "_blank" | undefined;
11
13
  rel?: string | undefined;
12
14
  };
15
+ /**
16
+ * Classes of an access card. A tone family does NOT go by its name — `.kapi-accesscard--ucuBlue`
17
+ * exists in no stylesheet and the icon tile would lose its colour — it goes through the fixed
18
+ * `--family` class, which reads the local slots the component sets inline.
19
+ */
13
20
  export declare const accessCardClasses: (opts?: {
14
21
  tone?: KapiAccessCardTone | undefined;
15
22
  className?: string | undefined;