@kapiuara/ui 0.15.2 → 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.
Files changed (145) hide show
  1. package/LICENSE +19 -15
  2. package/README.md +338 -6
  3. package/dist/components/data/KapiDataTable.d.ts +1 -1
  4. package/dist/components/data/KapiDataTable.js +22 -22
  5. package/dist/components/data/KapiPaginationFooter.js +1 -1
  6. package/dist/components/data/KapiSheet.d.ts +105 -0
  7. package/dist/components/data/KapiSheet.js +75 -0
  8. package/dist/components/data/KapiTable.d.ts +2 -2
  9. package/dist/components/data/KapiTable.js +347 -329
  10. package/dist/components/data/KapiTableFooter.d.ts +22 -0
  11. package/dist/components/data/KapiTableFooter.js +55 -0
  12. package/dist/components/data/KapiTableRow.js +53 -52
  13. package/dist/components/data/KapiTableToolbar.d.ts +4 -2
  14. package/dist/components/data/KapiTableToolbar.js +71 -69
  15. package/dist/components/data/index.d.ts +3 -1
  16. package/dist/components/data/tableCells.d.ts +5 -4
  17. package/dist/components/data/tableCells.js +48 -43
  18. package/dist/components/data/tableLogic.d.ts +2 -0
  19. package/dist/components/data/tableLogic.js +66 -66
  20. package/dist/components/data/tableSlots.d.ts +9 -0
  21. package/dist/components/data/tableSlots.js +12 -0
  22. package/dist/components/data/tableSpanLogic.d.ts +35 -0
  23. package/dist/components/data/tableSpanLogic.js +47 -0
  24. package/dist/components/data/tableTypes.d.ts +66 -1
  25. package/dist/components/data/useTableSelection.d.ts +4 -2
  26. package/dist/components/data/useTableSelection.js +27 -23
  27. package/dist/components/display/KapiAnchor.d.ts +36 -0
  28. package/dist/components/display/KapiAnchor.js +36 -0
  29. package/dist/components/display/KapiBadge.d.ts +6 -5
  30. package/dist/components/display/KapiBadge.js +25 -19
  31. package/dist/components/display/KapiText.d.ts +43 -0
  32. package/dist/components/display/KapiText.js +33 -0
  33. package/dist/components/display/KapiTitle.d.ts +33 -0
  34. package/dist/components/display/KapiTitle.js +29 -0
  35. package/dist/components/display/index.d.ts +7 -0
  36. package/dist/components/display/textLogic.d.ts +32 -0
  37. package/dist/components/display/textLogic.js +19 -0
  38. package/dist/components/feedback/KapiAlert.d.ts +8 -4
  39. package/dist/components/feedback/KapiAlert.js +39 -34
  40. package/dist/components/inputs/KapiButton.d.ts +7 -4
  41. package/dist/components/inputs/KapiButton.js +47 -42
  42. package/dist/components/inputs/KapiSelect.d.ts +12 -0
  43. package/dist/components/inputs/KapiSelect.js +215 -212
  44. package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
  45. package/dist/components/inputs/KapiSelectMenu.js +131 -133
  46. package/dist/components/inputs/fieldLogic.d.ts +2 -2
  47. package/dist/components/inputs/index.d.ts +1 -1
  48. package/dist/components/inputs/selectSlots.d.ts +24 -0
  49. package/dist/components/inputs/selectSlots.js +27 -0
  50. package/dist/components/layout/KapiBox.d.ts +31 -0
  51. package/dist/components/layout/KapiBox.js +26 -0
  52. package/dist/components/layout/KapiCard.d.ts +16 -4
  53. package/dist/components/layout/KapiCard.js +46 -34
  54. package/dist/components/layout/KapiCenter.d.ts +13 -0
  55. package/dist/components/layout/KapiCenter.js +23 -0
  56. package/dist/components/layout/KapiCol.d.ts +22 -0
  57. package/dist/components/layout/KapiCol.js +23 -0
  58. package/dist/components/layout/KapiGrid.d.ts +29 -3
  59. package/dist/components/layout/KapiGrid.js +39 -17
  60. package/dist/components/layout/KapiPageHeader.d.ts +10 -1
  61. package/dist/components/layout/KapiPageHeader.js +82 -80
  62. package/dist/components/layout/KapiPanelParts.d.ts +11 -2
  63. package/dist/components/layout/KapiPanelParts.js +73 -56
  64. package/dist/components/layout/KapiRail.d.ts +10 -1
  65. package/dist/components/layout/KapiRail.js +123 -120
  66. package/dist/components/layout/KapiRoot.d.ts +35 -5
  67. package/dist/components/layout/KapiRoot.js +54 -39
  68. package/dist/components/layout/KapiShell.d.ts +36 -3
  69. package/dist/components/layout/KapiShell.js +53 -50
  70. package/dist/components/layout/cardSlots.d.ts +9 -0
  71. package/dist/components/layout/cardSlots.js +12 -0
  72. package/dist/components/layout/gridSpanLogic.d.ts +46 -0
  73. package/dist/components/layout/gridSpanLogic.js +39 -0
  74. package/dist/components/layout/index.d.ts +11 -4
  75. package/dist/components/layout/layoutPrimitives.d.ts +11 -0
  76. package/dist/components/layout/layoutPrimitives.js +12 -1
  77. package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
  78. package/dist/components/layout/pageHeaderSlots.js +15 -0
  79. package/dist/components/layout/railLogic.d.ts +16 -3
  80. package/dist/components/layout/railSlots.d.ts +12 -0
  81. package/dist/components/layout/railSlots.js +15 -0
  82. package/dist/components/layout/shellSlots.d.ts +6 -0
  83. package/dist/components/layout/shellSlots.js +9 -0
  84. package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
  85. package/dist/components/layout/useGridBreakpoint.js +35 -0
  86. package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
  87. package/dist/components/navigation/KapiBreadcrumb.js +23 -16
  88. package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
  89. package/dist/components/navigation/KapiContextPanel.js +151 -135
  90. package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
  91. package/dist/components/navigation/KapiPanelGroup.js +66 -65
  92. package/dist/components/navigation/KapiTabs.d.ts +12 -0
  93. package/dist/components/navigation/KapiTabs.js +87 -71
  94. package/dist/components/navigation/MiniNavItem.d.ts +7 -2
  95. package/dist/components/navigation/MiniNavItem.js +41 -36
  96. package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
  97. package/dist/components/navigation/breadcrumbLogic.js +1 -1
  98. package/dist/components/navigation/navLink.d.ts +21 -0
  99. package/dist/components/navigation/navLink.js +26 -0
  100. package/dist/components/navigation/navLinkLogic.d.ts +18 -0
  101. package/dist/components/navigation/navLinkLogic.js +22 -0
  102. package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
  103. package/dist/components/overlays/KapiModal.d.ts +9 -0
  104. package/dist/components/overlays/KapiModal.js +77 -75
  105. package/dist/components/overlays/index.d.ts +1 -1
  106. package/dist/components/overlays/menuList.js +123 -113
  107. package/dist/components/overlays/modalSlots.d.ts +11 -0
  108. package/dist/components/overlays/modalSlots.js +14 -0
  109. package/dist/components/slotCatalog.d.ts +90 -0
  110. package/dist/components/slotCatalog.js +19 -0
  111. package/dist/components/slotsLogic.d.ts +34 -0
  112. package/dist/components/slotsLogic.js +18 -0
  113. package/dist/components/tone.d.ts +26 -0
  114. package/dist/components/tone.js +15 -14
  115. package/dist/css/base.css +1 -1
  116. package/dist/css/components/data/KapiEventCalendar.css +1 -1
  117. package/dist/css/components/data/KapiTable.css +1 -1
  118. package/dist/css/components/display/display.css +1 -1
  119. package/dist/css/components/display/typography.css +1 -0
  120. package/dist/css/components/feedback/feedback.css +1 -1
  121. package/dist/css/components/inputs/KapiButton.css +1 -1
  122. package/dist/css/components/inputs/KapiDatePicker.css +1 -1
  123. package/dist/css/components/layout/KapiBox.css +1 -0
  124. package/dist/css/components/layout/KapiRail.css +1 -1
  125. package/dist/css/components/layout/gridSpan.css +1 -0
  126. package/dist/css/components/navigation/navigation.css +1 -1
  127. package/dist/hooks/densityLogic.d.ts +15 -0
  128. package/dist/hooks/densityLogic.js +4 -0
  129. package/dist/hooks/index.d.ts +4 -0
  130. package/dist/hooks/themeColorsLogic.d.ts +19 -0
  131. package/dist/hooks/themeColorsLogic.js +4 -2
  132. package/dist/hooks/themeDeriveLogic.d.ts +16 -0
  133. package/dist/hooks/themeDeriveLogic.js +27 -17
  134. package/dist/hooks/toneFamilyLogic.d.ts +122 -0
  135. package/dist/hooks/toneFamilyLogic.js +151 -0
  136. package/dist/hooks/useKapiTheme.d.ts +8 -2
  137. package/dist/hooks/useKapiTheme.js +116 -103
  138. package/dist/hooks/useToneFamilies.d.ts +30 -0
  139. package/dist/hooks/useToneFamilies.js +46 -0
  140. package/dist/index.d.ts +3 -1
  141. package/dist/index.js +213 -204
  142. package/dist/kapi.css +1 -1
  143. package/dist/kapi.layered.css +1 -1
  144. package/dist/styles/rawHeights.d.ts +8 -0
  145. package/package.json +4 -4
