@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
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiNotificationBell.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { focusedMenuIndex as a, menuKeyIntent as o, nextEnabledIndex as
|
|
7
|
-
import { useControllableState as
|
|
8
|
-
import { activeElementOf as
|
|
9
|
-
import { resolveKapiRoot as
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { assignRef as t, focusLeaves as n } from "../inputs/fieldLogic.js";
|
|
5
|
+
import { useKapiFormatLocale as r, useLabels as i } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { focusedMenuIndex as a, menuKeyIntent as o, nextEnabledIndex as s } from "../overlays/menuKeyboardLogic.js";
|
|
7
|
+
import { useControllableState as ee } from "../../hooks/useControllableState.js";
|
|
8
|
+
import { activeElementOf as c } from "../../hooks/ownerDocument.js";
|
|
9
|
+
import { resolveKapiRoot as te } from "../../hooks/kapiRoot.js";
|
|
10
10
|
import { usePlacement as l } from "../../hooks/usePlacement.js";
|
|
11
11
|
import { useDismiss as u } from "../../hooks/useDismiss.js";
|
|
12
|
-
import { KapiOverlayPortal as
|
|
13
|
-
import { formatRelativeTime as
|
|
14
|
-
import { NOTIFICATION_BELL_PLACEMENT as
|
|
12
|
+
import { KapiOverlayPortal as d } from "../overlays/overlayPortal.js";
|
|
13
|
+
import { formatRelativeTime as ne } from "../../hooks/dateFormat.js";
|
|
14
|
+
import { NOTIFICATION_BELL_PLACEMENT as re, badgeText as ie, bellTriggerLabel as ae, notificationDateTime as f, unreadCount as p } from "./notificationBellLogic.js";
|
|
15
15
|
/* empty css */
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useEffect as oe, useId as m, useLayoutEffect as h, useRef as g, useState as _ } from "react";
|
|
17
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
18
18
|
import { Bell as x } from "lucide-react";
|
|
19
19
|
//#region src/components/layout/KapiNotificationBell.tsx
|
|
20
20
|
var S = {
|
|
@@ -27,9 +27,9 @@ var S = {
|
|
|
27
27
|
loading: "Cargando notificaciones…"
|
|
28
28
|
}, C = "[data-menu-index]", w = (e) => (e?.querySelector(C) ?? e)?.focus();
|
|
29
29
|
function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading: O = !1, emptyMessage: k, max: A = 9, open: j, defaultOpen: M = !1, onOpenChange: N, labels: P, now: F, ref: I, className: L, onClick: R, "aria-label": z, ...B }) {
|
|
30
|
-
let V =
|
|
31
|
-
|
|
32
|
-
ce(U ?
|
|
30
|
+
let V = i("notificationBell", S, P), H = r(), [U, W] = ee(j, M, N), G = m(), K = m(), q = g(null), J = g(null), [Y, ce] = _(null);
|
|
31
|
+
h(() => {
|
|
32
|
+
ce(U ? te(q.current) : null);
|
|
33
33
|
}, [U]);
|
|
34
34
|
let { style: le } = l({
|
|
35
35
|
open: U,
|
|
@@ -37,7 +37,7 @@ function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading
|
|
|
37
37
|
anchor: q,
|
|
38
38
|
floatingRef: J,
|
|
39
39
|
hideUntilPlaced: !1,
|
|
40
|
-
...
|
|
40
|
+
...re
|
|
41
41
|
}), ue = () => Array.from(J.current?.querySelectorAll(C) ?? []), de = () => w(J.current);
|
|
42
42
|
oe(() => {
|
|
43
43
|
U && Y && w(J.current);
|
|
@@ -49,26 +49,26 @@ function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading
|
|
|
49
49
|
}
|
|
50
50
|
}), Z = () => {
|
|
51
51
|
W(!1), q.current?.focus();
|
|
52
|
-
}, Q = p(T), $ =
|
|
52
|
+
}, Q = p(T), $ = ie(Q, A), fe = (e) => {
|
|
53
53
|
R?.(e), !e.defaultPrevented && W(!U);
|
|
54
54
|
}, pe = (e) => {
|
|
55
55
|
let t = o(e.key);
|
|
56
56
|
if (t.kind !== "move") return X(e);
|
|
57
57
|
let n = ue();
|
|
58
|
-
n.length !== 0 && (e.preventDefault(), n[
|
|
58
|
+
n.length !== 0 && (e.preventDefault(), n[s(a(c(e.currentTarget)), t.dir, n.map((e, t) => t))]?.focus());
|
|
59
59
|
}, me = (e) => {
|
|
60
|
-
|
|
60
|
+
n(e.relatedTarget, J.current, q.current) && e.relatedTarget && W(!1);
|
|
61
61
|
}, he = () => {
|
|
62
62
|
E?.(), de();
|
|
63
63
|
}, ge = F ?? /* @__PURE__ */ new Date();
|
|
64
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("button", {
|
|
65
65
|
...B,
|
|
66
|
-
ref: (
|
|
67
|
-
q.current =
|
|
66
|
+
ref: (e) => {
|
|
67
|
+
q.current = e, t(I, e);
|
|
68
68
|
},
|
|
69
69
|
type: "button",
|
|
70
|
-
className:
|
|
71
|
-
"aria-label": z ??
|
|
70
|
+
className: e("kapi-bell", L),
|
|
71
|
+
"aria-label": z ?? ae(V.title, Q, V.unread),
|
|
72
72
|
"aria-haspopup": "dialog",
|
|
73
73
|
"aria-expanded": U,
|
|
74
74
|
"aria-controls": U ? G : void 0,
|
|
@@ -76,18 +76,18 @@ function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading
|
|
|
76
76
|
onKeyDown: (e) => {
|
|
77
77
|
B.onKeyDown?.(e), X(e);
|
|
78
78
|
},
|
|
79
|
-
children: [/* @__PURE__ */
|
|
79
|
+
children: [/* @__PURE__ */ y(x, {
|
|
80
80
|
size: 20,
|
|
81
81
|
strokeWidth: 1.8,
|
|
82
82
|
"aria-hidden": "true"
|
|
83
|
-
}), $ && /* @__PURE__ */
|
|
83
|
+
}), $ && /* @__PURE__ */ y("span", {
|
|
84
84
|
className: "kapi-bell__badge",
|
|
85
85
|
"aria-hidden": "true",
|
|
86
86
|
children: $
|
|
87
87
|
})]
|
|
88
|
-
}), U && /* @__PURE__ */
|
|
88
|
+
}), U && /* @__PURE__ */ y(d, {
|
|
89
89
|
root: Y,
|
|
90
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ b("div", {
|
|
91
91
|
ref: J,
|
|
92
92
|
id: G,
|
|
93
93
|
role: "dialog",
|
|
@@ -98,85 +98,85 @@ function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading
|
|
|
98
98
|
onKeyDown: pe,
|
|
99
99
|
onBlur: me,
|
|
100
100
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ b("div", {
|
|
102
102
|
className: "kapi-bell__head",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ y("h2", {
|
|
104
104
|
id: K,
|
|
105
105
|
className: "kapi-bell__title",
|
|
106
106
|
children: V.title
|
|
107
|
-
}), E && Q > 0 && !O && /* @__PURE__ */
|
|
107
|
+
}), E && Q > 0 && !O && /* @__PURE__ */ y("button", {
|
|
108
108
|
type: "button",
|
|
109
109
|
className: "kapi-bell__link",
|
|
110
110
|
onClick: he,
|
|
111
111
|
children: V.markAllRead
|
|
112
112
|
})]
|
|
113
113
|
}),
|
|
114
|
-
O ? /* @__PURE__ */
|
|
114
|
+
O ? /* @__PURE__ */ b("div", {
|
|
115
115
|
className: "kapi-bell__state",
|
|
116
116
|
role: "status",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
117
|
+
children: [/* @__PURE__ */ y("span", {
|
|
118
118
|
className: "kapi-spinner kapi-spinner--sm",
|
|
119
119
|
"aria-hidden": "true"
|
|
120
120
|
}), V.loading]
|
|
121
|
-
}) : T.length === 0 ? /* @__PURE__ */
|
|
121
|
+
}) : T.length === 0 ? /* @__PURE__ */ y("div", {
|
|
122
122
|
className: "kapi-bell__state",
|
|
123
123
|
children: k ?? V.empty
|
|
124
|
-
}) : /* @__PURE__ */
|
|
124
|
+
}) : /* @__PURE__ */ y("ul", {
|
|
125
125
|
className: "kapi-bell__list",
|
|
126
126
|
"aria-labelledby": K,
|
|
127
|
-
children: T.map((
|
|
128
|
-
let
|
|
129
|
-
se?.(
|
|
130
|
-
}, a = /* @__PURE__ */
|
|
131
|
-
|
|
127
|
+
children: T.map((t, n) => {
|
|
128
|
+
let r = t.date === void 0 ? null : f(t.date), i = (e) => {
|
|
129
|
+
se?.(t, e), Z();
|
|
130
|
+
}, a = /* @__PURE__ */ b(v, { children: [
|
|
131
|
+
t.icon && /* @__PURE__ */ y("span", {
|
|
132
132
|
className: "kapi-bell__icon",
|
|
133
133
|
"aria-hidden": "true",
|
|
134
|
-
children:
|
|
134
|
+
children: t.icon
|
|
135
135
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ b("span", {
|
|
137
137
|
className: "kapi-bell__body",
|
|
138
138
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ y("span", {
|
|
140
140
|
className: "kapi-bell__itemtitle",
|
|
141
|
-
children:
|
|
141
|
+
children: t.title
|
|
142
142
|
}),
|
|
143
|
-
|
|
143
|
+
t.description && /* @__PURE__ */ y("span", {
|
|
144
144
|
className: "kapi-bell__desc",
|
|
145
|
-
children:
|
|
145
|
+
children: t.description
|
|
146
146
|
}),
|
|
147
|
-
|
|
147
|
+
r !== null && /* @__PURE__ */ y("time", {
|
|
148
148
|
className: "kapi-bell__date",
|
|
149
|
-
dateTime:
|
|
150
|
-
children:
|
|
149
|
+
dateTime: r,
|
|
150
|
+
children: ne(t.date, ge, H)
|
|
151
151
|
})
|
|
152
152
|
]
|
|
153
153
|
}),
|
|
154
|
-
!
|
|
154
|
+
!t.read && /* @__PURE__ */ y("span", {
|
|
155
155
|
className: "kapi-bell__dot",
|
|
156
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ y("span", {
|
|
157
157
|
className: "kapi-bell__sr",
|
|
158
158
|
children: V.unreadItem
|
|
159
159
|
})
|
|
160
160
|
})
|
|
161
161
|
] }), o = {
|
|
162
|
-
className:
|
|
163
|
-
"data-menu-index":
|
|
164
|
-
onClick:
|
|
162
|
+
className: e("kapi-bell__item", !t.read && "is-unread"),
|
|
163
|
+
"data-menu-index": n,
|
|
164
|
+
onClick: i
|
|
165
165
|
};
|
|
166
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ y("li", { children: t.href ? /* @__PURE__ */ y("a", {
|
|
167
167
|
...o,
|
|
168
|
-
href:
|
|
168
|
+
href: t.href,
|
|
169
169
|
children: a
|
|
170
|
-
}) : /* @__PURE__ */
|
|
170
|
+
}) : /* @__PURE__ */ y("button", {
|
|
171
171
|
...o,
|
|
172
172
|
type: "button",
|
|
173
173
|
children: a
|
|
174
|
-
}) },
|
|
174
|
+
}) }, t.id);
|
|
175
175
|
})
|
|
176
176
|
}),
|
|
177
|
-
D && /* @__PURE__ */
|
|
177
|
+
D && /* @__PURE__ */ y("div", {
|
|
178
178
|
className: "kapi-bell__foot",
|
|
179
|
-
children: /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ y("button", {
|
|
180
180
|
type: "button",
|
|
181
181
|
className: "kapi-bell__link",
|
|
182
182
|
onClick: () => {
|
|
@@ -11,8 +11,8 @@ import { useReopenBus as o } from "./reopenBus.js";
|
|
|
11
11
|
import { useScrollCollapse as s } from "../../hooks/useScrollCollapse.js";
|
|
12
12
|
import { pageHeaderBox as c } from "./pageHeaderLogic.js";
|
|
13
13
|
/* empty css */
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { useEffect as l, useLayoutEffect as u, useRef as d } from "react";
|
|
15
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
16
16
|
import { ChevronsLeft as h, ChevronsRight as g } from "lucide-react";
|
|
17
17
|
//#region src/components/layout/KapiPageHeader.tsx
|
|
18
18
|
var _ = "kapi-pageheader--collapsed", v = "kapi-pageheader--animating", y = "kapi-pageheader--measuring", b = 80, x = (e, t) => {
|
|
@@ -38,13 +38,13 @@ var _ = "kapi-pageheader--collapsed", v = "kapi-pageheader--animating", y = "kap
|
|
|
38
38
|
n ? r() : (e.style.transition = "none", r(), e.getBoundingClientRect(), e.style.transition = "");
|
|
39
39
|
};
|
|
40
40
|
function w({ title: _, subtitle: y, meta: w, actions: T, chip: E, breadcrumbs: D, collapseOnScroll: O = !0, sticky: k = !0, scrollRoot: A = null, responsive: j = !0, className: M, ref: N, ...P }) {
|
|
41
|
-
let { collapsed: F, sentinelRef: I } = s({ root: A }), L = O && F, R =
|
|
41
|
+
let { collapsed: F, sentinelRef: I } = s({ root: A }), L = O && F, R = d(null), z = n(R, N), B = d({
|
|
42
42
|
expanded: 0,
|
|
43
43
|
collapsed: 0
|
|
44
|
-
}), V =
|
|
44
|
+
}), V = d(L);
|
|
45
45
|
V.current = L;
|
|
46
|
-
let H =
|
|
47
|
-
|
|
46
|
+
let H = d(!1), U = d(!1);
|
|
47
|
+
u(() => {
|
|
48
48
|
let e = R.current;
|
|
49
49
|
if (!e) return;
|
|
50
50
|
let n = () => {
|
|
@@ -75,7 +75,7 @@ function w({ title: _, subtitle: y, meta: w, actions: T, chip: E, breadcrumbs: D
|
|
|
75
75
|
D,
|
|
76
76
|
O,
|
|
77
77
|
j
|
|
78
|
-
]),
|
|
78
|
+
]), u(() => {
|
|
79
79
|
let t = R.current;
|
|
80
80
|
if (!t) return;
|
|
81
81
|
let { expanded: n } = B.current, a = c(B.current, L), o = H.current && !r(t);
|
|
@@ -104,54 +104,54 @@ function w({ title: _, subtitle: y, meta: w, actions: T, chip: E, breadcrumbs: D
|
|
|
104
104
|
L && "kapi-pageheader--collapsed",
|
|
105
105
|
M
|
|
106
106
|
].filter(Boolean).join(" "), G = o(), K = G?.addHost;
|
|
107
|
-
|
|
107
|
+
l(() => K?.(), [K]);
|
|
108
108
|
let q = G?.info ?? null, J = q?.side === "right" ? h : g;
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
|
|
110
110
|
ref: I,
|
|
111
111
|
className: "kapi-pageheader__sentinel",
|
|
112
112
|
"aria-hidden": !0
|
|
113
|
-
}), /* @__PURE__ */
|
|
113
|
+
}), /* @__PURE__ */ m("header", {
|
|
114
114
|
...P,
|
|
115
115
|
ref: z,
|
|
116
116
|
className: W,
|
|
117
117
|
children: [
|
|
118
|
-
q && /* @__PURE__ */
|
|
118
|
+
q && /* @__PURE__ */ p("button", {
|
|
119
119
|
type: "button",
|
|
120
120
|
className: "kapi-paneltoggle kapi-pageheader__reopen",
|
|
121
121
|
onClick: q.expand,
|
|
122
122
|
"aria-label": q.label,
|
|
123
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ p(J, {
|
|
124
124
|
className: "kapi-flip-rtl",
|
|
125
125
|
size: 16,
|
|
126
126
|
strokeWidth: 2,
|
|
127
127
|
"aria-hidden": "true"
|
|
128
128
|
})
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ m("div", {
|
|
131
131
|
className: "kapi-pageheader__main",
|
|
132
132
|
children: [
|
|
133
|
-
D && D.length > 0 && /* @__PURE__ */
|
|
133
|
+
D && D.length > 0 && /* @__PURE__ */ p(a, {
|
|
134
134
|
className: "kapi-pageheader__breadcrumb",
|
|
135
135
|
items: D
|
|
136
136
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ m("div", {
|
|
138
138
|
className: "kapi-pageheader__titlerow",
|
|
139
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ p("h1", {
|
|
140
140
|
className: "kapi-pageheader__title",
|
|
141
141
|
children: _
|
|
142
142
|
}), E]
|
|
143
143
|
}),
|
|
144
|
-
y && /* @__PURE__ */
|
|
144
|
+
y && /* @__PURE__ */ p("div", {
|
|
145
145
|
className: "kapi-pageheader__subtitle",
|
|
146
146
|
children: y
|
|
147
147
|
}),
|
|
148
|
-
w && /* @__PURE__ */
|
|
148
|
+
w && /* @__PURE__ */ p("div", {
|
|
149
149
|
className: "kapi-pageheader__meta",
|
|
150
150
|
children: w
|
|
151
151
|
})
|
|
152
152
|
]
|
|
153
153
|
}),
|
|
154
|
-
T && /* @__PURE__ */
|
|
154
|
+
T && /* @__PURE__ */ p("div", {
|
|
155
155
|
className: "kapi-pageheader__actions",
|
|
156
156
|
children: T
|
|
157
157
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiRail.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
import { assignRef as t } from "../inputs/fieldLogic.js";
|
|
5
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
6
6
|
import { useSlidingIndicator as r } from "../../hooks/useSlidingIndicator.js";
|
|
7
7
|
import { KapiTooltip as i } from "../overlays/KapiTooltip.js";
|
|
8
8
|
import { DEFAULT_LINK_LABELS as a } from "../locale/linkLabels.js";
|
|
@@ -16,56 +16,56 @@ import { isRailSeparator as p, railClasses as m, railItemClasses as h, railOverf
|
|
|
16
16
|
import { useRailOverflow as b } from "./useRailOverflow.js";
|
|
17
17
|
import { RailVariantContext as x } from "./railContext.js";
|
|
18
18
|
/* empty css */
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { ExternalLink as
|
|
19
|
+
import { useCallback as S, useState as C } from "react";
|
|
20
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
21
|
+
import { ExternalLink as ee, MoreHorizontal as te } from "lucide-react";
|
|
22
22
|
//#region src/components/layout/KapiRail.tsx
|
|
23
|
-
var
|
|
23
|
+
var D = {
|
|
24
24
|
navigation: "Navegación principal",
|
|
25
25
|
more: "Más",
|
|
26
26
|
moreCurrent: "sección actual",
|
|
27
27
|
account: "Cuenta"
|
|
28
|
-
},
|
|
29
|
-
let
|
|
30
|
-
f(
|
|
31
|
-
let re =
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
enabled:
|
|
28
|
+
}, O = ({ items: O, activeId: k, onSelect: A, brand: j, footer: M, variant: N = "labeled", "aria-label": P, labels: F, className: I, ref: L, ...R }) => {
|
|
29
|
+
let z = n("rail", D, F), B = n("link", a, F), V = N === "compact", H = _(N), U = v(O), W = d(u), [G, ne] = C(null);
|
|
30
|
+
f(G, W);
|
|
31
|
+
let re = S((e) => {
|
|
32
|
+
ne(e), t(L, e);
|
|
33
|
+
}, [L]), { ref: K, edges: q } = l({ axis: "y" }), J = U.scroll, Y = J.filter((e) => !p(e)).length, ie = b(K, {
|
|
34
|
+
enabled: W,
|
|
35
35
|
count: Y,
|
|
36
36
|
separators: J.length - Y
|
|
37
|
-
}), { shown: ae, hidden: X } = y(J, ie ?? Y), Z = g(X,
|
|
38
|
-
active:
|
|
37
|
+
}), { shown: ae, hidden: X } = y(J, ie ?? Y), Z = g(X, k), { containerRef: Q, indicatorRef: oe } = r({
|
|
38
|
+
active: k ?? null,
|
|
39
39
|
deps: [
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
O,
|
|
41
|
+
N,
|
|
42
42
|
X.length
|
|
43
43
|
],
|
|
44
44
|
findActive: (e) => e.querySelector(".kapi-rail__item[aria-current=\"page\"], .kapi-rail__more--on")
|
|
45
|
-
}), se =
|
|
45
|
+
}), se = S((e) => {
|
|
46
46
|
Q.current = e, K.current = e;
|
|
47
47
|
}, [Q, K]), ce = ({ id: e, label: t, icon: n, href: r, external: a, newTab: o, badge: l, badgeTone: u, badgeLabel: d }) => {
|
|
48
|
-
let f =
|
|
48
|
+
let f = k === e, p = f ? "page" : void 0, m = s(l, d), g = m === null ? t : `${t} ${m}`, _ = V ? g : void 0, v = /* @__PURE__ */ T(c, {
|
|
49
49
|
value: l,
|
|
50
50
|
tone: u,
|
|
51
51
|
label: d,
|
|
52
52
|
placement: "corner",
|
|
53
|
-
announce: !
|
|
54
|
-
}), y = r === void 0 ? /* @__PURE__ */
|
|
53
|
+
announce: !V
|
|
54
|
+
}), y = r === void 0 ? /* @__PURE__ */ E("button", {
|
|
55
55
|
type: "button",
|
|
56
56
|
className: h({ active: f }),
|
|
57
|
-
onClick: () =>
|
|
57
|
+
onClick: () => A?.(e),
|
|
58
58
|
"aria-current": p,
|
|
59
59
|
"aria-label": _,
|
|
60
60
|
children: [
|
|
61
61
|
n,
|
|
62
|
-
!
|
|
62
|
+
!V && /* @__PURE__ */ T("span", {
|
|
63
63
|
className: "kapi-rail__label",
|
|
64
64
|
children: t
|
|
65
65
|
}),
|
|
66
66
|
v
|
|
67
67
|
]
|
|
68
|
-
},
|
|
68
|
+
}, H ? void 0 : e) : /* @__PURE__ */ E("a", {
|
|
69
69
|
className: h({
|
|
70
70
|
active: f,
|
|
71
71
|
link: !0
|
|
@@ -77,27 +77,27 @@ var E = {
|
|
|
77
77
|
"aria-label": _,
|
|
78
78
|
children: [
|
|
79
79
|
n,
|
|
80
|
-
!
|
|
80
|
+
!V && /* @__PURE__ */ T("span", {
|
|
81
81
|
className: "kapi-rail__label",
|
|
82
82
|
children: t
|
|
83
83
|
}),
|
|
84
84
|
v,
|
|
85
|
-
a && /* @__PURE__ */
|
|
85
|
+
a && /* @__PURE__ */ T(ee, {
|
|
86
86
|
className: "kapi-rail__ext",
|
|
87
87
|
size: 12,
|
|
88
88
|
"aria-hidden": "true"
|
|
89
89
|
}),
|
|
90
|
-
o && /* @__PURE__ */
|
|
90
|
+
o && /* @__PURE__ */ T("span", {
|
|
91
91
|
className: "kapi-rail__sr",
|
|
92
|
-
children:
|
|
92
|
+
children: B.newTab
|
|
93
93
|
})
|
|
94
94
|
]
|
|
95
|
-
},
|
|
96
|
-
return
|
|
95
|
+
}, H ? void 0 : e);
|
|
96
|
+
return H ? /* @__PURE__ */ T(i, {
|
|
97
97
|
label: g,
|
|
98
98
|
children: y
|
|
99
99
|
}, e) : y;
|
|
100
|
-
}, $ = (e) => e.map((e, t) => p(e) ? /* @__PURE__ */
|
|
100
|
+
}, $ = (e) => e.map((e, t) => p(e) ? /* @__PURE__ */ T("div", {
|
|
101
101
|
className: "kapi-rail__sep",
|
|
102
102
|
role: "separator",
|
|
103
103
|
"aria-orientation": "horizontal"
|
|
@@ -105,51 +105,51 @@ var E = {
|
|
|
105
105
|
let o = s(i, a);
|
|
106
106
|
return {
|
|
107
107
|
label: o === null ? t : `${t} ${o}`,
|
|
108
|
-
current:
|
|
108
|
+
current: k === e,
|
|
109
109
|
onClick: () => {
|
|
110
|
-
n === void 0 ?
|
|
110
|
+
n === void 0 ? A?.(e) : r ? window.open(n, "_blank", "noopener,noreferrer") : window.location.assign(n);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
});
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
...
|
|
114
|
+
return /* @__PURE__ */ E("nav", {
|
|
115
|
+
...R,
|
|
116
116
|
ref: re,
|
|
117
|
-
className:
|
|
118
|
-
"aria-label":
|
|
117
|
+
className: e(m({ variant: N }), I),
|
|
118
|
+
"aria-label": P ?? z.navigation,
|
|
119
119
|
children: [
|
|
120
|
-
|
|
120
|
+
j !== void 0 && /* @__PURE__ */ T("div", {
|
|
121
121
|
className: "kapi-rail__brand",
|
|
122
|
-
children:
|
|
122
|
+
children: j
|
|
123
123
|
}),
|
|
124
|
-
|
|
124
|
+
U.start.length > 0 && /* @__PURE__ */ T("div", {
|
|
125
125
|
className: "kapi-rail__start",
|
|
126
|
-
children: $(
|
|
126
|
+
children: $(U.start)
|
|
127
127
|
}),
|
|
128
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ E("div", {
|
|
129
129
|
ref: se,
|
|
130
|
-
className:
|
|
131
|
-
"data-edge-start": !
|
|
132
|
-
"data-edge-end": !
|
|
130
|
+
className: e("kapi-rail__scroll", !W && "kapi-fade-y"),
|
|
131
|
+
"data-edge-start": !W && q.start ? "" : void 0,
|
|
132
|
+
"data-edge-end": !W && q.end ? "" : void 0,
|
|
133
133
|
children: [
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ T("span", {
|
|
135
135
|
ref: oe,
|
|
136
136
|
className: "kapi-rail__indicator",
|
|
137
137
|
"aria-hidden": "true"
|
|
138
138
|
}),
|
|
139
139
|
$(ae),
|
|
140
|
-
X.length > 0 && /* @__PURE__ */
|
|
141
|
-
className:
|
|
140
|
+
X.length > 0 && /* @__PURE__ */ T(o, {
|
|
141
|
+
className: e("kapi-rail__more", Z.current && "kapi-rail__more--on"),
|
|
142
142
|
variant: "ghost",
|
|
143
143
|
drop: "up",
|
|
144
|
-
icon: /* @__PURE__ */
|
|
144
|
+
icon: /* @__PURE__ */ T(te, {
|
|
145
145
|
size: 21,
|
|
146
146
|
strokeWidth: 1.8
|
|
147
147
|
}),
|
|
148
|
-
...
|
|
149
|
-
label: /* @__PURE__ */ w
|
|
148
|
+
...V || Z.current ? { "aria-label": Z.current ? `${z.more} · ${z.moreCurrent}: ${Z.current.label}` : z.more } : {},
|
|
149
|
+
label: /* @__PURE__ */ E(w, { children: [!V && /* @__PURE__ */ T("span", {
|
|
150
150
|
className: "kapi-rail__label",
|
|
151
|
-
children:
|
|
152
|
-
}), Z.notice && /* @__PURE__ */
|
|
151
|
+
children: z.more
|
|
152
|
+
}), Z.notice && /* @__PURE__ */ T(c, {
|
|
153
153
|
value: "dot",
|
|
154
154
|
tone: Z.notice.badgeTone,
|
|
155
155
|
placement: "corner"
|
|
@@ -158,16 +158,16 @@ var E = {
|
|
|
158
158
|
})
|
|
159
159
|
]
|
|
160
160
|
}),
|
|
161
|
-
|
|
161
|
+
U.end.length > 0 && /* @__PURE__ */ T("div", {
|
|
162
162
|
className: "kapi-rail__end",
|
|
163
|
-
children: $(
|
|
163
|
+
children: $(U.end)
|
|
164
164
|
}),
|
|
165
|
-
|
|
166
|
-
value:
|
|
167
|
-
children:
|
|
165
|
+
M !== void 0 && /* @__PURE__ */ T(x.Provider, {
|
|
166
|
+
value: N,
|
|
167
|
+
children: M
|
|
168
168
|
})
|
|
169
169
|
]
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
172
|
//#endregion
|
|
173
|
-
export {
|
|
173
|
+
export { D as DEFAULT_RAIL_LABELS, O as KapiRail };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiRail.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 { KapiTooltip as n } from "../overlays/KapiTooltip.js";
|
|
6
6
|
import { initialsFrom as r } from "../display/avatarLogic.js";
|
|
7
7
|
import { RailVariantContext as i } from "./railContext.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { DEFAULT_RAIL_LABELS as a } from "./KapiRail.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useContext as o } from "react";
|
|
11
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/layout/KapiRailAccount.tsx
|
|
13
13
|
var l = ({ user: l, label: u, avatar: d, open: f = !1, labels: p, className: m, ref: h, ...g }) => {
|
|
14
|
-
let _ =
|
|
14
|
+
let _ = t("rail", a, p), v = o(i) === "compact", y = u ?? _.account, b = /* @__PURE__ */ c("button", {
|
|
15
15
|
...g,
|
|
16
16
|
ref: h,
|
|
17
17
|
type: "button",
|
|
18
|
-
className:
|
|
18
|
+
className: e("kapi-rail__item kapi-rail__item--account", m),
|
|
19
19
|
"aria-haspopup": "menu",
|
|
20
20
|
"aria-expanded": f,
|
|
21
21
|
"aria-label": v ? g["aria-label"] ?? y : g["aria-label"],
|
|
22
|
-
children: [/* @__PURE__ */
|
|
22
|
+
children: [/* @__PURE__ */ s("span", {
|
|
23
23
|
className: "kapi-rail__avatar",
|
|
24
24
|
"aria-hidden": "true",
|
|
25
25
|
children: d ?? l.initials ?? r(l.name)
|
|
26
|
-
}), !v && /* @__PURE__ */
|
|
26
|
+
}), !v && /* @__PURE__ */ s("span", {
|
|
27
27
|
className: "kapi-rail__label",
|
|
28
28
|
children: y
|
|
29
29
|
})]
|
|
30
30
|
});
|
|
31
|
-
return v ? /* @__PURE__ */
|
|
31
|
+
return v ? /* @__PURE__ */ s(n, {
|
|
32
32
|
label: y,
|
|
33
33
|
children: b
|
|
34
34
|
}) : b;
|