@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
|
@@ -7,15 +7,24 @@ var e = (e) => {
|
|
|
7
7
|
}
|
|
8
8
|
let r = t.indexOf(".");
|
|
9
9
|
return r === -1 ? 0 : t.length - r - 1;
|
|
10
|
-
}, t = (
|
|
10
|
+
}, t = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/, n = (e) => {
|
|
11
|
+
let n = e.trim().replace(",", ".");
|
|
12
|
+
if (!t.test(n)) return null;
|
|
13
|
+
let r = Number(n);
|
|
14
|
+
return Number.isFinite(r) ? r : null;
|
|
15
|
+
}, r = (t, { min: n, step: r = 1 } = {}) => {
|
|
16
|
+
if (!Number.isFinite(r) || r <= 0) return t;
|
|
17
|
+
let i = n ?? 0, a = Math.max(e(r), e(i)), o = Math.round(Number(((t - i) / r).toFixed(10)));
|
|
18
|
+
return Number((i + o * r).toFixed(a));
|
|
19
|
+
}, i = (e, { min: t, max: n } = {}) => {
|
|
11
20
|
let r = e;
|
|
12
21
|
return t !== void 0 && r < t && (r = t), n !== void 0 && r > n && (r = n), r;
|
|
13
|
-
},
|
|
14
|
-
let s = Number.isFinite(
|
|
15
|
-
return
|
|
16
|
-
min:
|
|
22
|
+
}, a = (t, n, { min: r, max: a, step: o = 1 } = {}) => {
|
|
23
|
+
let s = Number.isFinite(t) ? t : r ?? 0, c = s + n * o, l = Math.max(e(o), e(s));
|
|
24
|
+
return i(Number(c.toFixed(l)), {
|
|
25
|
+
min: r,
|
|
17
26
|
max: a
|
|
18
27
|
});
|
|
19
|
-
},
|
|
28
|
+
}, o = (e, { min: t } = {}) => t === void 0 || e > t, s = (e, { max: t } = {}) => t === void 0 || e < t;
|
|
20
29
|
//#endregion
|
|
21
|
-
export {
|
|
30
|
+
export { o as canDecrement, s as canIncrement, i as clampNumber, n as parseTypedNumber, r as snapToStep, a as stepValue };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { fieldContextValue as e, resolveValidation as t } from "./fieldLogic.js";
|
|
3
3
|
import { KapiField as n, useKapiField as r } from "./KapiField.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useId as i } from "react";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/inputs/ownField.tsx
|
|
7
7
|
var o = ({ id: o, label: s, help: c, required: l, invalid: u, status: d, readOnly: f, fieldClassName: p }) => {
|
|
8
|
-
let m = r(), h =
|
|
8
|
+
let m = r(), h = i(), g = s != null || !!c, _ = o ?? (g ? h : m?.controlId), v = c ? `${_}-help` : void 0, { status: y } = t(u, d);
|
|
9
9
|
return {
|
|
10
10
|
wraps: g,
|
|
11
11
|
field: g ? e({
|
|
@@ -20,7 +20,7 @@ var o = ({ id: o, label: s, help: c, required: l, invalid: u, status: d, readOnl
|
|
|
20
20
|
controlId: _,
|
|
21
21
|
autoId: h,
|
|
22
22
|
helpId: v,
|
|
23
|
-
wrap: (e) => g ? /* @__PURE__ */
|
|
23
|
+
wrap: (e) => g ? /* @__PURE__ */ a(n, {
|
|
24
24
|
label: s,
|
|
25
25
|
htmlFor: _,
|
|
26
26
|
required: l,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
+
import type { KapiCloseReason } from "../closeReason.js";
|
|
2
3
|
import type { KapiMenuItem } from "../overlays/KapiContextMenu.js";
|
|
3
4
|
import { type KapiRootProps } from "../rootProps.js";
|
|
4
5
|
import type { KapiLabelsOverride } from "../labelsLogic.js";
|
|
@@ -16,7 +17,7 @@ export type KapiAccountMenuProps = KapiRootProps<HTMLDivElement> & {
|
|
|
16
17
|
/** Muestra u oculta el menú (controlado). */
|
|
17
18
|
open: boolean;
|
|
18
19
|
/** Pide cerrar el menú (Escape, click afuera o tras elegir una acción); el foco vuelve al disparador. */
|
|
19
|
-
onClose: () => void;
|
|
20
|
+
onClose: (reason: KapiCloseReason) => void;
|
|
20
21
|
/** Usuario de la cabecera: nombre, email, rol e iniciales opcionales. */
|
|
21
22
|
user: KapiAccountMenuUser;
|
|
22
23
|
/** Cantidad de notificaciones sin leer; con 0 o sin valor no se muestra el badge. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
3
|
import "#kapi-css/components/layout/KapiAccountMenu.css";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
5
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
6
6
|
import { enabledIndexes as n, focusedMenuIndex as ee, menuKeyIntent as te, nextEnabledIndex as ne } from "../overlays/menuKeyboardLogic.js";
|
|
7
7
|
import { activeElementOf as r } from "../../hooks/ownerDocument.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
|
|
9
|
+
import { useDismiss as a } from "../../hooks/useDismiss.js";
|
|
9
10
|
/* empty css */
|
|
10
|
-
import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
|
|
11
11
|
import { useExitPresence as o } from "../overlays/useExitPresence.js";
|
|
12
12
|
import { isActionMenuItem as s, submenuKeyAction as c } from "../overlays/menuButtonLogic.js";
|
|
13
13
|
import { DEFAULT_LINK_LABELS as l } from "../locale/linkLabels.js";
|
|
@@ -16,8 +16,8 @@ import { useFocusReturn as f } from "../../hooks/useFocusReturn.js";
|
|
|
16
16
|
import { initialsFrom as p } from "../display/avatarLogic.js";
|
|
17
17
|
import { useKapiTheme as re } from "../../hooks/useKapiTheme.js";
|
|
18
18
|
/* empty css */
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { useEffect as ie, useId as m, useRef as ae } from "react";
|
|
20
|
+
import { Fragment as oe, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
21
21
|
import { Bell as se, LogOut as ce, Settings as le, User as ue } from "lucide-react";
|
|
22
22
|
//#region src/components/layout/KapiAccountMenu.tsx
|
|
23
23
|
var _ = {
|
|
@@ -34,23 +34,23 @@ var _ = {
|
|
|
34
34
|
size: 18,
|
|
35
35
|
strokeWidth: 1.8
|
|
36
36
|
}, y = ({ label: e, children: t }) => {
|
|
37
|
-
let n =
|
|
38
|
-
return /* @__PURE__ */
|
|
37
|
+
let n = m();
|
|
38
|
+
return /* @__PURE__ */ g("div", {
|
|
39
39
|
className: "kapi-acct__row",
|
|
40
40
|
role: "group",
|
|
41
41
|
"aria-labelledby": n,
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ h("span", {
|
|
43
43
|
id: n,
|
|
44
44
|
className: "kapi-acct__rowlabel",
|
|
45
45
|
children: e
|
|
46
|
-
}), /* @__PURE__ */
|
|
46
|
+
}), /* @__PURE__ */ h("div", {
|
|
47
47
|
className: "kapi-acct__seg",
|
|
48
48
|
children: t
|
|
49
49
|
})]
|
|
50
50
|
});
|
|
51
51
|
}, b = "[role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]", x = [], S = [];
|
|
52
|
-
function C({ open:
|
|
53
|
-
let { preference: L, setPreference: R } = re(), z =
|
|
52
|
+
function C({ open: m, onClose: C, user: w, notificationsCount: T = 0, onNotifications: E, onProfile: D, onConfig: O, onLogout: k, items: A, hideBuiltins: j = S, labels: M, id: N, ref: P, triggerRef: F, className: I, style: de }) {
|
|
53
|
+
let { preference: L, setPreference: R } = re(), z = t("accountMenu", _, M), B = t("link", l), V = A ?? x, H = d(V), U = (e) => !j.includes(e), fe = [
|
|
54
54
|
{
|
|
55
55
|
key: "light",
|
|
56
56
|
label: z.themeLight
|
|
@@ -63,25 +63,25 @@ function C({ open: g, onClose: C, user: w, notificationsCount: T = 0, onNotifica
|
|
|
63
63
|
key: "system",
|
|
64
64
|
label: z.themeSystem
|
|
65
65
|
}
|
|
66
|
-
], W =
|
|
66
|
+
], W = ae(null), pe = i(W, P), { present: me, closing: G } = o(m, W), K = () => Array.from(W.current?.querySelectorAll(b) ?? []).filter((e) => e.closest("[role=\"menu\"]") === W.current), q = (e) => n(e.length, (t) => e[t].getAttribute("aria-disabled") === "true"), { restore: J } = f(m, {
|
|
67
67
|
container: W,
|
|
68
68
|
target: F
|
|
69
|
-
}), Y = () => {
|
|
70
|
-
C(), J();
|
|
69
|
+
}), Y = (e) => {
|
|
70
|
+
C(e), J();
|
|
71
71
|
};
|
|
72
|
-
|
|
73
|
-
if (!
|
|
72
|
+
ie(() => {
|
|
73
|
+
if (!m) return;
|
|
74
74
|
let e = K();
|
|
75
75
|
e[q(e)[0] ?? -1]?.focus();
|
|
76
|
-
}, [
|
|
77
|
-
let he =
|
|
76
|
+
}, [m]);
|
|
77
|
+
let he = a(m, {
|
|
78
78
|
zones: [W],
|
|
79
79
|
outside: !1,
|
|
80
|
-
onDismiss: Y
|
|
80
|
+
onDismiss: (e) => Y(e)
|
|
81
81
|
});
|
|
82
82
|
if (!me) return null;
|
|
83
83
|
let X = (e) => () => {
|
|
84
|
-
e?.(), Y();
|
|
84
|
+
e?.(), Y("item-selected");
|
|
85
85
|
}, ge = (e) => {
|
|
86
86
|
let t = te(e.key);
|
|
87
87
|
if (t.kind === "move") {
|
|
@@ -91,112 +91,112 @@ function C({ open: g, onClose: C, user: w, notificationsCount: T = 0, onNotifica
|
|
|
91
91
|
} else c(e.key, {
|
|
92
92
|
hasSubmenu: Z() >= 0,
|
|
93
93
|
nested: !1
|
|
94
|
-
}) === "open" ? (e.preventDefault(), H.openSub(Z(), !0)) : t.kind === "close" && !t.returnFocus ? (J(), C()) : he(e);
|
|
94
|
+
}) === "open" ? (e.preventDefault(), H.openSub(Z(), !0)) : t.kind === "close" && !t.returnFocus ? (J(), C("outside")) : he(e);
|
|
95
95
|
}, Z = () => {
|
|
96
96
|
let e = r(W.current), t = H.itemEls.current.findIndex((t) => t !== null && t === e);
|
|
97
97
|
return t >= 0 && H.hasSubmenu(t) ? t : -1;
|
|
98
98
|
}, _e = (e, t) => {
|
|
99
|
-
e.onClick?.(t), e.keepOpen || Y();
|
|
99
|
+
e.onClick?.(t), e.keepOpen || Y("item-selected");
|
|
100
100
|
}, Q = 0, $ = () => ({
|
|
101
101
|
tabIndex: -1,
|
|
102
102
|
"data-menu-index": Q++
|
|
103
103
|
});
|
|
104
|
-
return /* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ g(oe, { children: [/* @__PURE__ */ h("div", {
|
|
105
105
|
className: "kapi-acct__backdrop",
|
|
106
106
|
"data-closing": G || void 0,
|
|
107
|
-
onClick: C,
|
|
107
|
+
onClick: () => C("outside"),
|
|
108
108
|
"aria-hidden": "true"
|
|
109
|
-
}), /* @__PURE__ */
|
|
109
|
+
}), /* @__PURE__ */ g("div", {
|
|
110
110
|
ref: pe,
|
|
111
111
|
id: N,
|
|
112
|
-
className:
|
|
112
|
+
className: e("kapi-acct", I),
|
|
113
113
|
style: de,
|
|
114
114
|
role: "menu",
|
|
115
115
|
"data-closing": G || void 0,
|
|
116
116
|
inert: G || void 0,
|
|
117
117
|
"aria-label": z.menu,
|
|
118
118
|
onKeyDown: ge,
|
|
119
|
-
children: [/* @__PURE__ */
|
|
119
|
+
children: [/* @__PURE__ */ g("div", {
|
|
120
120
|
className: "kapi-acct__head",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ h("span", {
|
|
122
122
|
className: "kapi-acct__av",
|
|
123
123
|
children: w.initials ?? p(w.name)
|
|
124
|
-
}), /* @__PURE__ */
|
|
124
|
+
}), /* @__PURE__ */ g("div", {
|
|
125
125
|
className: "kapi-acct__who",
|
|
126
|
-
children: [/* @__PURE__ */
|
|
126
|
+
children: [/* @__PURE__ */ h("div", {
|
|
127
127
|
className: "kapi-acct__name",
|
|
128
128
|
children: w.name
|
|
129
|
-
}), /* @__PURE__ */
|
|
129
|
+
}), /* @__PURE__ */ h("div", {
|
|
130
130
|
className: "kapi-acct__mail",
|
|
131
131
|
children: w.role ? `${w.email} · ${w.role}` : w.email
|
|
132
132
|
})]
|
|
133
133
|
})]
|
|
134
|
-
}), /* @__PURE__ */
|
|
134
|
+
}), /* @__PURE__ */ g("div", {
|
|
135
135
|
className: "kapi-acct__body",
|
|
136
136
|
children: [
|
|
137
|
-
U("notifications") && /* @__PURE__ */
|
|
137
|
+
U("notifications") && /* @__PURE__ */ g("button", {
|
|
138
138
|
type: "button",
|
|
139
139
|
role: "menuitem",
|
|
140
140
|
...$(),
|
|
141
141
|
className: "kapi-acct__item",
|
|
142
142
|
onClick: X(E),
|
|
143
|
-
children: [/* @__PURE__ */
|
|
143
|
+
children: [/* @__PURE__ */ g("span", {
|
|
144
144
|
className: "kapi-acct__label",
|
|
145
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ h(se, {
|
|
146
146
|
...v,
|
|
147
147
|
color: "var(--kapi-ink-3)"
|
|
148
148
|
}), z.notifications]
|
|
149
|
-
}), T > 0 && /* @__PURE__ */
|
|
149
|
+
}), T > 0 && /* @__PURE__ */ h("span", {
|
|
150
150
|
className: "kapi-acct__badge",
|
|
151
151
|
children: T
|
|
152
152
|
})]
|
|
153
153
|
}),
|
|
154
|
-
U("profile") && /* @__PURE__ */
|
|
154
|
+
U("profile") && /* @__PURE__ */ h("button", {
|
|
155
155
|
type: "button",
|
|
156
156
|
role: "menuitem",
|
|
157
157
|
...$(),
|
|
158
158
|
className: "kapi-acct__item",
|
|
159
159
|
onClick: X(D),
|
|
160
|
-
children: /* @__PURE__ */
|
|
160
|
+
children: /* @__PURE__ */ g("span", {
|
|
161
161
|
className: "kapi-acct__label",
|
|
162
|
-
children: [/* @__PURE__ */
|
|
162
|
+
children: [/* @__PURE__ */ h(ue, {
|
|
163
163
|
...v,
|
|
164
164
|
color: "var(--kapi-ink-3)"
|
|
165
165
|
}), z.profile]
|
|
166
166
|
})
|
|
167
167
|
}),
|
|
168
|
-
U("config") && /* @__PURE__ */
|
|
168
|
+
U("config") && /* @__PURE__ */ h("button", {
|
|
169
169
|
type: "button",
|
|
170
170
|
role: "menuitem",
|
|
171
171
|
...$(),
|
|
172
172
|
className: "kapi-acct__item",
|
|
173
173
|
onClick: X(O),
|
|
174
|
-
children: /* @__PURE__ */
|
|
174
|
+
children: /* @__PURE__ */ g("span", {
|
|
175
175
|
className: "kapi-acct__label",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
176
|
+
children: [/* @__PURE__ */ h(le, {
|
|
177
177
|
...v,
|
|
178
178
|
color: "var(--kapi-ink-3)"
|
|
179
179
|
}), z.config]
|
|
180
180
|
})
|
|
181
181
|
}),
|
|
182
|
-
V.map((e, t) => e.sep ? /* @__PURE__ */
|
|
182
|
+
V.map((e, t) => e.sep ? /* @__PURE__ */ h("div", {
|
|
183
183
|
role: "separator",
|
|
184
184
|
className: "kapi-acct__sep"
|
|
185
|
-
}, `s${t}`) : s(e) ? /* @__PURE__ */
|
|
185
|
+
}, `s${t}`) : s(e) ? /* @__PURE__ */ h(u, {
|
|
186
186
|
...H.entryProps(t),
|
|
187
187
|
item: e,
|
|
188
188
|
index: Q++,
|
|
189
189
|
newTabLabel: B.newTab,
|
|
190
190
|
onActivate: _e,
|
|
191
|
-
onClose: (e) => e ? Y() : C()
|
|
192
|
-
}, e.id ?? `m${t}`) : /* @__PURE__ */
|
|
191
|
+
onClose: (e) => e ? Y("outside") : C("outside")
|
|
192
|
+
}, e.id ?? `m${t}`) : /* @__PURE__ */ h("div", {
|
|
193
193
|
role: "presentation",
|
|
194
194
|
className: "kapi-ctxmenu__header",
|
|
195
195
|
children: e.header
|
|
196
196
|
}, `h${t}`)),
|
|
197
|
-
U("theme") && /* @__PURE__ */
|
|
197
|
+
U("theme") && /* @__PURE__ */ h(y, {
|
|
198
198
|
label: z.theme,
|
|
199
|
-
children: fe.map((e) => /* @__PURE__ */
|
|
199
|
+
children: fe.map((e) => /* @__PURE__ */ h("button", {
|
|
200
200
|
type: "button",
|
|
201
201
|
role: "menuitemradio",
|
|
202
202
|
...$(),
|
|
@@ -206,19 +206,19 @@ function C({ open: g, onClose: C, user: w, notificationsCount: T = 0, onNotifica
|
|
|
206
206
|
children: e.label
|
|
207
207
|
}, e.key))
|
|
208
208
|
}),
|
|
209
|
-
U("logout") && /* @__PURE__ */
|
|
209
|
+
U("logout") && /* @__PURE__ */ h("div", {
|
|
210
210
|
role: "separator",
|
|
211
211
|
className: "kapi-acct__sep"
|
|
212
212
|
}),
|
|
213
|
-
U("logout") && /* @__PURE__ */
|
|
213
|
+
U("logout") && /* @__PURE__ */ h("button", {
|
|
214
214
|
type: "button",
|
|
215
215
|
role: "menuitem",
|
|
216
216
|
...$(),
|
|
217
217
|
className: "kapi-acct__item kapi-acct__item--danger",
|
|
218
218
|
onClick: X(k),
|
|
219
|
-
children: /* @__PURE__ */
|
|
219
|
+
children: /* @__PURE__ */ g("span", {
|
|
220
220
|
className: "kapi-acct__label",
|
|
221
|
-
children: [/* @__PURE__ */
|
|
221
|
+
children: [/* @__PURE__ */ h(ce, {
|
|
222
222
|
...v,
|
|
223
223
|
color: "var(--kapi-danger)"
|
|
224
224
|
}), z.logout]
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/navigation/navigation.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
5
|
import { useControllableState as n } from "../../hooks/useControllableState.js";
|
|
6
6
|
import { directionOf as r, physicalSide as i } from "../../hooks/directionLogic.js";
|
|
7
7
|
import { useMergedRefs as ee } from "../../hooks/mergeRefs.js";
|
|
8
|
-
import { clampCtxPanelWidth as a, ctxPanelWidthFromDrag as o, stepCtxPanelWidth as
|
|
8
|
+
import { clampCtxPanelWidth as a, ctxPanelWidthFromDrag as o, stepCtxPanelWidth as te } from "../navigation/contextPanelLogic.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { KapiPanelMiniContext as
|
|
11
|
-
import { resolveGone as
|
|
12
|
-
import { useHydrated as
|
|
13
|
-
import { SHELL_MOBILE_QUERY as
|
|
14
|
-
import { useReopenBus as
|
|
15
|
-
import { openOnZoneCross as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
10
|
+
import { KapiPanelMiniContext as ne } from "../navigation/panelMini.js";
|
|
11
|
+
import { resolveGone as re, resolveMini as ie } from "../navigation/panelMiniLogic.js";
|
|
12
|
+
import { useHydrated as ae } from "../../hooks/useHydrated.js";
|
|
13
|
+
import { SHELL_MOBILE_QUERY as oe, SHELL_NARROW_QUERY as se, matchesQuery as ce, useMediaQuery as s } from "../../hooks/useMediaQuery.js";
|
|
14
|
+
import { useReopenBus as le } from "./reopenBus.js";
|
|
15
|
+
import { openOnZoneCross as ue, shellZone as c } from "../../hooks/breakpointOpenLogic.js";
|
|
16
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as de } from "react";
|
|
17
|
+
import { Fragment as fe, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
18
18
|
import { ChevronsLeft as h, ChevronsRight as g } from "lucide-react";
|
|
19
19
|
//#region src/components/layout/KapiContextSlot.tsx
|
|
20
20
|
var _ = {
|
|
@@ -23,18 +23,18 @@ var _ = {
|
|
|
23
23
|
region: "Panel contextual",
|
|
24
24
|
resize: "Redimensionar panel"
|
|
25
25
|
}, v = ({ title: v, actions: pe, children: me, open: he, defaultOpen: y, onOpenChange: ge, side: b = "left", collapsedMode: x = "hidden", resizable: _e = !1, width: ve, defaultWidth: ye, onWidthChange: be, minWidth: S = 200, maxWidth: C = 420, "aria-label": w, labels: T, className: E, style: D, id: O, ref: k }) => {
|
|
26
|
-
let A =
|
|
27
|
-
|
|
28
|
-
let e =
|
|
26
|
+
let A = t("contextSlot", _, T), j = w ?? A.region, M = b === "right", N = M ? g : h, xe = M ? h : g, Se = ae(), [P, F] = n(he, () => y ?? (!Se || !ce("(max-width: 1024px)")), ge), I = s(oe), Ce = s(se), L = c(I, Ce), R = f(L), z = f(L === "wide" ? P : y ?? !0);
|
|
27
|
+
u(() => {
|
|
28
|
+
let e = ue(R.current, L, z.current);
|
|
29
29
|
R.current = L, e !== null && e !== P && F(e);
|
|
30
30
|
}, [
|
|
31
31
|
L,
|
|
32
32
|
P,
|
|
33
33
|
F
|
|
34
|
-
]),
|
|
34
|
+
]), u(() => {
|
|
35
35
|
L === "wide" && (z.current = P);
|
|
36
36
|
}, [L, P]);
|
|
37
|
-
let [B, we] = n(ve, ye ?? null, be), [Te, V] =
|
|
37
|
+
let [B, we] = n(ve, ye ?? null, be), [Te, V] = de(!1), H = f(null), Ee = ee(H, k), U = f(null), W = B === null ? null : a(B, S, C), G = () => W ?? H.current?.offsetWidth ?? 258, K = (e) => {
|
|
38
38
|
e !== W && we(e);
|
|
39
39
|
}, De = (e) => {
|
|
40
40
|
e.button === 0 && (U.current = {
|
|
@@ -47,21 +47,21 @@ var _ = {
|
|
|
47
47
|
}, q = (e) => {
|
|
48
48
|
U.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), V(!1);
|
|
49
49
|
}, J = (e) => {
|
|
50
|
-
let t =
|
|
50
|
+
let t = te(i(b, r(e.currentTarget)), G(), e.key, S, C);
|
|
51
51
|
t !== null && (e.preventDefault(), K(t));
|
|
52
52
|
}, ke = W === null ? D : {
|
|
53
53
|
...D,
|
|
54
54
|
"--kapi-ctxslot-w": `${W}px`
|
|
55
|
-
}, Y =
|
|
55
|
+
}, Y = ie({
|
|
56
56
|
collapsedMode: x,
|
|
57
57
|
open: P,
|
|
58
58
|
mobile: I
|
|
59
|
-
}), X =
|
|
59
|
+
}), X = re({
|
|
60
60
|
collapsedMode: x,
|
|
61
61
|
open: P,
|
|
62
62
|
mobile: I
|
|
63
|
-
}), Z =
|
|
64
|
-
|
|
63
|
+
}), Z = le(), Q = Z?.publish, Ae = !!Z && I, $ = l(() => F(!0), [F]);
|
|
64
|
+
u(() => {
|
|
65
65
|
if (Q) {
|
|
66
66
|
if (!I || P || X) Q(null);
|
|
67
67
|
else return Q({
|
|
@@ -79,7 +79,7 @@ var _ = {
|
|
|
79
79
|
A.expand,
|
|
80
80
|
M
|
|
81
81
|
]);
|
|
82
|
-
let je =
|
|
82
|
+
let je = d(() => ({
|
|
83
83
|
mini: Y,
|
|
84
84
|
expand: () => F(!0),
|
|
85
85
|
tooltipSide: M ? "start" : "end"
|
|
@@ -88,13 +88,13 @@ var _ = {
|
|
|
88
88
|
F,
|
|
89
89
|
M
|
|
90
90
|
]);
|
|
91
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ m(fe, { children: [/* @__PURE__ */ m("div", {
|
|
92
92
|
ref: Ee,
|
|
93
93
|
id: O,
|
|
94
|
-
className:
|
|
94
|
+
className: e("kapi-ctxslot", M && "kapi-ctxslot--right", !P && "is-collapsed", Te && "is-resizing", Y && "is-mini kapi-navmini", X && "is-gone", E),
|
|
95
95
|
style: ke,
|
|
96
96
|
children: [
|
|
97
|
-
_e && P && !I && /* @__PURE__ */
|
|
97
|
+
_e && P && !I && /* @__PURE__ */ p("div", {
|
|
98
98
|
className: "kapi-ctxslot__resize",
|
|
99
99
|
role: "separator",
|
|
100
100
|
"aria-orientation": "vertical",
|
|
@@ -109,22 +109,22 @@ var _ = {
|
|
|
109
109
|
onPointerCancel: q,
|
|
110
110
|
onKeyDown: J
|
|
111
111
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ p("div", {
|
|
113
113
|
className: "kapi-ctxslot__inner",
|
|
114
114
|
inert: !P && !Y,
|
|
115
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ m("aside", {
|
|
116
116
|
className: "kapi-ctxpanel",
|
|
117
117
|
"aria-label": j,
|
|
118
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ m("div", {
|
|
119
119
|
className: "kapi-ctxpanel__head",
|
|
120
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ p("span", { children: v }), /* @__PURE__ */ m("div", {
|
|
121
121
|
className: "kapi-ctxpanel__actions",
|
|
122
|
-
children: [pe, /* @__PURE__ */
|
|
122
|
+
children: [pe, /* @__PURE__ */ p("button", {
|
|
123
123
|
type: "button",
|
|
124
124
|
className: "kapi-paneltoggle",
|
|
125
125
|
onClick: () => F(!1),
|
|
126
126
|
"aria-label": A.collapse,
|
|
127
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ p(N, {
|
|
128
128
|
className: "kapi-flip-rtl",
|
|
129
129
|
size: 16,
|
|
130
130
|
strokeWidth: 2,
|
|
@@ -132,18 +132,18 @@ var _ = {
|
|
|
132
132
|
})
|
|
133
133
|
})]
|
|
134
134
|
})]
|
|
135
|
-
}), /* @__PURE__ */
|
|
135
|
+
}), /* @__PURE__ */ p(ne.Provider, {
|
|
136
136
|
value: je,
|
|
137
137
|
children: me
|
|
138
138
|
})]
|
|
139
139
|
})
|
|
140
140
|
}),
|
|
141
|
-
!X && !Ae && /* @__PURE__ */
|
|
141
|
+
!X && !Ae && /* @__PURE__ */ p("button", {
|
|
142
142
|
type: "button",
|
|
143
143
|
className: "kapi-paneltoggle kapi-ctxslot__reopen",
|
|
144
144
|
onClick: $,
|
|
145
145
|
"aria-label": A.expand,
|
|
146
|
-
children: /* @__PURE__ */
|
|
146
|
+
children: /* @__PURE__ */ p(xe, {
|
|
147
147
|
className: "kapi-flip-rtl",
|
|
148
148
|
size: 16,
|
|
149
149
|
strokeWidth: 2,
|
|
@@ -151,7 +151,7 @@ var _ = {
|
|
|
151
151
|
})
|
|
152
152
|
})
|
|
153
153
|
]
|
|
154
|
-
}), /* @__PURE__ */
|
|
154
|
+
}), /* @__PURE__ */ p("div", {
|
|
155
155
|
className: "kapi-ctxslot__backdrop",
|
|
156
156
|
onClick: () => F(!1),
|
|
157
157
|
"aria-hidden": "true"
|
|
@@ -4,11 +4,11 @@ import { joinClasses as e } from "../rootProps.js";
|
|
|
4
4
|
import { gapValue as t, gridColumns as n } from "./layoutPrimitives.js";
|
|
5
5
|
import { useMasonrySpans as r } from "./useMasonrySpans.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Children as i, isValidElement as a } from "react";
|
|
8
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/layout/KapiMasonry.tsx
|
|
10
10
|
function s({ gap: s, min: c, cols: l, rowUnit: u = 8, className: d, style: f, children: p, ref: m, ...h }) {
|
|
11
|
-
let g =
|
|
11
|
+
let g = i.toArray(p), { spans: _, measured: v, register: y } = r({
|
|
12
12
|
rowUnit: u,
|
|
13
13
|
watch: [s, g.length]
|
|
14
14
|
}), b = t(s), x = n(l, c), S = {
|
|
@@ -17,17 +17,17 @@ function s({ gap: s, min: c, cols: l, rowUnit: u = 8, className: d, style: f, ch
|
|
|
17
17
|
...x !== void 0 && { gridTemplateColumns: x },
|
|
18
18
|
...f
|
|
19
19
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ o("div", {
|
|
21
21
|
...h,
|
|
22
22
|
ref: m,
|
|
23
23
|
className: e("kapi-masonry", v && "is-measured", d),
|
|
24
24
|
style: S,
|
|
25
|
-
children: g.map((e, t) => /* @__PURE__ */
|
|
25
|
+
children: g.map((e, t) => /* @__PURE__ */ o("div", {
|
|
26
26
|
ref: y(t),
|
|
27
27
|
className: "kapi-masonry__item",
|
|
28
28
|
style: { gridRowEnd: `span ${_[t] ?? 1}` },
|
|
29
29
|
children: e
|
|
30
|
-
},
|
|
30
|
+
}, a(e) && e.key !== null ? e.key : t))
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|