@@ -3,171 +3,174 @@ import "#kapi-css/components/layout/KapiRail.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
4
  import { assignRef as t } from "../inputs/fieldLogic.js";
5
5
  import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
- import { useSlidingIndicator as r } from "../../hooks/useSlidingIndicator.js";
7
- import { KapiTooltip as i } from "../overlays/KapiTooltip.js";
8
- import { DEFAULT_LINK_LABELS as a } from "../locale/linkLabels.js";
9
- import { KapiMenuButton as o } from "../overlays/KapiMenuButton.js";
10
- import { navBadgeA11yText as s } from "../navigation/navBadgeLogic.js";
11
- import { KapiNavBadge as c } from "../navigation/KapiNavBadge.js";
12
- import { useScrollEdges as l } from "../../hooks/useScrollEdges.js";
13
- import { SHELL_MOBILE_QUERY as u, useMediaQuery as d } from "../../hooks/useMediaQuery.js";
14
- import { useBottomBarInset as f } from "../../hooks/useBottomBarInset.js";
15
- import { isRailSeparator as p, railClasses as m, railItemClasses as h, railOverflowState as g, railShowsTooltip as _, splitRailEntries as v, splitRailOverflow as y } from "./railLogic.js";
16
- import { useRailOverflow as b } from "./useRailOverflow.js";
17
- import { RailVariantContext as x } from "./railContext.js";
6
+ import { slot as r } from "../slotsLogic.js";
7
+ import { useSlidingIndicator as i } from "../../hooks/useSlidingIndicator.js";
8
+ import { KapiTooltip as a } from "../overlays/KapiTooltip.js";
9
+ import { DEFAULT_LINK_LABELS as o } from "../locale/linkLabels.js";
10
+ import { KapiMenuButton as s } from "../overlays/KapiMenuButton.js";
11
+ import { navBadgeA11yText as c } from "../navigation/navBadgeLogic.js";
12
+ import { KapiNavBadge as l } from "../navigation/KapiNavBadge.js";
13
+ import { useScrollEdges as u } from "../../hooks/useScrollEdges.js";
14
+ import { renderNavLink as ee } from "../navigation/navLink.js";
15
+ import { SHELL_MOBILE_QUERY as d, useMediaQuery as f } from "../../hooks/useMediaQuery.js";
16
+ import { useBottomBarInset as p } from "../../hooks/useBottomBarInset.js";
17
+ import { isRailSeparator as m, railClasses as h, railItemClasses as g, railOverflowState as _, railShowsTooltip as v, splitRailEntries as y, splitRailOverflow as b } from "./railLogic.js";
18
+ import { useRailOverflow as x } from "./useRailOverflow.js";
19
+ import { RailVariantContext as S } from "./railContext.js";
18
20
  /* empty css */
