@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.
Files changed (288) hide show
  1. package/LICENSE +19 -15
  2. package/README.md +505 -13
  3. package/dist/components/chat/KapiChatThread.js +4 -4
  4. package/dist/components/chat/KapiComposer.js +8 -8
  5. package/dist/components/data/KapiDataTable.d.ts +1 -1
  6. package/dist/components/data/KapiDataTable.js +25 -25
  7. package/dist/components/data/KapiPaginationFooter.js +1 -1
  8. package/dist/components/data/KapiSheet.d.ts +105 -0
  9. package/dist/components/data/KapiSheet.js +75 -0
  10. package/dist/components/data/KapiSparkline.d.ts +2 -1
  11. package/dist/components/data/KapiSparkline.js +29 -26
  12. package/dist/components/data/KapiTable.d.ts +2 -2
  13. package/dist/components/data/KapiTable.js +347 -329
  14. package/dist/components/data/KapiTableFilter.js +6 -6
  15. package/dist/components/data/KapiTableFooter.d.ts +22 -0
  16. package/dist/components/data/KapiTableFooter.js +55 -0
  17. package/dist/components/data/KapiTableRow.js +53 -52
  18. package/dist/components/data/KapiTableToolbar.d.ts +4 -2
  19. package/dist/components/data/KapiTableToolbar.js +71 -69
  20. package/dist/components/data/index.d.ts +3 -1
  21. package/dist/components/data/tableCells.d.ts +17 -5
  22. package/dist/components/data/tableCells.js +52 -53
  23. package/dist/components/data/tableLogic.d.ts +2 -0
  24. package/dist/components/data/tableLogic.js +66 -66
  25. package/dist/components/data/tableSlots.d.ts +9 -0
  26. package/dist/components/data/tableSlots.js +12 -0
  27. package/dist/components/data/tableSpanLogic.d.ts +35 -0
  28. package/dist/components/data/tableSpanLogic.js +47 -0
  29. package/dist/components/data/tableTypes.d.ts +54 -1
  30. package/dist/components/data/useTableSelection.d.ts +4 -2
  31. package/dist/components/data/useTableSelection.js +29 -25
  32. package/dist/components/display/KapiAnchor.d.ts +36 -0
  33. package/dist/components/display/KapiAnchor.js +36 -0
  34. package/dist/components/display/KapiAnnotation.js +68 -63
  35. package/dist/components/display/KapiAvatar.d.ts +6 -4
  36. package/dist/components/display/KapiAvatar.js +33 -28
  37. package/dist/components/display/KapiBadge.d.ts +6 -5
  38. package/dist/components/display/KapiBadge.js +25 -19
  39. package/dist/components/display/KapiCodeBlock.d.ts +48 -0
  40. package/dist/components/display/KapiCodeBlock.js +44 -0
  41. package/dist/components/display/KapiCommentComposer.js +6 -6
  42. package/dist/components/display/KapiDiff.d.ts +62 -0
  43. package/dist/components/display/KapiDiff.js +118 -0
  44. package/dist/components/display/KapiHighlight.d.ts +27 -0
  45. package/dist/components/display/KapiHighlight.js +21 -0
  46. package/dist/components/display/KapiIconTile.d.ts +2 -1
  47. package/dist/components/display/KapiIconTile.js +23 -21
  48. package/dist/components/display/KapiStat.d.ts +3 -2
  49. package/dist/components/display/KapiStat.js +32 -26
  50. package/dist/components/display/KapiTag.d.ts +4 -3
  51. package/dist/components/display/KapiTag.js +29 -24
  52. package/dist/components/display/KapiText.d.ts +43 -0
  53. package/dist/components/display/KapiText.js +33 -0
  54. package/dist/components/display/KapiTimeline.d.ts +5 -2
  55. package/dist/components/display/KapiTimeline.js +31 -23
  56. package/dist/components/display/KapiTitle.d.ts +33 -0
  57. package/dist/components/display/KapiTitle.js +29 -0
  58. package/dist/components/display/annotationLogic.d.ts +2 -1
  59. package/dist/components/display/annotationLogic.js +7 -6
  60. package/dist/components/display/codeBlockSlots.d.ts +10 -0
  61. package/dist/components/display/codeBlockSlots.js +13 -0
  62. package/dist/components/display/diffLogic.d.ts +58 -0
  63. package/dist/components/display/diffLogic.js +96 -0
  64. package/dist/components/display/diffSlots.d.ts +14 -0
  65. package/dist/components/display/diffSlots.js +17 -0
  66. package/dist/components/display/highlightLogic.d.ts +18 -0
  67. package/dist/components/display/highlightLogic.js +26 -0
  68. package/dist/components/display/highlightSlots.d.ts +5 -0
  69. package/dist/components/display/highlightSlots.js +8 -0
  70. package/dist/components/display/iconTileLogic.d.ts +2 -2
  71. package/dist/components/display/iconTileLogic.js +7 -6
  72. package/dist/components/display/index.d.ts +15 -0
  73. package/dist/components/display/statLogic.d.ts +2 -1
  74. package/dist/components/display/statLogic.js +7 -6
  75. package/dist/components/display/tagLogic.d.ts +2 -1
  76. package/dist/components/display/tagLogic.js +7 -6
  77. package/dist/components/display/textLogic.d.ts +32 -0
  78. package/dist/components/display/textLogic.js +19 -0
  79. package/dist/components/display/timelineLogic.d.ts +20 -2
  80. package/dist/components/display/timelineLogic.js +10 -2
  81. package/dist/components/feedback/KapiAlert.d.ts +8 -4
  82. package/dist/components/feedback/KapiAlert.js +39 -34
  83. package/dist/components/feedback/KapiFab.js +108 -108
  84. package/dist/components/feedback/KapiProgress.js +63 -54
  85. package/dist/components/feedback/KapiToastContainer.js +9 -9
  86. package/dist/components/feedback/KapiTour.js +12 -12
  87. package/dist/components/feedback/progressLogic.d.ts +2 -1
  88. package/dist/components/feedback/progressLogic.js +9 -8
  89. package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
  90. package/dist/components/inputs/KapiAutocomplete.js +86 -85
  91. package/dist/components/inputs/KapiButton.d.ts +7 -4
  92. package/dist/components/inputs/KapiButton.js +47 -42
  93. package/dist/components/inputs/KapiChecklist.d.ts +7 -1
  94. package/dist/components/inputs/KapiChecklist.js +53 -52
  95. package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
  96. package/dist/components/inputs/KapiCopyButton.js +35 -0
  97. package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
  98. package/dist/components/inputs/KapiDatePicker.js +118 -116
  99. package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
  100. package/dist/components/inputs/KapiDateRangePicker.js +136 -135
  101. package/dist/components/inputs/KapiFacetedSearch.js +5 -5
  102. package/dist/components/inputs/KapiField.d.ts +9 -1
  103. package/dist/components/inputs/KapiField.js +43 -42
  104. package/dist/components/inputs/KapiFileUpload.js +6 -6
  105. package/dist/components/inputs/KapiInput.d.ts +29 -1
  106. package/dist/components/inputs/KapiInput.js +74 -51
  107. package/dist/components/inputs/KapiMaskedInput.js +26 -26
  108. package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
  109. package/dist/components/inputs/KapiNumberStepper.js +24 -23
  110. package/dist/components/inputs/KapiPinInput.d.ts +72 -0
  111. package/dist/components/inputs/KapiPinInput.js +75 -0
  112. package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
  113. package/dist/components/inputs/KapiPropsForm.js +78 -0
  114. package/dist/components/inputs/KapiRating.d.ts +7 -1
  115. package/dist/components/inputs/KapiRating.js +39 -38
  116. package/dist/components/inputs/KapiSearchChip.js +5 -5
  117. package/dist/components/inputs/KapiSegmented.d.ts +13 -5
  118. package/dist/components/inputs/KapiSegmented.js +81 -77
  119. package/dist/components/inputs/KapiSelect.d.ts +21 -1
  120. package/dist/components/inputs/KapiSelect.js +251 -245
  121. package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
  122. package/dist/components/inputs/KapiSelectMenu.js +131 -133
  123. package/dist/components/inputs/KapiSlider.d.ts +10 -3
  124. package/dist/components/inputs/KapiSlider.js +67 -63
  125. package/dist/components/inputs/KapiTagInput.d.ts +7 -1
  126. package/dist/components/inputs/KapiTagInput.js +70 -69
  127. package/dist/components/inputs/KapiTextarea.d.ts +7 -1
  128. package/dist/components/inputs/KapiTextarea.js +51 -50
  129. package/dist/components/inputs/copyLogic.d.ts +1 -0
  130. package/dist/components/inputs/copyLogic.js +12 -0
  131. package/dist/components/inputs/fieldLogic.d.ts +21 -1
  132. package/dist/components/inputs/fieldLogic.js +18 -11
  133. package/dist/components/inputs/index.d.ts +9 -1
  134. package/dist/components/inputs/inputLogic.d.ts +16 -1
  135. package/dist/components/inputs/inputLogic.js +3 -3
  136. package/dist/components/inputs/ownField.d.ts +3 -1
  137. package/dist/components/inputs/ownField.js +28 -27
  138. package/dist/components/inputs/pinInputLogic.d.ts +34 -0
  139. package/dist/components/inputs/pinInputLogic.js +37 -0
  140. package/dist/components/inputs/propsFormLogic.d.ts +53 -0
  141. package/dist/components/inputs/propsFormLogic.js +11 -0
  142. package/dist/components/inputs/segmentedLogic.d.ts +7 -0
  143. package/dist/components/inputs/segmentedLogic.js +2 -2
  144. package/dist/components/inputs/selectSlots.d.ts +24 -0
  145. package/dist/components/inputs/selectSlots.js +27 -0
  146. package/dist/components/layout/KapiAccessCard.d.ts +5 -1
  147. package/dist/components/layout/KapiAccessCard.js +43 -39
  148. package/dist/components/layout/KapiAccountMenu.js +7 -7
  149. package/dist/components/layout/KapiBox.d.ts +31 -0
  150. package/dist/components/layout/KapiBox.js +26 -0
  151. package/dist/components/layout/KapiCard.d.ts +16 -4
  152. package/dist/components/layout/KapiCard.js +46 -34
  153. package/dist/components/layout/KapiCenter.d.ts +13 -0
  154. package/dist/components/layout/KapiCenter.js +23 -0
  155. package/dist/components/layout/KapiCol.d.ts +22 -0
  156. package/dist/components/layout/KapiCol.js +23 -0
  157. package/dist/components/layout/KapiCollapse.d.ts +39 -0
  158. package/dist/components/layout/KapiCollapse.js +20 -0
  159. package/dist/components/layout/KapiContextSlot.js +4 -4
  160. package/dist/components/layout/KapiDivider.d.ts +11 -2
  161. package/dist/components/layout/KapiDivider.js +30 -24
  162. package/dist/components/layout/KapiGrid.d.ts +29 -3
  163. package/dist/components/layout/KapiGrid.js +39 -17
  164. package/dist/components/layout/KapiNotificationBell.js +10 -10
  165. package/dist/components/layout/KapiPageHeader.d.ts +10 -1
  166. package/dist/components/layout/KapiPageHeader.js +94 -92
  167. package/dist/components/layout/KapiPanelParts.d.ts +11 -2
  168. package/dist/components/layout/KapiPanelParts.js +73 -56
  169. package/dist/components/layout/KapiRail.d.ts +10 -1
  170. package/dist/components/layout/KapiRail.js +125 -122
  171. package/dist/components/layout/KapiRoot.d.ts +55 -5
  172. package/dist/components/layout/KapiRoot.js +57 -38
  173. package/dist/components/layout/KapiShell.d.ts +44 -3
  174. package/dist/components/layout/KapiShell.js +54 -50
  175. package/dist/components/layout/accessCardLogic.d.ts +8 -1
  176. package/dist/components/layout/accessCardLogic.js +11 -7
  177. package/dist/components/layout/cardSlots.d.ts +9 -0
  178. package/dist/components/layout/cardSlots.js +12 -0
  179. package/dist/components/layout/gridSpanLogic.d.ts +46 -0
  180. package/dist/components/layout/gridSpanLogic.js +39 -0
  181. package/dist/components/layout/index.d.ts +13 -4
  182. package/dist/components/layout/layoutPrimitives.d.ts +11 -0
  183. package/dist/components/layout/layoutPrimitives.js +12 -1
  184. package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
  185. package/dist/components/layout/pageHeaderSlots.js +15 -0
  186. package/dist/components/layout/railLogic.d.ts +16 -3
  187. package/dist/components/layout/railSlots.d.ts +12 -0
  188. package/dist/components/layout/railSlots.js +15 -0
  189. package/dist/components/layout/shellSlots.d.ts +6 -0
  190. package/dist/components/layout/shellSlots.js +9 -0
  191. package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
  192. package/dist/components/layout/useGridBreakpoint.js +35 -0
  193. package/dist/components/locale/labelRegistry.d.ts +10 -0
  194. package/dist/components/navigation/KapiAccordion.js +9 -9
  195. package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
  196. package/dist/components/navigation/KapiBreadcrumb.js +23 -16
  197. package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
  198. package/dist/components/navigation/KapiContextPanel.js +152 -136
  199. package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
  200. package/dist/components/navigation/KapiNavBadge.js +26 -22
  201. package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
  202. package/dist/components/navigation/KapiPanelGroup.js +66 -65
  203. package/dist/components/navigation/KapiTabs.d.ts +12 -0
  204. package/dist/components/navigation/KapiTabs.js +87 -71
  205. package/dist/components/navigation/KapiToc.d.ts +48 -0
  206. package/dist/components/navigation/KapiToc.js +66 -0
  207. package/dist/components/navigation/KapiTree.js +10 -10
  208. package/dist/components/navigation/MiniNavItem.d.ts +7 -2
  209. package/dist/components/navigation/MiniNavItem.js +41 -36
  210. package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
  211. package/dist/components/navigation/breadcrumbLogic.js +1 -1
  212. package/dist/components/navigation/index.d.ts +3 -0
  213. package/dist/components/navigation/navLink.d.ts +21 -0
  214. package/dist/components/navigation/navLink.js +26 -0
  215. package/dist/components/navigation/navLinkLogic.d.ts +18 -0
  216. package/dist/components/navigation/navLinkLogic.js +22 -0
  217. package/dist/components/navigation/tocLogic.d.ts +35 -0
  218. package/dist/components/navigation/tocLogic.js +11 -0
  219. package/dist/components/navigation/tocSlots.d.ts +8 -0
  220. package/dist/components/navigation/tocSlots.js +11 -0
  221. package/dist/components/overlays/KapiCommandPalette.js +6 -6
  222. package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
  223. package/dist/components/overlays/KapiContextMenu.js +5 -5
  224. package/dist/components/overlays/KapiMenuButton.js +7 -7
  225. package/dist/components/overlays/KapiModal.d.ts +9 -0
  226. package/dist/components/overlays/KapiModal.js +79 -77
  227. package/dist/components/overlays/KapiOffcanvas.js +24 -24
  228. package/dist/components/overlays/KapiPhotoView.js +10 -10
  229. package/dist/components/overlays/KapiPopover.js +6 -6
  230. package/dist/components/overlays/KapiShapeSheet.js +4 -4
  231. package/dist/components/overlays/KapiTooltip.js +18 -18
  232. package/dist/components/overlays/index.d.ts +1 -1
  233. package/dist/components/overlays/menuList.js +127 -117
  234. package/dist/components/overlays/modalSlots.d.ts +11 -0
  235. package/dist/components/overlays/modalSlots.js +14 -0
  236. package/dist/components/slotCatalog.d.ts +123 -0
  237. package/dist/components/slotCatalog.js +27 -0
  238. package/dist/components/slotsLogic.d.ts +34 -0
  239. package/dist/components/slotsLogic.js +18 -0
  240. package/dist/components/tone.d.ts +26 -0
  241. package/dist/components/tone.js +15 -14
  242. package/dist/css/base.css +1 -1
  243. package/dist/css/components/data/KapiEventCalendar.css +1 -1
  244. package/dist/css/components/data/KapiTable.css +1 -1
  245. package/dist/css/components/display/KapiAnnotation.css +1 -1
  246. package/dist/css/components/display/KapiCodeBlock.css +1 -0
  247. package/dist/css/components/display/KapiDiff.css +1 -0
  248. package/dist/css/components/display/display.css +1 -1
  249. package/dist/css/components/display/typography.css +1 -0
  250. package/dist/css/components/feedback/feedback.css +1 -1
  251. package/dist/css/components/inputs/KapiButton.css +1 -1
  252. package/dist/css/components/inputs/KapiDatePicker.css +1 -1
  253. package/dist/css/components/inputs/KapiPinInput.css +1 -0
  254. package/dist/css/components/inputs/KapiSelect.css +1 -1
  255. package/dist/css/components/inputs/inputsExtra.css +1 -1
  256. package/dist/css/components/layout/KapiAccessCard.css +1 -1
  257. package/dist/css/components/layout/KapiBox.css +1 -0
  258. package/dist/css/components/layout/KapiCollapse.css +1 -0
  259. package/dist/css/components/layout/KapiDivider.css +1 -1
  260. package/dist/css/components/layout/KapiRail.css +1 -1
  261. package/dist/css/components/layout/gridSpan.css +1 -0
  262. package/dist/css/components/navigation/KapiToc.css +1 -0
  263. package/dist/css/components/navigation/navigation.css +1 -1
  264. package/dist/hooks/asyncResourceLogic.d.ts +11 -0
  265. package/dist/hooks/asyncResourceLogic.js +4 -0
  266. package/dist/hooks/densityLogic.d.ts +15 -0
  267. package/dist/hooks/densityLogic.js +4 -0
  268. package/dist/hooks/index.d.ts +7 -0
  269. package/dist/hooks/themeColorsLogic.d.ts +19 -0
  270. package/dist/hooks/themeColorsLogic.js +4 -2
  271. package/dist/hooks/themeDeriveLogic.d.ts +16 -0
  272. package/dist/hooks/themeDeriveLogic.js +27 -17
  273. package/dist/hooks/toneFamilyLogic.d.ts +146 -0
  274. package/dist/hooks/toneFamilyLogic.js +164 -0
  275. package/dist/hooks/useAsyncResource.d.ts +45 -0
  276. package/dist/hooks/useAsyncResource.js +24 -0
  277. package/dist/hooks/useKapiTheme.d.ts +16 -3
  278. package/dist/hooks/useKapiTheme.js +130 -117
  279. package/dist/hooks/useToneFamilies.d.ts +40 -0
  280. package/dist/hooks/useToneFamilies.js +50 -0
  281. package/dist/index.d.ts +3 -1
  282. package/dist/index.js +227 -204
  283. package/dist/kapi.css +1 -1
  284. package/dist/kapi.layered.css +1 -1
  285. package/dist/logic.d.ts +41 -0
  286. package/dist/logic.js +42 -0
  287. package/dist/styles/rawHeights.d.ts +8 -0
  288. package/package.json +14 -3
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { KapiInput as e } from "./KapiInput.js";
3
+ import { useControllableState as t } from "../../hooks/useControllableState.js";
4
+ import { KapiSwitch as n } from "./KapiSwitch.js";
5
+ import { KapiSelect as r } from "./KapiSelect.js";
6
+ import { KapiTextarea as i } from "./KapiTextarea.js";
7
+ import { KapiNumberStepper as a } from "./KapiNumberStepper.js";
8
+ import { KapiGrid as o } from "../layout/KapiGrid.js";
9
+ import { missingPropsFormFields as s, reconcilePropsFormValues as c } from "./propsFormLogic.js";
10
+ import { useMemo as l } from "react";
11
+ import { jsx as u } from "react/jsx-runtime";
12
+ //#region src/components/inputs/KapiPropsForm.tsx
13
+ function d({ fields: d, values: f, defaultValues: p, onChange: m, showErrors: h = !1, disabled: g = !1, min: _ = 220, className: v, ...y }) {
14
+ let [b, x] = t(f, () => c(d, p ?? {}), m), S = l(() => c(d, b), [d, b]), C = l(() => h ? new Set(s(d, S)) : /* @__PURE__ */ new Set(), [
15
+ h,
16
+ d,
17
+ S
18
+ ]), w = (e, t) => x({
19
+ ...S,
20
+ [e]: t
21
+ });
22
+ return /* @__PURE__ */ u("div", {
23
+ ...y,
24
+ className: ["kapi-propsform", v].filter(Boolean).join(" "),
25
+ children: /* @__PURE__ */ u(o, {
26
+ min: _,
27
+ gap: 4,
28
+ children: d.map((t) => {
29
+ let o = {
30
+ label: t.label,
31
+ name: t.name,
32
+ disabled: g || t.disabled === !0,
33
+ required: t.required === !0,
34
+ invalid: C.has(t.name),
35
+ ...t.hint === void 0 ? {} : { help: t.hint }
36
+ }, s = S[t.name] ?? null;
37
+ if (t.kind === "boolean") return /* @__PURE__ */ u(n, {
38
+ ...o,
39
+ checked: s === !0,
40
+ onChange: (e) => w(t.name, e.currentTarget.checked)
41
+ }, t.name);
42
+ if (t.kind === "number") return /* @__PURE__ */ u(a, {
43
+ ...o,
44
+ ...typeof s == "number" ? { value: s } : {},
45
+ onChange: (e) => w(t.name, e),
46
+ ...t.min === void 0 ? {} : { min: t.min },
47
+ ...t.max === void 0 ? {} : { max: t.max }
48
+ }, t.name);
49
+ if (t.kind === "select") return /* @__PURE__ */ u(r, {
50
+ ...o,
51
+ options: (t.options ?? []).map((e) => ({
52
+ value: e.value,
53
+ label: e.label
54
+ })),
55
+ value: typeof s == "string" ? s : null,
56
+ onChange: (e) => w(t.name, e),
57
+ clearable: !0,
58
+ ...t.placeholder === void 0 ? {} : { placeholder: t.placeholder }
59
+ }, t.name);
60
+ let c = typeof s == "string" ? s : "", l = t.placeholder === void 0 ? {} : { placeholder: t.placeholder };
61
+ return t.kind === "textarea" ? /* @__PURE__ */ u(i, {
62
+ ...o,
63
+ ...l,
64
+ rows: 3,
65
+ value: c,
66
+ onChange: (e) => w(t.name, e.currentTarget.value)
67
+ }, t.name) : /* @__PURE__ */ u(e, {
68
+ ...o,
69
+ ...l,
70
+ value: c,
71
+ onChange: (e) => w(t.name, e.currentTarget.value)
72
+ }, t.name);
73
+ })
74
+ })
75
+ });
76
+ }
77
+ //#endregion
78
+ export { d as KapiPropsForm };
@@ -43,6 +43,12 @@ export type KapiRatingProps = Omit<HTMLAttributes<HTMLDivElement>, "children" |
43
43
  label?: ReactNode | undefined;
