@kapiuara/ui 0.13.0 → 0.15.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 (132) hide show
  1. package/README.md +239 -1
  2. package/dist/components/chat/KapiChatDivider.d.ts +7 -3
  3. package/dist/components/chat/KapiChatDivider.js +6 -6
  4. package/dist/components/chat/KapiChatList.js +19 -19
  5. package/dist/components/chat/KapiChatThread.js +23 -23
  6. package/dist/components/chat/KapiComposer.js +19 -19
  7. package/dist/components/chat/KapiMessageBubble.js +4 -4
  8. package/dist/components/chat/KapiTypingIndicator.js +4 -4
  9. package/dist/components/chat/index.d.ts +1 -1
  10. package/dist/components/closeReason.d.ts +34 -0
  11. package/dist/components/data/KapiBarChart.js +1 -1
  12. package/dist/components/data/KapiDataTable.js +31 -31
  13. package/dist/components/data/KapiEventCalendar.js +78 -78
  14. package/dist/components/data/KapiHeatmap.js +23 -23
  15. package/dist/components/data/KapiLineChart.js +1 -1
  16. package/dist/components/data/KapiPagination.js +4 -4
  17. package/dist/components/data/KapiSparkline.js +1 -1
  18. package/dist/components/data/KapiTable.js +122 -122
  19. package/dist/components/data/KapiTableFilter.js +18 -18
  20. package/dist/components/data/KapiTableRow.js +24 -24
  21. package/dist/components/data/KapiTableToolbar.js +49 -49
  22. package/dist/components/data/chartFrame.js +21 -21
  23. package/dist/components/data/useColumnResize.js +8 -8
  24. package/dist/components/data/useTableSelection.js +8 -8
  25. package/dist/components/display/KapiAnnotation.js +55 -55
  26. package/dist/components/display/KapiComment.js +4 -4
  27. package/dist/components/display/KapiCommentComposer.js +16 -16
  28. package/dist/components/display/KapiFileItem.js +6 -6
  29. package/dist/components/display/KapiFileViewer.js +9 -9
  30. package/dist/components/display/KapiTruncate.js +7 -7
  31. package/dist/components/feedback/KapiAlert.d.ts +2 -1
  32. package/dist/components/feedback/KapiAlert.js +8 -8
  33. package/dist/components/feedback/KapiCountdown.js +8 -8
  34. package/dist/components/feedback/KapiFab.js +30 -30
  35. package/dist/components/feedback/KapiOfflineBanner.js +8 -8
  36. package/dist/components/feedback/KapiToastContainer.js +25 -25
  37. package/dist/components/feedback/KapiTour.d.ts +2 -1
  38. package/dist/components/feedback/KapiTour.js +35 -35
  39. package/dist/components/inputs/KapiAutocomplete.js +14 -14
  40. package/dist/components/inputs/KapiButton.d.ts +17 -1
  41. package/dist/components/inputs/KapiButton.js +41 -25
  42. package/dist/components/inputs/KapiCalendar.js +5 -5
  43. package/dist/components/inputs/KapiCalendarGrid.js +10 -10
  44. package/dist/components/inputs/KapiChecklist.js +71 -71
  45. package/dist/components/inputs/KapiDatePicker.js +124 -122
  46. package/dist/components/inputs/KapiDateRangePicker.js +138 -136
  47. package/dist/components/inputs/KapiFacetedSearch.js +29 -29
  48. package/dist/components/inputs/KapiField.js +14 -14
  49. package/dist/components/inputs/KapiFileUpload.js +27 -27
  50. package/dist/components/inputs/KapiIconButton.d.ts +9 -1
  51. package/dist/components/inputs/KapiIconButton.js +27 -10
  52. package/dist/components/inputs/KapiInput.js +21 -21
  53. package/dist/components/inputs/KapiInputGroup.js +8 -8
  54. package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
  55. package/dist/components/inputs/KapiMaskedInput.js +64 -51
  56. package/dist/components/inputs/KapiNumberStepper.js +29 -29
  57. package/dist/components/inputs/KapiRating.js +61 -59
  58. package/dist/components/inputs/KapiSearchChip.js +8 -8
  59. package/dist/components/inputs/KapiSegmented.js +74 -64
  60. package/dist/components/inputs/KapiSelect.js +232 -222
  61. package/dist/components/inputs/KapiSelectMenu.js +60 -60
  62. package/dist/components/inputs/KapiSlider.js +1 -1
  63. package/dist/components/inputs/KapiSwitch.js +6 -6
  64. package/dist/components/inputs/KapiTagInput.js +83 -81
  65. package/dist/components/inputs/KapiTextarea.js +8 -8
  66. package/dist/components/inputs/misuseWarnings.d.ts +37 -0
  67. package/dist/components/inputs/misuseWarnings.js +36 -0
  68. package/dist/components/inputs/numberStepLogic.d.ts +10 -0
  69. package/dist/components/inputs/numberStepLogic.js +16 -7
  70. package/dist/components/inputs/ownField.js +4 -4
  71. package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
  72. package/dist/components/layout/KapiAccountMenu.js +53 -53
  73. package/dist/components/layout/KapiContextSlot.js +35 -35
  74. package/dist/components/layout/KapiMasonry.js +6 -6
  75. package/dist/components/layout/KapiNotificationBell.js +60 -60
  76. package/dist/components/layout/KapiPageHeader.js +19 -19
  77. package/dist/components/layout/KapiRail.js +60 -60
  78. package/dist/components/layout/KapiRailAccount.js +9 -9
  79. package/dist/components/layout/KapiRoot.js +21 -21
  80. package/dist/components/layout/KapiScrollArea.js +11 -11
  81. package/dist/components/layout/KapiShell.js +12 -12
  82. package/dist/components/locale/KapiLocaleProvider.js +13 -13
  83. package/dist/components/navigation/CtxSlidingList.js +4 -4
  84. package/dist/components/navigation/KapiAccordion.js +12 -12
  85. package/dist/components/navigation/KapiBreadcrumb.js +11 -11
  86. package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
  87. package/dist/components/navigation/KapiContextPanel.js +76 -76
  88. package/dist/components/navigation/KapiFilterChips.js +9 -9
  89. package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
  90. package/dist/components/navigation/KapiNavBadge.js +11 -10
  91. package/dist/components/navigation/KapiPanelGroup.js +25 -25
  92. package/dist/components/navigation/KapiSteps.js +4 -4
  93. package/dist/components/navigation/KapiTabs.d.ts +4 -1
  94. package/dist/components/navigation/KapiTabs.js +63 -55
  95. package/dist/components/navigation/KapiTree.js +75 -75
  96. package/dist/components/navigation/KapiWizard.d.ts +2 -1
  97. package/dist/components/navigation/KapiWizard.js +30 -30
  98. package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
  99. package/dist/components/overlays/KapiCanvasForm.js +12 -12
  100. package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
  101. package/dist/components/overlays/KapiCommandPalette.js +23 -23
  102. package/dist/components/overlays/KapiConfirm.d.ts +2 -1
  103. package/dist/components/overlays/KapiConfirm.js +12 -12
  104. package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
  105. package/dist/components/overlays/KapiContextMenu.js +18 -18
  106. package/dist/components/overlays/KapiDialogHost.js +22 -22
  107. package/dist/components/overlays/KapiLoading.js +16 -16
  108. package/dist/components/overlays/KapiMenuButton.js +15 -15
  109. package/dist/components/overlays/KapiModal.d.ts +2 -1
  110. package/dist/components/overlays/KapiModal.js +28 -28
  111. package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
  112. package/dist/components/overlays/KapiOffcanvas.js +63 -63
  113. package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
  114. package/dist/components/overlays/KapiPhotoView.js +15 -15
  115. package/dist/components/overlays/KapiPopover.d.ts +2 -1
  116. package/dist/components/overlays/KapiPopover.js +10 -10
  117. package/dist/components/overlays/KapiShapeSheet.js +20 -20
  118. package/dist/components/overlays/KapiSplitModal.js +29 -29
  119. package/dist/components/overlays/KapiTooltip.js +21 -21
  120. package/dist/components/overlays/menuList.js +60 -60
  121. package/dist/components/renderSlot.d.ts +27 -0
  122. package/dist/components/renderSlot.js +23 -0
  123. package/dist/css/components/chat/chat.css +1 -1
  124. package/dist/hooks/portalRoot.js +6 -6
  125. package/dist/hooks/useControllableState.d.ts +6 -2
  126. package/dist/hooks/useControllableState.js +14 -11
  127. package/dist/hooks/useFormReset.d.ts +22 -0
  128. package/dist/hooks/useFormReset.js +17 -0
  129. package/dist/index.d.ts +2 -0
  130. package/dist/kapi.css +1 -1
  131. package/dist/kapi.layered.css +1 -1
  132. package/package.json +5 -2
