@kapiuara/ui 0.15.3 → 0.16.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/LICENSE +19 -15
- package/README.md +338 -6
- package/dist/components/data/KapiDataTable.d.ts +1 -1
- package/dist/components/data/KapiDataTable.js +22 -22
- package/dist/components/data/KapiPaginationFooter.js +1 -1
- package/dist/components/data/KapiSheet.d.ts +105 -0
- package/dist/components/data/KapiSheet.js +75 -0
- package/dist/components/data/KapiTable.d.ts +2 -2
- package/dist/components/data/KapiTable.js +347 -329
- package/dist/components/data/KapiTableFooter.d.ts +22 -0
- package/dist/components/data/KapiTableFooter.js +55 -0
- package/dist/components/data/KapiTableRow.js +53 -52
- package/dist/components/data/KapiTableToolbar.d.ts +4 -2
- package/dist/components/data/KapiTableToolbar.js +71 -69
- package/dist/components/data/index.d.ts +3 -1
- package/dist/components/data/tableCells.d.ts +5 -4
- package/dist/components/data/tableCells.js +42 -41
- package/dist/components/data/tableLogic.d.ts +2 -0
- package/dist/components/data/tableLogic.js +66 -66
- package/dist/components/data/tableSlots.d.ts +9 -0
- package/dist/components/data/tableSlots.js +12 -0
- package/dist/components/data/tableSpanLogic.d.ts +35 -0
- package/dist/components/data/tableSpanLogic.js +47 -0
- package/dist/components/data/tableTypes.d.ts +54 -1
- package/dist/components/data/useTableSelection.d.ts +4 -2
- package/dist/components/data/useTableSelection.js +27 -23
- package/dist/components/display/KapiAnchor.d.ts +36 -0
- package/dist/components/display/KapiAnchor.js +36 -0
- package/dist/components/display/KapiBadge.d.ts +6 -5
- package/dist/components/display/KapiBadge.js +25 -19
- package/dist/components/display/KapiText.d.ts +43 -0
- package/dist/components/display/KapiText.js +33 -0
- package/dist/components/display/KapiTitle.d.ts +33 -0
- package/dist/components/display/KapiTitle.js +29 -0
- package/dist/components/display/index.d.ts +7 -0
- package/dist/components/display/textLogic.d.ts +32 -0
- package/dist/components/display/textLogic.js +19 -0
- package/dist/components/feedback/KapiAlert.d.ts +8 -4
- package/dist/components/feedback/KapiAlert.js +39 -34
- package/dist/components/inputs/KapiButton.d.ts +7 -4
- package/dist/components/inputs/KapiButton.js +47 -42
- package/dist/components/inputs/KapiSelect.d.ts +12 -0
- package/dist/components/inputs/KapiSelect.js +215 -212
- package/dist/components/inputs/KapiSelectMenu.d.ts +4 -2
- package/dist/components/inputs/KapiSelectMenu.js +131 -133
- package/dist/components/inputs/fieldLogic.d.ts +2 -2
- package/dist/components/inputs/index.d.ts +1 -1
- package/dist/components/inputs/selectSlots.d.ts +24 -0
- package/dist/components/inputs/selectSlots.js +27 -0
- package/dist/components/layout/KapiBox.d.ts +31 -0
- package/dist/components/layout/KapiBox.js +26 -0
- package/dist/components/layout/KapiCard.d.ts +16 -4
- package/dist/components/layout/KapiCard.js +46 -34
- package/dist/components/layout/KapiCenter.d.ts +13 -0
- package/dist/components/layout/KapiCenter.js +23 -0
- package/dist/components/layout/KapiCol.d.ts +22 -0
- package/dist/components/layout/KapiCol.js +23 -0
- package/dist/components/layout/KapiGrid.d.ts +29 -3
- package/dist/components/layout/KapiGrid.js +39 -17
- package/dist/components/layout/KapiPageHeader.d.ts +10 -1
- package/dist/components/layout/KapiPageHeader.js +82 -80
- package/dist/components/layout/KapiPanelParts.d.ts +11 -2
- package/dist/components/layout/KapiPanelParts.js +73 -56
- package/dist/components/layout/KapiRail.d.ts +10 -1
- package/dist/components/layout/KapiRail.js +123 -120
- package/dist/components/layout/KapiRoot.d.ts +35 -5
- package/dist/components/layout/KapiRoot.js +54 -39
- package/dist/components/layout/KapiShell.d.ts +36 -3
- package/dist/components/layout/KapiShell.js +53 -50
- package/dist/components/layout/cardSlots.d.ts +9 -0
- package/dist/components/layout/cardSlots.js +12 -0
- package/dist/components/layout/gridSpanLogic.d.ts +46 -0
- package/dist/components/layout/gridSpanLogic.js +39 -0
- package/dist/components/layout/index.d.ts +11 -4
- package/dist/components/layout/layoutPrimitives.d.ts +11 -0
- package/dist/components/layout/layoutPrimitives.js +12 -1
- package/dist/components/layout/pageHeaderSlots.d.ts +12 -0
- package/dist/components/layout/pageHeaderSlots.js +15 -0
- package/dist/components/layout/railLogic.d.ts +16 -3
- package/dist/components/layout/railSlots.d.ts +12 -0
- package/dist/components/layout/railSlots.js +15 -0
- package/dist/components/layout/shellSlots.d.ts +6 -0
- package/dist/components/layout/shellSlots.js +9 -0
- package/dist/components/layout/useGridBreakpoint.d.ts +12 -0
- package/dist/components/layout/useGridBreakpoint.js +35 -0
- package/dist/components/navigation/KapiBreadcrumb.d.ts +18 -2
- package/dist/components/navigation/KapiBreadcrumb.js +23 -16
- package/dist/components/navigation/KapiContextPanel.d.ts +17 -4
- package/dist/components/navigation/KapiContextPanel.js +151 -135
- package/dist/components/navigation/KapiPanelGroup.d.ts +16 -4
- package/dist/components/navigation/KapiPanelGroup.js +66 -65
- package/dist/components/navigation/KapiTabs.d.ts +12 -0
- package/dist/components/navigation/KapiTabs.js +87 -71
- package/dist/components/navigation/MiniNavItem.d.ts +7 -2
- package/dist/components/navigation/MiniNavItem.js +41 -36
- package/dist/components/navigation/breadcrumbLogic.d.ts +4 -2
- package/dist/components/navigation/breadcrumbLogic.js +1 -1
- package/dist/components/navigation/navLink.d.ts +21 -0
- package/dist/components/navigation/navLink.js +26 -0
- package/dist/components/navigation/navLinkLogic.d.ts +18 -0
- package/dist/components/navigation/navLinkLogic.js +22 -0
- package/dist/components/overlays/KapiContextMenu.d.ts +8 -0
- package/dist/components/overlays/KapiModal.d.ts +9 -0
- package/dist/components/overlays/KapiModal.js +77 -75
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/components/overlays/menuList.js +123 -113
- package/dist/components/overlays/modalSlots.d.ts +11 -0
- package/dist/components/overlays/modalSlots.js +14 -0
- package/dist/components/slotCatalog.d.ts +90 -0
- package/dist/components/slotCatalog.js +19 -0
- package/dist/components/slotsLogic.d.ts +34 -0
- package/dist/components/slotsLogic.js +18 -0
- package/dist/components/tone.d.ts +26 -0
- package/dist/components/tone.js +15 -14
- package/dist/css/base.css +1 -1
- package/dist/css/components/data/KapiEventCalendar.css +1 -1
- package/dist/css/components/data/KapiTable.css +1 -1
- package/dist/css/components/display/display.css +1 -1
- package/dist/css/components/display/typography.css +1 -0
- package/dist/css/components/feedback/feedback.css +1 -1
- package/dist/css/components/inputs/KapiButton.css +1 -1
- package/dist/css/components/inputs/KapiDatePicker.css +1 -1
- package/dist/css/components/layout/KapiBox.css +1 -0
- package/dist/css/components/layout/KapiRail.css +1 -1
- package/dist/css/components/layout/gridSpan.css +1 -0
- package/dist/css/components/navigation/navigation.css +1 -1
- package/dist/hooks/densityLogic.d.ts +15 -0
- package/dist/hooks/densityLogic.js +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/themeColorsLogic.d.ts +19 -0
- package/dist/hooks/themeColorsLogic.js +4 -2
- package/dist/hooks/themeDeriveLogic.d.ts +16 -0
- package/dist/hooks/themeDeriveLogic.js +27 -17
- package/dist/hooks/toneFamilyLogic.d.ts +122 -0
- package/dist/hooks/toneFamilyLogic.js +151 -0
- package/dist/hooks/useKapiTheme.d.ts +8 -2
- package/dist/hooks/useKapiTheme.js +116 -103
- package/dist/hooks/useToneFamilies.d.ts +30 -0
- package/dist/hooks/useToneFamilies.js +46 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +213 -204
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/styles/rawHeights.d.ts +8 -0
- package/package.json +2 -2
|
@@ -1,239 +1,255 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/navigation/navigation.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { renderSlot as t } from "../renderSlot.js";
|
|
5
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { useControllableState as r } from "../../hooks/useControllableState.js";
|
|
7
|
+
import { directionOf as i, physicalSide as a } from "../../hooks/directionLogic.js";
|
|
8
|
+
import { useMergedRefs as o } from "../../hooks/mergeRefs.js";
|
|
9
|
+
import { DEFAULT_LINK_LABELS as s } from "../locale/linkLabels.js";
|
|
9
10
|
import "./navBadgeLogic.js";
|
|
10
|
-
import { KapiNavBadge as
|
|
11
|
-
import { CtxSlidingList as
|
|
11
|
+
import { KapiNavBadge as c } from "./KapiNavBadge.js";
|
|
12
|
+
import { CtxSlidingList as l } from "./CtxSlidingList.js";
|
|
12
13
|
/* empty css */
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
14
|
+
import { renderNavLink as u } from "./navLink.js";
|
|
15
|
+
import { KapiPanelMiniContext as ee, useKapiPanelMini as d } from "./panelMini.js";
|
|
16
|
+
import { MiniNavItem as f } from "./MiniNavItem.js";
|
|
17
|
+
import { KapiPanelSearch as p } from "../layout/KapiPanelParts.js";
|
|
18
|
+
import { canCollapse as m, clampCtxPanelWidth as te, ctxPanelClasses as h, ctxPanelWidthFromDrag as g, stepCtxPanelWidth as _ } from "./contextPanelLogic.js";
|
|
19
|
+
import { activeIdIn as v } from "./activeItemLogic.js";
|
|
20
|
+
import { useLayoutEffect as y, useMemo as ne, useRef as b, useState as x } from "react";
|
|
21
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
22
|
+
import { ChevronsLeft as T, ChevronsRight as E, ExternalLink as D } from "lucide-react";
|
|
21
23
|
//#region src/components/navigation/KapiContextPanel.tsx
|
|
22
|
-
var
|
|
23
|
-
let { mini:
|
|
24
|
-
|
|
24
|
+
var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
25
|
+
let { mini: a } = d(), o = e.detail !== void 0 || e.initials !== void 0, s = () => r?.(e.id);
|
|
26
|
+
if (a) return /* @__PURE__ */ C(f, {
|
|
25
27
|
label: e.label,
|
|
26
28
|
icon: e.icon,
|
|
27
29
|
initials: e.initials,
|
|
28
|
-
active:
|
|
30
|
+
active: n,
|
|
29
31
|
badge: e.badge,
|
|
30
32
|
badgeTone: e.badgeTone,
|
|
31
33
|
badgeLabel: e.badgeLabel,
|
|
32
34
|
disabled: e.disabled,
|
|
33
|
-
|
|
35
|
+
...e.render === void 0 ? !o && e.href !== void 0 ? {
|
|
34
36
|
href: e.href,
|
|
35
37
|
newTab: e.newTab,
|
|
36
|
-
newTabLabel:
|
|
37
|
-
} : { onClick:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
children: [
|
|
45
|
-
e.initials !== void 0 && /* @__PURE__ */
|
|
38
|
+
newTabLabel: i
|
|
39
|
+
} : { onClick: s } : {
|
|
40
|
+
render: e.render,
|
|
41
|
+
newTab: e.newTab,
|
|
42
|
+
newTabLabel: i
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (o) {
|
|
46
|
+
let r = /* @__PURE__ */ w(S, { children: [
|
|
47
|
+
e.initials !== void 0 && /* @__PURE__ */ C("span", {
|
|
46
48
|
className: "kapi-ctxrec__av kapi-ctxrec__av--tone",
|
|
47
49
|
children: e.initials
|
|
48
50
|
}),
|
|
49
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ w("span", {
|
|
50
52
|
className: "kapi-ctxrec__txt",
|
|
51
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ C("span", {
|
|
52
54
|
className: "kapi-ctxrec__name",
|
|
53
55
|
children: e.label
|
|
54
|
-
}), e.detail !== void 0 && /* @__PURE__ */
|
|
56
|
+
}), e.detail !== void 0 && /* @__PURE__ */ C("span", {
|
|
55
57
|
className: "kapi-ctxrec__sub",
|
|
56
58
|
children: e.detail
|
|
57
59
|
})]
|
|
58
60
|
}),
|
|
59
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ C(c, {
|
|
60
62
|
value: e.badge,
|
|
61
63
|
tone: e.badgeTone,
|
|
62
64
|
label: e.badgeLabel,
|
|
63
65
|
max: 999
|
|
64
66
|
}),
|
|
65
67
|
e.trailing
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
] }), i = `kapi-ctxrec${n ? " kapi-ctxrec--on" : ""}`;
|
|
69
|
+
return e.render === void 0 ? /* @__PURE__ */ C("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
className: i,
|
|
72
|
+
"aria-current": n ? "page" : void 0,
|
|
73
|
+
disabled: e.disabled,
|
|
74
|
+
onClick: s,
|
|
75
|
+
children: r
|
|
76
|
+
}) : t(e.render, { className: i }, {
|
|
77
|
+
"aria-current": n ? "page" : void 0,
|
|
78
|
+
"aria-disabled": e.disabled || void 0,
|
|
79
|
+
...e.disabled ? { onClick: (e) => e.preventDefault() } : {},
|
|
80
|
+
children: r
|
|
81
|
+
}, (e) => /* @__PURE__ */ C("a", { ...e }));
|
|
82
|
+
}
|
|
83
|
+
return e.href !== void 0 || e.render !== void 0 ? u({
|
|
84
|
+
render: e.render,
|
|
85
|
+
href: e.href,
|
|
86
|
+
newTab: e.newTab,
|
|
71
87
|
disabled: e.disabled,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
active: n,
|
|
89
|
+
className: `kapi-ctxitem kapi-ctxitem--link${n ? " kapi-ctxitem--on" : ""}`,
|
|
90
|
+
children: /* @__PURE__ */ w(S, { children: [
|
|
91
|
+
/* @__PURE__ */ w("span", {
|
|
75
92
|
className: "kapi-ctxitem__main",
|
|
76
93
|
children: [e.icon, e.label]
|
|
77
94
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ C(c, {
|
|
79
96
|
value: e.badge,
|
|
80
97
|
tone: e.badgeTone,
|
|
81
98
|
label: e.badgeLabel,
|
|
82
99
|
max: 999
|
|
83
100
|
}),
|
|
84
|
-
e.trailing
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
e.trailing,
|
|
102
|
+
e.external && /* @__PURE__ */ C(D, {
|
|
103
|
+
className: "kapi-ctxitem__ext",
|
|
104
|
+
size: 14,
|
|
105
|
+
"aria-hidden": "true"
|
|
106
|
+
}),
|
|
107
|
+
e.newTab && /* @__PURE__ */ C("span", {
|
|
108
|
+
className: "kapi-ctxitem__sr",
|
|
109
|
+
children: i
|
|
110
|
+
})
|
|
111
|
+
] })
|
|
112
|
+
}) : /* @__PURE__ */ w("button", {
|
|
113
|
+
type: "button",
|
|
114
|
+
className: `kapi-ctxitem${n ? " kapi-ctxitem--on" : ""}`,
|
|
115
|
+
"aria-current": n ? "page" : void 0,
|
|
116
|
+
disabled: e.disabled,
|
|
117
|
+
onClick: s,
|
|
93
118
|
children: [
|
|
94
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ w("span", {
|
|
95
120
|
className: "kapi-ctxitem__main",
|
|
96
121
|
children: [e.icon, e.label]
|
|
97
122
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ C(c, {
|
|
99
124
|
value: e.badge,
|
|
100
125
|
tone: e.badgeTone,
|
|
101
126
|
label: e.badgeLabel,
|
|
102
127
|
max: 999
|
|
103
128
|
}),
|
|
104
|
-
e.trailing
|
|
105
|
-
e.external && /* @__PURE__ */ b(w, {
|
|
106
|
-
className: "kapi-ctxitem__ext",
|
|
107
|
-
size: 14,
|
|
108
|
-
"aria-hidden": "true"
|
|
109
|
-
}),
|
|
110
|
-
e.newTab && /* @__PURE__ */ b("span", {
|
|
111
|
-
className: "kapi-ctxitem__sr",
|
|
112
|
-
children: r
|
|
113
|
-
})
|
|
129
|
+
e.trailing
|
|
114
130
|
]
|
|
115
131
|
});
|
|
116
|
-
},
|
|
117
|
-
let
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
i && /* @__PURE__ */
|
|
132
|
+
}, k = ({ sections: e, activeId: t, onSelect: r, search: i, hint: a, labels: o }) => {
|
|
133
|
+
let c = n("link", s, o);
|
|
134
|
+
return /* @__PURE__ */ w(S, { children: [
|
|
135
|
+
i && /* @__PURE__ */ C(p, {
|
|
120
136
|
placeholder: i.placeholder,
|
|
121
137
|
value: i.value,
|
|
122
138
|
...i["aria-label"] === void 0 ? {} : { "aria-label": i["aria-label"] },
|
|
123
139
|
onChange: (e) => i.onChange?.(e.target.value)
|
|
124
140
|
}),
|
|
125
|
-
e.map((e,
|
|
141
|
+
e.map((e, n) => /* @__PURE__ */ w("div", {
|
|
126
142
|
className: "kapi-ctxsection",
|
|
127
143
|
children: [
|
|
128
|
-
|
|
129
|
-
e.label && /* @__PURE__ */
|
|
144
|
+
n > 0 && /* @__PURE__ */ C("div", { className: "kapi-ctxdivider" }),
|
|
145
|
+
e.label && /* @__PURE__ */ C("div", {
|
|
130
146
|
className: "kapi-ct",
|
|
131
147
|
children: e.label
|
|
132
148
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
active:
|
|
135
|
-
children: e.items.map((e) => /* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ C(l, {
|
|
150
|
+
active: v(e.items, t),
|
|
151
|
+
children: e.items.map((e) => /* @__PURE__ */ C(O, {
|
|
136
152
|
item: e,
|
|
137
|
-
active: e.id ===
|
|
153
|
+
active: e.id === t,
|
|
138
154
|
onSelect: r,
|
|
139
|
-
newTabLabel:
|
|
155
|
+
newTabLabel: c.newTab
|
|
140
156
|
}, e.id))
|
|
141
157
|
})
|
|
142
158
|
]
|
|
143
159
|
}, e.id)),
|
|
144
|
-
a && /* @__PURE__ */
|
|
160
|
+
a && /* @__PURE__ */ C("div", {
|
|
145
161
|
className: "kapi-hint",
|
|
146
162
|
children: a
|
|
147
163
|
})
|
|
148
164
|
] });
|
|
149
|
-
},
|
|
165
|
+
}, A = {
|
|
150
166
|
resize: "Redimensionar panel",
|
|
151
167
|
collapse: "Plegar panel",
|
|
152
168
|
expand: "Desplegar panel",
|
|
153
169
|
region: "Panel contextual"
|
|
154
|
-
},
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
J && (
|
|
158
|
-
}, [J,
|
|
170
|
+
}, j = ({ title: t, actions: s, collapsed: c, defaultCollapsed: l, onCollapsedChange: u, collapseLabel: d, expandLabel: f, side: p = "left", collapsedMode: v = "hidden", resizable: S = !1, minWidth: D = 200, maxWidth: O = 420, "aria-label": j, labels: M, className: N, style: P, id: F, ref: I, ...L }) => {
|
|
171
|
+
let R = n("contextPanel", A, M), re = d ?? R.collapse, ie = f ?? R.expand, z = j ?? R.region, [B, ae] = r(c, l ?? !1, u), [V, H] = x(null), [oe, U] = x(!1), W = b(null), G = b(null), K = o(G, I), q = b(null), [J, Y] = x(null);
|
|
172
|
+
y(() => {
|
|
173
|
+
J && (B === J.next && q.current?.focus(), Y(null));
|
|
174
|
+
}, [J, B]);
|
|
159
175
|
let X = (e) => {
|
|
160
|
-
Y({ next: e }),
|
|
161
|
-
}, Z =
|
|
162
|
-
|
|
176
|
+
Y({ next: e }), ae(e);
|
|
177
|
+
}, Z = b(X);
|
|
178
|
+
y(() => {
|
|
163
179
|
Z.current = X;
|
|
164
180
|
});
|
|
165
|
-
let se =
|
|
181
|
+
let se = ne(() => ({
|
|
166
182
|
mini: !0,
|
|
167
183
|
expand: () => Z.current(!1),
|
|
168
|
-
tooltipSide:
|
|
169
|
-
}), [
|
|
184
|
+
tooltipSide: p === "right" ? "start" : "end"
|
|
185
|
+
}), [p]), ce = p === "right" ? E : T, le = p === "right" ? T : E, Q = () => V ?? G.current?.offsetWidth ?? 258, ue = (e) => {
|
|
170
186
|
e.button === 0 && (W.current = {
|
|
171
187
|
startX: e.clientX,
|
|
172
188
|
startWidth: Q()
|
|
173
189
|
}, e.currentTarget.setPointerCapture(e.pointerId), U(!0), e.preventDefault());
|
|
174
190
|
}, de = (e) => {
|
|
175
191
|
let t = W.current;
|
|
176
|
-
t && H(
|
|
192
|
+
t && H(g(a(p, i(e.currentTarget)), t.startWidth, t.startX, e.clientX, D, O));
|
|
177
193
|
}, $ = (e) => {
|
|
178
194
|
W.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), U(!1);
|
|
179
195
|
}, fe = (e) => {
|
|
180
|
-
let t =
|
|
196
|
+
let t = _(a(p, i(e.currentTarget)), Q(), e.key, D, O);
|
|
181
197
|
t !== null && (e.preventDefault(), H(t));
|
|
182
198
|
};
|
|
183
|
-
if (
|
|
184
|
-
let t =
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
ref:
|
|
187
|
-
id:
|
|
188
|
-
className: e(
|
|
189
|
-
side:
|
|
199
|
+
if (B) {
|
|
200
|
+
let t = v === "mini";
|
|
201
|
+
return /* @__PURE__ */ w("aside", {
|
|
202
|
+
ref: I,
|
|
203
|
+
id: F,
|
|
204
|
+
className: e(h({
|
|
205
|
+
side: p,
|
|
190
206
|
collapsed: !0
|
|
191
|
-
}), t && "is-mini kapi-navmini",
|
|
192
|
-
style:
|
|
193
|
-
"aria-label":
|
|
194
|
-
children: [/* @__PURE__ */
|
|
207
|
+
}), t && "is-mini kapi-navmini", N),
|
|
208
|
+
style: P,
|
|
209
|
+
"aria-label": z,
|
|
210
|
+
children: [/* @__PURE__ */ C("button", {
|
|
195
211
|
ref: q,
|
|
196
212
|
type: "button",
|
|
197
213
|
className: "kapi-paneltoggle",
|
|
198
214
|
onClick: () => X(!1),
|
|
199
|
-
"aria-label":
|
|
200
|
-
children: /* @__PURE__ */
|
|
215
|
+
"aria-label": ie,
|
|
216
|
+
children: /* @__PURE__ */ C(le, {
|
|
201
217
|
className: "kapi-flip-rtl",
|
|
202
218
|
size: 16,
|
|
203
219
|
strokeWidth: 2,
|
|
204
220
|
"aria-hidden": "true"
|
|
205
221
|
})
|
|
206
|
-
}), t && /* @__PURE__ */
|
|
222
|
+
}), t && /* @__PURE__ */ C(ee.Provider, {
|
|
207
223
|
value: se,
|
|
208
|
-
children: /* @__PURE__ */
|
|
209
|
-
...
|
|
210
|
-
labels:
|
|
224
|
+
children: /* @__PURE__ */ C(k, {
|
|
225
|
+
...L,
|
|
226
|
+
labels: M
|
|
211
227
|
})
|
|
212
228
|
})]
|
|
213
229
|
});
|
|
214
230
|
}
|
|
215
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ w("aside", {
|
|
216
232
|
ref: K,
|
|
217
|
-
id:
|
|
218
|
-
className: e(
|
|
219
|
-
side:
|
|
233
|
+
id: F,
|
|
234
|
+
className: e(h({
|
|
235
|
+
side: p,
|
|
220
236
|
resizing: oe
|
|
221
|
-
}),
|
|
222
|
-
"aria-label":
|
|
223
|
-
"data-resizable":
|
|
224
|
-
style:
|
|
225
|
-
...
|
|
237
|
+
}), N),
|
|
238
|
+
"aria-label": z,
|
|
239
|
+
"data-resizable": S || void 0,
|
|
240
|
+
style: S && V !== null ? {
|
|
241
|
+
...P,
|
|
226
242
|
width: V
|
|
227
|
-
} :
|
|
243
|
+
} : P,
|
|
228
244
|
children: [
|
|
229
|
-
|
|
245
|
+
S && /* @__PURE__ */ C("div", {
|
|
230
246
|
className: "kapi-ctxpanel__resize",
|
|
231
247
|
role: "separator",
|
|
232
248
|
"aria-orientation": "vertical",
|
|
233
|
-
"aria-label":
|
|
234
|
-
"aria-valuemin":
|
|
235
|
-
"aria-valuemax":
|
|
236
|
-
"aria-valuenow": te(V ?? 258,
|
|
249
|
+
"aria-label": R.resize,
|
|
250
|
+
"aria-valuemin": D,
|
|
251
|
+
"aria-valuemax": O,
|
|
252
|
+
"aria-valuenow": te(V ?? 258, D, O),
|
|
237
253
|
tabIndex: 0,
|
|
238
254
|
onPointerDown: ue,
|
|
239
255
|
onPointerMove: de,
|
|
@@ -241,21 +257,21 @@ var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
|
|
|
241
257
|
onPointerCancel: $,
|
|
242
258
|
onKeyDown: fe
|
|
243
259
|
}),
|
|
244
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ w("div", {
|
|
245
261
|
className: "kapi-ctxpanel__head",
|
|
246
|
-
children: [/* @__PURE__ */
|
|
262
|
+
children: [/* @__PURE__ */ C("span", { children: t }), /* @__PURE__ */ w("div", {
|
|
247
263
|
className: "kapi-ctxpanel__actions",
|
|
248
|
-
children: [s,
|
|
264
|
+
children: [s, m({
|
|
249
265
|
collapsed: c,
|
|
250
|
-
defaultCollapsed:
|
|
251
|
-
onCollapsedChange:
|
|
252
|
-
}) && /* @__PURE__ */
|
|
266
|
+
defaultCollapsed: l,
|
|
267
|
+
onCollapsedChange: u
|
|
268
|
+
}) && /* @__PURE__ */ C("button", {
|
|
253
269
|
ref: q,
|
|
254
270
|
type: "button",
|
|
255
271
|
className: "kapi-paneltoggle",
|
|
256
272
|
onClick: () => X(!0),
|
|
257
|
-
"aria-label":
|
|
258
|
-
children: /* @__PURE__ */
|
|
273
|
+
"aria-label": re,
|
|
274
|
+
children: /* @__PURE__ */ C(ce, {
|
|
259
275
|
className: "kapi-flip-rtl",
|
|
260
276
|
size: 16,
|
|
261
277
|
strokeWidth: 2,
|
|
@@ -264,12 +280,12 @@ var T = ({ item: e, active: t, onSelect: n, newTabLabel: r }) => {
|
|
|
264
280
|
})]
|
|
265
281
|
})]
|
|
266
282
|
}),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
...
|
|
269
|
-
labels:
|
|
283
|
+
/* @__PURE__ */ C(k, {
|
|
284
|
+
...L,
|
|
285
|
+
labels: M
|
|
270
286
|
})
|
|
271
287
|
]
|
|
272
288
|
});
|
|
273
289
|
};
|
|
274
290
|
//#endregion
|
|
275
|
-
export {
|
|
291
|
+
export { A as DEFAULT_CONTEXT_PANEL_LABELS, j as KapiContextPanel, k as KapiContextSections };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type KapiLinkLabels } from "../locale/linkLabels.js";
|
|
3
|
+
import type { KapiRender } from "../renderSlot.js";
|
|
3
4
|
import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
|
|
4
5
|
import type { KapiTone } from "../tone.js";
|
|
5
6
|
import type { KapiRootProps } from "../rootProps.js";
|
|
@@ -20,11 +21,22 @@ export type KapiPanelGroupItem<Id extends string = string> = {
|
|
|
20
21
|
icon?: ReactNode;
|
|
21
22
|
/** No se puede elegir (botón deshabilitado o enlace `aria-disabled`). */
|
|
22
23
|
disabled?: boolean | undefined;
|
|
23
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Si se pasa, se dibuja un enlace real `<a>` en vez de un botón. Es un enlace NATIVO: navega con carga
|
|
26
|
+
* completa de página. Para navegar dentro de una SPA sin recargar, usa `render`.
|
|
27
|
+
*/
|
|
24
28
|
href?: string | undefined;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* El elemento que dibuja el subítem: el `<Link>` de tu router. Navega sin recargar la página. Las clases
|
|
31
|
+
* se unen, los estilos se funden y los handlers corren los dos (primero el tuyo); la librería no le pone
|
|
32
|
+
* `href` y `href` se ignora. `onSelect(id)` NO se llama: un enlace navega solo (igual que con `href`), así que no hay doble navegación si tu `onSelect` ya navega para los ítems que son botones.
|
|
33
|
+
*
|
|
34
|
+
* { id: "abiertos", label: "Abiertos", render: <Link to="/abiertos" /> }
|
|
35
|
+
*/
|
|
36
|
+
render?: KapiRender | undefined;
|
|
37
|
+
/** Destino en otro sistema: agrega el ícono ↗ (sólo con `href` o `render`). */
|
|
26
38
|
external?: boolean | undefined;
|
|
27
|
-
/** Abrir el enlace en una pestaña nueva (sólo con `href`). */
|
|
39
|
+
/** Abrir el enlace en una pestaña nueva (sólo con `href` o `render`). */
|
|
28
40
|
newTab?: boolean | undefined;
|
|
29
41
|
};
|
|
30
42
|
/**
|
|
@@ -48,7 +60,7 @@ export type KapiPanelGroupProps<Id extends string = string> = KapiRootProps<HTML
|
|
|
48
60
|
items: readonly KapiPanelGroupItem<Id>[];
|
|
49
61
|
/** Id del subítem activo (`aria-current="page"`); lo decide la app, normalmente desde el router. */
|
|
50
62
|
activeId?: Id | undefined;
|
|
51
|
-
/** Se llama con el `id` del subítem clickeado (no aplica a los enlaces con `href`). */
|
|
63
|
+
/** Se llama con el `id` del subítem clickeado (no aplica a los enlaces: ni con `href` ni con `render`). */
|
|
52
64
|
onSelect?: ((id: Id) => void) | undefined;
|
|
53
65
|
/** Controlado. */
|
|
54
66
|
open?: boolean | undefined;
|