@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,58 +1,63 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/KapiButton.css";
3
- import { renderSlot as e } from "../renderSlot.js";
4
- import { buttonLookModifier as t, resolveButtonLook as n } from "../tone.js";
3
+ import { useToneLook as e } from "../../hooks/useToneFamilies.js";
4
+ import { renderSlot as t } from "../renderSlot.js";
5
+ import { buttonLookModifier as n, isFamilyTone as r, resolveButtonLook as i } from "../tone.js";
5
6
  /* empty css */
6
- import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
7
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
8
  //#region src/components/inputs/KapiButton.tsx
8
- var o = ({ tone: e, variant: r, size: i = "md", iconOnly: a = !1, bordered: o = !1, loading: s = !1, className: c = "" } = {}) => {
9
- let l = t(n(e, r));
9
+ var c = ({ tone: e, variant: t, size: a = "md", iconOnly: o = !1, bordered: s = !1, loading: c = !1, className: l = "" } = {}) => {
10
+ let u = r(e) ? `family-${i(void 0, t).appearance}` : n(i(e, t));
10
11
  return [
11
12
  "kapi-btn",
12
- l !== null && `kapi-btn--${l}`,
13
- i !== "md" && `kapi-btn--${i}`,
14
- a && "kapi-btn--iconbtn",
15
- o && "kapi-btn--bordered",
16
- s && "is-loading",
17
- c
13
+ u !== null && `kapi-btn--${u}`,
14
+ a !== "md" && `kapi-btn--${a}`,
15
+ o && "kapi-btn--iconbtn",
16
+ s && "kapi-btn--bordered",
17
+ c && "is-loading",
18
+ l
18
19
  ].filter(Boolean).join(" ");
19
- }, s = ({ tone: t, variant: n, size: s = "md", iconOnly: c = !1, bordered: l = !1, icon: u, loading: d = !1, disabled: f, className: p, type: m = "button", children: h, ref: g, render: _, ...v }) => {
20
- let y = d || f, b = d ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("span", {
20
+ }, l = ({ tone: n, variant: r, size: i = "md", iconOnly: l = !1, bordered: u = !1, icon: d, loading: f = !1, disabled: p, className: m, style: h, type: g = "button", children: _, ref: v, render: y, ...b }) => {
21
+ let x = e("KapiButton", n), S = f || p, C = f ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
21
22
  className: "kapi-spinner kapi-btn__spinner",
22
23
  "aria-hidden": "true"
23
- }), /* @__PURE__ */ a("span", {
24
+ }), /* @__PURE__ */ s("span", {
24
25
  className: "kapi-btn__content",
25
- children: [u, h]
26
- })] }) : /* @__PURE__ */ a(r, { children: [u, h] }), x = {
27
- className: o({
28
- tone: t,
29
- variant: n,
30
- size: s,
31
- iconOnly: c,
32
- bordered: l,
33
- loading: d,
34
- className: p
26
+ children: [d, _]
27
+ })] }) : /* @__PURE__ */ s(a, { children: [d, _] }), w = {
28
+ className: c({
29
+ tone: x.tone,
30
+ variant: r,
31
+ size: i,
32
+ iconOnly: l,
33
+ bordered: u,
34
+ loading: f,
35
+ className: m
35
36
  }),
36
- ...v
37
+ ...x.style || h ? { style: {
38
+ ...x.style,
39
+ ...h
40
+ } } : {},
41
+ ...b
37
42
  };
