@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
@@ -1,7 +1,9 @@
1
1
  import { type CSSProperties, type ReactNode, type Ref } from "react";
2
2
  import { type IndexedRow, type KapiSelectOption } from "./selectLogic.js";
3
- import type { KapiSelectRenderContext } from "./KapiSelect.js";
3
+ import type { KapiSelectClassNames, KapiSelectRenderContext } from "./KapiSelect.js";
4
4
  export type KapiSelectMenuProps<T> = {
5
+ /** `classNames` del select: acá cuentan las partes del menú. */
6
+ classNames?: KapiSelectClassNames | undefined;
5
7
  /** `.kapi` donde se portalea (escapa tablas y overflow). */
6
8
  root: Element;
7
9
  ref: Ref<HTMLDivElement>;
@@ -35,4 +37,4 @@ export type KapiSelectMenuProps<T> = {
35
37
  onChoose: (option: KapiSelectOption<T>, shift: boolean) => void;
36
38
  };
37
39
  /** Listbox portaleado de `KapiSelect`: grupos, fila de crear y mensaje de estado. Solo dibuja. */
38
- export declare const KapiSelectMenu: <T>({ root, ref, side, hug, style, listboxId, optionId, multiple, "aria-label": ariaLabel, rows, createRow, createIndex, loading, empty, message, active, values, renderOption, query, virtual, onHover, onChoose }: KapiSelectMenuProps<T>) => import("react").ReactPortal;
40
+ export declare const KapiSelectMenu: <T>({ classNames, root, ref, side, hug, style, listboxId, optionId, multiple, "aria-label": ariaLabel, rows, createRow, createIndex, loading, empty, message, active, values, renderOption, query, virtual, onHover, onChoose }: KapiSelectMenuProps<T>) => import("react").ReactPortal;
@@ -1,173 +1,171 @@
1
1
  "use client";
2
2
  import { flattenMenuRows as e } from "./selectLogic.js";
3
3
  import { useVirtualList as t } from "../../hooks/useVirtualList.js";
4
- import { memo as n, useCallback as r, useLayoutEffect as i, useMemo as a, useRef as o } from "react";
5
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
- import { Check as l } from "lucide-react";
7
- import { createPortal as u } from "react-dom";
4
+ import { slot as n } from "../slotsLogic.js";
5
+ import { SELECT_SLOTS as r } from "./selectSlots.js";
6
+ import { memo as i, useCallback as a, useLayoutEffect as o, useMemo as s, useRef as c } from "react";
7
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ import { Check as d } from "lucide-react";
9
+ import { createPortal as f } from "react-dom";
8
10
  //#region src/components/inputs/KapiSelectMenu.tsx
9
- var d = 38, f = 264, p = 4, m = n(({ option: e, index: t, id: n, selected: r, active: i, create: a, vindex: o, setSize: u, renderOption: d, query: f, onHover: p, onChoose: m }) => /* @__PURE__ */ c("li", {
10
- id: n,
11
+ var p = 38, m = 264, h = 4, g = i(({ optionClass: e, checkClass: t, option: i, index: a, id: o, selected: s, active: c, create: f, vindex: p, setSize: m, renderOption: h, query: g, onHover: _, onChoose: v }) => /* @__PURE__ */ u("li", {
12
+ id: o,
11
13
  role: "option",
12
- "aria-selected": r,
13
- "aria-disabled": e.disabled || void 0,
14
- "data-kapisel-index": t,
15
- "data-vindex": o,
16
- "aria-setsize": o === void 0 ? void 0 : u,
17
- "aria-posinset": o === void 0 ? void 0 : t + 1,
18
- className: [
19
- "kapisel__opt",
20
- i && "kapisel__opt--active",
21
- r && "kapisel__opt--selected",
22
- a && "kapisel__opt--create",
23
- e.disabled && "kapisel__opt--disabled"
24
- ].filter(Boolean).join(" "),
14
+ "aria-selected": s,
15
+ "aria-disabled": i.disabled || void 0,
16
+ "data-kapisel-index": a,
17
+ "data-vindex": p,
18
+ "aria-setsize": p === void 0 ? void 0 : m,
19
+ "aria-posinset": p === void 0 ? void 0 : a + 1,
20
+ ...n(r, "option", { option: e }, c && "kapisel__opt--active", s && "kapisel__opt--selected", f && "kapisel__opt--create", i.disabled && "kapisel__opt--disabled"),
25
21
  onMouseMove: () => {
26
- !e.disabled && !i && p(t);
22
+ !i.disabled && !c && _(a);
27
23
  },
28
- onClick: (t) => m(e, t.shiftKey),
29
- children: [/* @__PURE__ */ s("span", {
24
+ onClick: (e) => v(i, e.shiftKey),
25
+ children: [/* @__PURE__ */ l("span", {
30
26
  className: "kapisel__opt-body",
31
- children: d && !a ? d(e, {
32
- selected: r,
33
- active: i,
34
- disabled: e.disabled === !0,
35
- query: f
36
- }) : e.label
37
- }), r && /* @__PURE__ */ s(l, {
38
- className: "kapisel__check",
27
+ children: h && !f ? h(i, {
28
+ selected: s,
29
+ active: c,
30
+ disabled: i.disabled === !0,
31
+ query: g
32
+ }) : i.label
33
+ }), s && /* @__PURE__ */ l(d, {
34
+ ...n(r, "check", { check: t }),
39
35
  size: 15,
40
36
  strokeWidth: 2.4,
41
37
  "aria-hidden": "true"
42
38
  })]
43
- })), h = ({ root: n, ref: l, side: h, hug: g, style: _, listboxId: v, optionId: y, multiple: b, "aria-label": x, rows: S, createRow: C, createIndex: w, loading: T, empty: E, message: D, active: O, values: k, renderOption: A, query: j, virtual: M, onHover: N, onChoose: P }) => {
44
- let F = o(null), I = a(() => M ? e(S, C, w) : null, [
45
- M,
46
- S,
47
- C,
48
- w
49
- ]), L = a(() => I?.rows.map((e) => e.key), [I]), R = t({
50
- enabled: M && !T,
51
- count: I?.rows.length ?? 0,
52
- scrollRef: F,
53
- estimate: d,
39
+ })), _ = ({ classNames: i, root: d, ref: _, side: v, hug: y, style: b, listboxId: x, optionId: S, multiple: C, "aria-label": w, rows: T, createRow: E, createIndex: D, loading: O, empty: k, message: A, active: j, values: M, renderOption: N, query: P, virtual: F, onHover: I, onChoose: L }) => {
40
+ let R = c(null), z = s(() => F ? e(T, E, D) : null, [
41
+ F,
42
+ T,
43
+ E,
44
+ D
45
+ ]), B = s(() => z?.rows.map((e) => e.key), [z]), V = t({
46
+ enabled: F && !O,
47
+ count: z?.rows.length ?? 0,
48
+ scrollRef: R,
49
+ estimate: p,
54
50
  measure: !0,
55
- keys: L,
56
- overscan: p,
57
- fallbackViewHeight: f
58
- }), { scrollToIndex: z } = R, B = O >= 0 ? I?.rowOf[O] : void 0;
59
- i(() => {
60
- B !== void 0 && z(B);
61
- }, [B, z]);
62
- let V = a(() => new Set(k), [k]), H = o({
63
- onHover: N,
64
- onChoose: P
51
+ keys: B,
52
+ overscan: h,
53
+ fallbackViewHeight: m
54
+ }), { scrollToIndex: H } = V, U = j >= 0 ? z?.rowOf[j] : void 0;
55
+ o(() => {
56
+ U !== void 0 && H(U);
57
+ }, [U, H]);
58
+ let W = s(() => new Set(M), [M]), G = c({
59
+ onHover: I,
60
+ onChoose: L
65
61
  });
66
- i(() => {
67
- H.current = {
68
- onHover: N,
69
- onChoose: P
62
+ o(() => {
63
+ G.current = {
64
+ onHover: I,
65
+ onChoose: L
70
66
  };
71
67
  });
72
- let U = r((e) => H.current.onHover(e), []), W = r((e, t) => H.current.onChoose(e, t), []), G = w + 1, K = ({ option: e, index: t }, n) => {
73
- let r = e === C, i = A && !r ? A : void 0;
74
- return /* @__PURE__ */ s(m, {
68
+ let K = a((e) => G.current.onHover(e), []), q = a((e, t) => G.current.onChoose(e, t), []), J = D + 1, Y = ({ option: e, index: t }, n) => {
69
+ let r = e === E, a = N && !r ? N : void 0;
70
+ return /* @__PURE__ */ l(g, {
71
+ optionClass: i?.option,
72
+ checkClass: i?.check,
75
73
  option: e,
76
74
  index: t,
77
- id: y(t),
78
- selected: V.has(e.value),
79
- active: t === O,
75
+ id: S(t),
76
+ selected: W.has(e.value),
77
+ active: t === j,
80
78
  create: r,
81
79
  vindex: n,
82
- setSize: n === void 0 ? void 0 : G,
83
- renderOption: i,
84
- query: i ? j : "",
85
- onHover: U,
86
- onChoose: W
80
+ setSize: n === void 0 ? void 0 : J,
81
+ renderOption: a,
82
+ query: a ? P : "",
83
+ onHover: K,
84
+ onChoose: q
87
85
  }, `${e.value}-${t}`);
86
+ }, X = (e, t, a, o, s) => {
87
+ let c = [];
88
+ o > 0 && c.push(/* @__PURE__ */ l("li", {
89
+ role: "presentation",
90
+ "aria-hidden": !0,
91
+ style: { height: o }
92
+ }, "pad-top"));
93
+ let d = t;
94
+ for (; d < a;) {
95
+ let t = e[d];
96
+ if (t.group === null) {
97
+ t.kind === "option" && c.push(Y(t.item, d)), d += 1;
98
+ continue;
99
+ }
100
+ let o = t.group, s = null, f = [];
101
+ for (; d < a && e[d].group?.key === o.key;) {
102
+ let t = e[d];
103
+ t.kind === "header" ? s = /* @__PURE__ */ l("div", {
104
+ ...n(r, "groupLabel", i),
105
+ "aria-hidden": "true",
106
+ "data-vindex": d,
107
+ children: o.label
108
+ }, "h") : f.push(Y(t.item, d)), d += 1;
109
+ }
110
+ c.push(/* @__PURE__ */ u("li", {
111
+ role: "presentation",
112
+ ...n(r, "group", i),
113
+ children: [s, f.length > 0 && /* @__PURE__ */ l("ul", {
114
+ role: "group",
115
+ "aria-label": o.label,
116
+ className: "kapisel__group-list",
117
+ children: f
118
+ })]
119
+ }, o.key));
120
+ }
121
+ return s > 0 && c.push(/* @__PURE__ */ l("li", {
122
+ role: "presentation",
123
+ "aria-hidden": !0,
124
+ style: { height: s }
125
+ }, "pad-bottom")), c;
88
126
  };
89
- return u(/* @__PURE__ */ c("div", {
90
- ref: l,
91
- className: `kapisel__menu kapisel__menu--${h}${g ? " kapisel__menu--hug" : ""}`,
92
- style: _,
127
+ return f(/* @__PURE__ */ u("div", {
128
+ ref: _,
129
+ ...n(r, "menu", i, `kapisel__menu--${v}`, y && "kapisel__menu--hug"),
130
+ style: b,
93
131
  onMouseDown: (e) => e.preventDefault(),
94
- children: [/* @__PURE__ */ c("ul", {
95
- id: v,
132
+ children: [/* @__PURE__ */ u("ul", {
133
+ id: x,
96
134
  role: "listbox",
97
- "aria-multiselectable": b || void 0,
98
- "aria-label": x,
99
- className: M ? "kapisel__list kapisel__list--virtual" : "kapisel__list",
100
- hidden: E || T,
101
- ref: F,
102
- onScroll: M ? R.onScroll : void 0,
135
+ "aria-multiselectable": C || void 0,
136
+ "aria-label": w,
137
+ ...n(r, "list", i, F && "kapisel__list--virtual"),
138
+ hidden: k || O,
139
+ ref: R,
140
+ onScroll: F ? V.onScroll : void 0,
103
141
  children: [
104
- !T && I && ((e, t, n, r, i) => {
105
- let a = [];
106
- r > 0 && a.push(/* @__PURE__ */ s("li", {
107
- role: "presentation",
108
- "aria-hidden": !0,
109
- style: { height: r }
110
- }, "pad-top"));
111
- let o = t;
112
- for (; o < n;) {
113
- let t = e[o];
114
- if (t.group === null) {
115
- t.kind === "option" && a.push(K(t.item, o)), o += 1;
116
- continue;
117
- }
118
- let r = t.group, i = null, l = [];
119
- for (; o < n && e[o].group?.key === r.key;) {
120
- let t = e[o];
121
- t.kind === "header" ? i = /* @__PURE__ */ s("div", {
122
- className: "kapisel__group-label",
123
- "aria-hidden": "true",
124
- "data-vindex": o,
125
- children: r.label
126
- }, "h") : l.push(K(t.item, o)), o += 1;
127
- }
128
- a.push(/* @__PURE__ */ c("li", {
129
- role: "presentation",
130
- className: "kapisel__group",
131
- children: [i, l.length > 0 && /* @__PURE__ */ s("ul", {
132
- role: "group",
133
- "aria-label": r.label,
134
- className: "kapisel__group-list",
135
- children: l
136
- })]
137
- }, r.key));
138
- }
139
- return i > 0 && a.push(/* @__PURE__ */ s("li", {
140
- role: "presentation",
141
- "aria-hidden": !0,
142
- style: { height: i }
143
- }, "pad-bottom")), a;
144
- })(I.rows, R.start, R.end, R.padTop, R.padBottom),
145
- !T && !I && S.map((e) => e.kind === "option" ? K(e.item) : /* @__PURE__ */ c("li", {
142
+ !O && z && X(z.rows, V.start, V.end, V.padTop, V.padBottom),
143
+ !O && !z && T.map((e) => e.kind === "option" ? Y(e.item) : /* @__PURE__ */ u("li", {
146
144
  role: "presentation",
147
- className: "kapisel__group",
148
- children: [/* @__PURE__ */ s("div", {
149
- className: "kapisel__group-label",
145
+ ...n(r, "group", i),
146
+ children: [/* @__PURE__ */ l("div", {
147
+ ...n(r, "groupLabel", i),
150
148
  "aria-hidden": "true",
151
149
  children: e.label
152
- }), /* @__PURE__ */ s("ul", {
150
+ }), /* @__PURE__ */ l("ul", {
153
151
  role: "group",
154
152
  "aria-label": e.label,
155
153
  className: "kapisel__group-list",
156
- children: e.items.map((e) => K(e))
154
+ children: e.items.map((e) => Y(e))
157
155
  })]
158
156
  }, e.key)),
159
- !I && C && K({
160
- option: C,
161
- index: w
157
+ !z && E && Y({
158
+ option: E,
159
+ index: D
162
160
  })
163
161
  ]
164
- }), D != null && D !== !1 && D !== "" && /* @__PURE__ */ s("div", {
165
- className: "kapisel__status",
162
+ }), A != null && A !== !1 && A !== "" && /* @__PURE__ */ l("div", {
163
+ ...n(r, "status", i),
166
164
  role: "status",
167
165
  "aria-live": "polite",
168
- children: D
166
+ children: A
169
167
  })]
170
- }), n);
168
+ }), d);
171
169
  };
172
170
  //#endregion
173
- export { h as KapiSelectMenu };
171
+ export { _ as KapiSelectMenu };
@@ -1,4 +1,5 @@
1
1
  import { type InputHTMLAttributes, type ReactNode, type Ref } from "react";
2
+ import { type KapiFamilyTone } from "../tone.js";
2
3
  export type KapiSliderTone = "primary" | "success" | "warning" | "danger";
3
4
  export type KapiSliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "defaultValue" | "onChange" | "min" | "max" | "step"> & {
4
5
  /** Valor actual; con él, el control es controlado. */
@@ -14,7 +15,7 @@ export type KapiSliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type"
14
15
  /** Paso entre valores. */
15
16
  step?: number | undefined;
16
17
  /** Color of the filled track and the thumb. */
17
- tone?: KapiSliderTone | undefined;
18
+ tone?: KapiSliderTone | KapiFamilyTone | undefined;
18
19
  /**
19
20
  * Etiqueta arriba del slider, en la misma fila que `showValue` (por eso no es el `<label>` de un
20
21
  * `KapiField`: el valor va a su derecha). Lo nombra con `for`.
@@ -22,6 +23,12 @@ export type KapiSliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type"
22
23
  label?: ReactNode;
23
24
  /** Ayuda / mensaje de error bajo el slider (lo envuelve en un `KapiField` sin etiqueta). */
24
25
  help?: ReactNode | undefined;
26
+ /**
27
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
28
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
29
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
30
+ */
31
+ error?: ReactNode | undefined;
25
32
  /**
26
33
  * Solo lectura: se enfoca y muestra el valor, pero no se mueve (`aria-readonly`). Sin la prop, lo
27
34
  * toma del `KapiField`.
@@ -45,7 +52,7 @@ export type KapiSliderProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type"
45
52
  };
46
53
  /** Wrapper classes. Pure and exported. */
47
54
  export declare const sliderClasses: ({ tone, disabled, readOnly, className }?: {
48
- tone?: KapiSliderTone | undefined;
55
+ tone?: KapiSliderTone | KapiFamilyTone | undefined;
49
56
  disabled?: boolean | undefined;
50
57
  readOnly?: boolean | undefined;
51
58
  className?: string | undefined;
@@ -57,4 +64,4 @@ export declare const sliderClasses: ({ tone, disabled, readOnly, className }?: {
57
64
  * `name` goes to the native range, so a native `<form>` submits the number. Inside a `KapiField`
58
65
  * (and without its own `label`) it takes the field id, help, `aria-invalid` and `aria-required`.
59
66
  */
60
- export declare const KapiSlider: ({ value: valueProp, defaultValue, onChange, min, max, step, tone, label, help, readOnly: readOnlyProp, showValue, formatValue, fieldClassName, wrapperClassName, className, style: styleProp, disabled, id, ref, invalid, required, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, ...rest }: KapiSliderProps) => ReactNode;
67
+ export declare const KapiSlider: ({ value: valueProp, defaultValue, onChange, min, max, step, tone, label, help, error, readOnly: readOnlyProp, showValue, formatValue, fieldClassName, wrapperClassName, className, style: styleProp, disabled, id, ref, invalid, required, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, ...rest }: KapiSliderProps) => ReactNode;
@@ -1,83 +1,87 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/inputsExtra.css";
3
- import { nativeFieldProps as e, resolveFieldClassName as t, resolveReadOnly as n } from "./fieldLogic.js";
4
- import { useOwnField as r } from "./ownField.js";
3
+ import { useToneLook as e } from "../../hooks/useToneFamilies.js";
4
+ import { isFamilyTone as t } from "../tone.js";
5
+ import { nativeFieldProps as n, resolveFieldClassName as r, resolveReadOnly as i } from "./fieldLogic.js";
6
+ import { useOwnField as a } from "./ownField.js";
5
7
  /* empty css */
6
- import { useControllableState as i } from "../../hooks/useControllableState.js";
7
- import { clampToStep as a, percentOf as o } from "./sliderLogic.js";
8
+ import { useControllableState as o } from "../../hooks/useControllableState.js";
9
+ import { clampToStep as s, percentOf as c } from "./sliderLogic.js";
8
10
  import "react";
9
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
11
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
12
  //#region src/components/inputs/KapiSlider.tsx
11
- var l = ({ tone: e = "primary", disabled: t = !1, readOnly: n = !1, className: r = "" } = {}) => [
13
+ var d = ({ tone: e = "primary", disabled: n = !1, readOnly: r = !1, className: i = "" } = {}) => [
12
14
  "kapi-slider",
13
- e !== "primary" && `kapi-slider--${e}`,
14
- t && "kapi-slider--disabled",
15
- n && "kapi-slider--readonly",
16
- r
17
- ].filter(Boolean).join(" "), u = ({ value: u, defaultValue: d, onChange: f, min: p = 0, max: m = 100, step: h = 1, tone: g, label: _, help: v, readOnly: y, showValue: b, formatValue: x, fieldClassName: S, wrapperClassName: C, className: w, style: T, disabled: E, id: D, ref: O, invalid: k, required: A, "aria-describedby": j, "aria-invalid": M, "aria-required": N, ...P }) => {
18
- let F = r({
19
- id: D,
20
- help: v,
21
- required: A,
22
- invalid: k,
23
- readOnly: y
24
- }), I = F.autoId, L = n(y, F.field), [R, z] = i(u, d ?? p, f), B = e(F.wraps || _ == null ? F.field : null, {
25
- id: D,
26
- describedBy: j,
27
- invalid: k,
28
- required: A,
29
- ariaInvalid: M,
30
- ariaRequired: N
31
- }), V = B.id ?? I, H = a(R, {
32
- min: p,
33
- max: m,
34
- step: h
35
- }), U = { "--kapi-slider-pct": `${o(H, p, m)}%` }, W = _ != null || b, G = x ? x(H) : void 0;
36
- return F.wrap(/* @__PURE__ */ c("div", {
37
- className: l({
38
- tone: g,
39
- disabled: E,
40
- readOnly: L,
41
- className: t(S, C)
15
+ t(e) ? "kapi-slider--family" : e !== "primary" && `kapi-slider--${e}`,
16
+ n && "kapi-slider--disabled",
17
+ r && "kapi-slider--readonly",
18
+ i
19
+ ].filter(Boolean).join(" "), f = ({ value: t, defaultValue: f, onChange: p, min: m = 0, max: h = 100, step: g = 1, tone: _, label: v, help: y, error: b, readOnly: x, showValue: S, formatValue: C, fieldClassName: w, wrapperClassName: T, className: E, style: D, disabled: O, id: k, ref: A, invalid: j, required: M, "aria-describedby": N, "aria-invalid": P, "aria-required": F, ...I }) => {
20
+ let L = a({
21
+ id: k,
22
+ help: y,
23
+ error: b,
24
+ required: M,
25
+ invalid: j,
26
+ readOnly: x
27
+ }), R = L.autoId, z = i(x, L.field), [B, V] = o(t, f ?? m, p), H = n(L.wraps || v == null ? L.field : null, {
28
+ id: k,
29
+ describedBy: N,
30
+ invalid: j,
31
+ required: M,
32
+ ariaInvalid: P,
33
+ ariaRequired: F
34
+ }), U = H.id ?? R, W = s(B, {
35
+ min: m,
36
+ max: h,
37
+ step: g
38
+ }), G = e("KapiSlider", _), K = { "--kapi-slider-pct": `${c(W, m, h)}%` }, q = v != null || S, J = C ? C(W) : void 0;
39
+ return L.wrap(/* @__PURE__ */ u("div", {
40
+ className: d({
41
+ tone: G.tone,
42
+ disabled: O,
43
+ readOnly: z,
44
+ className: r(w, T)
42
45
  }),
43
- children: [W && /* @__PURE__ */ c("div", {
46
+ children: [q && /* @__PURE__ */ u("div", {
44
47
  className: "kapi-slider__head",
45
- children: [_ != null && /* @__PURE__ */ s("label", {
46
- htmlFor: V,
47
- children: _
48
- }), b && /* @__PURE__ */ s("output", {
49
- htmlFor: V,
48
+ children: [v != null && /* @__PURE__ */ l("label", {
49
+ htmlFor: U,
50
+ children: v
51
+ }), S && /* @__PURE__ */ l("output", {
52
+ htmlFor: U,
50
53
  className: "kapi-slider__value",
51
- children: G ?? H
54
+ children: J ?? W
52
55
  })]
53
- }), /* @__PURE__ */ s("input", {
54
- ...P,
55
- ...B,
56
- ref: O,
57
- id: V,
58
- required: A,
56
+ }), /* @__PURE__ */ l("input", {
57
+ ...I,
58
+ ...H,
59
+ ref: A,
60
+ id: U,
61
+ required: M,
59
62
  type: "range",
60
- className: ["kapi-slider__input", w].filter(Boolean).join(" "),
61
- min: p,
62
- max: m,
63
- step: h,
64
- value: H,
65
- "aria-valuetext": G,
66
- "aria-readonly": L || void 0,
67
- disabled: E,
63
+ className: ["kapi-slider__input", E].filter(Boolean).join(" "),
64
+ min: m,
65
+ max: h,
66
+ step: g,
67
+ value: W,
68
+ "aria-valuetext": J,
69
+ "aria-readonly": z || void 0,
70
+ disabled: O,
68
71
  style: {
69
- ...T,
70
- ...U
72
+ ...G.style,
73
+ ...D,
74
+ ...K
71
75
  },
72
76
  onChange: (e) => {
73
- L || z(a(Number(e.target.value), {
74
- min: p,
75
- max: m,
76
- step: h
77
+ z || V(s(Number(e.target.value), {
78
+ min: m,
79
+ max: h,
80
+ step: g
77
81
  }));
78
82
  }
79
83
  })]
80
84
  }));
81
85
  };
82
86
  //#endregion
83
- export { u as KapiSlider, l as sliderClasses };
87
+ export { f as KapiSlider, d as sliderClasses };
@@ -52,6 +52,12 @@ export type KapiTagInputProps = Omit<HTMLAttributes<HTMLDivElement>, "children"
52
52
  label?: ReactNode | undefined;
53
53
  /** Ayuda / mensaje de error bajo el control (lo envuelve en un `KapiField`). */
54
54
  help?: ReactNode | undefined;
55
+ /**
56
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
57
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
58
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
59
+ */
60
+ error?: ReactNode | undefined;
55
61
  /** Clase del `KapiField` propio (con `label` o `help`). `className` va al contenedor. */
56
62
  fieldClassName?: string | undefined;
57
63
  /**
@@ -86,5 +92,5 @@ export declare const tagInputClasses: ({ size, invalid, disabled, readOnly, clas
86
92
  * texto vacío quita la última. `validate`, `maxTags` y los duplicados rechazan con un mensaje y dejan el
87
93
  * texto para corregirlo.
88
94
  */
89
- export declare function KapiTagInput({ value, defaultValue, onChange, validate, maxTags, allowDuplicates, caseSensitive, placeholder, disabled, size, name, id, invalid, required, label, help, fieldClassName, readOnly: readOnlyProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onBlur, ref, labels, className, onClick, ...rest }: KapiTagInputProps): ReactNode;
95
+ export declare function KapiTagInput({ value, defaultValue, onChange, validate, maxTags, allowDuplicates, caseSensitive, placeholder, disabled, size, name, id, invalid, required, label, help, error: errorProp, fieldClassName, readOnly: readOnlyProp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onBlur, ref, labels, className, onClick, ...rest }: KapiTagInputProps): ReactNode;
90
96
  export {};