@@ -6,173 +6,175 @@ import { useKapiLocale as re, useLabels as ie } from "../locale/KapiLocaleProvid
6
6
  import { resolveChipLabel as ae } from "./selectLogic.js";
7
7
  import { useControllableState as oe } from "../../hooks/useControllableState.js";
8
8
  import { activeHTMLElementOf as se } from "../../hooks/ownerDocument.js";
9
- import { useOutsidePress as ce } from "../../hooks/useOutsidePress.js";
10
- import { DEFAULT_CALENDAR_LABELS as n, calendarNames as le, chipFieldSize as ue, datePatternFor as de, formDateValue as r, monthTitle as fe, pickerIsChip as pe } from "./datePickerLogic.js";
9
+ import { useFormReset as ce } from "../../hooks/useFormReset.js";
10
+ import { useMergedRefs as le } from "../../hooks/mergeRefs.js";
11
+ import { useOutsidePress as ue } from "../../hooks/useOutsidePress.js";
12
+ import { DEFAULT_CALENDAR_LABELS as n, calendarNames as de, chipFieldSize as fe, datePatternFor as pe, formDateValue as r, monthTitle as me, pickerIsChip as he } from "./datePickerLogic.js";
11
13
  /* empty css */
12
- import { KapiCalendarGrid as me } from "./KapiCalendarGrid.js";
13
- import { useCalendarFocus as he } from "./useCalendarFocus.js";
14
- import { useDatePopSide as ge } from "./useDatePopSide.js";
15
- import { EMPTY_RANGE as i, formatRange as a, isCompleteRange as _e, maskRangeInput as ve, openEndedDay as ye, parseRangeText as be, pickRangeDay as xe, rangeDayState as o, rangePlaceholder as Se, sameRange as Ce, validRange as s } from "./dateRangeLogic.js";
16
- import { Fragment as we, jsx as c, jsxs as l } from "react/jsx-runtime";
17
- import { useId as Te, useMemo as u, useRef as d, useState as f } from "react";
18
- import { Calendar as Ee, ChevronLeft as De, ChevronRight as Oe } from "lucide-react";
14
+ import { KapiCalendarGrid as ge } from "./KapiCalendarGrid.js";
15
+ import { useCalendarFocus as _e } from "./useCalendarFocus.js";
16
+ import { useDatePopSide as ve } from "./useDatePopSide.js";
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 { 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
+ import { Calendar as ke, ChevronLeft as Ae, ChevronRight as je } from "lucide-react";
19
21
  //#region src/components/inputs/KapiDateRangePicker.tsx
20
- var p = {
22
+ var f = {
21
23
  ...n,
22
24
  pickStart: "Elige la fecha de inicio",
23
25
  pickEnd: "Elige la fecha de fin",
24
26
  openEnd: "Desde esta fecha",
25
27
  openStart: "Hasta esta fecha"
26
- }, ke = (e) => `${e.from?.getTime() ?? ""}-${e.to?.getTime() ?? ""}`, m = ({ value: n, defaultValue: m, onChange: Ae, placeholder: je, variant: Me, icon: h, chipLabel: g, label: _, help: Ne, fieldClassName: Pe, readOnly: v, disabled: y = !1, id: b, name: x, className: Fe, style: Ie, "aria-label": Le, labels: Re, invalid: S, required: C, ref: ze, onBlur: Be, weekStartsOn: Ve }) => {
27
- let w = re(), T = u(() => de(w), [w]), E = je ?? Se(T), He = u(() => w ? {
28
- ...p,
29
- ...le(w)
30
- } : p, [w]), D = ie("calendar", He, Re), O = pe({
31
- variant: Me,
32
- icon: h,
33
- chipLabel: g,
34
- label: _
35
- }), { chipLabel: k, fieldLabel: Ue } = ae({
36
- chip: O,
37
- chipLabel: g,
38
- label: _
39
- }), A = ne({
40
- id: b,
41
- label: Ue,
42
- help: Ne,
43
- required: C,
44
- invalid: S,
45
- readOnly: v,
46
- fieldClassName: Pe
47
- }), j = A.field, M = te(v, j), We = Te(), N = b ?? j?.controlId ?? (O ? We : void 0), [P, F] = f(!1), Ge = n !== void 0, [I, Ke] = oe(n === void 0 ? void 0 : s(n), s(m ?? i), Ae), [L, R] = f(I), [qe, z] = f(null), [B, V] = f(() => a(I, T)), [H, U] = f(() => I.from ?? /* @__PURE__ */ new Date()), W = d(null), G = d(null), K = d(null), { inputRef: Je, focusRequest: Ye, openFromKeyboard: q, openFromFocus: Xe, returnFocus: J } = he(F), Y = ke(I), [Ze, Qe] = f(Y), [$e, et] = f(T);
48
- (Ze !== Y || $e !== T) && (Qe(Y), et(T), R(I), V(a(I, T)), I.from && U(I.from));
49
- let X = () => {
50
- F(!1), R(I), z(null);
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 = s(() => pe(S), [S]), w = Pe ?? we(C), Ke = s(() => S ? {
30
+ ...f,
31
+ ...de(S)
32
+ } : f, [S]), T = ie("calendar", Ke, Ve), E = he({
33
+ variant: Fe,
34
+ icon: m,
35
+ chipLabel: h,
36
+ label: g
37
+ }), { chipLabel: D, fieldLabel: qe } = ae({
38
+ chip: E,
39
+ chipLabel: h,
40
+ label: g
41
+ }), O = ne({
42
+ id: y,
43
+ label: qe,
44
+ help: Ie,
45
+ required: x,
46
+ invalid: He,
47
+ readOnly: _,
48
+ fieldClassName: Le
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
+ (rt !== q || at !== C) && (it(q), ot(C), I(P), z(a(P, C)), P.from && V(P.from));
51
+ let J = () => {
52
+ N(!1), I(P), L(null);
51
53
  };
52
- ce(P, [W], () => {
53
- let e = se(W.current);
54
- e && K.current?.contains(e) && e.blur(), X();
54
+ ue(M, [H], () => {
55
+ let e = se(H.current);
56
+ e && W.current?.contains(e) && e.blur(), J();
55
57
  });
56
- let Z = (e) => {
57
- Ke(e);
58
- let t = Ge ? I : e;
59
- R(t), V(a(t, T));
60
- }, tt = () => {
61
- let e = be(B, T);
62
- e === null ? (I.from || I.to) && Z(i) : e === void 0 ? V(a(I, T)) : (Ce(e, I) ? V(a(e, T)) : Z(e), e.from && U(e.from));
63
- }, nt = (e) => {
64
- let t = xe(L, e);
65
- z(null), _e(t) ? (Z(t), J()) : R(t);
66
- }, rt = (e) => {
67
- z(null), Z(e), J();
68
- }, it = (e) => U(new Date(H.getFullYear(), H.getMonth() + e, 1)), Q = !!L.from && !L.to, $ = ye(L), at = ge(P && !y && !M, G, K);
69
- return A.wrap(/* @__PURE__ */ l("div", {
58
+ let Y = (e) => {
59
+ Xe(e);
60
+ let t = Ye ? P : e;
61
+ I(t), z(a(t, C));
62
+ }, st = () => {
63
+ let e = Se(R, C);
64
+ e === null ? (P.from || P.to) && Y(i) : e === void 0 ? z(a(P, C)) : (Te(e, P) ? z(a(e, C)) : Y(e), e.from && V(e.from));
65
+ }, ct = (e) => {
66
+ let t = Ce(F, e);
67
+ L(null), ye(t) ? (Y(t), K()) : I(t);
68
+ }, X = (e) => {
69
+ L(null), Y(e), K();
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__ */ d("div", {
70
72
  className: [
71
73
  "kapi-dp",
72
74
  "kapi-dp--range",
73
- O && "kapi-dp--chip",
74
- M && "kapi-dp--readonly",
75
- Fe
75
+ E && "kapi-dp--chip",
76
+ A && "kapi-dp--readonly",
77
+ Re
76
78
  ].filter(Boolean).join(" "),
77
- style: Ie,
78
- ref: W,
79
+ style: ze,
80
+ ref: $e,
79
81
  onBlur: (e) => {
80
- ee(e.relatedTarget, e.currentTarget) && Be?.(e);
82
+ ee(e.relatedTarget, e.currentTarget) && We?.(e);
81
83
  },
82
84
  children: [
83
- /* @__PURE__ */ l("div", {
84
- className: ["kapi-dp__field", O && "kapi-filterchip"].filter(Boolean).join(" "),
85
- ref: G,
85
+ /* @__PURE__ */ d("div", {
86
+ className: ["kapi-dp__field", E && "kapi-filterchip"].filter(Boolean).join(" "),
87
+ ref: U,
86
88
  children: [
87
- O && h,
88
- k && /* @__PURE__ */ l("label", {
89
+ E && m,
90
+ D && /* @__PURE__ */ d("label", {
89
91
  className: "kapi-dp__label",
90
- htmlFor: N,
91
- children: [k, ":"]
92
+ htmlFor: j,
93
+ children: [D, ":"]
92
94
  }),
93
- /* @__PURE__ */ c("input", {
95
+ /* @__PURE__ */ u("input", {
94
96
  ref: (t) => {
95
- Je.current = t, e(ze, t);
97
+ et.current = t, e(Ue, t);
96
98
  },
97
- ...t(j, {
98
- id: N,
99
- invalid: S,
100
- required: C
99
+ ...t(k, {
100
+ id: j,
101
+ invalid: He,
102
+ required: x
101
103
  }),
102
- ...O ? { size: ue(E) } : {},
104
+ ...E ? { size: fe(w) } : {},
103
105
  className: "kapi-input kapi-dp__input",
104
- value: B,
105
- placeholder: E,
106
- disabled: y,
107
- readOnly: M || void 0,
108
- "aria-label": Le,
106
+ value: R,
107
+ placeholder: w,
108
+ disabled: v,
109
+ readOnly: A || void 0,
110
+ "aria-label": Be,
109
111
  autoComplete: "off",
110
112
  inputMode: "numeric",
111
- onChange: (e) => V(ve(e.target.value, T)),
112
- onFocus: M ? void 0 : Xe,
113
- onBlur: tt,
113
+ onChange: (e) => z(be(e.target.value, C)),
114
+ onFocus: A ? void 0 : nt,
115
+ onBlur: st,
114
116
  onKeyDown: (e) => {
115
- e.key === "Escape" && P && (e.preventDefault(), e.stopPropagation(), X()), e.key === "ArrowDown" && !M && (e.preventDefault(), q());
117
+ e.key === "Escape" && M && (e.preventDefault(), e.stopPropagation(), J()), e.key === "ArrowDown" && !A && (e.preventDefault(), G());
116
118
  }
117
119
  }),
118
- /* @__PURE__ */ c("button", {
120
+ /* @__PURE__ */ u("button", {
119
121
  type: "button",
120
122
  className: "kapi-dp__toggle",
121
- disabled: y || M,
122
- "aria-label": D.openPicker,
123
- "aria-expanded": P,
124
- onClick: () => P ? X() : q(),
125
- children: /* @__PURE__ */ c(Ee, {
123
+ disabled: v || A,
124
+ "aria-label": T.openPicker,
125
+ "aria-expanded": M,
126
+ onClick: () => M ? J() : G(),
127
+ children: /* @__PURE__ */ u(ke, {
126
128
  size: 16,
127
129
  strokeWidth: 1.9
128
130
  })
129
131
  })
130
132
  ]
131
133
  }),
132
- x && /* @__PURE__ */ l(we, { children: [/* @__PURE__ */ c("input", {
134
+ b && /* @__PURE__ */ d(Oe, { children: [/* @__PURE__ */ u("input", {
133
135
  type: "hidden",
134
- name: `${x}.from`,
135
- value: r(I.from, "date"),
136
- disabled: y
137
- }), /* @__PURE__ */ c("input", {
136
+ name: `${b}.from`,
137
+ value: r(P.from, "date"),
138
+ disabled: v
139
+ }), /* @__PURE__ */ u("input", {
138
140
  type: "hidden",
139
- name: `${x}.to`,
140
- value: r(I.to, "date"),
141
- disabled: y
141
+ name: `${b}.to`,
142
+ value: r(P.to, "date"),
143
+ disabled: v
142
144
  })] }),
143
- P && !y && !M && /* @__PURE__ */ c("div", {
144
- ref: K,
145
- className: `kapi-dp__pop${at === "top" ? " kapi-dp__pop--up" : ""}`,
145
+ M && !v && !A && /* @__PURE__ */ u("div", {
146
+ ref: W,
147
+ className: `kapi-dp__pop${lt === "top" ? " kapi-dp__pop--up" : ""}`,
146
148
  onKeyDown: (e) => {
147
- e.key === "Escape" && (e.preventDefault(), X(), J());
149
+ e.key === "Escape" && (e.preventDefault(), J(), K());
148
150
  },
149
- children: /* @__PURE__ */ l("div", {
151
+ children: /* @__PURE__ */ d("div", {
150
152
  className: "kapi-dp__cal",
151
153
  children: [
152
- /* @__PURE__ */ l("div", {
154
+ /* @__PURE__ */ d("div", {
153
155
  className: "kapi-dp__head",
154
156
  children: [
155
- /* @__PURE__ */ c("button", {
157
+ /* @__PURE__ */ u("button", {
156
158
  type: "button",
157
159
  className: "kapi-dp__nav",
158
- "aria-label": D.prevMonth,
159
- onClick: () => it(-1),
160
- children: /* @__PURE__ */ c(De, {
160
+ "aria-label": T.prevMonth,
161
+ onClick: () => Z(-1),
162
+ children: /* @__PURE__ */ u(Ae, {
161
163
  className: "kapi-flip-rtl",
162
164
  size: 15,
163
165
  strokeWidth: 2.2
164
166
  })
165
167
  }),
166
- /* @__PURE__ */ c("span", {
168
+ /* @__PURE__ */ u("span", {
167
169
  className: "kapi-dp__title",
168
- children: fe(H, D.months)
170
+ children: me(B, T.months)
169
171
  }),
170
- /* @__PURE__ */ c("button", {
172
+ /* @__PURE__ */ u("button", {
171
173
  type: "button",
172
174
  className: "kapi-dp__nav",
173
- "aria-label": D.nextMonth,
174
- onClick: () => it(1),
175
- children: /* @__PURE__ */ c(Oe, {
175
+ "aria-label": T.nextMonth,
176
+ onClick: () => Z(1),
177
+ children: /* @__PURE__ */ u(je, {
176
178
  className: "kapi-flip-rtl",
177
179
  size: 15,
178
180
  strokeWidth: 2.2
@@ -180,56 +182,56 @@ var p = {
180
182
  })
181
183
  ]
182
184
  }),
183
- /* @__PURE__ */ c(me, {
184
- weekStartsOn: Ve,
185
- view: H,
186
- onViewChange: U,
187
- labels: D,
188
- focusTarget: L.from,
189
- focusRequest: Ye,
190
- isSelected: (e) => o(e, L, null) !== null,
185
+ /* @__PURE__ */ u(ge, {
186
+ weekStartsOn: Ge,
187
+ view: B,
188
+ onViewChange: V,
189
+ labels: T,
190
+ focusTarget: F.from,
191
+ focusRequest: tt,
192
+ isSelected: (e) => o(e, F, null) !== null,
191
193
  dayClassName: (e) => {
192
- let t = o(e, L, Q ? qe : null);
194
+ let t = o(e, F, Q ? Qe : null);
193
195
  return [(t === "start" || t === "end" || t === "single") && "kapi-dp__day--sel", t && `kapi-dp__day--${t}`].filter(Boolean).join(" ");
194
196
  },
195
- onPick: nt,
197
+ onPick: ct,
196
198
  onDayHover: (e) => {
197
- e === null ? z(null) : Q && z(e);
199
+ e === null ? L(null) : Q && L(e);
198
200
  }
199
201
  }),
200
- /* @__PURE__ */ l("div", {
202
+ /* @__PURE__ */ d("div", {
201
203
  className: "kapi-dp__foot",
202
- children: [/* @__PURE__ */ c("button", {
204
+ children: [/* @__PURE__ */ u("button", {
203
205
  type: "button",
204
206
  className: "kapi-dp__link",
205
207
  onClick: () => {
206
- Z(i), F(!1);
208
+ Y(i), N(!1);
207
209
  },
208
- children: D.clear
209
- }), /* @__PURE__ */ c("span", {
210
+ children: T.clear
211
+ }), /* @__PURE__ */ u("span", {
210
212
  className: "kapi-dp__hint",
211
213
  "aria-live": "polite",
212
- children: Q ? D.pickEnd : D.pickStart
214
+ children: Q ? T.pickEnd : T.pickStart
213
215
  })]
214
216
  }),
215
- $ && /* @__PURE__ */ l("div", {
217
+ $ && /* @__PURE__ */ d("div", {
216
218
  className: "kapi-dp__open",
217
- children: [/* @__PURE__ */ c("button", {
219
+ children: [/* @__PURE__ */ u("button", {
218
220
  type: "button",
219
221
  className: "kapi-dp__link",
220
- onClick: () => rt({
222
+ onClick: () => X({
221
223
  from: $,
222
224
  to: null
223
225
  }),
224
- children: D.openEnd
225
- }), /* @__PURE__ */ c("button", {
226
+ children: T.openEnd
227
+ }), /* @__PURE__ */ u("button", {
226
228
  type: "button",
227
229
  className: "kapi-dp__link",
228
- onClick: () => rt({
230
+ onClick: () => X({
229
231
  from: null,
230
232
  to: $
231
233
  }),
232
- children: D.openStart
234
+ children: T.openStart
233
235
  })]
234
236
  })
235
237
  ]
@@ -239,4 +241,4 @@ var p = {
239
241
  }));
240
242
  };
241
243
  //#endregion
242
- export { p as DEFAULT_DATE_RANGE_LABELS, m as KapiDateRangePicker };
244
+ export { f as DEFAULT_DATE_RANGE_LABELS, p as KapiDateRangePicker };
@@ -1,18 +1,18 @@
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
- import { useAsyncLoader as r } from "../../hooks/useAsyncLoader.js";
7
- import { KapiDatePicker as te } from "./KapiDatePicker.js";
8
- import { KapiDateRangePicker as ne } from "./KapiDateRangePicker.js";
9
- import { useMergedRefs as re } from "../../hooks/mergeRefs.js";
6
+ import { useMergedRefs as r } from "../../hooks/mergeRefs.js";
7
+ import { useAsyncLoader as te } from "../../hooks/useAsyncLoader.js";
8
+ import { KapiDatePicker as ne } from "./KapiDatePicker.js";
9
+ import { KapiDateRangePicker as re } from "./KapiDateRangePicker.js";
10
10
  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 = re(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,
@@ -50,7 +50,7 @@ function m({ facets: m, chips: h, onText: fe, onClearAll: g, loadDelay: pe = 300
50
50
  gte: y.operatorGte,
51
51
  lt: y.operatorLt,
52
52
  lte: y.operatorLte
53
- }, B = (e) => ae(e, e.operator ? z[e.operator] : void 0), V = o(D) && !I, be = r({
53
+ }, B = (e) => ae(e, e.operator ? z[e.operator] : void 0), V = o(D) && !I, be = te({
54
54
  query: F,
55
55
  key: `${D?.key ?? ""}\u0000${F}`,
56
56
  enabled: R && j && !V,
@@ -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(ne, {
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(te, {
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"