@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.
- package/README.md +239 -1
- package/dist/components/chat/KapiChatDivider.d.ts +7 -3
- package/dist/components/chat/KapiChatDivider.js +6 -6
- package/dist/components/chat/KapiChatList.js +19 -19
- package/dist/components/chat/KapiChatThread.js +23 -23
- package/dist/components/chat/KapiComposer.js +19 -19
- package/dist/components/chat/KapiMessageBubble.js +4 -4
- package/dist/components/chat/KapiTypingIndicator.js +4 -4
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/closeReason.d.ts +34 -0
- package/dist/components/data/KapiBarChart.js +1 -1
- package/dist/components/data/KapiDataTable.js +31 -31
- package/dist/components/data/KapiEventCalendar.js +78 -78
- package/dist/components/data/KapiHeatmap.js +23 -23
- package/dist/components/data/KapiLineChart.js +1 -1
- package/dist/components/data/KapiPagination.js +4 -4
- package/dist/components/data/KapiSparkline.js +1 -1
- package/dist/components/data/KapiTable.js +122 -122
- package/dist/components/data/KapiTableFilter.js +18 -18
- package/dist/components/data/KapiTableRow.js +24 -24
- package/dist/components/data/KapiTableToolbar.js +49 -49
- package/dist/components/data/chartFrame.js +21 -21
- package/dist/components/data/useColumnResize.js +8 -8
- package/dist/components/data/useTableSelection.js +8 -8
- package/dist/components/display/KapiAnnotation.js +55 -55
- package/dist/components/display/KapiComment.js +4 -4
- package/dist/components/display/KapiCommentComposer.js +16 -16
- package/dist/components/display/KapiFileItem.js +6 -6
- package/dist/components/display/KapiFileViewer.js +9 -9
- package/dist/components/display/KapiTruncate.js +7 -7
- package/dist/components/feedback/KapiAlert.d.ts +2 -1
- package/dist/components/feedback/KapiAlert.js +8 -8
- package/dist/components/feedback/KapiCountdown.js +8 -8
- package/dist/components/feedback/KapiFab.js +30 -30
- package/dist/components/feedback/KapiOfflineBanner.js +8 -8
- package/dist/components/feedback/KapiToastContainer.js +25 -25
- package/dist/components/feedback/KapiTour.d.ts +2 -1
- package/dist/components/feedback/KapiTour.js +35 -35
- package/dist/components/inputs/KapiAutocomplete.js +14 -14
- package/dist/components/inputs/KapiButton.d.ts +17 -1
- package/dist/components/inputs/KapiButton.js +41 -25
- package/dist/components/inputs/KapiCalendar.js +5 -5
- package/dist/components/inputs/KapiCalendarGrid.js +10 -10
- package/dist/components/inputs/KapiChecklist.js +71 -71
- package/dist/components/inputs/KapiDatePicker.js +124 -122
- package/dist/components/inputs/KapiDateRangePicker.js +138 -136
- package/dist/components/inputs/KapiFacetedSearch.js +29 -29
- package/dist/components/inputs/KapiField.js +14 -14
- package/dist/components/inputs/KapiFileUpload.js +27 -27
- package/dist/components/inputs/KapiIconButton.d.ts +9 -1
- package/dist/components/inputs/KapiIconButton.js +27 -10
- package/dist/components/inputs/KapiInput.js +21 -21
- package/dist/components/inputs/KapiInputGroup.js +8 -8
- package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
- package/dist/components/inputs/KapiMaskedInput.js +64 -51
- package/dist/components/inputs/KapiNumberStepper.js +29 -29
- package/dist/components/inputs/KapiRating.js +61 -59
- package/dist/components/inputs/KapiSearchChip.js +8 -8
- package/dist/components/inputs/KapiSegmented.js +74 -64
- package/dist/components/inputs/KapiSelect.js +232 -222
- package/dist/components/inputs/KapiSelectMenu.js +60 -60
- package/dist/components/inputs/KapiSlider.js +1 -1
- package/dist/components/inputs/KapiSwitch.js +6 -6
- package/dist/components/inputs/KapiTagInput.js +83 -81
- package/dist/components/inputs/KapiTextarea.js +8 -8
- package/dist/components/inputs/misuseWarnings.d.ts +37 -0
- package/dist/components/inputs/misuseWarnings.js +36 -0
- package/dist/components/inputs/numberStepLogic.d.ts +10 -0
- package/dist/components/inputs/numberStepLogic.js +16 -7
- package/dist/components/inputs/ownField.js +4 -4
- package/dist/components/layout/KapiAccountMenu.d.ts +2 -1
- package/dist/components/layout/KapiAccountMenu.js +53 -53
- package/dist/components/layout/KapiContextSlot.js +35 -35
- package/dist/components/layout/KapiMasonry.js +6 -6
- package/dist/components/layout/KapiNotificationBell.js +60 -60
- package/dist/components/layout/KapiPageHeader.js +19 -19
- package/dist/components/layout/KapiRail.js +60 -60
- package/dist/components/layout/KapiRailAccount.js +9 -9
- package/dist/components/layout/KapiRoot.js +21 -21
- package/dist/components/layout/KapiScrollArea.js +11 -11
- package/dist/components/layout/KapiShell.js +12 -12
- package/dist/components/locale/KapiLocaleProvider.js +13 -13
- package/dist/components/navigation/CtxSlidingList.js +4 -4
- package/dist/components/navigation/KapiAccordion.js +12 -12
- package/dist/components/navigation/KapiBreadcrumb.js +11 -11
- package/dist/components/navigation/KapiCollapsiblePanel.js +23 -23
- package/dist/components/navigation/KapiContextPanel.js +76 -76
- package/dist/components/navigation/KapiFilterChips.js +9 -9
- package/dist/components/navigation/KapiNavBadge.d.ts +4 -2
- package/dist/components/navigation/KapiNavBadge.js +11 -10
- package/dist/components/navigation/KapiPanelGroup.js +25 -25
- package/dist/components/navigation/KapiSteps.js +4 -4
- package/dist/components/navigation/KapiTabs.d.ts +4 -1
- package/dist/components/navigation/KapiTabs.js +63 -55
- package/dist/components/navigation/KapiTree.js +75 -75
- package/dist/components/navigation/KapiWizard.d.ts +2 -1
- package/dist/components/navigation/KapiWizard.js +30 -30
- package/dist/components/overlays/KapiCanvasForm.d.ts +6 -2
- package/dist/components/overlays/KapiCanvasForm.js +12 -12
- package/dist/components/overlays/KapiCommandPalette.d.ts +2 -1
- package/dist/components/overlays/KapiCommandPalette.js +23 -23
- package/dist/components/overlays/KapiConfirm.d.ts +2 -1
- package/dist/components/overlays/KapiConfirm.js +12 -12
- package/dist/components/overlays/KapiContextMenu.d.ts +2 -1
- package/dist/components/overlays/KapiContextMenu.js +18 -18
- package/dist/components/overlays/KapiDialogHost.js +22 -22
- package/dist/components/overlays/KapiLoading.js +16 -16
- package/dist/components/overlays/KapiMenuButton.js +15 -15
- package/dist/components/overlays/KapiModal.d.ts +2 -1
- package/dist/components/overlays/KapiModal.js +28 -28
- package/dist/components/overlays/KapiOffcanvas.d.ts +3 -2
- package/dist/components/overlays/KapiOffcanvas.js +63 -63
- package/dist/components/overlays/KapiOffcanvasStack.js +38 -38
- package/dist/components/overlays/KapiPhotoView.js +15 -15
- package/dist/components/overlays/KapiPopover.d.ts +2 -1
- package/dist/components/overlays/KapiPopover.js +10 -10
- package/dist/components/overlays/KapiShapeSheet.js +20 -20
- package/dist/components/overlays/KapiSplitModal.js +29 -29
- package/dist/components/overlays/KapiTooltip.js +21 -21
- package/dist/components/overlays/menuList.js +60 -60
- package/dist/components/renderSlot.d.ts +27 -0
- package/dist/components/renderSlot.js +23 -0
- package/dist/css/components/chat/chat.css +1 -1
- package/dist/hooks/portalRoot.js +6 -6
- package/dist/hooks/useControllableState.d.ts +6 -2
- package/dist/hooks/useControllableState.js +14 -11
- package/dist/hooks/useFormReset.d.ts +22 -0
- package/dist/hooks/useFormReset.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +5 -2
|
@@ -4,12 +4,12 @@ import { useControllableState as t } from "../../hooks/useControllableState.js";
|
|
|
4
4
|
import { formatCount as n } from "../../hooks/numberFormatLogic.js";
|
|
5
5
|
import { selectOnlyWithin as r, selectionState as i } from "./tableLogic.js";
|
|
6
6
|
import { datasetActionLabel as a, datasetHintLabel as o, datasetNoticeState as s, datasetSelectedLabel as c } from "./datasetSelectionLogic.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useMemo as l } from "react";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
import { Loader2 as p } from "lucide-react";
|
|
10
10
|
//#region src/components/data/useTableSelection.tsx
|
|
11
11
|
var m = [], h = ({ rows: a, keyField: o, selectable: c, selectedIds: h, defaultSelectedIds: g, onSelectedIdsChange: _, isRowSelectable: v, selectionPresets: y, rangeSelect: b, dataset: x, loadingLabel: S, locale: C }) => {
|
|
12
|
-
let [w, T] = t(h, g ?? m, _ && ((e) => _([...e]))), E =
|
|
12
|
+
let [w, T] = t(h, g ?? m, _ && ((e) => _([...e]))), E = l(() => new Set(w), [w]), D = (e) => T([...e]), O = () => D(/* @__PURE__ */ new Set()), k = [...E], A = e(), j = c && y !== void 0 && y.length > 0, M = l(() => a.filter((e) => !v || v(e)), [a, v]), N = l(() => M.map((e) => e[o]), [M, o]), P = l(() => j && y ? y.map((e) => ({
|
|
13
13
|
preset: e,
|
|
14
14
|
matching: e.match === void 0 ? [] : M.filter(e.match).map((e) => e[o])
|
|
15
15
|
})) : [], [
|
|
@@ -18,12 +18,12 @@ var m = [], h = ({ rows: a, keyField: o, selectable: c, selectedIds: h, defaultS
|
|
|
18
18
|
M,
|
|
19
19
|
o
|
|
20
20
|
]).map(({ preset: e, matching: t }) => {
|
|
21
|
-
let i = e.onSelect === void 0 ? t.length : e.count, a = e.pending === !0, o = a ? /* @__PURE__ */
|
|
21
|
+
let i = e.onSelect === void 0 ? t.length : e.count, a = e.pending === !0, o = a ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(p, {
|
|
22
22
|
size: 14,
|
|
23
23
|
strokeWidth: 2.2,
|
|
24
24
|
className: "kapi-table-spin",
|
|
25
25
|
"aria-hidden": !0
|
|
26
|
-
}), /* @__PURE__ */
|
|
26
|
+
}), /* @__PURE__ */ d("span", {
|
|
27
27
|
className: "kapi-sr-only",
|
|
28
28
|
children: S
|
|
29
29
|
})] }) : e.icon;
|
|
@@ -60,15 +60,15 @@ var m = [], h = ({ rows: a, keyField: o, selectable: c, selectedIds: h, defaultS
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
function g({ dataset: e, notice: t, shown: n, clearLabel: r, labels: i, locale: s }) {
|
|
63
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ f("div", {
|
|
64
64
|
className: t === "none" ? void 0 : "kapi-table__dataset",
|
|
65
65
|
role: "status",
|
|
66
|
-
children: [t === "offer" && /* @__PURE__ */
|
|
66
|
+
children: [t === "offer" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", { children: e.hintLabel ? e.hintLabel(n, e.total) : o(n, e.total, i, s) }), /* @__PURE__ */ d("button", {
|
|
67
67
|
type: "button",
|
|
68
68
|
className: "kapi-link",
|
|
69
69
|
onClick: e.onSelect,
|
|
70
70
|
children: e.actionLabel ? e.actionLabel(e.total) : a(e.total, i, s)
|
|
71
|
-
})] }), t === "selected" && /* @__PURE__ */
|
|
71
|
+
})] }), t === "selected" && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("span", { children: e.selectedLabel ? e.selectedLabel(e.total) : c(e.total, i, s) }), e.onClear && /* @__PURE__ */ d("button", {
|
|
72
72
|
type: "button",
|
|
73
73
|
className: "kapi-link",
|
|
74
74
|
onClick: e.onClear,
|
|
@@ -3,120 +3,120 @@ import "#kapi-css/components/display/KapiAnnotation.css";
|
|
|
3
3
|
import { joinIds as e } from "../inputs/fieldLogic.js";
|
|
4
4
|
import { resolveKapiRoot as t } from "../../hooks/kapiRoot.js";
|
|
5
5
|
import { usePlacement as n } from "../../hooks/usePlacement.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useMergedRefs as r } from "../../hooks/mergeRefs.js";
|
|
7
|
+
import { useDismiss as i } from "../../hooks/useDismiss.js";
|
|
8
8
|
import { KapiTooltip as a } from "../overlays/KapiTooltip.js";
|
|
9
|
-
import { annotationClasses as
|
|
9
|
+
import { annotationClasses as o, annotationRole as s } from "./annotationLogic.js";
|
|
10
10
|
/* empty css */
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { createPortal as
|
|
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
|
|
16
|
-
function
|
|
17
|
-
let
|
|
18
|
-
underline:
|
|
19
|
-
tone:
|
|
20
|
-
clickable: !!
|
|
21
|
-
className:
|
|
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" && (
|
|
23
|
+
e.key === "Escape" && (N(!1), P(!0));
|
|
24
24
|
}, H = () => clearTimeout(I.current), U = () => {
|
|
25
|
-
H(), P(!1),
|
|
25
|
+
H(), P(!1), N(!0);
|
|
26
26
|
}, W = () => {
|
|
27
|
-
H(),
|
|
27
|
+
H(), N(!1), P(!1);
|
|
28
28
|
}, G = () => {
|
|
29
|
-
if (!
|
|
30
|
-
H(), I.current = setTimeout(W,
|
|
29
|
+
if (!w) return W();
|
|
30
|
+
H(), I.current = setTimeout(W, _);
|
|
31
31
|
}, K = (e) => {
|
|
32
32
|
let t = e.relatedTarget;
|
|
33
|
-
|
|
33
|
+
w && t && F.current?.contains(t) || W();
|
|
34
34
|
}, { placement: q } = n({
|
|
35
|
-
open:
|
|
36
|
-
anchor:
|
|
35
|
+
open: M,
|
|
36
|
+
anchor: A,
|
|
37
37
|
floatingRef: F,
|
|
38
38
|
side: "bottom",
|
|
39
39
|
align: "center",
|
|
40
|
-
offset:
|
|
41
|
-
margin:
|
|
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 =
|
|
47
|
-
zones: [
|
|
46
|
+
} : null, Y = i(M && w, {
|
|
47
|
+
zones: [A, F],
|
|
48
48
|
onDismiss: (e) => {
|
|
49
49
|
if (e === "outside") return W();
|
|
50
|
-
|
|
50
|
+
N(!1), P(!0);
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
|
|
53
|
+
c(() => () => clearTimeout(I.current), []);
|
|
54
54
|
let X = {
|
|
55
|
-
...
|
|
56
|
-
ref:
|
|
55
|
+
...O,
|
|
56
|
+
ref: j,
|
|
57
57
|
className: B,
|
|
58
58
|
onKeyDown: V,
|
|
59
|
-
onClick:
|
|
60
|
-
...
|
|
61
|
-
"data-dismissed":
|
|
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(
|
|
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__ */
|
|
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__ */
|
|
75
|
+
return /* @__PURE__ */ f(a, {
|
|
76
76
|
label: e,
|
|
77
77
|
prefer: "top",
|
|
78
78
|
children: t
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
let Z =
|
|
81
|
+
let Z = C ?? { body: y }, Q = {
|
|
82
82
|
...X,
|
|
83
|
-
"aria-describedby": e(
|
|
83
|
+
"aria-describedby": e(O["aria-describedby"], M && k),
|
|
84
84
|
onFocus: U,
|
|
85
85
|
onBlur: K
|
|
86
|
-
}, $ =
|
|
87
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
92
|
+
children: [L === "button" ? /* @__PURE__ */ f("button", {
|
|
93
93
|
...Q,
|
|
94
94
|
type: "button",
|
|
95
|
-
children:
|
|
96
|
-
}) : /* @__PURE__ */
|
|
95
|
+
children: v
|
|
96
|
+
}) : /* @__PURE__ */ f("span", {
|
|
97
97
|
...Q,
|
|
98
98
|
tabIndex: R,
|
|
99
|
-
children:
|
|
100
|
-
}), $ &&
|
|
99
|
+
children: v
|
|
100
|
+
}), $ && m(/* @__PURE__ */ p("span", {
|
|
101
101
|
ref: F,
|
|
102
|
-
id:
|
|
102
|
+
id: k,
|
|
103
103
|
role: "tooltip",
|
|
104
104
|
className: "kapi-annotation__pop",
|
|
105
105
|
"data-side": J?.side ?? "bottom",
|
|
106
|
-
"data-interactive":
|
|
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:
|
|
113
|
-
onMouseEnter:
|
|
114
|
-
onMouseLeave:
|
|
115
|
-
onBlur:
|
|
116
|
-
children: [Z.title && /* @__PURE__ */
|
|
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__ */
|
|
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 {
|
|
127
|
+
export { v as KapiAnnotation };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/display/KapiComment.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 =
|
|
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:
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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 {
|
|
13
|
-
import {
|
|
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 =
|
|
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__ */
|
|
35
|
-
className:
|
|
34
|
+
return /* @__PURE__ */ d("div", {
|
|
35
|
+
className: e("kapi-composer", x),
|
|
36
36
|
style: S,
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ u(o, {
|
|
38
38
|
...A,
|
|
39
39
|
ref: (e) => {
|
|
40
|
-
z.current = 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":
|
|
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__ */
|
|
56
|
+
}), /* @__PURE__ */ d("div", {
|
|
57
57
|
className: "kapi-composer__foot",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: [/* @__PURE__ */ u("span", {
|
|
59
59
|
id: N,
|
|
60
60
|
className: "kapi-composer__hint",
|
|
61
61
|
children: j.shortcut
|
|
62
|
-
}), /* @__PURE__ */
|
|
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 {
|
|
4
|
-
import {
|
|
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 =
|
|
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:
|
|
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:
|
|
69
|
+
}, h = ({ className: t, ref: n, ...r }) => /* @__PURE__ */ s("ul", {
|
|
70
70
|
...r,
|
|
71
71
|
ref: n,
|
|
72
|
-
className:
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 =
|
|
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 = (
|
|
30
|
-
className:
|
|
29
|
+
} : S, N = (e) => v && O ? /* @__PURE__ */ c("a", {
|
|
30
|
+
className: t({
|
|
31
31
|
size: "sm",
|
|
32
|
-
className:
|
|
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:
|
|
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:
|
|
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 {
|
|
8
|
-
import {
|
|
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 =
|
|
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
|
-
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 =
|
|
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:
|
|
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(
|
|
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 {
|
|
9
|
-
import {
|
|
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] =
|
|
13
|
-
|
|
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__ */
|
|
21
|
+
return /* @__PURE__ */ p(n, {
|
|
22
22
|
label: P,
|
|
23
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
33
|
+
children: [F && /* @__PURE__ */ p("span", {
|
|
34
34
|
className: "kapi-countdown__prefix",
|
|
35
35
|
children: g
|
|
36
|
-
}), /* @__PURE__ */
|
|
36
|
+
}), /* @__PURE__ */ p("span", {
|
|
37
37
|
className: "kapi-countdown__time",
|
|
38
38
|
children: s(j, O)
|
|
39
39
|
})]
|