38
- return _ === void 0 ? /* @__PURE__ */ i("button", {
39
- ref: g,
40
- type: m,
41
- ...x,
42
- disabled: y,
43
- ...d ? { "aria-busy": !0 } : {},
44
- children: b
45
- }) : e(_, x, {
46
- "aria-disabled": y || void 0,
47
- "aria-busy": d || void 0,
48
- onClick: y ? (e) => e.preventDefault() : void 0,
49
- ref: g,
50
- children: b
51
- }, (e) => /* @__PURE__ */ i("button", {
43
+ return y === void 0 ? /* @__PURE__ */ o("button", {
44
+ ref: v,
45
+ type: g,
46
+ ...w,
47
+ disabled: S,
48
+ ...f ? { "aria-busy": !0 } : {},
49
+ children: C
50
+ }) : t(y, w, {
51
+ "aria-disabled": S || void 0,
52
+ "aria-busy": f || void 0,
53
+ onClick: S ? (e) => e.preventDefault() : void 0,
54
+ ref: v,
55
+ children: C
56
+ }, (e) => /* @__PURE__ */ o("button", {
52
57
  ...e,
53
- type: m,
54
- children: b
58
+ type: g,
59
+ children: C
55
60
  }));
56
61
  };
57
62
  //#endregion
58
- export { s as KapiButton, o as buttonClasses };
63
+ export { l as KapiButton, c as buttonClasses };
@@ -37,6 +37,12 @@ export type KapiChecklistProps<Id extends string = string> = Omit<HTMLAttributes
37
37
  label?: ReactNode | undefined;
38
38
  /** Ayuda / mensaje de error bajo la lista (la envuelve en un `KapiField` sin etiqueta). */
39
39
  help?: ReactNode | undefined;
40
+ /**
41
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
42
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
43
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
44
+ */
45
+ error?: ReactNode | undefined;
40
46
  /** Clase del `KapiField` propio (con `help`). `className` va a la raíz de la lista. */
41
47
  fieldClassName?: string | undefined;
42
48
  /**
@@ -74,4 +80,4 @@ export type KapiChecklistProps<Id extends string = string> = Omit<HTMLAttributes
74
80
  * desde el último alternado, Shift + flechas extienden la selección y Ctrl/Cmd + A marca o desmarca
75
81
  * todo lo visible. Tipear con la lista enfocada escribe en el buscador.
76
82
  */
77
- export declare function KapiChecklist<Id extends string = string>({ items, value, defaultValue, onChange, label, help, fieldClassName, readOnly: readOnlyProp, invalid, required, searchable, query: queryProp, defaultQuery, onQueryChange, selectAll, rangeSelect, disabled, labels, className, "aria-label": ariaLabel, ...rest }: KapiChecklistProps<Id>): ReactNode;
83
+ export declare function KapiChecklist<Id extends string = string>({ items, value, defaultValue, onChange, label, help, error, fieldClassName, readOnly: readOnlyProp, invalid, required, searchable, query: queryProp, defaultQuery, onQueryChange, selectAll, rangeSelect, disabled, labels, className, "aria-label": ariaLabel, ...rest }: KapiChecklistProps<Id>): ReactNode;
@@ -1,37 +1,38 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/KapiChecklist.css";
3
3
  import { joinClasses as e } from "../rootProps.js";
4
- import { fieldControlProps as t, resolveReadOnly as n } from "./fieldLogic.js";
5
- import { useOwnField as r } from "./ownField.js";
6
- import { useLabels as i } from "../locale/KapiLocaleProvider.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";
7
7
  import { KapiInput as ee } from "./KapiInput.js";
8
+ import { useControllableState as a } from "../../hooks/useControllableState.js";
8
9
  import { useRangeSelect as te } from "../../hooks/useRangeSelect.js";
9
- import { navKeyOf as ne, nextEnabledIndex as a } from "../overlays/menuKeyboardLogic.js";
10
- import { checklistBulkState as re, filterChecklistItems as o, orderedChecklistValue as s, setChecklistItems as ie } from "./checklistLogic.js";
10
+ import { navKeyOf as ne, nextEnabledIndex as o } from "../overlays/menuKeyboardLogic.js";
11
+ import { checklistBulkState as re, filterChecklistItems as ie, orderedChecklistValue as ae, setChecklistItems as oe } from "./checklistLogic.js";
11
12
  /* empty css */
12
- import { useControllableState as c } from "../../hooks/useControllableState.js";
13
- import { useEffect as ae, useId as oe, useMemo as l, useRef as u, useState as se } from "react";
14
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
15
- import { Check as ce, Search as p } from "lucide-react";
13
+ import { useEffect as se, useId as ce, useMemo as s, useRef as c, useState as l } from "react";
14
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
15
+ import { Check as f, Search as le } from "lucide-react";
16
16
  //#region src/components/inputs/KapiChecklist.tsx
17
- var m = {
17
+ var p = {
18
18
  search: "Buscar en la lista",
19
19
  searchPlaceholder: "Buscar…",
20
20
  selectAll: "Marcar todo",
21
21
  clearAll: "Desmarcar todo",
22
22
  empty: "Sin coincidencias"
23
- }, h = 7;
24
- function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help: ue, fieldClassName: de, readOnly: y, invalid: b, required: x, searchable: S, query: C, defaultQuery: w, onQueryChange: fe, selectAll: pe = !1, rangeSelect: T = !0, disabled: E = !1, labels: me, className: he, "aria-label": ge, ..._e }) {
25
- let D = i("checklist", m, me), O = r({
26
- help: ue,
27
- required: x,
28
- invalid: b,
29
- readOnly: y,
30
- fieldClassName: de
31
- }), k = O.field, A = n(y, k), j = oe(), M = `${j}-label`, N = u(null), P = u(null), [F, ve] = c(g, le ?? [], _), I = l(() => new Set(F), [F]), L = (e) => {
32
- A || ve(s(h, e));
33
- }, [R, z] = c(C, w ?? "", fe), B = S ?? h.length > 7, V = l(() => o(h, R), [h, R]), H = l(() => V.map((e) => e.id), [V]), U = l(() => E ? [] : V.flatMap((e, t) => e.disabled ? [] : [t]), [V, E]), W = (e) => !E && h.some((t) => t.id === e && !t.disabled), G = te(), [K, q] = se(null), J = K === null ? -1 : H.indexOf(K), Y = (e) => `${j}-opt-${h.findIndex((t) => t.id === e)}`;
34
- ae(() => {
23
+ }, m = 7;
24
+ function h({ items: m, value: h, defaultValue: ue, onChange: de, label: g, help: fe, error: _, fieldClassName: pe, readOnly: v, invalid: y, required: b, searchable: x, query: S, defaultQuery: C, onQueryChange: w, selectAll: me = !1, rangeSelect: T = !0, disabled: E = !1, labels: he, className: ge, "aria-label": _e, ...ve }) {
25
+ let D = t("checklist", p, he), O = i({
26
+ help: fe,
27
+ error: _,
28
+ required: b,
29
+ invalid: y,
30
+ readOnly: v,
31
+ fieldClassName: pe
32
+ }), k = O.field, A = r(v, k), j = ce(), M = `${j}-label`, N = c(null), P = c(null), [F, ye] = a(h, ue ?? [], de), I = s(() => new Set(F), [F]), L = (e) => {
33
+ A || ye(ae(m, e));
34
+ }, [R, z] = a(S, C ?? "", w), B = x ?? m.length > 7, V = s(() => ie(m, R), [m, R]), H = s(() => V.map((e) => e.id), [V]), U = s(() => E ? [] : V.flatMap((e, t) => e.disabled ? [] : [t]), [V, E]), W = (e) => !E && m.some((t) => t.id === e && !t.disabled), G = te(), [K, q] = l(null), J = K === null ? -1 : H.indexOf(K), Y = (e) => `${j}-opt-${m.findIndex((t) => t.id === e)}`;
35
+ se(() => {
35
36
  J < 0 || N.current?.querySelector(`[data-index="${J}"]`)?.scrollIntoView?.({ block: "nearest" });
36
37
  }, [J]);
37
38
  let X = (e, t) => {
@@ -43,13 +44,13 @@ function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help:
43
44
  isSelectable: W
44
45
  }));
45
46
  }, Z = re(V, I), Q = (e) => {
46
- E || L(ie(h, I, H, e));
47
- }, ye = (e) => {
47
+ E || L(oe(m, I, H, e));
48
+ }, be = (e) => {
48
49
  if (E) return;
49
50
  let t = ne(e.key, "vertical");
50
51
  if (t) {
51
52
  e.preventDefault();
52
- let n = a(J, t, U);
53
+ let n = o(J, t, U);
53
54
  if (n < 0) return;
54
55
  let r = t === "next" && n < J || t === "prev" && n > J;
55
56
  if (e.shiftKey && T && J >= 0) {
@@ -65,22 +66,22 @@ function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help:
65
66
  }
66
67
  q(H[n]);
67
68
  } else e.key === " " || e.key === "Enter" ? (e.preventDefault(), K !== null && J >= 0 && X(K, e.shiftKey)) : (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a" ? (e.preventDefault(), Q(Z !== "all")) : B && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey && (e.preventDefault(), z(R + e.key), P.current?.focus());
68
- }, be = () => {
69
+ }, xe = () => {
69
70
  J < 0 && U.length > 0 && q(H[U[0]]), N.current?.focus();
70
- }, xe = v == null ? { "aria-label": ge } : { "aria-labelledby": M }, $ = t(k, {
71
- invalid: b,
72
- required: x
71
+ }, Se = g == null ? { "aria-label": _e } : { "aria-labelledby": M }, $ = n(k, {
72
+ invalid: y,
73
+ required: b
73
74
  });
74
- return O.wrap(/* @__PURE__ */ f("div", {
75
- ..._e,
76
- className: e("kapi-checklist", E && "is-disabled", A && "is-readonly", he),
75
+ return O.wrap(/* @__PURE__ */ d("div", {
76
+ ...ve,
77
+ className: e("kapi-checklist", E && "is-disabled", A && "is-readonly", ge),
77
78
  children: [
78
- v != null && /* @__PURE__ */ d("div", {
79
+ g != null && /* @__PURE__ */ u("div", {
79
80
  id: M,
80
81
  className: "kapi-checklist__label",
81
- children: v
82
+ children: g
82
83
  }),
83
- B && /* @__PURE__ */ d(ee, {
84
+ B && /* @__PURE__ */ u(ee, {
84
85
  ref: P,
85
86
  type: "search",
86
87
  size: "sm",
@@ -88,30 +89,30 @@ function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help:
88
89
  "aria-label": D.search,
89
90
  placeholder: D.searchPlaceholder,
90
91
  spellCheck: !1,
91
- startIcon: /* @__PURE__ */ d(p, {}),
92
+ startIcon: /* @__PURE__ */ u(le, {}),
92
93
  clearable: !0,
93
94
  disabled: E,
94
95
  value: R,
95
96
  onChange: (e) => z(e.target.value),
96
97
  onKeyDown: (e) => {
97
- (e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), be());
98
+ (e.key === "ArrowDown" || e.key === "Enter") && (e.preventDefault(), xe());
98
99
  }
99
100
  }),
100
- pe && /* @__PURE__ */ f("div", {
101
+ me && /* @__PURE__ */ d("div", {
101
102
  className: "kapi-checklist__bulk",
102
- children: [/* @__PURE__ */ d("button", {
103
+ children: [/* @__PURE__ */ u("button", {
103
104
  type: "button",
104
105
  disabled: E || A || Z === "all",
105
106
  onClick: () => Q(!0),
106
107
  children: D.selectAll
107
- }), /* @__PURE__ */ d("button", {
108
+ }), /* @__PURE__ */ u("button", {
108
109
  type: "button",
109
110
  disabled: E || A || Z === "none",
110
111
  onClick: () => Q(!1),
111
112
  children: D.clearAll
112
113
  })]
113
114
  }),
114
- V.length > 0 ? /* @__PURE__ */ d("div", {
115
+ V.length > 0 ? /* @__PURE__ */ u("div", {
115
116
  ref: N,
116
117
  role: "listbox",
117
118
  "aria-multiselectable": "true",
@@ -123,14 +124,14 @@ function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help:
123
124
  "aria-activedescendant": J >= 0 && K !== null ? Y(K) : void 0,
124
125
  tabIndex: E ? -1 : 0,
125
126
  className: "kapi-checklist__list",
126
- onKeyDown: ye,
127
+ onKeyDown: be,
127
128
  onFocus: (e) => {
128
129
  e.target === e.currentTarget && J < 0 && U.length > 0 && q(H[U[0]]);
129
130
  },
130
- ...xe,
131
+ ...Se,
131
132
  children: V.map((t, n) => {
132
133
  let r = I.has(t.id), i = E || t.disabled === !0;
133
- return /* @__PURE__ */ f("div", {
134
+ return /* @__PURE__ */ d("div", {
134
135
  id: Y(t.id),
135
136
  "data-index": n,
136
137
  role: "option",
@@ -144,32 +145,32 @@ function g({ items: h, value: g, defaultValue: le, onChange: _, label: v, help:
144
145
  onClick: (e) => {
145
146
  i || (q(t.id), X(t.id, e.shiftKey));
146
147
  },
147
- children: [/* @__PURE__ */ d("span", {
148
+ children: [/* @__PURE__ */ u("span", {
148
149
  className: "kapi-checklist__box",
149
150
  "aria-hidden": "true",
150
- children: r && /* @__PURE__ */ d(ce, {
151
+ children: r && /* @__PURE__ */ u(f, {
151
152
  size: 12,
152
153
  strokeWidth: 3
153
154
  })
154
- }), /* @__PURE__ */ f("span", {
155
+ }), /* @__PURE__ */ d("span", {
155
156
  className: "kapi-checklist__text",
156
- children: [/* @__PURE__ */ d("span", {
157
+ children: [/* @__PURE__ */ u("span", {
157
158
  className: "kapi-checklist__name",
158
159
  children: t.label
159
- }), t.description != null && /* @__PURE__ */ d("span", {
160
+ }), t.description != null && /* @__PURE__ */ u("span", {
160
161
  className: "kapi-checklist__desc",
161
162
  children: t.description
162
163
  })]
163
164
  })]
164
165
  }, t.id);
165
166
  })
166
- }) : /* @__PURE__ */ d("div", {
167
+ }) : /* @__PURE__ */ u("div", {
167
168
  className: "kapi-checklist__empty",
168
169
  role: "status",
169
- children: h.length > 0 ? D.empty : null
170
+ children: m.length > 0 ? D.empty : null
170
171
  })
171
172
  ]
172
173
  }));
173
174
  }
174
175
  //#endregion
175
- export { h as CHECKLIST_SEARCH_THRESHOLD, m as DEFAULT_CHECKLIST_LABELS, g as KapiChecklist };
176
+ export { m as CHECKLIST_SEARCH_THRESHOLD, p as DEFAULT_CHECKLIST_LABELS, h as KapiChecklist };
@@ -0,0 +1,40 @@
1
+ import { type ReactNode, type Ref } from "react";
2
+ import type { KapiLabelsOverride } from "../labelsLogic.js";
3
+ import { type KapiButtonProps } from "./KapiButton.js";
4
+ export type KapiCopyButtonLabels = {
5
+ /** Nombre del botón en reposo. */
6
+ copy: string;
7
+ /** Nombre y texto mientras muestra que copió. */
8
+ copied: string;
9
+ };
10
+ export declare const DEFAULT_COPY_BUTTON_LABELS: KapiCopyButtonLabels;
11
+ /** Cuánto dura el «Copiado» antes de volver al estado normal. */
12
+ export declare const COPY_FEEDBACK_MS = 2000;
13
+ /** Lo de `KapiButton` (tono, variante, tamaño, `render`…) más lo propio. */
14
+ export type KapiCopyButtonProps = Omit<KapiButtonProps, "onClick" | "children" | "icon"> & {
15
+ /** Ref al `<button>`. */
16
+ ref?: Ref<HTMLButtonElement> | undefined;
17
+ /** Lo que se copia. */
18
+ value: string;
19
+ /** Texto del botón. Sin esto queda sólo el ícono, con el nombre del locale. */
20
+ children?: ReactNode;
21
+ /**
22
+ * Avisa el resultado REAL: `true` si el portapapeles aceptó, `false` si no había portapapeles o
23
+ * rechazó. No es un «se intentó»: con `false` el botón tampoco confirma.
24
+ */
25
+ onCopy?: ((ok: boolean) => void) | undefined;
26
+ /** Textos propios (`copy`, `copied`). */
27
+ labels?: KapiLabelsOverride<KapiCopyButtonLabels> | undefined;
28
+ };
29
+ /**
30
+ * Botón que copia un valor y **confirma sólo si copió de verdad**.
31
+ *
32
+ * Eso último es todo el componente. El portapapeles pide contexto seguro y permiso: en http sin
33
+ * TLS `navigator.clipboard` ni existe, y la promesa puede rechazar. Un botón que dice «Copiado»
34
+ * pase lo que pase es peor que uno que no dice nada, porque la persona se va creyendo que tiene el
35
+ * valor y lo descubre al pegar.
36
+ *
37
+ * La confirmación vuelve sola a los 2 s (`COPY_FEEDBACK_MS`) y el temporizador se limpia al
38
+ * desmontar.
39
+ */
40
+ export declare function KapiCopyButton({ value, children, onCopy, labels, ref, ...rest }: KapiCopyButtonProps): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { KapiButton as e } from "./KapiButton.js";
3
+ import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
4
+ import { useLabels as n } from "../locale/KapiLocaleProvider.js";
5
+ import { copyText as r } from "./copyLogic.js";
6
+ import { present as i } from "./inputLogic.js";
7
+ import { useEffect as a, useRef as o, useState as s } from "react";
8
+ import { jsx as c } from "react/jsx-runtime";
9
+ import { Check as l, Copy as u } from "lucide-react";
10
+ //#region src/components/inputs/KapiCopyButton.tsx
11
+ var d = {
12
+ copy: "Copiar",
13
+ copied: "Copiado"
14
+ }, f = 2e3;
15
+ function p({ value: p, children: m, onCopy: h, labels: g, ref: _, ...v }) {
16
+ let y = n("copyButton", d, g), [b, x] = s(!1), S = o(null), C = o(void 0), w = o(!0), T = t(S, _);
17
+ a(() => (w.current = !0, () => {
18
+ w.current = !1, clearTimeout(C.current);
19
+ }), []);
20
+ let E = async () => {
21
+ let e = await r(p, S.current);
22
+ w.current && (h?.(e), e && (x(!0), clearTimeout(C.current), C.current = setTimeout(() => x(!1), f)));
23
+ }, D = i(m), O = b ? y.copied : y.copy;
24
+ return /* @__PURE__ */ c(e, {
25
+ ...v,
26
+ ref: T,
27
+ icon: c(b ? l : u, { "aria-hidden": "true" }),
28
+ iconOnly: !D,
29
+ "aria-label": D && !b ? void 0 : O,
30
+ onClick: () => void E(),
31
+ children: D ? b ? y.copied : m : void 0
32
+ });
33
+ }
34
+ //#endregion
35
+ export { f as COPY_FEEDBACK_MS, d as DEFAULT_COPY_BUTTON_LABELS, p as KapiCopyButton };
@@ -37,6 +37,12 @@ export type KapiDatePickerProps = {
37
37
  label?: ReactNode | undefined;
38
38
  /** Ayuda / mensaje de error bajo el campo (envuelve el picker en un `KapiField`). */
39
39
  help?: ReactNode | undefined;
40
+ /**
41
+ * El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
42
+ * `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
43
+ * Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
44
+ */
45
+ error?: ReactNode | undefined;
40
46
  /** Clase del `KapiField` propio (con `label` o `help`). `className` va al envoltorio del picker. */
41
47
  fieldClassName?: string | undefined;
42
48
  /**
@@ -87,4 +93,4 @@ export type KapiDatePickerProps = {
87
93
  * Con `label` o `icon` el campo se dibuja como el chip de `KapiDropdown` (la misma clase
88
94
  * `.kapi-filterchip`), para una fila de filtros que mezcle los dos.
89
95
  */
90
- export declare const KapiDatePicker: ({ mode, value, defaultValue, onChange, placeholder, variant, icon, chipLabel: chipLabelProp, label: labelProp, help, fieldClassName, readOnly: readOnlyProp, disabled, id, name, className, style, "aria-label": ariaLabel, labels, minuteStep, invalid, required, ref, onBlur: onBlurProp, weekStartsOn }: KapiDatePickerProps) => ReactNode;
96
+ export declare const KapiDatePicker: ({ mode, value, defaultValue, onChange, placeholder, variant, icon, chipLabel: chipLabelProp, label: labelProp, help, error, fieldClassName, readOnly: readOnlyProp, disabled, id, name, className, style, "aria-label": ariaLabel, labels, minuteStep, invalid, required, ref, onBlur: onBlurProp, weekStartsOn }: KapiDatePickerProps) => ReactNode;