@kapiuara/ui 0.14.0 → 0.15.1

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 (118) hide show
  1. package/README.md +234 -1
  2. package/dist/components/chat/KapiChatList.js +19 -19
  3. package/dist/components/chat/KapiChatThread.js +23 -23
  4. package/dist/components/chat/KapiComposer.js +19 -19
  5. package/dist/components/chat/KapiMessageBubble.js +4 -4
  6. package/dist/components/chat/KapiTypingIndicator.js +4 -4
  7. package/dist/components/closeReason.d.ts +34 -0
  8. package/dist/components/data/KapiBarChart.js +1 -1
  9. package/dist/components/data/KapiDataTable.js +31 -31
  10. package/dist/components/data/KapiEventCalendar.js +78 -78
  11. package/dist/components/data/KapiHeatmap.js +23 -23
  12. package/dist/components/data/KapiLineChart.js +1 -1
  13. package/dist/components/data/KapiPagination.js +4 -4
  14. package/dist/components/data/KapiSparkline.js +1 -1
  15. package/dist/components/data/KapiTable.js +122 -122
  16. package/dist/components/data/KapiTableFilter.js +18 -18
  17. package/dist/components/data/KapiTableRow.js +24 -24
  18. package/dist/components/data/KapiTableToolbar.js +49 -49
  19. package/dist/components/data/chartFrame.js +21 -21
  20. package/dist/components/data/useColumnResize.js +8 -8
  21. package/dist/components/data/useTableSelection.js +8 -8
  22. package/dist/components/display/KapiAnnotation.js +53 -53
  23. package/dist/components/display/KapiComment.js +4 -4
  24. package/dist/components/display/KapiCommentComposer.js +16 -16
  25. package/dist/components/display/KapiFileItem.js +6 -6
  26. package/dist/components/display/KapiFileViewer.js +9 -9
  27. package/dist/components/display/KapiTruncate.js +7 -7
  28. package/dist/components/feedback/KapiAlert.d.ts +2 -1
  29. package/dist/components/feedback/KapiAlert.js +8 -8
  30. package/dist/components/feedback/KapiCountdown.js +8 -8
  31. package/dist/components/feedback/KapiFab.js +31 -31
  32. package/dist/components/feedback/KapiOfflineBanner.js +8 -8
  33. package/dist/components/feedback/KapiToastContainer.js +21 -21
  34. package/dist/components/feedback/KapiTour.d.ts +2 -1
  35. package/dist/components/feedback/KapiTour.js +32 -32
  36. package/dist/components/inputs/KapiAutocomplete.js +14 -14
  37. package/dist/components/inputs/KapiButton.d.ts +17 -1
  38. package/dist/components/inputs/KapiButton.js +41 -25
  39. package/dist/components/inputs/KapiCalendar.js +5 -5
  40. package/dist/components/inputs/KapiCalendarGrid.js +10 -10
  41. package/dist/components/inputs/KapiChecklist.js +71 -71
  42. package/dist/components/inputs/KapiDatePicker.js +28 -28
  43. package/dist/components/inputs/KapiDateRangePicker.js +27 -27
  44. package/dist/components/inputs/KapiFacetedSearch.js +24 -24
  45. package/dist/components/inputs/KapiField.js +14 -14
  46. package/dist/components/inputs/KapiFileUpload.js +27 -27
  47. package/dist/components/inputs/KapiIconButton.d.ts +9 -1
  48. package/dist/components/inputs/KapiIconButton.js +27 -10
  49. package/dist/components/inputs/KapiInput.js +21 -21
  50. package/dist/components/inputs/KapiInputGroup.js +8 -8
  51. package/dist/components/inputs/KapiMaskedInput.js +22 -22
  52. package/dist/components/inputs/KapiNumberStepper.js +12 -12
  53. package/dist/components/inputs/KapiRating.js +1 -1
  54. package/dist/components/inputs/KapiSearchChip.js +8 -8
  55. package/dist/components/inputs/KapiSegmented.js +27 -27
  56. package/dist/components/inputs/KapiSelect.js +166 -166
  57. package/dist/components/inputs/KapiSelectMenu.js +60 -60
  58. package/dist/components/inputs/KapiSlider.js +1 -1
  59. package/dist/components/inputs/KapiSwitch.js +6 -6
  60. package/dist/components/inputs/KapiTagInput.js +22 -22
  61. package/dist/components/inputs/KapiTextarea.js +8 -8
  62. package/dist/components/inputs/ownField.js +4 -4
  63. package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
  64. package/dist/components/layout/KapiAccountMenu.js +51 -51
  65. package/dist/components/layout/KapiContextSlot.js +35 -35
  66. package/dist/components/layout/KapiMasonry.js +6 -6
  67. package/dist/components/layout/KapiNotificationBell.js +60 -60
  68. package/dist/components/layout/KapiPageHeader.js +19 -19
  69. package/dist/components/layout/KapiRail.js +60 -60
  70. package/dist/components/layout/KapiRailAccount.js +9 -9
  71. package/dist/components/layout/KapiRoot.js +21 -21
  72. package/dist/components/layout/KapiScrollArea.js +11 -11
  73. package/dist/components/layout/KapiShell.js +12 -12
  74. package/dist/components/locale/KapiLocaleProvider.js +13 -13
  75. package/dist/components/navigation/KapiAccordion.js +12 -12
  76. package/dist/components/navigation/KapiBreadcrumb.js +11 -11
  77. package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
  78. package/dist/components/navigation/KapiContextPanel.js +76 -76
  79. package/dist/components/navigation/KapiFilterChips.js +9 -9
  80. package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
  81. package/dist/components/navigation/KapiNavBadge.js +11 -10
  82. package/dist/components/navigation/KapiPanelGroup.js +25 -25
  83. package/dist/components/navigation/KapiSteps.js +4 -4
  84. package/dist/components/navigation/KapiTabs.d.ts +4 -1
  85. package/dist/components/navigation/KapiTabs.js +18 -17
  86. package/dist/components/navigation/KapiTree.js +72 -72
  87. package/dist/components/navigation/KapiWizard.d.ts +2 -1
  88. package/dist/components/navigation/KapiWizard.js +30 -30
  89. package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
  90. package/dist/components/overlays/KapiCanvasForm.js +12 -12
  91. package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
  92. package/dist/components/overlays/KapiCommandPalette.js +23 -23
  93. package/dist/components/overlays/KapiConfirm.d.ts +2 -1
  94. package/dist/components/overlays/KapiConfirm.js +12 -12
  95. package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
  96. package/dist/components/overlays/KapiContextMenu.js +15 -15
  97. package/dist/components/overlays/KapiDialogHost.js +22 -22
  98. package/dist/components/overlays/KapiLoading.js +16 -16
  99. package/dist/components/overlays/KapiMenuButton.js +12 -12
  100. package/dist/components/overlays/KapiModal.d.ts +2 -1
  101. package/dist/components/overlays/KapiModal.js +28 -28
  102. package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
  103. package/dist/components/overlays/KapiOffcanvas.js +63 -63
  104. package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
  105. package/dist/components/overlays/KapiPhotoView.js +14 -14
  106. package/dist/components/overlays/KapiPopover.d.ts +2 -1
  107. package/dist/components/overlays/KapiPopover.js +7 -7
  108. package/dist/components/overlays/KapiShapeSheet.js +17 -17
  109. package/dist/components/overlays/KapiSplitModal.js +29 -29
  110. package/dist/components/overlays/KapiTooltip.js +20 -20
  111. package/dist/components/overlays/menuList.js +60 -60
  112. package/dist/components/overlays/useNativeDialog.d.ts +5 -0
  113. package/dist/components/overlays/useNativeDialog.js +2 -2
  114. package/dist/components/renderSlot.d.ts +27 -0
  115. package/dist/components/renderSlot.js +23 -0
  116. package/dist/hooks/portalRoot.js +6 -6
  117. package/dist/index.d.ts +2 -0
  118. package/package.json +1 -1