19
- import { useCallback as S, useState as C } from "react";
20
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
21
- import { ExternalLink as ee, MoreHorizontal as te } from "lucide-react";
21
+ import { RAIL_SLOTS as C } from "./railSlots.js";
22
+ import { Fragment as te, useCallback as w, useState as T } from "react";
23
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
24
+ import { ExternalLink as ne, MoreHorizontal as re } from "lucide-react";
22
25
  //#region src/components/layout/KapiRail.tsx
23
- var D = {
26
+ var k = {
24
27
  navigation: "Navegación principal",
25
28
  more: "Más",
26
29
  moreCurrent: "sección actual",
27
30
  account: "Cuenta"
28
- }, O = ({ items: O, activeId: k, onSelect: A, brand: j, footer: M, variant: N = "labeled", "aria-label": P, labels: F, className: I, ref: L, ...R }) => {
29
- let z = n("rail", D, F), B = n("link", a, F), V = N === "compact", H = _(N), U = v(O), W = d(u), [G, ne] = C(null);
30
- f(G, W);
31
- let re = S((e) => {
32
- ne(e), t(L, e);
33
- }, [L]), { ref: K, edges: q } = l({ axis: "y" }), J = U.scroll, Y = J.filter((e) => !p(e)).length, ie = b(K, {
34
- enabled: W,
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);
33
+ p(W, U);
34
+ let ce = w((e) => {
35
+ G(e), t(z, e);
36
+ }, [z]), { ref: K, edges: q } = u({ axis: "y" }), J = H.scroll, Y = J.filter((e) => !m(e)).length, le = x(K, {
37
+ enabled: U,
35
38
  count: Y,
36
39
  separators: J.length - Y
37
- }), { shown: ae, hidden: X } = y(J, ie ?? Y), Z = g(X, k), { containerRef: Q, indicatorRef: oe } = r({
38
- active: k ?? null,
40
+ }), { shown: ue, hidden: X } = b(J, le ?? Y), Z = _(X, j), { containerRef: Q, indicatorRef: de } = i({
41
+ active: j ?? null,
39
42
  deps: [
40
- O,
41
- N,
43
+ A,
44
+ F,
42
45
  X.length
43
46
  ],
44
47
  findActive: (e) => e.querySelector(".kapi-rail__item[aria-current=\"page\"], .kapi-rail__more--on")
45
- }), se = S((e) => {
48
+ }), fe = w((e) => {
46
49
  Q.current = e, K.current = e;
47
- }, [Q, K]), ce = ({ id: e, label: t, icon: n, href: r, external: a, newTab: o, badge: l, badgeTone: u, badgeLabel: d }) => {
48
- let f = k === e, p = f ? "page" : void 0, m = s(l, d), g = m === null ? t : `${t} ${m}`, _ = V ? g : void 0, v = /* @__PURE__ */ T(c, {
49
- value: l,
50
- tone: u,
51
- label: d,
50
+ }, [Q, K]), pe = ({ id: e, label: t, icon: n, href: i, render: o, external: s, newTab: u, badge: d, badgeTone: f, badgeLabel: p }) => {
51
+ let m = j === e, h = m ? "page" : void 0, _ = c(d, p), v = _ === null ? t : `${t} ${_}`, y = V ? v : void 0, b = /* @__PURE__ */ D(l, {
52
+ value: d,
53
+ tone: f,
54
+ label: p,
52
55
  placement: "corner",
53
56
  announce: !V
54
- }), y = r === void 0 ? /* @__PURE__ */ E("button", {
55
- type: "button",
56
- className: h({ active: f }),
57
- onClick: () => A?.(e),
58
- "aria-current": p,
59
- "aria-label": _,
60
- children: [
61
- n,
62
- !V && /* @__PURE__ */ T("span", {
63
- className: "kapi-rail__label",
64
- children: t
65
- }),
66
- v
67
- ]
68
- }, H ? void 0 : e) : /* @__PURE__ */ E("a", {
69
- className: h({
70
- active: f,
71
- link: !0
57
+ }), x = /* @__PURE__ */ O(E, { children: [
58
+ n,
59
+ !V && /* @__PURE__ */ D("span", {
60
+ ...r(C, "label", R),
61
+ children: t
62
+ }),
63
+ b,
64
+ (i !== void 0 || o !== void 0) && s && /* @__PURE__ */ D(ne, {
65
+ className: "kapi-rail__ext",
66
+ size: 12,
67
+ "aria-hidden": "true"
72
68
  }),
73
- href: r,
74
- rel: "noopener noreferrer",
75
- target: o ? "_blank" : void 0,
76
- "aria-current": p,
77
- "aria-label": _,
78
- children: [
79
- n,
80
- !V && /* @__PURE__ */ T("span", {
81
- className: "kapi-rail__label",
82
- children: t
83
- }),
84
- v,
85
- a && /* @__PURE__ */ T(ee, {
86
- className: "kapi-rail__ext",
87
- size: 12,
88
- "aria-hidden": "true"
89
- }),
90
- o && /* @__PURE__ */ T("span", {
91
- className: "kapi-rail__sr",
92
- children: B.newTab
93
- })
94
- ]
95
- }, H ? void 0 : e);
96
- return H ? /* @__PURE__ */ T(i, {
97
- label: g,
98
- children: y
99
- }, e) : y;
100
- }, $ = (e) => e.map((e, t) => p(e) ? /* @__PURE__ */ T("div", {
101
- className: "kapi-rail__sep",
69
+ (i !== void 0 || o !== void 0) && u && /* @__PURE__ */ D("span", {
70
+ className: "kapi-rail__sr",
71
+ children: oe.newTab
72
+ })
73
+ ] }), S = r(C, "item", R, g({
74
+ active: m,
75
+ link: !0
76
+ })), w = i !== void 0 || o !== void 0 ? ee({
77
+ render: o,
78
+ href: i,
79
+ newTab: u,
80
+ active: m,
81
+ className: S.className ?? "",
82
+ extra: {
83
+ "aria-label": y,
84
+ "data-slot": S["data-slot"]
85
+ },
86
+ children: x
87
+ }) : /* @__PURE__ */ D("button", {
88
+ type: "button",
89
+ ...r(C, "item", R, g({ active: m })),
90
+ onClick: () => M?.(e),
91
+ "aria-current": h,
92
+ "aria-label": y,
93
+ children: x
94
+ });
95
+ return se ? /* @__PURE__ */ D(a, {
96
+ label: v,
97
+ children: w
98
+ }, e) : /* @__PURE__ */ D(te, { children: w }, e);
99
+ }, $ = (e) => e.map((e, t) => m(e) ? /* @__PURE__ */ D("div", {
100
+ ...r(C, "separator", R),
102
101
  role: "separator",
103
102
  "aria-orientation": "horizontal"
104
- }, e.id ?? `sep-${t}`) : ce(e)), le = X.map(({ id: e, label: t, href: n, newTab: r, badge: i, badgeLabel: a }) => {
105
- let o = s(i, a);
103
+ }, e.id ?? `sep-${t}`) : pe(e)), me = X.map(({ id: e, label: t, href: n, render: r, newTab: i, badge: a, badgeLabel: o }) => {
104
+ let s = c(a, o);
106
105
  return {
107
- label: o === null ? t : `${t} ${o}`,
108
- current: k === e,
106
+ label: s === null ? t : `${t} ${s}`,
107
+ current: j === e,
108
+ ...r === void 0 ? n === void 0 ? {} : {
109
+ href: n,
110
+ ...i ? { target: "_blank" } : {}
111
+ } : { render: r },
109
112
  onClick: () => {
110
- n === void 0 ? A?.(e) : r ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n);
113
+ n === void 0 && r === void 0 && M?.(e);
111
114
  }
112
115
  };
113
116
  });
114
- return /* @__PURE__ */ E("nav", {
115
- ...R,
116
- ref: re,
117
- className: e(m({ variant: N }), I),
118
- "aria-label": P ?? z.navigation,
117
+ return /* @__PURE__ */ O("nav", {
118
+ ...ae,
119
+ ref: ce,
120
+ ...r(C, "root", R, h({ variant: F }), L),
121
+ "aria-label": ie ?? B.navigation,
119
122
  children: [
120
- j !== void 0 && /* @__PURE__ */ T("div", {
121
- className: "kapi-rail__brand",
122
- children: j
123
+ N !== void 0 && /* @__PURE__ */ D("div", {
124
+ ...r(C, "brand", R),
125
+ children: N
123
126
  }),
124
- U.start.length > 0 && /* @__PURE__ */ T("div", {
125
- className: "kapi-rail__start",
126
- children: $(U.start)
127
+ H.start.length > 0 && /* @__PURE__ */ D("div", {
128
+ ...r(C, "start", R),
129
+ children: $(H.start)
127
130
  }),
128
- /* @__PURE__ */ E("div", {
129
- ref: se,
130
- className: e("kapi-rail__scroll", !W && "kapi-fade-y"),
131
- "data-edge-start": !W && q.start ? "" : void 0,
132
- "data-edge-end": !W && q.end ? "" : void 0,
131
+ /* @__PURE__ */ O("div", {
132
+ ref: fe,
133
+ ...r(C, "scroll", R, !U && "kapi-fade-y"),
134
+ "data-edge-start": !U && q.start ? "" : void 0,
135
+ "data-edge-end": !U && q.end ? "" : void 0,
133
136
  children: [
134
- /* @__PURE__ */ T("span", {
135
- ref: oe,
136
- className: "kapi-rail__indicator",
137
+ /* @__PURE__ */ D("span", {
138
+ ref: de,
139
+ ...r(C, "indicator", R),
137
140
  "aria-hidden": "true"
138
141
  }),
139
- $(ae),
140
- X.length > 0 && /* @__PURE__ */ T(o, {
142
+ $(ue),
143
+ X.length > 0 && /* @__PURE__ */ D(s, {
141
144
  className: e("kapi-rail__more", Z.current && "kapi-rail__more--on"),
142
145
  variant: "ghost",
143
146
  drop: "up",
144
- icon: /* @__PURE__ */ T(te, {
147
+ icon: /* @__PURE__ */ D(re, {
145
148
  size: 21,
146
149
  strokeWidth: 1.8
147
150
  }),
148
- ...V || Z.current ? { "aria-label": Z.current ? `${z.more} · ${z.moreCurrent}: ${Z.current.label}` : z.more } : {},
149
- label: /* @__PURE__ */ E(w, { children: [!V && /* @__PURE__ */ T("span", {
150
- className: "kapi-rail__label",
151
- children: z.more
152
- }), Z.notice && /* @__PURE__ */ T(c, {
151
+ ...V || Z.current ? { "aria-label": Z.current ? `${B.more} · ${B.moreCurrent}: ${Z.current.label}` : B.more } : {},
152
+ label: /* @__PURE__ */ O(E, { children: [!V && /* @__PURE__ */ D("span", {
153
+ ...r(C, "label", R),
154
+ children: B.more
155
+ }), Z.notice && /* @__PURE__ */ D(l, {
153
156
  value: "dot",
154
157
  tone: Z.notice.badgeTone,
155
158
  placement: "corner"
156
159
  })] }),
157
- items: le
160
+ items: me
158
161
  })
159
162
  ]
160
163
  }),
161
- U.end.length > 0 && /* @__PURE__ */ T("div", {
162
- className: "kapi-rail__end",
163
- children: $(U.end)
164
+ H.end.length > 0 && /* @__PURE__ */ D("div", {
165
+ ...r(C, "end", R),
166
+ children: $(H.end)
164
167
  }),
165
- M !== void 0 && /* @__PURE__ */ T(x.Provider, {
166
- value: N,
167
- children: M
168
+ P !== void 0 && /* @__PURE__ */ D(S.Provider, {
169
+ value: F,
170
+ children: P
168
171
  })
169
172
  ]
170
173
  });
171
174
  };
172
175
  //#endregion
173
- export { D as DEFAULT_RAIL_LABELS, O as KapiRail };
176
+ export { k as DEFAULT_RAIL_LABELS, A as KapiRail };
@@ -1,13 +1,19 @@
1
1
  import { type CSSProperties, type HTMLAttributes, type ReactNode, type Ref } from "react";
2
2
  import { type KapiThemeState } from "../../hooks/useKapiTheme.js";
3
+ import type { KapiDensity } from "../../hooks/densityLogic.js";
3
4
  import type { KapiDir } from "../../hooks/directionLogic.js";
4
- import type { KapiThemeColors } from "../../hooks/themeDeriveLogic.js";
5
+ import type { KapiBrandTheme } from "../../hooks/themeColorsLogic.js";
6
+ import type { KapiToneFamilies } from "../../hooks/toneFamilyLogic.js";
5
7
  /** Opciones de `useKapiRootWiring`: lo que una raíz `.kapi` recibe por props. Interno. */
6
8
  export type KapiRootWiringOptions = {
7
9
  /** Namespace de las preferencias guardadas. */
8
10
  storageNamespace?: string | undefined;
9
11
  /** Tema de marca (base de los colores). */
10
- brandTheme?: KapiThemeColors | undefined;
12
+ brandTheme?: KapiBrandTheme | undefined;
13
+ /** Familias de tono de la app (ver `KapiRootProps.toneFamilies`). */
14
+ toneFamilies?: KapiToneFamilies | undefined;
15
+ /** Densidad de la interfaz (ver `KapiRootProps.density`). */
16
+ density?: KapiDensity | undefined;
11
17
  /** `style` del consumidor; las variables del tema van encima. */
12
18
  style?: CSSProperties | undefined;
13
19
  /** `ref` del consumidor al `<div>` raíz. */
@@ -17,6 +23,8 @@ export type KapiRootWiringOptions = {
17
23
  export type KapiRootWiring = {
18
24
  /** Estado del tema de esta raíz (va al `KapiThemeContext`). */
19
25
  themeState: KapiThemeState;
26
+ /** Nombres de las familias de tono registradas (las de esta raíz y las heredadas). */
27
+ toneNames: ReadonlySet<string>;
20
28
  /** `dir` del `KapiLocaleProvider`; se escribe ANTES del passthrough, así un `dir` propio gana. */
21
29
  dir: KapiDir | undefined;
22
30
  /** Atributos propios de la raíz; van DESPUÉS del passthrough (no se pisan). */
@@ -24,6 +32,7 @@ export type KapiRootWiring = {
24
32
  ref: Ref<HTMLDivElement>;
25
33
  "data-theme": KapiThemeState["theme"];
26
34
  "data-motion": "reduced" | undefined;
35
+ "data-density": "compact" | "comfortable" | undefined;
27
36
  style: CSSProperties;
28
37
  suppressHydrationWarning: true;
29
38
  };
@@ -37,7 +46,7 @@ export type KapiRootWiring = {
37
46
  * `style`), `dir` y raíz de portales. Interno: lo comparten `KapiShell` y `KapiRoot`, que sólo
38
47
  * difieren en lo que dibujan adentro.
39
48
  */
40
- export declare const useKapiRootWiring: ({ storageNamespace, brandTheme, style, ref }: KapiRootWiringOptions) => KapiRootWiring;
49
+ export declare const useKapiRootWiring: ({ storageNamespace, brandTheme, toneFamilies, density, style, ref }: KapiRootWiringOptions) => KapiRootWiring;
41
50
  /**
42
51
  * Contextos que una raíz `.kapi` da a su subárbol: el tema y la raíz de portales. Los overlays sin
43
52
  * ancla (modal, offcanvas, paleta de comandos, toasts…) se montan en ESTA raíz y no en el primer
@@ -65,8 +74,29 @@ export type KapiRootProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
65
74
  /**
66
75
  * Tema de marca: los colores de la identidad del producto (`primary`, `bg`, `ink`…). Es la base;
67
76
  * el acento y lo que la persona personalizó se aplican encima, color por color.
77
+ * Plano (`{ primary, bg… }`) vale para los dos esquemas; `{ light, dark }` afina cada uno por
78
+ * separado (un esquema que falta no hereda del otro).
68
79
  */
69
- brandTheme?: KapiThemeColors | undefined;
80
+ brandTheme?: KapiBrandTheme | undefined;
81
+ /**
82
+ * Familias de tono propias de la app: colores semánticos nuevos (`ucuBlue`, `ember`…) que valen
83
+ * donde un componente acepta `tone`. Cada una es `{ color }` (el esquema claro; el oscuro se
84
+ * adapta solo hasta ser legible) o `{ light, dark }`; de `color` salen el tinte, el borde y la
85
+ * tinta, o se fijan a mano. Para que `tone="ucuBlue"` compile hay que declararla en
86
+ * `KapiCustomTones` (ver el README). Declararla fuera del componente o con `useMemo`: un objeto
87
+ * nuevo por render recalcula el tema. Los contrastes se miden con `checkToneFamilyContrast`.
88
+ */
89
+ toneFamilies?: KapiToneFamilies | undefined;
90
+ /**
91
+ * Densidad de la interfaz: qué tan apretados o holgados son los controles. `compact` es para
92
+ * pantallas administrativas con mucha información, `comfortable` para portales públicos y uso
93
+ * táctil; `default` (lo de siempre) no cambia nada. Mueve los tres tamaños de control
94
+ * (`--kapi-ctl-h-sm`, `--kapi-ctl-h` y `--kapi-ctl-h-lg`) escribiendo `data-density` en la raíz,
95
+ * sin estilos inline, así que el CSS de la app sigue ganando. Con puntero táctil los controles
96
+ * no bajan de `--kapi-tap` (44px) en ninguna densidad. Es un ajuste de la app, no una preferencia
97
+ * de la persona: no se guarda. No reemplaza a `size` (que elige un tamaño de UN control).
98
+ */
99
+ density?: KapiDensity | undefined;
70
100
  };
71
101
  /**
72
102
  * Raíz mínima para embeber componentes en una página que ya existe (una isla en un sitio hecho con
@@ -82,4 +112,4 @@ export type KapiRootProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
82
112
  * <KapiButton onClick={…}>Inscribirme</KapiButton>
83
113
  * </KapiRoot>
84
114
  */
85
- export declare const KapiRoot: ({ children, className, storageNamespace, brandTheme, style, ref, ...rest }: KapiRootProps) => import("react").JSX.Element;
115
+ export declare const KapiRoot: ({ children, className, storageNamespace, brandTheme, toneFamilies, density, style, ref, ...rest }: KapiRootProps) => import("react").JSX.Element;
@@ -1,58 +1,73 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/layout/KapiRoot.css";
3
- import { joinClasses as e } from "../rootProps.js";
4
- import { useKapiDir as t } from "../locale/KapiLocaleProvider.js";
5
- import { KapiPortalRootProvider as n, usePortalRootOverride as r } from "../../hooks/portalRoot.js";
6
- import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
7
- import { KapiThemeContext as a, themeRootStyle as o, useKapiThemeState as s } from "../../hooks/useKapiTheme.js";
3
+ import { ToneFamilyNamesContext as e, useToneFamilyProblemWarning as t, useToneFamilyRegistry as n } from "../../hooks/useToneFamilies.js";
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";
8
+ import { KapiThemeContext as c, themeRootStyle as l, useKapiThemeState as u } from "../../hooks/useKapiTheme.js";
9
+ import { densityAttribute as d } from "../../hooks/densityLogic.js";
8
10
  /* empty css */
9
- import { createContext as c, useContext as l, useMemo as u, useState as d } from "react";
10
- import { jsx as f } from "react/jsx-runtime";
11
+ import { createContext as f, useContext as p, useMemo as m, useState as h } from "react";
12
+ import { jsx as g } from "react/jsx-runtime";
11
13
  //#region src/components/layout/KapiRoot.tsx
12
- var p = c(null), m = ({ storageNamespace: e, brandTheme: n, style: a, ref: c }) => {
13
- let f = s({ namespace: e }), m = t(), h = u(() => o(f, n), [f, n]), [g, _] = d(null), v = i(_, c), y = r(), b = l(p), x = y && y !== b ? y : g;
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,
17
+ 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;
14
22
  return {
15
- themeState: f,
16
- dir: m,
23
+ themeState: v,
24
+ toneNames: x,
25
+ dir: y,
17
26
  attrs: {
18
- ref: v,
19
- "data-theme": f.theme,
20
- "data-motion": f.motion === "reduced" ? "reduced" : void 0,
27
+ ref: T,
28
+ "data-theme": v.theme,
29
+ "data-motion": v.motion === "reduced" ? "reduced" : void 0,
30
+ "data-density": d(c),
21
31
  style: {
22
- ...a,
23
- ...h
32
+ ...f,
33
+ ...b
24
34
  },
25
35
  suppressHydrationWarning: !0
26
36
  },
27
- element: g,
28
- portalRoot: x
37
+ element: C,
38
+ portalRoot: O
29
39
  };
30
- }, h = ({ wiring: e, children: t }) => /* @__PURE__ */ f(a.Provider, {
31
- value: e.themeState,
32
- children: /* @__PURE__ */ f(p.Provider, {
33
- value: e.element,
34
- children: /* @__PURE__ */ f(n, {
35
- root: e.portalRoot,
36
- children: t
40
+ }, y = ({ wiring: t, children: n }) => /* @__PURE__ */ g(c.Provider, {
41
+ value: t.themeState,
42
+ children: /* @__PURE__ */ g(e.Provider, {
43
+ value: t.toneNames,
44
+ children: /* @__PURE__ */ g(_.Provider, {
45
+ value: t.element,
46
+ children: /* @__PURE__ */ g(a, {
47
+ root: t.portalRoot,
48
+ children: n
49
+ })
37
50
  })
38
51
  })
39
- }), g = ({ children: t, className: n, storageNamespace: r, brandTheme: i, style: a, ref: o, ...s }) => {
40
- let c = m({
41
- storageNamespace: r,
52
+ }), b = ({ children: e, className: t, storageNamespace: n, brandTheme: i, toneFamilies: a, density: o, style: s, ref: c, ...l }) => {
53
+ let u = v({
54
+ storageNamespace: n,
42
55
  brandTheme: i,
43
- style: a,
44
- ref: o
56
+ toneFamilies: a,
57
+ density: o,
58
+ style: s,
59
+ ref: c
45
60
  });
46
- return /* @__PURE__ */ f(h, {
47
- wiring: c,
48
- children: /* @__PURE__ */ f("div", {
49
- ...c.dir ? { dir: c.dir } : {},
50
- ...s,
51
- className: e("kapi", "kapi--embed", n),
52
- ...c.attrs,
53
- children: t
61
+ return /* @__PURE__ */ g(y, {
62
+ wiring: u,
63
+ children: /* @__PURE__ */ g("div", {
64
+ ...u.dir ? { dir: u.dir } : {},
65
+ ...l,
66
+ className: r("kapi", "kapi--embed", t),
67
+ ...u.attrs,
68
+ children: e
54
69
  })
55
70
  });
56
71
  };
57
72
  //#endregion
58
- export { g as KapiRoot, h as KapiRootScope, m as useKapiRootWiring };
73
+ export { b as KapiRoot, y as KapiRootScope, v as useKapiRootWiring };
@@ -1,10 +1,15 @@
1
1
  import { type HTMLAttributes, type ReactNode, type Ref } from "react";
2
- import type { KapiThemeColors } from "../../hooks/themeDeriveLogic.js";
2
+ import type { KapiDensity } from "../../hooks/densityLogic.js";
3
+ import type { KapiBrandTheme } from "../../hooks/themeColorsLogic.js";
4
+ import type { KapiToneFamilies } from "../../hooks/toneFamilyLogic.js";
3
5
  import { type KapiMenuItem } from "../overlays/KapiContextMenu.js";
6
+ import type { KapiClassNames } from "../slotCatalog.js";
4
7
  /**
5
8
  * Atributos nativos (`id`, `style`, `data-*`…) van a la raíz `.kapi`. `data-theme`/`data-motion`
6
9
  * son propios y las variables del tema (`--kapi-font`, `--kapi-primary`…) ganan sobre `style`.
7
10
  */
11
+ /** Partes de `KapiShell` que acepta `classNames`: `root`, `content` (el `<main>`) y `reopen`. */
12
+ export type KapiShellClassNames = KapiClassNames<"shell">;
8
13
  export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
9
14
  /** Ref al `<div>` raíz del shell. */
10
15
  ref?: Ref<HTMLDivElement> | undefined;
@@ -27,6 +32,13 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
27
32
  overlays?: ReactNode;
28
33
  /** Clase extra del `<main>` que envuelve el contenido. */
29
34
  contentClassName?: string | undefined;
35
+ /**
36
+ * Clases por parte: `classNames={{ content: "mi-contenido" }}`. Se suman a las propias. `root` es el
37
+ * marco (lo mismo que `className`) y `content` el `<main>` (lo mismo que `contentClassName`, que se
38
+ * mantiene). Cada parte además lleva `data-slot="shell-<parte>"`. El rail, el panel y la cabecera son
39
+ * componentes aparte, con sus propias partes.
40
+ */
41
+ classNames?: KapiShellClassNames | undefined;
30
42
  /**
31
43
  * Namespace de las preferencias guardadas (tema, acento, fuente, movimiento). Default `kapi`
32
44
  * (`kapi:theme`…). Dos apps del design system en el mismo origen pasan uno distinto para no pisarse.
@@ -36,8 +48,29 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
36
48
  * Tema de marca: los colores de la identidad del producto (`primary`, `bg`, `ink`…). Es la base;
37
49
  * el acento y lo que la persona personalizó se aplican encima, color por color. Se deriva sobre
38
50
  * el tema claro u oscuro que se ve.
51
+ * Plano (`{ primary, bg… }`) vale para los dos esquemas; `{ light, dark }` afina cada uno por
52
+ * separado (un esquema que falta no hereda del otro).
53
+ */
54
+ brandTheme?: KapiBrandTheme | undefined;
55
+ /**
56
+ * Familias de tono propias de la app: colores semánticos nuevos (`ucuBlue`, `ember`…) que valen
57
+ * donde un componente acepta `tone`. Cada una es `{ color }` (el esquema claro; el oscuro se
58
+ * adapta solo hasta ser legible) o `{ light, dark }`; de `color` salen el tinte, el borde y la
59
+ * tinta, o se fijan a mano. Para que `tone="ucuBlue"` compile hay que declararla en
60
+ * `KapiCustomTones` (ver el README). Declararla fuera del componente o con `useMemo`: un objeto
61
+ * nuevo por render recalcula el tema. Los contrastes se miden con `checkToneFamilyContrast`.
62
+ */
63
+ toneFamilies?: KapiToneFamilies | undefined;
64
+ /**
65
+ * Densidad de la interfaz: qué tan apretados o holgados son los controles. `compact` es para
66
+ * pantallas administrativas con mucha información, `comfortable` para portales públicos y uso
67
+ * táctil; `default` (lo de siempre) no cambia nada. Mueve los tres tamaños de control
68
+ * (`--kapi-ctl-h-sm`, `--kapi-ctl-h` y `--kapi-ctl-h-lg`) escribiendo `data-density` en la raíz,
69
+ * sin estilos inline, así que el CSS de la app sigue ganando. Con puntero táctil los controles
70
+ * no bajan de `--kapi-tap` (44px) en ninguna densidad. Es un ajuste de la app, no una preferencia
71
+ * de la persona: no se guarda. No reemplaza a `size` (que elige un tamaño de UN control).
39
72
  */
40
- brandTheme?: KapiThemeColors | undefined;
73
+ density?: KapiDensity | undefined;
41
74
  };
42
75
  /**
43
76
  * Marco de la app. Es la raíz `.kapi` (tokens, tema, fuente, raíz de portales) y compone:
@@ -65,4 +98,4 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
65
98
  * // sin rail (otra navegación, p. ej. tabs arriba o router propio)
66
99
  * <KapiShell><MiTopNav /><Pagina /></KapiShell>
67
100
  */
68
- export declare const KapiShell: ({ rail, panel, panelRight, children, contextMenuItems, rightClick, overlays, className, contentClassName, storageNamespace, brandTheme, style, ref, ...rest }: KapiShellProps) => import("react").JSX.Element;
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;