44
44
  /** Ayuda / mensaje de error bajo la calificación (la envuelve en un `KapiField`). */
45
45
  help?: ReactNode | undefined;
46
+ /**
47
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
48
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
49
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
50
+ */
51
+ error?: ReactNode | undefined;
46
52
  /** Clase del `KapiField` propio (con `label` o `help`). `className` va a la raíz. */
47
53
  fieldClassName?: string | undefined;
48
54
  /**
@@ -69,4 +75,4 @@ export declare const ratingClasses: ({ size, interactive, disabled, readOnly, cl
69
75
  * Inside a `KapiField` the interactive slider takes the field id, name (`aria-labelledby`), help,
70
76
  * `aria-invalid` and `aria-required`.
71
77
  */
72
- export declare const KapiRating: ({ value: valueProp, defaultValue, onChange, max, size, disabled, allowHalf, className, labels, "aria-label": ariaLabelProp, name, invalid, required, label, help, fieldClassName, readOnly: readOnlyProp, id, "aria-describedby": describedBy, ref, ...rest }: KapiRatingProps) => ReactNode;
78
+ export declare const KapiRating: ({ value: valueProp, defaultValue, onChange, max, size, disabled, allowHalf, className, labels, "aria-label": ariaLabelProp, name, invalid, required, label, help, error, fieldClassName, readOnly: readOnlyProp, id, "aria-describedby": describedBy, ref, ...rest }: KapiRatingProps) => ReactNode;
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/inputsExtra.css";
3
- import { fieldControlProps as e, resolveReadOnly as t } from "./fieldLogic.js";
4
- import { useOwnField as n } from "./ownField.js";
5
- import { useLabels as r } from "../locale/KapiLocaleProvider.js";
3
+ import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
4
+ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
+ import { fieldControlProps as n, resolveReadOnly as r } from "./fieldLogic.js";
6
+ import { useOwnField as i } from "./ownField.js";
6
7
  /* empty css */