@@ -15,8 +15,8 @@ import { KapiCalendarGrid as ge } from "./KapiCalendarGrid.js";
15
15
  import { useCalendarFocus as _e } from "./useCalendarFocus.js";
16
16
  import { useDatePopSide as ve } from "./useDatePopSide.js";
17
17
  import { EMPTY_RANGE as i, formatRange as a, isCompleteRange as ye, maskRangeInput as be, openEndedDay as xe, parseRangeText as Se, pickRangeDay as Ce, rangeDayState as o, rangePlaceholder as we, sameRange as Te, validRange as Ee } from "./dateRangeLogic.js";
18
- import { Fragment as De, jsx as s, jsxs as c } from "react/jsx-runtime";
19
- import { useId as Oe, useMemo as l, useRef as u, useState as d } from "react";
18
+ import { useId as De, useMemo as s, useRef as c, useState as l } from "react";
19
+ import { Fragment as Oe, jsx as u, jsxs as d } from "react/jsx-runtime";
20
20
  import { Calendar as ke, ChevronLeft as Ae, ChevronRight as je } from "lucide-react";
21
21
  //#region src/components/inputs/KapiDateRangePicker.tsx
22
22
  var f = {
@@ -26,7 +26,7 @@ var f = {
26
26
  openEnd: "Desde esta fecha",
27
27
  openStart: "Hasta esta fecha"
28
28
  }, Me = (e) => `${e.from?.getTime() ?? ""}-${e.to?.getTime() ?? ""}`, p = ({ value: n, defaultValue: p, onChange: Ne, placeholder: Pe, variant: Fe, icon: m, chipLabel: h, label: g, help: Ie, fieldClassName: Le, readOnly: _, disabled: v = !1, id: y, name: b, className: Re, style: ze, "aria-label": Be, labels: Ve, invalid: He, required: x, ref: Ue, onBlur: We, weekStartsOn: Ge }) => {
29
- let S = re(), C = l(() => pe(S), [S]), w = Pe ?? we(C), Ke = l(() => S ? {
29
+ let S = re(), C = s(() => pe(S), [S]), w = Pe ?? we(C), Ke = s(() => S ? {
30
30
  ...f,
31
31
  ...de(S)
32
32
  } : f, [S]), T = ie("calendar", Ke, Ve), E = he({
@@ -46,7 +46,7 @@ var f = {
46
46
  invalid: He,
47
47
  readOnly: _,
48
48
  fieldClassName: Le
49
- }), k = O.field, A = te(_, k), Je = Oe(), j = y ?? k?.controlId ?? (E ? Je : void 0), [M, N] = d(!1), Ye = n !== void 0, [P, Xe, , Ze] = oe(n === void 0 ? void 0 : Ee(n), Ee(p ?? i), Ne), [F, I] = d(P), [Qe, L] = d(null), [R, z] = d(() => a(P, C)), [B, V] = d(() => P.from ?? /* @__PURE__ */ new Date()), H = u(null), $e = le(H, ce(Ze)), U = u(null), W = u(null), { inputRef: et, focusRequest: tt, openFromKeyboard: G, openFromFocus: nt, returnFocus: K } = _e(N), q = Me(P), [rt, it] = d(q), [at, ot] = d(C);
49
+ }), k = O.field, A = te(_, k), Je = De(), j = y ?? k?.controlId ?? (E ? Je : void 0), [M, N] = l(!1), Ye = n !== void 0, [P, Xe, , Ze] = oe(n === void 0 ? void 0 : Ee(n), Ee(p ?? i), Ne), [F, I] = l(P), [Qe, L] = l(null), [R, z] = l(() => a(P, C)), [B, V] = l(() => P.from ?? /* @__PURE__ */ new Date()), H = c(null), $e = le(H, ce(Ze)), U = c(null), W = c(null), { inputRef: et, focusRequest: tt, openFromKeyboard: G, openFromFocus: nt, returnFocus: K } = _e(N), q = Me(P), [rt, it] = l(q), [at, ot] = l(C);
50
50
  (rt !== q || at !== C) && (it(q), ot(C), I(P), z(a(P, C)), P.from && V(P.from));
51
51
  let J = () => {
52
52
  N(!1), I(P), L(null);
@@ -68,7 +68,7 @@ var f = {
68
68
  }, X = (e) => {
69
69
  L(null), Y(e), K();
70
70
  }, Z = (e) => V(new Date(B.getFullYear(), B.getMonth() + e, 1)), Q = !!F.from && !F.to, $ = xe(F), lt = ve(M && !v && !A, U, W);
71
- return O.wrap(/* @__PURE__ */ c("div", {
71
+ return O.wrap(/* @__PURE__ */ d("div", {
72
72
  className: [
73
73
  "kapi-dp",
74
74
  "kapi-dp--range",
@@ -82,17 +82,17 @@ var f = {
82
82
  ee(e.relatedTarget, e.currentTarget) && We?.(e);
83
83
  },
84
84
  children: [
85
- /* @__PURE__ */ c("div", {
85
+ /* @__PURE__ */ d("div", {
86
86
  className: ["kapi-dp__field", E && "kapi-filterchip"].filter(Boolean).join(" "),
87
87
  ref: U,
88
88
  children: [
89
89
  E && m,
90
- D && /* @__PURE__ */ c("label", {
90
+ D && /* @__PURE__ */ d("label", {
91
91
  className: "kapi-dp__label",
92
92
  htmlFor: j,
93
93
  children: [D, ":"]
94
94
  }),
95
- /* @__PURE__ */ s("input", {
95
+ /* @__PURE__ */ u("input", {
96
96
  ref: (t) => {
97
97
  et.current = t, e(Ue, t);
98
98
  },
@@ -117,64 +117,64 @@ var f = {
117
117
  e.key === "Escape" && M && (e.preventDefault(), e.stopPropagation(), J()), e.key === "ArrowDown" && !A && (e.preventDefault(), G());
118
118
  }
119
119
  }),
120
- /* @__PURE__ */ s("button", {
120
+ /* @__PURE__ */ u("button", {
121
121
  type: "button",
122
122
  className: "kapi-dp__toggle",
123
123
  disabled: v || A,
124
124
  "aria-label": T.openPicker,
125
125
  "aria-expanded": M,
126
126
  onClick: () => M ? J() : G(),
127
- children: /* @__PURE__ */ s(ke, {
127
+ children: /* @__PURE__ */ u(ke, {
128
128
  size: 16,
129
129
  strokeWidth: 1.9
130
130
  })
131
131
  })
132
132
  ]
133
133
  }),
134
- b && /* @__PURE__ */ c(De, { children: [/* @__PURE__ */ s("input", {
134
+ b && /* @__PURE__ */ d(Oe, { children: [/* @__PURE__ */ u("input", {
135
135
  type: "hidden",
136
136
  name: `${b}.from`,
137
137
  value: r(P.from, "date"),
138
138
  disabled: v
139
- }), /* @__PURE__ */ s("input", {
139
+ }), /* @__PURE__ */ u("input", {
140
140
  type: "hidden",
141
141
  name: `${b}.to`,
142
142
  value: r(P.to, "date"),
143
143
  disabled: v
144
144
  })] }),
145
- M && !v && !A && /* @__PURE__ */ s("div", {
145
+ M && !v && !A && /* @__PURE__ */ u("div", {
146
146
  ref: W,
147
147
  className: `kapi-dp__pop${lt === "top" ? " kapi-dp__pop--up" : ""}`,
148
148
  onKeyDown: (e) => {
149
149
  e.key === "Escape" && (e.preventDefault(), J(), K());
150
150
  },
151
- children: /* @__PURE__ */ c("div", {
151
+ children: /* @__PURE__ */ d("div", {
152
152
  className: "kapi-dp__cal",
153
153
  children: [
154
- /* @__PURE__ */ c("div", {
154
+ /* @__PURE__ */ d("div", {
155
155
  className: "kapi-dp__head",
156
156
  children: [
157
- /* @__PURE__ */ s("button", {
157
+ /* @__PURE__ */ u("button", {
158
158
  type: "button",
159
159
  className: "kapi-dp__nav",
160
160
  "aria-label": T.prevMonth,
161
161
  onClick: () => Z(-1),
162
- children: /* @__PURE__ */ s(Ae, {
162
+ children: /* @__PURE__ */ u(Ae, {
163
163
  className: "kapi-flip-rtl",
164
164
  size: 15,
165
165
  strokeWidth: 2.2
166
166
  })
167
167
  }),
168
- /* @__PURE__ */ s("span", {
168
+ /* @__PURE__ */ u("span", {
169
169
  className: "kapi-dp__title",
170
170
  children: me(B, T.months)
171
171
  }),
172
- /* @__PURE__ */ s("button", {
172
+ /* @__PURE__ */ u("button", {
173
173
  type: "button",
174
174
  className: "kapi-dp__nav",
175
175
  "aria-label": T.nextMonth,
176
176
  onClick: () => Z(1),
177
- children: /* @__PURE__ */ s(je, {
177
+ children: /* @__PURE__ */ u(je, {
178
178
  className: "kapi-flip-rtl",
179
179
  size: 15,
180
180
  strokeWidth: 2.2
@@ -182,7 +182,7 @@ var f = {
182
182
  })
183
183
  ]
184
184
  }),
185
- /* @__PURE__ */ s(ge, {
185
+ /* @__PURE__ */ u(ge, {
186
186
  weekStartsOn: Ge,
187
187
  view: B,
188
188
  onViewChange: V,
@@ -199,24 +199,24 @@ var f = {
199
199
  e === null ? L(null) : Q && L(e);
200
200
  }
201
201
  }),
202
- /* @__PURE__ */ c("div", {
202
+ /* @__PURE__ */ d("div", {
203
203
  className: "kapi-dp__foot",
204
- children: [/* @__PURE__ */ s("button", {
204
+ children: [/* @__PURE__ */ u("button", {
205
205
  type: "button",
206
206
  className: "kapi-dp__link",
207
207
  onClick: () => {
208
208
  Y(i), N(!1);
209
209
  },
210
210
  children: T.clear
211
- }), /* @__PURE__ */ s("span", {
211
+ }), /* @__PURE__ */ u("span", {
212
212
  className: "kapi-dp__hint",
213
213
  "aria-live": "polite",
214
214
  children: Q ? T.pickEnd : T.pickStart
215
215
  })]
216
216
  }),
217
- $ && /* @__PURE__ */ c("div", {
217
+ $ && /* @__PURE__ */ d("div", {
218
218
  className: "kapi-dp__open",
219
- children: [/* @__PURE__ */ s("button", {
219
+ children: [/* @__PURE__ */ u("button", {
220
220
  type: "button",
221
221
  className: "kapi-dp__link",
222
222
  onClick: () => X({
@@ -224,7 +224,7 @@ var f = {
224
224
  to: null
225
225
  }),
226
226
  children: T.openEnd
227
- }), /* @__PURE__ */ s("button", {
227
+ }), /* @__PURE__ */ u("button", {
228
228
  type: "button",
229
229
  className: "kapi-dp__link",
230
230
  onClick: () => X({
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/KapiFacetedSearch.css";
3
- import { useLabels as e } from "../locale/KapiLocaleProvider.js";
4
- import { joinClasses as t } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
5
  import { enabledIndexes as ee, nextEnabledIndex as n } from "../overlays/menuKeyboardLogic.js";
6
6
  import { useMergedRefs as r } from "../../hooks/mergeRefs.js";
7
7
  import { useAsyncLoader as te } from "../../hooks/useAsyncLoader.js";
@@ -11,8 +11,8 @@ import { KapiTag as i } from "../display/KapiTag.js";
11
11
  import { KapiPopover as ie } from "../overlays/KapiPopover.js";
12
12
  import { facetChipText as ae, facetKeyAction as oe, facetMenuItems as se, facetOperators as a, facetOptionName as ce, isDateFacet as o, toDateRangeValue as le, toDateValue as ue } from "./facetedSearchLogic.js";
13
13
  /* empty css */
14
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
15
- import { useId as u, useRef as d, useState as f } from "react";
14
+ import { useId as s, useRef as c, useState as l } from "react";
15
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
16
16
  import { Search as de } from "lucide-react";
17
17
  //#region src/components/inputs/KapiFacetedSearch.tsx
18
18
  var p = {
@@ -40,7 +40,7 @@ var p = {
40
40
  operatorLte: "menor o igual que"
41
41
  };
42
42
  function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300, reloadKey: me, labels: he, className: ge, onMouseDown: _e, "aria-label": _, ref: ve, ...v }) {
43
- let y = e("facetedSearch", p, he), b = u(), x = `${b}-list`, S = d(null), ye = r(S, ve), C = d(null), w = d(null), [T, E] = f(""), [D, O] = f(null), [k, A] = f(null), [j, M] = f(!1), [N, P] = f(-1), F = T.trim(), I = !!D && a(D).length >= 2 && k === null, L = D?.kind === "text" && !I, R = typeof D?.loadOptions == "function" && D.kind !== "text" && !I, z = {
43
+ let y = t("facetedSearch", p, he), b = s(), x = `${b}-list`, S = c(null), ye = r(S, ve), C = c(null), w = c(null), [T, E] = l(""), [D, O] = l(null), [k, A] = l(null), [j, M] = l(!1), [N, P] = l(-1), F = T.trim(), I = !!D && a(D).length >= 2 && k === null, L = D?.kind === "text" && !I, R = typeof D?.loadOptions == "function" && D.kind !== "text" && !I, z = {
44
44
  eq: y.operatorEq,
45
45
  ne: y.operatorNe,
46
46
  contains: y.operatorContains,
@@ -113,22 +113,22 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
113
113
  let t = e.target.value === "";
114
114
  e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), q(), K()) : e.key === "Backspace" && t && (e.preventDefault(), X());
115
115
  }, $ = (e) => `${b}-opt-${e}`;
116
- return /* @__PURE__ */ l("div", {
116
+ return /* @__PURE__ */ f("div", {
117
117
  ...v,
118
118
  ref: ye,
119
- className: t("kapi-facets", ge),
119
+ className: e("kapi-facets", ge),
120
120
  role: "search",
121
121
  "aria-label": _ ?? y.region,
122
122
  onMouseDown: (e) => {
123
123
  _e?.(e), !e.defaultPrevented && e.target === e.currentTarget && (e.preventDefault(), C.current?.focus(), M(!0));
124
124
  },
125
125
  children: [
126
- /* @__PURE__ */ c(de, {
126
+ /* @__PURE__ */ d(de, {
127
127
  className: "kapi-facets__icon",
128
128
  size: 15,
129
129
  "aria-hidden": !0
130
130
  }),
131
- h.map((e) => /* @__PURE__ */ c(i, {
131
+ h.map((e) => /* @__PURE__ */ d(i, {
132
132
  size: "sm",
133
133
  onRemove: () => {
134
134
  e.onRemove(), K();
@@ -136,7 +136,7 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
136
136
  removeLabel: `${y.remove} ${B(e)}`,
137
137
  children: B(e)
138
138
  }, e.key)),
139
- D && /* @__PURE__ */ l(i, {
139
+ D && /* @__PURE__ */ f(i, {
140
140
  size: "sm",
141
141
  tone: "primary",
142
142
  className: "kapi-facets__pending",
@@ -146,23 +146,23 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
146
146
  ":"
147
147
  ]
148
148
  }),
149
- V && D ? /* @__PURE__ */ c("span", {
149
+ V && D ? /* @__PURE__ */ d("span", {
150
150
  className: "kapi-facets__date",
151
151
  onKeyDownCapture: Se,
152
- children: D.kind === "dateRange" ? /* @__PURE__ */ c(re, {
152
+ children: D.kind === "dateRange" ? /* @__PURE__ */ d(re, {
153
153
  ref: w,
154
154
  "aria-label": `${y.valuePrefix} ${D.label}`,
155
155
  onChange: ({ from: e, to: t }) => {
156
156
  e && t && (D.apply(le(e, t), k ?? "eq"), J());
157
157
  }
158
- }) : /* @__PURE__ */ c(ne, {
158
+ }) : /* @__PURE__ */ d(ne, {
159
159
  ref: w,
160
160
  "aria-label": `${y.valuePrefix} ${D.label}`,
161
161
  onChange: (e) => {
162
162
  e && (D.apply(ue(e), k ?? "eq"), J());
163
163
  }
164
164
  })
165
- }) : /* @__PURE__ */ c("input", {
165
+ }) : /* @__PURE__ */ d("input", {
166
166
  ref: C,
167
167
  className: "kapi-facets__input",
168
168
  type: "text",
@@ -186,7 +186,7 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
186
186
  },
187
187
  onKeyDown: xe
188
188
  }),
189
- g && h.length > 0 && /* @__PURE__ */ c("button", {
189
+ g && h.length > 0 && /* @__PURE__ */ d("button", {
190
190
  type: "button",
191
191
  className: "kapi-facets__clear",
192
192
  onClick: () => {
@@ -194,7 +194,7 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
194
194
  },
195
195
  children: y.clearAll
196
196
  }),
197
- /* @__PURE__ */ l(ie, {
197
+ /* @__PURE__ */ f(ie, {
198
198
  open: G,
199
199
  anchorRef: S,
200
200
  onClose: () => M(!1),
@@ -206,19 +206,19 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
206
206
  restoreFocus: !1,
207
207
  className: "kapi-facets__menu",
208
208
  children: [
209
- U && /* @__PURE__ */ c("div", {
209
+ U && /* @__PURE__ */ d("div", {
210
210
  className: "kapi-facets__empty",
211
211
  children: y.loading
212
212
  }),
213
- !U && H?.error && /* @__PURE__ */ c("div", {
213
+ !U && H?.error && /* @__PURE__ */ d("div", {
214
214
  className: "kapi-facets__empty kapi-facets__empty--err",
215
215
  children: y.loadError
216
216
  }),
217
- !U && !H?.error && W.length === 0 && /* @__PURE__ */ c("div", {
217
+ !U && !H?.error && W.length === 0 && /* @__PURE__ */ d("div", {
218
218
  className: "kapi-facets__empty",
219
219
  children: y.empty
220
220
  }),
221
- !U && !H?.error && W.map((e, t) => /* @__PURE__ */ c("div", {
221
+ !U && !H?.error && W.map((e, t) => /* @__PURE__ */ d("div", {
222
222
  id: $(t),
223
223
  role: "option",
224
224
  "aria-selected": t === N,
@@ -227,19 +227,19 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
227
227
  onMouseDown: (e) => e.preventDefault(),
228
228
  onMouseEnter: () => P(t),
229
229
  onClick: () => Q(e),
230
- children: e.type === "text" ? /* @__PURE__ */ l("span", { children: [
230
+ children: e.type === "text" ? /* @__PURE__ */ f("span", { children: [
231
231
  y.searchFor,
232
232
  " “",
233
233
  e.text,
234
234
  "”"
235
- ] }) : e.type === "operator" ? /* @__PURE__ */ c("span", { children: z[e.operator] }) : e.type === "option" ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("span", { children: e.option.label }), e.option.count !== void 0 && /* @__PURE__ */ c("span", {
235
+ ] }) : e.type === "operator" ? /* @__PURE__ */ d("span", { children: z[e.operator] }) : e.type === "option" ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", { children: e.option.label }), e.option.count !== void 0 && /* @__PURE__ */ d("span", {
236
236
  className: "kapi-facets__count",
237
237
  "aria-hidden": "true",
238
238
  children: e.option.count
239
- })] }) : /* @__PURE__ */ l("span", { children: [/* @__PURE__ */ c("span", {
239
+ })] }) : /* @__PURE__ */ f("span", { children: [/* @__PURE__ */ d("span", {
240
240
  className: "kapi-facets__facet",
241
241
  children: e.facet.label
242
- }), e.facet.kind !== "flag" && /* @__PURE__ */ l("span", {
242
+ }), e.facet.kind !== "flag" && /* @__PURE__ */ f("span", {
243
243
  className: "kapi-facets__hint",
244
244
  children: [
245
245
  " ",
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { fieldContextValue as e, fieldIds as t, resolveValidation as n } from "./fieldLogic.js";
3
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
- import { createContext as a, useContext as o, useId as s, useMemo as c } from "react";
3
+ import { createContext as r, useContext as i, useId as a, useMemo as o } from "react";
4
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
5
  import { AlertTriangle as l, CheckCircle2 as u, LoaderCircle as d } from "lucide-react";
6
6
  //#region src/components/inputs/KapiField.tsx
7
- var f = a(null), p = () => o(f), m = (e = "") => ["kapi-field", e].filter(Boolean).join(" "), h = (e) => ["kapi-help", e && `kapi-help--${e}`].filter(Boolean).join(" "), g = ({ label: a, htmlFor: o, required: p = !1, help: g, helpId: _, invalid: v, status: y, readOnly: b, className: x, children: S, ...C }) => {
8
- let w = s(), T = !!g, { controlId: E, labelId: D, helpId: O } = t({
9
- htmlFor: o,
7
+ var f = r(null), p = () => i(f), m = (e = "") => ["kapi-field", e].filter(Boolean).join(" "), h = (e) => ["kapi-help", e && `kapi-help--${e}`].filter(Boolean).join(" "), g = ({ label: r, htmlFor: i, required: p = !1, help: g, helpId: _, invalid: v, status: y, readOnly: b, className: x, children: S, ...C }) => {
8
+ let w = a(), T = !!g, { controlId: E, labelId: D, helpId: O } = t({
9
+ htmlFor: i,
10
10
  autoId: w,
11
11
  helpId: _,
12
12
  hasHelp: T
13
- }), { status: k } = n(v, y), A = a != null, j = c(() => e({
13
+ }), { status: k } = n(v, y), A = r != null, j = o(() => e({
14
14
  controlId: E,
15
15
  labelId: A ? D : void 0,
16
16
  helpId: O,
@@ -26,33 +26,33 @@ var f = a(null), p = () => o(f), m = (e = "") => ["kapi-field", e].filter(Boolea
26
26
  k,
27
27
  b
28
28
  ]);
29
- return /* @__PURE__ */ r(f.Provider, {
29
+ return /* @__PURE__ */ s(f.Provider, {
30
30
  value: j,
31
- children: /* @__PURE__ */ i("div", {
31
+ children: /* @__PURE__ */ c("div", {
32
32
  ...C,
33
33
  className: m(x),
34
34
  children: [
35
- a != null && /* @__PURE__ */ i("label", {
35
+ r != null && /* @__PURE__ */ c("label", {
36
36
  id: D,
37
37
  htmlFor: E,
38
- children: [a, p && " *"]
38
+ children: [r, p && " *"]
39
39
  }),
40
40
  S,
41
- T ? /* @__PURE__ */ i("span", {
41
+ T ? /* @__PURE__ */ c("span", {
42
42
  id: O,
43
43
  className: h(k),
44
44
  role: k === "err" ? "alert" : void 0,
45
45
  "aria-live": k === "pending" ? "polite" : void 0,
46
46
  children: [
47
- k === "ok" && /* @__PURE__ */ r(u, {
47
+ k === "ok" && /* @__PURE__ */ s(u, {
48
48
  size: 13,
49
49
  strokeWidth: 2.2
50
50
  }),
51
- k === "err" && /* @__PURE__ */ r(l, {
51
+ k === "err" && /* @__PURE__ */ s(l, {
52
52
  size: 13,
53
53
  strokeWidth: 2.2
54
54
  }),
55
- k === "pending" && /* @__PURE__ */ r(d, {
55
+ k === "pending" && /* @__PURE__ */ s(d, {
56
56
  size: 13,
57
57
  strokeWidth: 2.2,
58
58
  className: "kapi-spinner"
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/inputs/KapiFileUpload.css";
3
- import { fieldControlProps as e, joinIds as t } from "./fieldLogic.js";
4
- import { useKapiField as n } from "./KapiField.js";
5
- import { useLabels as r } from "../locale/KapiLocaleProvider.js";
6
- import { joinClasses as i } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { fieldControlProps as t, joinIds as n } from "./fieldLogic.js";
5
+ import { useKapiField as r } from "./KapiField.js";
6
+ import { useLabels as i } from "../locale/KapiLocaleProvider.js";
7
7
  import { formatFileSize as a, isActivationKey as o, matchesAccept as s, mergeFiles as c, removeFileAt as l } from "./fileUploadLogic.js";
8
8
  /* empty css */
9
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
- import { useEffect as f, useId as p, useRef as m, useState as h } from "react";
9
+ import { useEffect as u, useId as d, useRef as f, useState as p } from "react";
10
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
11
11
  import { FileText as g, UploadCloud as _, X as v } from "lucide-react";
12
12
  //#region src/components/inputs/KapiFileUpload.tsx
13
13
  var y = {
@@ -16,12 +16,12 @@ var y = {
16
16
  remove: "Quitar",
17
17
  hint: "PDF, JPG, PNG · hasta 10MB"
18
18
  }, b = ({ multiple: b = !0, accept: x, hint: S, onChange: C, disabled: w = !1, className: T, style: E, labels: D, name: O, id: k, onBlur: A, invalid: j, "aria-describedby": M, ref: N }) => {
19
- let P = r("fileUpload", y, D), F = S ?? P.hint, I = n(), [L, R] = h([]), [z, B] = h(!1), V = m(null), H = p(), U = `${H}-title`, W = `${H}-hint`, G = !!I?.labelId, K = e(I, {
19
+ let P = i("fileUpload", y, D), F = S ?? P.hint, I = r(), [L, R] = p([]), [z, B] = p(!1), V = f(null), H = d(), U = `${H}-title`, W = `${H}-hint`, G = !!I?.labelId, K = t(I, {
20
20
  id: k,
21
- describedBy: t(G && W, M),
21
+ describedBy: n(G && W, M),
22
22
  invalid: j
23
23
  });
24
- f(() => {
24
+ u(() => {
25
25
  let e = V.current;
26
26
  if (!O || !e || typeof DataTransfer > "u" || L.length === 0 && !e.files?.length) return;
27
27
  let t = new DataTransfer();
@@ -33,16 +33,16 @@ var y = {
33
33
  let t = Array.from(e ?? []);
34
34
  t.length !== 0 && q(c(L, t, b));
35
35
  }, Y = () => V.current?.click();
36
- return /* @__PURE__ */ d("div", {
37
- className: i("kapi-upload-wrap", T),
36
+ return /* @__PURE__ */ h("div", {
37
+ className: e("kapi-upload-wrap", T),
38
38
  style: E,
39
39
  children: [
40
- /* @__PURE__ */ d("div", {
40
+ /* @__PURE__ */ h("div", {
41
41
  ref: N,
42
42
  id: K.id,
43
43
  "aria-describedby": K["aria-describedby"],
44
44
  "aria-invalid": K["aria-invalid"],
45
- "aria-labelledby": G ? t(I?.labelId, U) : void 0,
45
+ "aria-labelledby": G ? n(I?.labelId, U) : void 0,
46
46
  onBlur: A,
47
47
  className: `kapi-upload${z ? " is-over" : ""}`,
48
48
  onClick: Y,
@@ -61,30 +61,30 @@ var y = {
61
61
  role: "button",
62
62
  tabIndex: w ? -1 : 0,
63
63
  "aria-disabled": w || void 0,
64
- children: [/* @__PURE__ */ u("span", {
64
+ children: [/* @__PURE__ */ m("span", {
65
65
  className: "kapi-upload__ico",
66
- children: /* @__PURE__ */ u(_, {
66
+ children: /* @__PURE__ */ m(_, {
67
67
  size: 22,
68
68
  strokeWidth: 1.9
69
69
  })
70
- }), /* @__PURE__ */ d("div", {
70
+ }), /* @__PURE__ */ h("div", {
71
71
  className: "kapi-upload__body",
72
- children: [/* @__PURE__ */ d("div", {
72
+ children: [/* @__PURE__ */ h("div", {
73
73
  id: U,
74
74
  className: "kapi-upload__t",
75
75
  children: [
76
76
  P.drop,
77
77
  " ",
78
- /* @__PURE__ */ u("b", { children: P.choose })
78
+ /* @__PURE__ */ m("b", { children: P.choose })
79
79
  ]
80
- }), /* @__PURE__ */ u("div", {
80
+ }), /* @__PURE__ */ m("div", {
81
81
  id: W,
82
82
  className: "kapi-upload__s",
83
83
  children: F
84
84
  })]
85
85
  })]
86
86
  }),
87
- /* @__PURE__ */ u("input", {
87
+ /* @__PURE__ */ m("input", {
88
88
  ref: V,
89
89
  className: "kapi-upload__input",
90
90
  type: "file",
@@ -98,29 +98,29 @@ var y = {
98
98
  J(e.target.files), e.target.value = "";
99
99
  }
100
100
  }),
101
- L.length > 0 && /* @__PURE__ */ u("div", {
101
+ L.length > 0 && /* @__PURE__ */ m("div", {
102
102
  className: "kapi-upload__list",
103
- children: L.map((e, t) => /* @__PURE__ */ d("div", {
103
+ children: L.map((e, t) => /* @__PURE__ */ h("div", {
104
104
  className: "kapi-upload__file",
105
105
  children: [
106
- /* @__PURE__ */ u(g, {
106
+ /* @__PURE__ */ m(g, {
107
107
  className: "kapi-upload__fileico",
108
108
  size: 16,
109
109
  strokeWidth: 1.9
110
110
  }),
111
- /* @__PURE__ */ u("span", {
111
+ /* @__PURE__ */ m("span", {
112
112
  className: "kapi-upload__name",
113
113
  children: e.name
114
114
  }),
115
- /* @__PURE__ */ u("span", {
115
+ /* @__PURE__ */ m("span", {
116
116
  className: "kapi-upload__size",
117
117
  children: a(e.size)
118
118
  }),
119
- /* @__PURE__ */ u("button", {
119
+ /* @__PURE__ */ m("button", {
120
120
  type: "button",
121
121
  "aria-label": `${P.remove} ${e.name}`,
122
122
  onClick: () => q(l(L, t)),
123
- children: /* @__PURE__ */ u(v, {
123
+ children: /* @__PURE__ */ m(v, {
124
124
  size: 15,
125
125
  strokeWidth: 2.2
126
126
  })
@@ -1,4 +1,5 @@
1
1
  import type { ButtonHTMLAttributes, ReactNode, Ref } from "react";
2
+ import { type KapiRender } from "../renderSlot.js";
2
3
  export type KapiIconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "aria-label"> & {
3
4
  /** Nombre accesible (el botón no tiene texto visible). */
4
5
  "aria-label": string;
@@ -6,8 +7,15 @@ export type KapiIconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>,
6
7
  icon?: ReactNode;
7
8
  /** Ref al `<button>` nativo. */
8
9
  ref?: Ref<HTMLButtonElement> | undefined;
10
+ /**
11
+ * Dibuja OTRO elemento con el aspecto del botón de ícono: el `<Link>` de tu router, un `<a>`.
12
+ * Mismas reglas que `KapiButton`: clases unidas, estilos fundidos, handlers encadenados con el
13
+ * tuyo primero. `type` no viaja —sólo tiene sentido en un `<button>`— y `disabled` va como
14
+ * `aria-disabled`, que es lo válido fuera de un control nativo.
15
+ */
16
+ render?: KapiRender | undefined;
9
17
  };
10
18
  /** Clases del botón. Pura y exportada para testear. */
11
19
  export declare const iconButtonClasses: (className?: string) => string;
12
20
  /** Botón cuadrado de ícono (`.kapi-btn--icon`), p. ej. el `⋯` de acciones de una fila. */
13
- export declare const KapiIconButton: ({ icon, className, type, ref, ...rest }: KapiIconButtonProps) => import("react").JSX.Element;
21
+ export declare const KapiIconButton: ({ icon, className, type, disabled, ref, render, ...rest }: KapiIconButtonProps) => import("react").JSX.Element;
@@ -1,16 +1,33 @@
1
1
  "use client";
2
- import { jsx as e } from "react/jsx-runtime";
2
+ import { renderSlot as e } from "../renderSlot.js";
3
+ import { jsx as t } from "react/jsx-runtime";
3
4
  //#region src/components/inputs/KapiIconButton.tsx
4
- var t = (e = "") => [
5
+ var n = (e = "") => [
5
6
  "kapi-btn",
6
7
  "kapi-btn--icon",
7
8
  e
8
- ].filter(Boolean).join(" "), n = ({ icon: n, className: r, type: i = "button", ref: a, ...o }) => /* @__PURE__ */ e("button", {
9
- ref: a,
10
- type: i,
11
- className: t(r),
12
- ...o,
13
- children: n ?? "⋯"
14
- });
9
+ ].filter(Boolean).join(" "), r = ({ icon: r, className: i, type: a = "button", disabled: o, ref: s, render: c, ...l }) => {
10
+ let u = r ?? "⋯", d = {
11
+ className: n(i),
12
+ ...l
13
+ };
14
+ return c === void 0 ? /* @__PURE__ */ t("button", {
15
+ ref: s,
16
+ type: a,
17
+ disabled: o,
18
+ className: n(i),
19
+ ...l,
20
+ children: u
21
+ }) : e(c, d, {
22
+ "aria-disabled": o || void 0,
23
+ onClick: o ? (e) => e.preventDefault() : void 0,
24
+ ref: s,
25
+ children: u
26
+ }, (e) => /* @__PURE__ */ t("button", {
27
+ ...e,
28
+ type: a,
29
+ children: u
30
+ }));
31
+ };
15
32
  //#endregion
16
- export { n as KapiIconButton, t as iconButtonClasses };
33
+ export { r as KapiIconButton, n as iconButtonClasses };