@kapiuara/ui 0.14.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 (116) 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/renderSlot.d.ts +27 -0
  113. package/dist/components/renderSlot.js +23 -0
  114. package/dist/hooks/portalRoot.js +6 -6
  115. package/dist/index.d.ts +2 -0
  116. package/package.json +1 -1
@@ -6,117 +6,117 @@ import { usePlacement as n } from "../../hooks/usePlacement.js";
6
6
  import { useMergedRefs as r } from "../../hooks/mergeRefs.js";
7
7
  import { useDismiss as i } from "../../hooks/useDismiss.js";
8
8
  import { KapiTooltip as a } from "../overlays/KapiTooltip.js";
9
- import { annotationClasses as ee, annotationRole as o } from "./annotationLogic.js";
9
+ import { annotationClasses as o, annotationRole as s } from "./annotationLogic.js";
10
10
  /* empty css */
11
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
12
- import { useEffect as l, useId as u, useRef as d, useState as f } from "react";
13
- import { createPortal as p } from "react-dom";
11
+ import { useEffect as c, useId as l, useRef as u, useState as d } from "react";
12
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
13
+ import { createPortal as m } from "react-dom";
14
14
  //#region src/components/display/KapiAnnotation.tsx
15
- var m = 8, h = 8, g = 150;
16
- function _({ children: _, info: v, underline: y = "dotted", tone: b = "primary", onClick: x, popover: S, interactive: C = !1, className: w, "aria-label": T, ref: E, ...D }) {
17
- let O = u(), k = d(null), A = r(k, E), [j, M] = f(!1), [N, P] = f(!1), F = d(null), I = d(void 0), { element: L, tabIndex: R, mode: z } = o(x, S, v), B = ee({
18
- underline: y,
19
- tone: b,
20
- clickable: !!x,
21
- className: w
15
+ var h = 8, g = 8, _ = 150;
16
+ function v({ children: v, info: y, underline: b = "dotted", tone: x = "primary", onClick: S, popover: C, interactive: w = !1, className: T, "aria-label": E, ref: D, ...O }) {
17
+ let k = l(), A = u(null), j = r(A, D), [M, N] = d(!1), [ee, P] = d(!1), F = u(null), I = u(void 0), { element: L, tabIndex: R, mode: z } = s(S, C, y), B = o({
18
+ underline: b,
19
+ tone: x,
20
+ clickable: !!S,
21
+ className: T
22
22
  }), V = (e) => {
23
- e.key === "Escape" && (M(!1), P(!0));
23
+ e.key === "Escape" && (N(!1), P(!0));
24
24
  }, H = () => clearTimeout(I.current), U = () => {
25
- H(), P(!1), M(!0);
25
+ H(), P(!1), N(!0);
26
26
  }, W = () => {
27
- H(), M(!1), P(!1);
27
+ H(), N(!1), P(!1);
28
28
  }, G = () => {
29
- if (!C) return W();
30
- H(), I.current = setTimeout(W, g);
29
+ if (!w) return W();
30
+ H(), I.current = setTimeout(W, _);
31
31
  }, K = (e) => {
32
32
  let t = e.relatedTarget;
33
- C && t && F.current?.contains(t) || W();
33
+ w && t && F.current?.contains(t) || W();
34
34
  }, { placement: q } = n({
35
- open: j,
36
- anchor: k,
35
+ open: M,
36
+ anchor: A,
37
37
  floatingRef: F,
38
38
  side: "bottom",
39
39
  align: "center",
40
- offset: m,
41
- margin: h
40
+ offset: h,
41
+ margin: g
42
42
  }), J = q ? {
43
43
  top: q.top,
44
44
  left: q.centerX,
45
45
  side: q.side === "top" ? "top" : "bottom"
46
- } : null, Y = i(j && C, {
47
- zones: [k, F],
46
+ } : null, Y = i(M && w, {
47
+ zones: [A, F],
48
48
  onDismiss: (e) => {
49
49
  if (e === "outside") return W();
50
- M(!1), P(!0);
50
+ N(!1), P(!0);
51
51
  }
52
52
  });
53
- l(() => () => clearTimeout(I.current), []);
53
+ c(() => () => clearTimeout(I.current), []);
54
54
  let X = {
55
- ...D,
56
- ref: A,
55
+ ...O,
56
+ ref: j,
57
57
  className: B,
58
58
  onKeyDown: V,
59
- onClick: x,
60
- ...T !== void 0 && { "aria-label": T },
61
- "data-dismissed": N ? "" : void 0
59
+ onClick: S,
60
+ ...E !== void 0 && { "aria-label": E },
61
+ "data-dismissed": ee ? "" : void 0
62
62
  };
63
63
  if (z === "tooltip") {
64
- let e = String(v), t = L === "button" ? /* @__PURE__ */ s("button", {
64
+ let e = String(y), t = L === "button" ? /* @__PURE__ */ f("button", {
65
65
  ...X,
66
66
  type: "button",
67
67
  onBlur: W,
68
- children: _
69
- }) : /* @__PURE__ */ s("span", {
68
+ children: v
69
+ }) : /* @__PURE__ */ f("span", {
70
70
  ...X,
71
71
  tabIndex: R,
72
72
  onBlur: W,
73
- children: _
73
+ children: v
74
74
  });
75
- return /* @__PURE__ */ s(a, {
75
+ return /* @__PURE__ */ f(a, {
76
76
  label: e,
77
77
  prefer: "top",
78
78
  children: t
79
79
  });
80
80
  }
81
- let Z = S ?? { body: v }, Q = {
81
+ let Z = C ?? { body: y }, Q = {
82
82
  ...X,
83
- "aria-describedby": e(D["aria-describedby"], j && O),
83
+ "aria-describedby": e(O["aria-describedby"], M && k),
84
84
  onFocus: U,
85
85
  onBlur: K
86
- }, $ = j ? t(k.current) : null;
87
- return /* @__PURE__ */ c("span", {
86
+ }, $ = M ? t(A.current) : null;
87
+ return /* @__PURE__ */ p("span", {
88
88
  className: "kapi-annotation-wrap",
89
89
  onMouseEnter: U,
90
90
  onMouseLeave: G,
91
91
  onKeyDown: Y,
92
- children: [L === "button" ? /* @__PURE__ */ s("button", {
92
+ children: [L === "button" ? /* @__PURE__ */ f("button", {
93
93
  ...Q,
94
94
  type: "button",
95
- children: _
96
- }) : /* @__PURE__ */ s("span", {
95
+ children: v
96
+ }) : /* @__PURE__ */ f("span", {
97
97
  ...Q,
98
98
  tabIndex: R,
99
- children: _
100
- }), $ && p(/* @__PURE__ */ c("span", {
99
+ children: v
100
+ }), $ && m(/* @__PURE__ */ p("span", {
101
101
  ref: F,
102
- id: O,
102
+ id: k,
103
103
  role: "tooltip",
104
104
  className: "kapi-annotation__pop",
105
105
  "data-side": J?.side ?? "bottom",
106
- "data-interactive": C ? "" : void 0,
106
+ "data-interactive": w ? "" : void 0,
107
107
  style: {
108
108
  top: J?.top ?? 0,
109
109
  left: J?.left ?? 0,
110
110
  visibility: J ? void 0 : "hidden"
111
111
  },
112
- tabIndex: C ? -1 : void 0,
113
- onMouseEnter: C ? H : void 0,
114
- onMouseLeave: C ? G : void 0,
115
- onBlur: C ? K : void 0,
116
- children: [Z.title && /* @__PURE__ */ s("span", {
112
+ tabIndex: w ? -1 : void 0,
113
+ onMouseEnter: w ? H : void 0,
114
+ onMouseLeave: w ? G : void 0,
115
+ onBlur: w ? K : void 0,
116
+ children: [Z.title && /* @__PURE__ */ f("span", {
117
117
  className: "kapi-annotation__title",
118
118
  children: Z.title
119
- }), /* @__PURE__ */ s("span", {
119
+ }), /* @__PURE__ */ f("span", {
120
120
  className: "kapi-annotation__body",
121
121
  children: Z.body
122
122
  })]
@@ -124,4 +124,4 @@ function _({ children: _, info: v, underline: y = "dotted", tone: b = "primary",
124
124
  });
125
125
  }
126
126
  //#endregion
127
- export { _ as KapiAnnotation };
127
+ export { v as KapiAnnotation };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/display/KapiComment.css";
3
- import { useKapiFormatLocale as e } from "../locale/KapiLocaleProvider.js";
4
- import { joinClasses as t } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { useKapiFormatLocale as t } from "../locale/KapiLocaleProvider.js";
5
5
  import { KapiAvatar as n } from "./KapiAvatar.js";
6
6
  import { formatDate as r, formatRelativeTime as i, isoDateTime as a } from "../../hooks/dateFormat.js";
7
7
  /* empty css */
@@ -11,11 +11,11 @@ var c = {
11
11
  dateStyle: "medium",
12
12
  timeStyle: "short"
13
13
  }, l = ({ author: l, avatarSrc: u, avatar: d, date: f, now: p, body: m, meta: h, actions: g, children: _, ref: v, className: y, ...b }) => {
14
- let x = e(), S = f === void 0 ? null : a(f), C = _ != null && _ !== !1;
14
+ let x = t(), S = f === void 0 ? null : a(f), C = _ != null && _ !== !1;
15
15
  return /* @__PURE__ */ s("article", {
16
16
  ...b,
17
17
  ref: v,
18
- className: t("kapi-comment", y),
18
+ className: e("kapi-comment", y),
19
19
  children: [/* @__PURE__ */ s("div", {
20
20
  className: "kapi-comment__row",
21
21
  children: [/* @__PURE__ */ o("span", {
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/display/KapiComment.css";
3
- import { KapiButton as e } from "../inputs/KapiButton.js";
4
- import { assignRef as t, joinIds as n } from "../inputs/fieldLogic.js";
5
- import { useKapiField as r } from "../inputs/KapiField.js";
6
- import { useLabels as i } from "../locale/KapiLocaleProvider.js";
7
- import { joinClasses as a } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { KapiButton as t } from "../inputs/KapiButton.js";
5
+ import { assignRef as n, joinIds as r } from "../inputs/fieldLogic.js";
6
+ import { useKapiField as i } from "../inputs/KapiField.js";
7
+ import { useLabels as a } from "../locale/KapiLocaleProvider.js";
8
8
  import { KapiTextarea as o } from "../inputs/KapiTextarea.js";
9
9
  /* empty css */
10
10
  import { isSubmitShortcut as s } from "./commentLogic.js";
11
11
  import { useSubmitDraft as c } from "../../hooks/useSubmitDraft.js";
12
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
13
- import { useId as d } from "react";
12
+ import { useId as l } from "react";
13
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
14
14
  //#region src/components/display/KapiCommentComposer.tsx
15
15
  var f = {
16
16
  label: "Comentario",
@@ -18,7 +18,7 @@ var f = {
18
18
  submit: "Comentar",
19
19
  shortcut: "Ctrl o ⌘ + Enter para enviar"
20
20
  }, p = ({ value: p, defaultValue: m, onChange: h, onSubmit: g, loading: _ = !1, invalid: v, required: y, disabled: b, className: x, style: S, labels: C, ref: w, placeholder: T, onKeyDown: E, "aria-label": D, "aria-labelledby": O, "aria-describedby": k, ...A }) => {
21
- let j = i("commentComposer", f, C), M = r(), N = d(), { text: P, setText: F, submit: I, busy: L, canSubmit: R, boxRef: z } = c({
21
+ let j = a("commentComposer", f, C), M = i(), N = l(), { text: P, setText: F, submit: I, busy: L, canSubmit: R, boxRef: z } = c({
22
22
  value: p,
23
23
  defaultValue: m,
24
24
  onChange: h,
@@ -31,13 +31,13 @@ var f = {
31
31
  isComposing: e.nativeEvent.isComposing
32
32
  }) && (e.preventDefault(), I());
33
33
  }, V = D !== void 0 || O !== void 0 || M !== null;
34
- return /* @__PURE__ */ u("div", {
35
- className: a("kapi-composer", x),
34
+ return /* @__PURE__ */ d("div", {
35
+ className: e("kapi-composer", x),
36
36
  style: S,
37
- children: [/* @__PURE__ */ l(o, {
37
+ children: [/* @__PURE__ */ u(o, {
38
38
  ...A,
39
39
  ref: (e) => {
40
- z.current = e, t(w, e);
40
+ z.current = e, n(w, e);
41
41
  },
42
42
  className: "kapi-composer__input",
43
43
  autosize: !0,
@@ -48,18 +48,18 @@ var f = {
48
48
  placeholder: T ?? j.placeholder,
49
49
  "aria-label": V ? D : j.label,
50
50
  "aria-labelledby": O,
51
- "aria-describedby": n(k, N),
51
+ "aria-describedby": r(k, N),
52
52
  ...y === void 0 ? {} : { required: y },
53
53
  ...v ? { invalid: !0 } : {},
54
54
  onChange: (e) => F(e.target.value),
55
55
  onKeyDown: B
56
- }), /* @__PURE__ */ u("div", {
56
+ }), /* @__PURE__ */ d("div", {
57
57
  className: "kapi-composer__foot",
58
- children: [/* @__PURE__ */ l("span", {
58
+ children: [/* @__PURE__ */ u("span", {
59
59
  id: N,
60
60
  className: "kapi-composer__hint",
61
61
  children: j.shortcut
62
- }), /* @__PURE__ */ l(e, {
62
+ }), /* @__PURE__ */ u(t, {
63
63
  tone: "primary",
64
64
  size: "sm",
65
65
  disabled: !R,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/display/KapiFileItem.css";
3
- import { useKapiFormatLocale as e } from "../locale/KapiLocaleProvider.js";
4
- import { joinClasses as t } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { useKapiFormatLocale as t } from "../locale/KapiLocaleProvider.js";
5
5
  import { formatFileSize as n } from "../../hooks/downloadLogic.js";
6
6
  import { formatDate as r, isoDateTime as i } from "../../hooks/dateFormat.js";
7
7
  import { fileItemKind as a, fileMetaParts as o } from "./fileItemLogic.js";
@@ -15,14 +15,14 @@ var p = {
15
15
  text: u,
16
16
  other: l
17
17
  }, m = ({ name: l, mimeType: u, size: d, date: f, details: m, icon: h, status: g, actions: _, onOpen: v, ref: y, className: b, ...x }) => {
18
- let S = e(), C = a(u, l), w = p[C], T = f === void 0 ? null : i(f), E = T === null || f === void 0 ? null : /* @__PURE__ */ s("time", {
18
+ let S = t(), C = a(u, l), w = p[C], T = f === void 0 ? null : i(f), E = T === null || f === void 0 ? null : /* @__PURE__ */ s("time", {
19
19
  dateTime: T,
20
20
  children: r(f, S)
21
21
  }, "date"), D = o(m, d === void 0 ? "" : n(d, S), E);
22
22
  return /* @__PURE__ */ c("li", {
23
23
  ...x,
24
24
  ref: y,
25
- className: t("kapi-file", b),
25
+ className: e("kapi-file", b),
26
26
  children: [
27
27
  /* @__PURE__ */ s("span", {
28
28
  className: `kapi-file__icon kapi-file__icon--${C}`,
@@ -66,10 +66,10 @@ var p = {
66
66
  })
67
67
  ]
68
68
  });
69
- }, h = ({ className: e, ref: n, ...r }) => /* @__PURE__ */ s("ul", {
69
+ }, h = ({ className: t, ref: n, ...r }) => /* @__PURE__ */ s("ul", {
70
70
  ...r,
71
71
  ref: n,
72
- className: t("kapi-filelist", e)
72
+ className: e("kapi-filelist", t)
73
73
  });
74
74
  //#endregion
75
75
  export { m as KapiFileItem, h as KapiFileList };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/display/KapiFileViewer.css";
3
- import { buttonClasses as e } from "../inputs/KapiButton.js";
4
- import { useLabels as t } from "../locale/KapiLocaleProvider.js";
5
- import { joinClasses as n } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { buttonClasses as t } from "../inputs/KapiButton.js";
5
+ import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
6
  import { fileKind as r, fileNameFromUrl as i, isSafeFileUrl as a } from "../../hooks/downloadLogic.js";
7
7
  import { useObjectUrl as o } from "../../hooks/useObjectUrl.js";
8
8
  /* empty css */
@@ -23,13 +23,13 @@ var f = {
23
23
  return r(n ?? (typeof e == "string" ? e : ""));
24
24
  };
25
25
  function h({ src: r, fileName: i, type: h, title: g, height: _, downloadable: v = !0, toolbar: y = !0, labels: b, className: x, style: S, ref: C, ...w }) {
26
- let T = t("fileViewer", f, b), E = o(typeof r == "string" ? null : r), D = typeof r == "string" && !a(r), O = typeof r == "string" ? D ? null : r : E, k = p(r, i), A = m(r, h, k), j = g ?? k ?? T.file, M = _ ? {
26
+ let T = n("fileViewer", f, b), E = o(typeof r == "string" ? null : r), D = typeof r == "string" && !a(r), O = typeof r == "string" ? D ? null : r : E, k = p(r, i), A = m(r, h, k), j = g ?? k ?? T.file, M = _ ? {
27
27
  ...S,
28
28
  "--kapi-file-viewer-h": _
29
- } : S, N = (t) => v && O ? /* @__PURE__ */ c("a", {
30
- className: e({
29
+ } : S, N = (e) => v && O ? /* @__PURE__ */ c("a", {
30
+ className: t({
31
31
  size: "sm",
32
- className: t
32
+ className: e
33
33
  }),
34
34
  href: O,
35
35
  download: k ?? "",
@@ -75,7 +75,7 @@ function h({ src: r, fileName: i, type: h, title: g, height: _, downloadable: v
75
75
  }) : P), /* @__PURE__ */ c("div", {
76
76
  ...w,
77
77
  ref: C,
78
- className: n("kapi-file-viewer", `kapi-file-viewer--${A}`, x),
78
+ className: e("kapi-file-viewer", `kapi-file-viewer--${A}`, x),
79
79
  style: M,
80
80
  children: [y && /* @__PURE__ */ c("div", {
81
81
  className: "kapi-file-viewer__bar",
@@ -85,7 +85,7 @@ function h({ src: r, fileName: i, type: h, title: g, height: _, downloadable: v
85
85
  }), /* @__PURE__ */ c("span", {
86
86
  className: "kapi-file-viewer__actions",
87
87
  children: [typeof r == "string" && O && /* @__PURE__ */ c("a", {
88
- className: e({
88
+ className: t({
89
89
  size: "sm",
90
90
  variant: "ghost"
91
91
  }),
@@ -4,35 +4,35 @@ import { joinClasses as e } from "../rootProps.js";
4
4
  import { KapiTooltip as t } from "../overlays/KapiTooltip.js";
5
5
  import { isTruncated as n } from "./truncateLogic.js";
6
6
  /* empty css */
7
- import { jsx as r } from "react/jsx-runtime";
8
- import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
7
+ import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
8
+ import { jsx as s } from "react/jsx-runtime";
9
9
  //#region src/components/display/KapiTruncate.tsx
10
10
  var c = ({ text: c, prefer: l = "top", focusable: u = !1, className: d, ref: f, ...p }) => {
11
- let m = o(null), h = o(null), [g, _] = s(!1), v = i(() => {
11
+ let m = a(null), h = a(null), [g, _] = o(!1), v = r(() => {
12
12
  let e = m.current, t = h.current;
13
13
  e && t && _(n(t.scrollWidth, e.clientWidth));
14
14
  }, []);
15
- a(() => {
15
+ i(() => {
16
16
  v();
17
17
  let e = m.current;
18
18
  if (!e || typeof ResizeObserver > "u") return;
19
19
  let t = new ResizeObserver(v);
20
20
  return t.observe(e), () => t.disconnect();
21
21
  }, [v, c]);
22
- let y = /* @__PURE__ */ r("span", {
22
+ let y = /* @__PURE__ */ s("span", {
23
23
  className: "kapi-truncate__text",
24
24
  ref: h,
25
25
  ...u ? { tabIndex: 0 } : {},
26
26
  children: c
27
27
  });
28
- return /* @__PURE__ */ r("span", {
28
+ return /* @__PURE__ */ s("span", {
29
29
  ...p,
30
30
  ref: (e) => {
31
31
  m.current = e, typeof f == "function" ? f(e) : f && (f.current = e);
32
32
  },
33
33
  className: e("kapi-truncate", d),
34
34
  "data-truncated": g || void 0,
35
- children: g ? /* @__PURE__ */ r(t, {
35
+ children: g ? /* @__PURE__ */ s(t, {
36
36
  label: c,
37
37
  prefer: l,
38
38
  className: "kapi-truncate__tip",
@@ -1,4 +1,5 @@
1
1
  import type { HTMLAttributes, ReactNode, Ref } from "react";
2
+ import type { KapiCloseReason } from "../closeReason.js";
2
3
  import { type KapiTone } from "../tone.js";
3
4
  import type { KapiLabelsOverride } from "../labelsLogic.js";
4
5
  export type KapiAlertLabels = {
@@ -37,7 +38,7 @@ export type KapiAlertProps = Omit<HTMLAttributes<HTMLDivElement>, "title" | "rol
37
38
  */
38
39
  icon?: ReactNode | false | undefined;
39
40
  /** Hace el aviso descartable: dibuja una X a la derecha que llama a `onClose`. El padre lo desmonta. */
40
- onClose?: (() => void) | undefined;
41
+ onClose?: ((reason: KapiCloseReason) => void) | undefined;
41
42
  /** Textos fijos (nombre accesible de la X). */
42
43
  labels?: KapiLabelsOverride<KapiAlertLabels> | undefined;
43
44
  };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import "#kapi-css/components/feedback/feedback.css";
3
- import { resolveTone as e } from "../tone.js";
4
- import { KapiButton as t } from "../inputs/KapiButton.js";
5
- import { useLabels as n } from "../locale/KapiLocaleProvider.js";
6
- import { joinClasses as r } from "../rootProps.js";
3
+ import { joinClasses as e } from "../rootProps.js";
4
+ import { resolveTone as t } from "../tone.js";
5
+ import { KapiButton as n } from "../inputs/KapiButton.js";
6
+ import { useLabels as r } from "../locale/KapiLocaleProvider.js";
7
7
  /* empty css */
8
8
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
9
9
  import { AlertTriangle as o, CheckCircle2 as s, Info as c, X as l, XCircle as u } from "lucide-react";
@@ -29,10 +29,10 @@ var d = { close: "Cerrar aviso" }, f = (e, t) => {
29
29
  color: "var(--kapi-danger)"
30
30
  }
31
31
  }, m = ({ tone: o, variant: s, title: c, children: u, action: m, icon: h, onClose: g, labels: _, className: v, role: y, ...b }) => {
32
- let x = n("alert", d, _), S = e(o, s, "info"), C = S in p ? S : "info", { Icon: w, color: T } = p[C];
32
+ let x = r("alert", d, _), S = t(o, s, "info"), C = S in p ? S : "info", { Icon: w, color: T } = p[C];
33
33
  return /* @__PURE__ */ a("div", {
34
34
  ...b,
35
- className: r("kapi-alert", `kapi-alert--${C}`, v),
35
+ className: e("kapi-alert", `kapi-alert--${C}`, v),
36
36
  role: f(C, y),
37
37
  children: [
38
38
  h === void 0 ? /* @__PURE__ */ i(w, {
@@ -57,7 +57,7 @@ var d = { close: "Cerrar aviso" }, f = (e, t) => {
57
57
  })]
58
58
  }),
59
59
  m,
60
- g && /* @__PURE__ */ i(t, {
60
+ g && /* @__PURE__ */ i(n, {
61
61
  className: "kapi-alert__close",
62
62
  variant: "ghost",
63
63
  size: "sm",
@@ -68,7 +68,7 @@ var d = { close: "Cerrar aviso" }, f = (e, t) => {
68
68
  "aria-hidden": "true"
69
69
  }),
70
70
  "aria-label": x.close,
71
- onClick: g
71
+ onClick: () => g?.("close-button")
72
72
  })
73
73
  ]
74
74
  });
@@ -5,12 +5,12 @@ import { KapiTooltip as n } from "../overlays/KapiTooltip.js";
5
5
  import { KapiBadge as r } from "../display/KapiBadge.js";
6
6
  /* empty css */
7
7
  import { DEFAULT_COUNTDOWN_LABELS as i, DEFAULT_NEAR_MS as a, bucketFor as o, chipText as s, describe as c, parseTarget as l, resolveTones as u } from "./countdownLogic.js";
8
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
- import { useEffect as p, useState as m } from "react";
8
+ import { useEffect as d, useState as f } from "react";
9
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
10
  //#region src/components/feedback/KapiCountdown.tsx
11
11
  function h({ to: h, prefix: g, tones: _, nearThresholdMs: v = a, detail: y, labels: b, size: x = "md", badgeVariant: S, badgeTone: C, className: w, ...T }) {
12
- let [E, D] = m(() => Date.now()), O = t("countdown", i, b), k = e() ?? "es";
13
- p(() => {
12
+ let [E, D] = f(() => Date.now()), O = t("countdown", i, b), k = e() ?? "es";
13
+ d(() => {
14
14
  D(Date.now());
15
15
  let e = setInterval(() => D(Date.now()), 1e3);
16
16
  return () => clearInterval(e);
@@ -18,9 +18,9 @@ function h({ to: h, prefix: g, tones: _, nearThresholdMs: v = a, detail: y, labe
18
18
  let A = l(h);
19
19
  if (!Number.isFinite(A)) return null;
20
20
  let j = A - E, M = o(j, v), N = u(_)[M], P = y ?? c(j, O, k), F = g && M !== "overdue";
21
- return /* @__PURE__ */ d(n, {
21
+ return /* @__PURE__ */ p(n, {
22
22
  label: P,
23
- children: /* @__PURE__ */ f(r, {
23
+ children: /* @__PURE__ */ m(r, {
24
24
  ...T,
25
25
  tone: N,
26
26
  variant: S ?? C ?? "subtle",
@@ -30,10 +30,10 @@ function h({ to: h, prefix: g, tones: _, nearThresholdMs: v = a, detail: y, labe
30
30
  role: "timer",
31
31
  "aria-label": P,
32
32
  suppressHydrationWarning: !0,
33
- children: [F && /* @__PURE__ */ d("span", {
33
+ children: [F && /* @__PURE__ */ p("span", {
34
34
  className: "kapi-countdown__prefix",
35
35
  children: g
36
- }), /* @__PURE__ */ d("span", {
36
+ }), /* @__PURE__ */ p("span", {
37
37
  className: "kapi-countdown__time",
38
38
  children: s(j, O)
39
39
  })]