7
- import { useControllableState as i } from "../../hooks/useControllableState.js";
8
- import { directionOf as ee, logicalKeyOf as te } from "../../hooks/directionLogic.js";
9
- import { useFormReset as ne } from "../../hooks/useFormReset.js";
10
- import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
11
- import { normalizeRating as o, ratingFromKey as s, ratingFromPointer as c, starFills as re } from "./ratingLogic.js";
8
+ import { useControllableState as a } from "../../hooks/useControllableState.js";
9
+ import { directionOf as o, logicalKeyOf as s } from "../../hooks/directionLogic.js";
10
+ import { useFormReset as ee } from "../../hooks/useFormReset.js";
11
+ import { normalizeRating as te, ratingFromKey as c, ratingFromPointer as ne, starFills as re } from "./ratingLogic.js";
12
12
  import { useState as ie } from "react";
13
13
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
14
14
  import { Star as d } from "lucide-react";
@@ -16,46 +16,47 @@ import { Star as d } from "lucide-react";
16
16
  var f = {
17
17
  rating: "Calificación",
18
18
  of: "de"
19
- }, p = {
19
+ }, ae = {
20
20
  sm: 16,
21
21
  md: 22,
22
22
  lg: 30
23
- }, m = ({ size: e = "md", interactive: t = !1, disabled: n = !1, readOnly: r = !1, className: i = "" } = {}) => [
23
+ }, p = ({ size: e = "md", interactive: t = !1, disabled: n = !1, readOnly: r = !1, className: i = "" } = {}) => [
24
24
  "kapi-rating",
25
25
  e !== "md" && `kapi-rating--${e}`,
26
26
  t && "kapi-rating--interactive",
27
27
  n && "kapi-rating--disabled",
28
28
  r && "kapi-rating--readonly",
29
29
  i
30
- ].filter(Boolean).join(" "), h = ({ value: h, defaultValue: g, onChange: _, max: v = 5, size: y = "md", disabled: b = !1, allowHalf: x = !1, className: ae, labels: S, "aria-label": C, name: w, invalid: T, required: E, label: D, help: O, fieldClassName: k, readOnly: A, id: j, "aria-describedby": M, ref: oe, ...N }) => {
31
- let P = r("rating", f, S), F = n({
30
+ ].filter(Boolean).join(" "), m = ({ value: m, defaultValue: h, onChange: g, max: _ = 5, size: v = "md", disabled: y = !1, allowHalf: b = !1, className: x, labels: oe, "aria-label": S, name: C, invalid: w, required: T, label: E, help: D, error: O, fieldClassName: k, readOnly: A, id: j, "aria-describedby": M, ref: se, ...N }) => {
31
+ let P = t("rating", f, oe), F = i({
32
32
  id: j,
33
- label: D,
34
- help: O,
35
- required: E,
36
- invalid: T,
33
+ label: E,
34
+ help: D,
35
+ error: O,
36
+ required: T,
37
+ invalid: w,
37
38
  readOnly: A,
38
39
  fieldClassName: k
39
- }), I = F.field, L = t(A, I), [R, z] = ie(null), [B, V, , H] = i(h, g ?? 0, _), U = a(oe, ne(H)), W = (_ !== void 0 || h === void 0 && g !== void 0) && !b, G = W && !L, K = e(W ? I : null, {
40
+ }), I = F.field, L = r(A, I), [R, z] = ie(null), [B, V, , H] = a(m, h ?? 0, g), U = e(se, ee(H)), W = (g !== void 0 || m === void 0 && h !== void 0) && !y, G = W && !L, K = n(W ? I : null, {
40
41
  id: j,
41
42
  describedBy: M,
42
- invalid: T,
43
- required: E,
43
+ invalid: w,
44
+ required: T,
44
45
  labelable: !1,
45
- ariaLabel: C
46
- }), q = C ?? P.rating, J = o(B, v, x), Y = w ? /* @__PURE__ */ l("input", {
46
+ ariaLabel: S
47
+ }), q = S ?? P.rating, J = te(B, _, b), Y = C ? /* @__PURE__ */ l("input", {
47
48
  type: "hidden",
48
- name: w,
49
+ name: C,
49
50
  value: J,
50
- disabled: b
51
- }) : null, se = re(G && R !== null ? R : J, v, x), X = p[y], Z = (e, t) => {
52
- let n = e.currentTarget.getBoundingClientRect(), r = ee(e.currentTarget) === "rtl" ? n.right - e.clientX : e.clientX - n.left, i = n.width > 0 ? r / n.width : 1;
53
- return c(t, i, x);
54
- }, ce = (e) => {
51
+ disabled: y
52
+ }) : null, ce = re(G && R !== null ? R : J, _, b), X = ae[v], Z = (e, t) => {
53
+ let n = e.currentTarget.getBoundingClientRect(), r = o(e.currentTarget) === "rtl" ? n.right - e.clientX : e.clientX - n.left, i = n.width > 0 ? r / n.width : 1;
54
+ return ne(t, i, b);
55
+ }, le = (e) => {
55
56
  if (!G) return;
56
- let t = s(te(e), J, v, x);
57
+ let t = c(s(e), J, _, b);
57
58
  t !== null && (e.preventDefault(), t !== J && V(t));
58
- }, Q = se.map((e, t) => /* @__PURE__ */ u("span", {
59
+ }, Q = ce.map((e, t) => /* @__PURE__ */ u("span", {
59
60
  className: "kapi-rating__star",
60
61
  "data-fill": e,
61
62
  onMouseMove: G ? (e) => z(Z(e, t)) : void 0,
@@ -78,12 +79,12 @@ var f = {
78
79
  "aria-hidden": "true"
79
80
  })
80
81
  })]
81
- }, t)), $ = m({
82
- size: y,
82
+ }, t)), $ = p({
83
+ size: v,
83
84
  interactive: W,
84
- disabled: b,
85
+ disabled: y,
85
86
  readOnly: W && L,
86
- className: ae
87
+ className: x
87
88
  });
88
89
  return W ? F.wrap(/* @__PURE__ */ u("div", {
89
90
  ...N,
@@ -94,11 +95,11 @@ var f = {
94
95
  tabIndex: 0,
95
96
  "aria-label": K["aria-labelledby"] ? void 0 : q,
96
97
  "aria-valuemin": 0,
97
- "aria-valuemax": v,
98
+ "aria-valuemax": _,
98
99
  "aria-valuenow": J,
99
- "aria-valuetext": `${J} ${P.of} ${v}`,
100
+ "aria-valuetext": `${J} ${P.of} ${_}`,
100
101
  "aria-readonly": L || void 0,
101
- onKeyDown: ce,
102
+ onKeyDown: le,
102
103
  onMouseLeave: () => z(null),
103
104
  children: [Q, Y]
104
105
  })) : F.wrap(/* @__PURE__ */ u("div", {
@@ -108,9 +109,9 @@ var f = {
108
109
  "aria-describedby": M,
109
110
  className: $,
110
111
  role: "img",
111
- "aria-label": `${q}: ${J} ${P.of} ${v}`,
112
+ "aria-label": `${q}: ${J} ${P.of} ${_}`,
112
113
  children: [Q, Y]
113
114
  }));
114
115
  };
115
116
  //#endregion
116
- export { f as DEFAULT_RATING_LABELS, h as KapiRating, m as ratingClasses };
117
+ export { f as DEFAULT_RATING_LABELS, m as KapiRating, p as ratingClasses };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/KapiSearchChip.css";
3
- import { assignRef as e } from "./fieldLogic.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
3
+ import { useLabels as e } from "../locale/KapiLocaleProvider.js";
4
+ import { assignRef as t } from "./fieldLogic.js";
5
5
  import { useControllableState as n } from "../../hooks/useControllableState.js";
6
6
  import { searchChipClasses as r, searchChipName as i } from "./searchChipLogic.js";
7
7
  /* empty css */
@@ -16,12 +16,12 @@ var u = {
16
16
  }, d = (e) => {
17
17
  Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 }));
18
18
  }, f = ({ value: f, defaultValue: p, onChange: m, onSubmit: h, disabled: g = !1, placeholder: _, "aria-label": v, labels: y, className: b, style: x, ref: S, onKeyDown: C, ...w }) => {
19
- let T = t("searchChip", u, y), E = a(null), [D, O] = n(f, p ?? ""), k = _ ?? T.placeholder, A = i({
19
+ let T = e("searchChip", u, y), E = a(null), [D, O] = n(f, p ?? ""), k = _ ?? T.placeholder, A = i({
20
20
  ariaLabel: v,
21
21
  placeholder: k,
22
22
  fallback: T.search
23
- }), j = D !== "" && !g && !w.readOnly, M = (t) => {
24
- E.current = t, e(S, t);
23
+ }), j = D !== "" && !g && !w.readOnly, M = (e) => {
24
+ E.current = e, t(S, e);
25
25
  }, N = () => {
26
26
  let e = E.current;
27
27
  e && (d(e), e.focus());
@@ -1,10 +1,12 @@
1
1
  import type { FocusEvent, HTMLAttributes, ReactNode, Ref } from "react";
2
- import { type KapiTone } from "../tone.js";
2
+ import { type KapiFamilyTone, type KapiTone } from "../tone.js";
3
3
  export type KapiSegmentedVariant = "text" | "icon" | "both";
4
4
  /** Escala del segmentado: `sm` para barras compactas (filtros de tabla), `md` el de siempre. */
5
5
  export type KapiSegmentedSize = "sm" | "md";
6
6
  /** Tonos de un ítem de `KapiSegmented` (subconjunto de `KapiTone`). */
7
7
  export type KapiSegmentedTone = Extract<KapiTone, "success" | "warning" | "danger" | "info">;
8
+ /** Tono de un ítem: uno del subconjunto, o una familia propia de la app (`toneFamilies`). */
9
+ export type KapiSegmentedToneName = KapiSegmentedTone | KapiFamilyTone;
8
10
  /** @deprecated Usar `KapiSegmentedTone`. */
9
11
  export type KapiSegmentedColor = KapiSegmentedTone;
10
12
  export type KapiSegmentedItem<Id extends string | number = string> = {
@@ -19,15 +21,15 @@ export type KapiSegmentedItem<Id extends string | number = string> = {
19
21
  */
20
22
  count?: number | undefined;
21
23
  /** Tono del ítem cuando está activo (en vez del primario); sin activar no se ve. */
22
- activeTone?: KapiSegmentedTone | undefined;
24
+ activeTone?: KapiSegmentedToneName | undefined;
23
25
  /** Nombre anterior de `activeTone`, deprecado. @deprecated Usar `activeTone` (mismos valores). */
24
- color?: KapiSegmentedTone | undefined;
26
+ color?: KapiSegmentedToneName | undefined;
25
27
  /**
26
28
  * Estado permanente del ítem: tiñe el label y el contador **siempre**, sin tocar el fondo, para que una
27
29
  * opción que necesita atención («Demorados 41») se vea sin tener que elegirla. Si además está activa, el
28
30
  * tratamiento de `activeTone` gana.
29
31
  */
30
- tone?: KapiSegmentedTone | undefined;
32
+ tone?: KapiSegmentedToneName | undefined;
31
33
  /** Opción no elegible: se ve atenuada y el teclado la saltea. */
32
34
  disabled?: boolean | undefined;
33
35
  };
@@ -58,6 +60,12 @@ export type KapiSegmentedProps<Id extends string | number = string> = Omit<HTMLA
58
60
  label?: ReactNode | undefined;
59
61
  /** Ayuda / mensaje de error bajo el grupo (lo envuelve en un `KapiField`). */
60
62
  help?: ReactNode | undefined;
63
+ /**
64
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
65
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
66
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
67
+ */
68
+ error?: ReactNode | undefined;
61
69
  /** Clase del `KapiField` propio (con `label` o `help`). `className` va al `radiogroup`. */
62
70
  fieldClassName?: string | undefined;
63
71
  /** Deshabilita el grupo entero (cada opción también acepta `disabled`). */
@@ -78,4 +86,4 @@ export type KapiSegmentedProps<Id extends string | number = string> = Omit<HTMLA
78
86
  * En variante `icon` cada tab muestra su label en un tooltip al hover.
79
87
  * Dentro de un `KapiField` toma id, nombre (`aria-labelledby`), ayuda, `aria-invalid` y `aria-required`.
80
88
  */
81
- export declare const KapiSegmented: <Id extends string | number = string>({ items, value: valueProp, defaultValue, onChange, variant, "aria-label": ariaLabel, className, name, onBlur, invalid, required, label, help, fieldClassName, disabled, readOnly: readOnlyProp, size, id, "aria-describedby": describedBy, ref, ...rest }: KapiSegmentedProps<Id>) => ReactNode;
89
+ export declare const KapiSegmented: <Id extends string | number = string>({ items, value: valueProp, defaultValue, onChange, variant, "aria-label": ariaLabel, className, name, onBlur, invalid, required, label, help, error, fieldClassName, disabled, readOnly: readOnlyProp, size, id, "aria-describedby": describedBy, ref, ...rest }: KapiSegmentedProps<Id>) => ReactNode;
@@ -1,116 +1,120 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/inputsExtra.css";
3
- import { joinClasses as e } from "../rootProps.js";
4
- import { resolveTone as t } from "../tone.js";
5
- import { assignRef as n, fieldControlProps as r, resolveReadOnly as i } from "./fieldLogic.js";
6
- import { useOwnField as a } from "./ownField.js";
7
- import { useKapiFormatLocale as o } from "../locale/KapiLocaleProvider.js";
3
+ import { useToneLookResolver as e } from "../../hooks/useToneFamilies.js";
4
+ import { joinClasses as t } from "../rootProps.js";
5
+ import { resolveTone as n } from "../tone.js";
6
+ import { useKapiFormatLocale as r } from "../locale/KapiLocaleProvider.js";
7
+ import { assignRef as i, fieldControlProps as a, resolveReadOnly as o } from "./fieldLogic.js";
8
+ import { useOwnField as s } from "./ownField.js";
8
9
  /* empty css */
9
- import { useControllableState as s } from "../../hooks/useControllableState.js";
10
+ import { useControllableState as ee } from "../../hooks/useControllableState.js";
10
11
  import { logicalKeyOf as c } from "../../hooks/directionLogic.js";
11
- import { useDuplicateValueWarning as l, useMutedControlWarning as ee } from "./misuseWarnings.js";
12
- import { useFormReset as u } from "../../hooks/useFormReset.js";
13
- import { useSlidingIndicator as d } from "../../hooks/useSlidingIndicator.js";
14
- import { formatCount as f } from "../../hooks/numberFormatLogic.js";
15
- import { KapiTooltip as p } from "../overlays/KapiTooltip.js";
16
- import { nextRadioIndex as m } from "./segmentedLogic.js";
17
- import { useMemo as h } from "react";
18
- import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
12
+ import { useDuplicateValueWarning as l, useMutedControlWarning as te } from "./misuseWarnings.js";
13
+ import { useFormReset as ne } from "../../hooks/useFormReset.js";
14
+ import { useSlidingIndicator as u } from "../../hooks/useSlidingIndicator.js";
15
+ import { formatCount as d } from "../../hooks/numberFormatLogic.js";
16
+ import { KapiTooltip as f } from "../overlays/KapiTooltip.js";
17
+ import { nextRadioIndex as p, segmentedToneAttr as m } from "./segmentedLogic.js";
18
+ import { useMemo as re } from "react";
19
+ import { Fragment as ie, jsx as h, jsxs as g } from "react/jsx-runtime";
19
20
  //#region src/components/inputs/KapiSegmented.tsx
20
- var y = (e) => t(e.activeTone, e.color, void 0), b = ({ items: t, value: b, defaultValue: x, onChange: S, variant: C = "text", "aria-label": w, className: T, name: E, onBlur: D, invalid: O, required: k, label: A, help: j, fieldClassName: M, disabled: N = !1, readOnly: P, size: F = "md", id: I, "aria-describedby": L, ref: R, ...z }) => {
21
- let B = o(), V = a({
22
- id: I,
23
- label: A,
24
- help: j,
25
- required: k,
26
- invalid: O,
27
- readOnly: P,
28
- fieldClassName: M
29
- }), H = i(P, V.field), U = (e) => N || t[e]?.disabled === !0, W = r(V.field, {
30
- id: I,
31
- describedBy: L,
32
- invalid: O,
33
- required: k,
21
+ var _ = (e) => n(e.activeTone, e.color, void 0), v = ({ items: n, value: v, defaultValue: y, onChange: b, variant: x = "text", "aria-label": S, className: C, name: w, onBlur: T, invalid: E, required: D, label: O, help: k, error: A, fieldClassName: j, disabled: M = !1, readOnly: N, size: P = "md", id: F, "aria-describedby": I, ref: L, ...R }) => {
22
+ let z = r(), B = s({
23
+ id: F,
24
+ label: O,
25
+ help: k,
26
+ error: A,
27
+ required: D,
28
+ invalid: E,
29
+ readOnly: N,
30
+ fieldClassName: j
31
+ }), V = o(N, B.field), H = (e) => M || n[e]?.disabled === !0, U = a(B.field, {
32
+ id: F,
33
+ describedBy: I,
34
+ invalid: E,
35
+ required: D,
34
36
  labelable: !1,
35
- ariaLabel: w
36
- }), [G, K, , q] = s(b, () => x ?? t[0]?.id, S), J = u(q), Y = h(() => t.map((e) => e.id), [t]);
37
- l("KapiSegmented", Y), ee("KapiSegmented", {
38
- controlled: b !== void 0,
39
- hasOnChange: !!S,
40
- readOnly: H,
41
- disabled: N
37
+ ariaLabel: S
38
+ }), [W, G, , K] = ee(v, () => y ?? n[0]?.id, b), q = ne(K), J = re(() => n.map((e) => e.id), [n]);
39
+ l("KapiSegmented", J), te("KapiSegmented", {
40
+ controlled: v !== void 0,
41
+ hasOnChange: !!b,
42
+ readOnly: V,
43
+ disabled: M
42
44
  });
43
- let X = t.find((e) => e.id === G), { containerRef: Z, indicatorRef: Q } = d({
44
- active: G ?? null,
45
- deps: [t, C],
45
+ let Y = n.find((e) => e.id === W), X = e("KapiSegmented"), Z = X(Y ? _(Y) : void 0), { containerRef: Q, indicatorRef: ae } = u({
46
+ active: W ?? null,
47
+ deps: [n, x],
46
48
  findActive: (e) => e.querySelector("[role=\"radio\"][aria-checked=\"true\"]")
47
- }), $ = t.findIndex((e) => e.id === G), te = $ >= 0 && !U($) ? $ : t.findIndex((e, t) => !U(t)), ne = (e) => {
48
- if (H) return;
49
- let n = m(t.length, $, c(e), U), r = n === void 0 ? void 0 : t[n];
50
- n !== void 0 && r && (e.preventDefault(), K(r.id), Z.current?.querySelectorAll("[role=\"radio\"]")[n]?.focus());
51
- }, re = (e) => {
52
- e.currentTarget.contains(e.relatedTarget) || D?.(e);
49
+ }), $ = n.findIndex((e) => e.id === W), oe = $ >= 0 && !H($) ? $ : n.findIndex((e, t) => !H(t)), se = (e) => {
50
+ if (V) return;
51
+ let t = p(n.length, $, c(e), H), r = t === void 0 ? void 0 : n[t];
52
+ t !== void 0 && r && (e.preventDefault(), G(r.id), Q.current?.querySelectorAll("[role=\"radio\"]")[t]?.focus());
53
+ }, ce = (e) => {
54
+ e.currentTarget.contains(e.relatedTarget) || T?.(e);
53
55
  };
54
- return V.wrap(/* @__PURE__ */ v("div", {
55
- ...z,
56
- ...W,
56
+ return B.wrap(/* @__PURE__ */ g("div", {
57
+ ...R,
58
+ ...U,
57
59
  ref: (e) => {
58
- Z.current = e, J(e), n(R, e);
60
+ Q.current = e, q(e), i(L, e);
59
61
  },
60
- className: e("kapi-seg", F === "sm" && "kapi-seg--sm", H && "kapi-seg--readonly", T),
62
+ className: t("kapi-seg", P === "sm" && "kapi-seg--sm", V && "kapi-seg--readonly", C),
61
63
  role: "radiogroup",
62
- "aria-label": w,
63
- "aria-disabled": N || void 0,
64
- "aria-readonly": H || void 0,
65
- onKeyDown: ne,
66
- onBlur: re,
64
+ "aria-label": S,
65
+ "aria-disabled": M || void 0,
66
+ "aria-readonly": V || void 0,
67
+ onKeyDown: se,
68
+ onBlur: ce,
67
69
  children: [
68
- /* @__PURE__ */ _("span", {
69
- ref: Q,
70
+ /* @__PURE__ */ h("span", {
71
+ ref: ae,
70
72
  className: "kapi-seg__indicator",
71
- "data-color": X ? y(X) : void 0,
73
+ "data-color": m(Z.tone, Z.style !== void 0),
74
+ style: Z.style,
72
75
  "aria-hidden": "true"
73
76
  }),
74
- t.map((e, t) => {
75
- let n = G === e.id, r = /* @__PURE__ */ v("button", {
77
+ n.map((e, t) => {
78
+ let n = W === e.id, r = t === oe, i = X(e.tone), a = X(_(e)), o = n && a.style || i.style, s = /* @__PURE__ */ g("button", {
76
79
  type: "button",
77
80
  role: "radio",
78
81
  "aria-checked": n,
79
- tabIndex: t === te ? 0 : -1,
80
- "aria-label": C === "icon" ? e.label : void 0,
82
+ tabIndex: r ? 0 : -1,
83
+ "aria-label": x === "icon" ? e.label : void 0,
81
84
  className: `kapi-seg__btn${n ? " is-on" : ""}`,
82
- "data-color": n ? y(e) : void 0,
83
- "data-tone": e.tone,
84
- disabled: U(t) || void 0,
85
+ "data-color": n ? m(a.tone, a.style !== void 0) : void 0,
86
+ "data-tone": m(i.tone, i.style !== void 0),
87
+ style: o,
88
+ disabled: H(t) || void 0,
85
89
  onClick: () => {
86
- H || K(e.id);
90
+ V || G(e.id);
87
91
  },
88
92
  children: [
89
- (C === "icon" || C === "both") && e.icon && /* @__PURE__ */ _("span", {
93
+ (x === "icon" || x === "both") && e.icon && /* @__PURE__ */ h("span", {
90
94
  className: "kapi-seg__ico",
91
95
  children: e.icon
92
96
  }),
93
- C !== "icon" && /* @__PURE__ */ _("span", { children: e.label }),
94
- e.count != null && /* @__PURE__ */ v(g, { children: [" ", /* @__PURE__ */ _("span", {
97
+ x !== "icon" && /* @__PURE__ */ h("span", { children: e.label }),
98
+ e.count != null && /* @__PURE__ */ g(ie, { children: [" ", /* @__PURE__ */ h("span", {
95
99
  className: "kapi-seg__n",
96
- children: f(e.count, B)
100
+ children: d(e.count, z)
97
101
  })] })
98
102
  ]
99
103
  }, e.id);
100
- return C === "icon" && e.label ? /* @__PURE__ */ _(p, {
104
+ return x === "icon" && e.label ? /* @__PURE__ */ h(f, {
101
105
  label: e.label,
102
106
  prefer: "top",
103
- children: r
104
- }, e.id) : r;
107
+ children: s
108
+ }, e.id) : s;
105
109
  }),
106
- E && /* @__PURE__ */ _("input", {
110
+ w && /* @__PURE__ */ h("input", {
107
111
  type: "hidden",
108
- name: E,
109
- value: G === void 0 ? "" : String(G),
110
- disabled: N || void 0
112
+ name: w,
113
+ value: W === void 0 ? "" : String(W),
114
+ disabled: M || void 0
111
115
  })
112
116
  ]
113
117
  }));
114
118
  };
115
119
  //#endregion
116
- export { b as KapiSegmented };
120
+ export { v as KapiSegmented };
@@ -1,8 +1,11 @@
1
1
  import { type CSSProperties, type FocusEvent, type ReactNode, type Ref } from "react";
2
2
  import { type KapiSelectEntry, type KapiSelectGroup, type KapiSelectOption } from "./selectLogic.js";
3
3
  import type { KapiLabelsOverride } from "../labelsLogic.js";
4
+ import type { KapiClassNames } from "../slotCatalog.js";
4
5
  export type { KapiSelectEntry, KapiSelectGroup, KapiSelectOption };
5
6
  export type KapiSelectSize = "sm" | "md" | "lg";
7
+ /** Partes de `KapiSelect` que acepta `classNames` (el disparador y el menú). */
8
+ export type KapiSelectClassNames = KapiClassNames<"select">;
6
9
  /** Cara del disparador: `field` (campo de formulario) o `chip` (chip compacto de una fila de filtros). */
7
10
  export type KapiSelectVariant = "field" | "chip";
8
11
  /** Modo simple (default): el valor es un `string` o `null` (vacío). */
@@ -98,6 +101,12 @@ export interface KapiSelectBaseProps<T = unknown> {
98
101
  chipLabel?: string | undefined;
99
102
  /** Ayuda / mensaje de error bajo el control (envuelve el select en un `KapiField`). */
100
103
  help?: ReactNode | undefined;
104
+ /**
105
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
106
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
107
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
108
+ */
109
+ error?: ReactNode | undefined;
101
110
  /** Clase del `KapiField` propio (con `label` o `help`). `className` va al select. */
102
111
  fieldClassName?: string | undefined;
103
112
  /**
@@ -139,6 +148,15 @@ export interface KapiSelectBaseProps<T = unknown> {
139
148
  id?: string | undefined;
140
149
  /** Clase del envoltorio. */
141
150
  className?: string | undefined;
151
+ /**
152
+ * Clases por parte: `classNames={{ tag: "mi-tag", menu: "mi-menu", option: "mi-opcion" }}`. Se suman
153
+ * a las propias, sin reemplazarlas. Cubre el disparador (`root`, `icon`, `label`, `values`, `single`,
154
+ * `placeholder`, `tag`, `tagLabel`, `tagRemove`, `input`, `combo`, `spinner`, `clear`, `caret`) y el
155
+ * menú portaleado (`menu`, `list`, `group`, `groupLabel`, `option`, `check`, `status`). Cada parte
156
+ * además lleva `data-slot="select-<parte>"`; el estado de una opción se alcanza con
157
+ * `[data-slot="select-option"][aria-selected="true"]`.
158
+ */
159
+ classNames?: KapiSelectClassNames | undefined;
142
160
  /** Estilos en línea del envoltorio. */
143
161
  style?: CSSProperties | undefined;
144
162
  /** Nombre accesible cuando no hay `<label>` asociado (o `KapiField`). */
@@ -151,13 +169,15 @@ export interface KapiSelectBaseProps<T = unknown> {
151
169
  onBlur?: ((event: FocusEvent<HTMLElement>) => void) | undefined;
152
170
  }
153
171
  /** Clases del contenedor. Pura y exportada para testear. */
154
- export declare const selectClasses: ({ size, open, disabled, readOnly, multi, chip, className }: {
172
+ export declare const selectClasses: ({ size, open, disabled, readOnly, multi, chip, invalid, className }: {
155
173
  size?: KapiSelectSize | undefined;
156
174
  open?: boolean | undefined;
157
175
  disabled?: boolean | undefined;
158
176
  readOnly?: boolean | undefined;
159
177
  multi?: boolean | undefined;
160
178
  chip?: boolean | undefined;
179
+ /** Pinta la caja en rojo, como ya hacían el input, el textarea y el stepper. */
180
+ invalid?: boolean | undefined;
161
181
  className?: string | undefined;
162
182
  }) => string;
163
183
  /**