@kapiuara/ui 0.16.0 → 0.18.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 +430 -20
- package/dist/components/chat/KapiChatThread.js +4 -4
- package/dist/components/chat/KapiComposer.js +8 -8
- package/dist/components/data/KapiDataTable.js +4 -4
- package/dist/components/data/KapiScatterChart.d.ts +56 -0
- package/dist/components/data/KapiScatterChart.js +90 -0
- package/dist/components/data/KapiSparkline.d.ts +2 -1
- package/dist/components/data/KapiSparkline.js +29 -26
- package/dist/components/data/KapiTableFilter.js +6 -6
- package/dist/components/data/chartFrame.d.ts +20 -2
- package/dist/components/data/chartFrame.js +33 -24
- package/dist/components/data/index.d.ts +4 -0
- package/dist/components/data/scatterLogic.d.ts +56 -0
- package/dist/components/data/scatterLogic.js +43 -0
- package/dist/components/data/tableCells.d.ts +12 -1
- package/dist/components/data/tableCells.js +49 -51
- package/dist/components/data/useTableSelection.js +3 -3
- package/dist/components/display/KapiAnnotation.js +68 -63
- package/dist/components/display/KapiAvatar.d.ts +6 -4
- package/dist/components/display/KapiAvatar.js +33 -28
- package/dist/components/display/KapiAvatarGroup.d.ts +14 -2
- package/dist/components/display/KapiAvatarGroup.js +25 -23
- package/dist/components/display/KapiCodeBlock.d.ts +48 -0
- package/dist/components/display/KapiCodeBlock.js +44 -0
- package/dist/components/display/KapiCommentComposer.js +6 -6
- package/dist/components/display/KapiDiff.d.ts +62 -0
- package/dist/components/display/KapiDiff.js +118 -0
- package/dist/components/display/KapiHighlight.d.ts +27 -0
- package/dist/components/display/KapiHighlight.js +21 -0
- package/dist/components/display/KapiIconTile.d.ts +2 -1
- package/dist/components/display/KapiIconTile.js +23 -21
- package/dist/components/display/KapiStat.d.ts +3 -2
- package/dist/components/display/KapiStat.js +32 -26
- package/dist/components/display/KapiTag.d.ts +4 -3
- package/dist/components/display/KapiTag.js +29 -24
- package/dist/components/display/KapiTimeline.d.ts +19 -2
- package/dist/components/display/KapiTimeline.js +38 -23
- package/dist/components/display/annotationLogic.d.ts +2 -1
- package/dist/components/display/annotationLogic.js +7 -6
- package/dist/components/display/avatarGroupSlots.d.ts +6 -0
- package/dist/components/display/avatarGroupSlots.js +9 -0
- package/dist/components/display/codeBlockSlots.d.ts +10 -0
- package/dist/components/display/codeBlockSlots.js +13 -0
- package/dist/components/display/diffLogic.d.ts +58 -0
- package/dist/components/display/diffLogic.js +96 -0
- package/dist/components/display/diffSlots.d.ts +14 -0
- package/dist/components/display/diffSlots.js +17 -0
- package/dist/components/display/highlightLogic.d.ts +18 -0
- package/dist/components/display/highlightLogic.js +26 -0
- package/dist/components/display/highlightSlots.d.ts +5 -0
- package/dist/components/display/highlightSlots.js +8 -0
- package/dist/components/display/iconTileLogic.d.ts +2 -2
- package/dist/components/display/iconTileLogic.js +7 -6
- package/dist/components/display/index.d.ts +9 -1
- package/dist/components/display/statLogic.d.ts +2 -1
- package/dist/components/display/statLogic.js +7 -6
- package/dist/components/display/tagLogic.d.ts +2 -1
- package/dist/components/display/tagLogic.js +7 -6
- package/dist/components/display/timelineLogic.d.ts +20 -2
- package/dist/components/display/timelineLogic.js +10 -2
- package/dist/components/feedback/KapiAlert.d.ts +6 -1
- package/dist/components/feedback/KapiAlert.js +45 -44
- package/dist/components/feedback/KapiCountdown.d.ts +12 -1
- package/dist/components/feedback/KapiCountdown.js +34 -31
- package/dist/components/feedback/KapiEmpty.d.ts +6 -1
- package/dist/components/feedback/KapiEmpty.js +20 -18
- package/dist/components/feedback/KapiFab.js +108 -108
- package/dist/components/feedback/KapiProgress.js +63 -54
- package/dist/components/feedback/KapiSpinner.d.ts +48 -0
- package/dist/components/feedback/KapiSpinner.js +27 -0
- package/dist/components/feedback/KapiToastContainer.js +10 -10
- package/dist/components/feedback/KapiTour.js +13 -13
- package/dist/components/feedback/alertSlots.d.ts +9 -0
- package/dist/components/feedback/alertSlots.js +12 -0
- package/dist/components/feedback/countdownSlots.d.ts +6 -0
- package/dist/components/feedback/countdownSlots.js +9 -0
- package/dist/components/feedback/emptySlots.d.ts +8 -0
- package/dist/components/feedback/emptySlots.js +11 -0
- package/dist/components/feedback/index.d.ts +5 -3
- package/dist/components/feedback/progressLogic.d.ts +2 -1
- package/dist/components/feedback/progressLogic.js +9 -8
- package/dist/components/inputs/KapiAutocomplete.d.ts +6 -0
- package/dist/components/inputs/KapiAutocomplete.js +86 -85
- package/dist/components/inputs/KapiChecklist.d.ts +7 -1
- package/dist/components/inputs/KapiChecklist.js +53 -52
- package/dist/components/inputs/KapiCopyButton.d.ts +40 -0
- package/dist/components/inputs/KapiCopyButton.js +35 -0
- package/dist/components/inputs/KapiDatePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDatePicker.js +118 -116
- package/dist/components/inputs/KapiDateRangePicker.d.ts +7 -1
- package/dist/components/inputs/KapiDateRangePicker.js +136 -135
- package/dist/components/inputs/KapiFacetedSearch.js +5 -5
- package/dist/components/inputs/KapiField.d.ts +9 -1
- package/dist/components/inputs/KapiField.js +43 -42
- package/dist/components/inputs/KapiFileUpload.d.ts +14 -1
- package/dist/components/inputs/KapiFileUpload.js +83 -70
- package/dist/components/inputs/KapiInput.d.ts +29 -1
- package/dist/components/inputs/KapiInput.js +74 -51
- package/dist/components/inputs/KapiMaskedInput.js +26 -26
- package/dist/components/inputs/KapiNumberStepper.d.ts +7 -1
- package/dist/components/inputs/KapiNumberStepper.js +24 -23
- package/dist/components/inputs/KapiPinInput.d.ts +72 -0
- package/dist/components/inputs/KapiPinInput.js +75 -0
- package/dist/components/inputs/KapiPropsForm.d.ts +34 -0
- package/dist/components/inputs/KapiPropsForm.js +78 -0
- package/dist/components/inputs/KapiRating.d.ts +7 -1
- package/dist/components/inputs/KapiRating.js +39 -38
- package/dist/components/inputs/KapiSearchChip.js +5 -5
- package/dist/components/inputs/KapiSegmented.d.ts +13 -5
- package/dist/components/inputs/KapiSegmented.js +81 -77
- package/dist/components/inputs/KapiSelect.d.ts +9 -1
- package/dist/components/inputs/KapiSelect.js +236 -233
- package/dist/components/inputs/KapiSlider.d.ts +10 -3
- package/dist/components/inputs/KapiSlider.js +67 -63
- package/dist/components/inputs/KapiTagInput.d.ts +7 -1
- package/dist/components/inputs/KapiTagInput.js +70 -69
- package/dist/components/inputs/KapiTextarea.d.ts +7 -1
- package/dist/components/inputs/KapiTextarea.js +51 -50
- package/dist/components/inputs/copyLogic.d.ts +1 -0
- package/dist/components/inputs/copyLogic.js +12 -0
- package/dist/components/inputs/fieldLogic.d.ts +23 -3
- package/dist/components/inputs/fieldLogic.js +18 -11
- package/dist/components/inputs/formBridgeLogic.d.ts +104 -0
- package/dist/components/inputs/formBridgeLogic.js +25 -0
- package/dist/components/inputs/index.d.ts +10 -0
- package/dist/components/inputs/inputLogic.d.ts +16 -1
- package/dist/components/inputs/inputLogic.js +3 -3
- package/dist/components/inputs/ownField.d.ts +3 -1
- package/dist/components/inputs/ownField.js +28 -27
- package/dist/components/inputs/pinInputLogic.d.ts +34 -0
- package/dist/components/inputs/pinInputLogic.js +37 -0
- package/dist/components/inputs/propsFormLogic.d.ts +53 -0
- package/dist/components/inputs/propsFormLogic.js +11 -0
- package/dist/components/inputs/segmentedLogic.d.ts +7 -0
- package/dist/components/inputs/segmentedLogic.js +2 -2
- package/dist/components/layout/KapiAccessCard.d.ts +5 -1
- package/dist/components/layout/KapiAccessCard.js +43 -39
- package/dist/components/layout/KapiAccountMenu.js +7 -7
- package/dist/components/layout/KapiCollapse.d.ts +39 -0
- package/dist/components/layout/KapiCollapse.js +20 -0
- package/dist/components/layout/KapiContextSlot.js +4 -4
- package/dist/components/layout/KapiDivider.d.ts +11 -2
- package/dist/components/layout/KapiDivider.js +30 -24
- package/dist/components/layout/KapiGrid.js +2 -2
- package/dist/components/layout/KapiNotificationBell.js +10 -10
- package/dist/components/layout/KapiPageHeader.js +22 -22
- package/dist/components/layout/KapiRail.js +4 -4
- package/dist/components/layout/KapiRoot.d.ts +22 -2
- package/dist/components/layout/KapiRoot.js +33 -29
- package/dist/components/layout/KapiShell.d.ts +9 -1
- package/dist/components/layout/KapiShell.js +28 -27
- package/dist/components/layout/accessCardLogic.d.ts +8 -1
- package/dist/components/layout/accessCardLogic.js +11 -7
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/locale/labelRegistry.d.ts +18 -0
- package/dist/components/navigation/KapiAccordion.js +9 -9
- package/dist/components/navigation/KapiContextPanel.js +12 -12
- package/dist/components/navigation/KapiNavBadge.d.ts +6 -3
- package/dist/components/navigation/KapiNavBadge.js +26 -22
- package/dist/components/navigation/KapiSteps.d.ts +26 -5
- package/dist/components/navigation/KapiSteps.js +55 -43
- package/dist/components/navigation/KapiTabs.js +9 -9
- package/dist/components/navigation/KapiToc.d.ts +48 -0
- package/dist/components/navigation/KapiToc.js +66 -0
- package/dist/components/navigation/KapiTree.js +10 -10
- package/dist/components/navigation/index.d.ts +3 -0
- package/dist/components/navigation/tocLogic.d.ts +35 -0
- package/dist/components/navigation/tocLogic.js +11 -0
- package/dist/components/navigation/tocSlots.d.ts +8 -0
- package/dist/components/navigation/tocSlots.js +11 -0
- package/dist/components/overlays/KapiCommandPalette.js +6 -6
- package/dist/components/overlays/KapiContextMenu.js +5 -5
- package/dist/components/overlays/KapiImageViewer.d.ts +63 -0
- package/dist/components/overlays/KapiImageViewer.js +106 -0
- package/dist/components/overlays/KapiMenuButton.js +7 -7
- package/dist/components/overlays/KapiModal.js +3 -3
- package/dist/components/overlays/KapiOffcanvas.js +24 -24
- package/dist/components/overlays/KapiPhotoView.js +10 -10
- package/dist/components/overlays/KapiPopover.js +6 -6
- package/dist/components/overlays/KapiShapeSheet.js +4 -4
- package/dist/components/overlays/KapiShortcutsHelp.d.ts +53 -0
- package/dist/components/overlays/KapiShortcutsHelp.js +55 -0
- package/dist/components/overlays/KapiTooltip.d.ts +49 -10
- package/dist/components/overlays/KapiTooltip.js +120 -68
- package/dist/components/overlays/KapiViewport.d.ts +63 -0
- package/dist/components/overlays/KapiViewport.js +195 -0
- package/dist/components/overlays/index.d.ts +8 -0
- package/dist/components/overlays/menuList.js +22 -22
- package/dist/components/overlays/shortcutsHelpSlots.d.ts +9 -0
- package/dist/components/overlays/shortcutsHelpSlots.js +12 -0
- package/dist/components/overlays/viewportLogic.d.ts +73 -0
- package/dist/components/overlays/viewportLogic.js +54 -0
- package/dist/components/slotCatalog.d.ts +66 -0
- package/dist/components/slotCatalog.js +30 -12
- package/dist/css/base.css +1 -1
- package/dist/css/components/data/KapiScatterChart.css +1 -0
- package/dist/css/components/display/KapiAnnotation.css +1 -1
- package/dist/css/components/display/KapiCodeBlock.css +1 -0
- package/dist/css/components/display/KapiDiff.css +1 -0
- package/dist/css/components/display/display.css +1 -1
- package/dist/css/components/feedback/feedback.css +1 -1
- package/dist/css/components/inputs/KapiFileUpload.css +1 -1
- package/dist/css/components/inputs/KapiPinInput.css +1 -0
- package/dist/css/components/inputs/KapiSelect.css +1 -1
- package/dist/css/components/inputs/inputsExtra.css +1 -1
- package/dist/css/components/layout/KapiAccessCard.css +1 -1
- package/dist/css/components/layout/KapiCollapse.css +1 -0
- package/dist/css/components/layout/KapiDivider.css +1 -1
- package/dist/css/components/navigation/KapiSteps.css +1 -1
- package/dist/css/components/navigation/KapiToc.css +1 -0
- package/dist/css/components/overlays/KapiViewport.css +1 -0
- package/dist/css/components/overlays/overlays.css +1 -1
- package/dist/hooks/asyncResourceLogic.d.ts +11 -0
- package/dist/hooks/asyncResourceLogic.js +4 -0
- package/dist/hooks/elementSizeLogic.d.ts +15 -0
- package/dist/hooks/elementSizeLogic.js +7 -0
- package/dist/hooks/hotkeyLogic.d.ts +9 -0
- package/dist/hooks/hotkeyLogic.js +16 -15
- package/dist/hooks/hotkeyRegistry.d.ts +44 -0
- package/dist/hooks/hotkeyRegistry.js +32 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/toneFamilyLogic.d.ts +26 -2
- package/dist/hooks/toneFamilyLogic.js +19 -6
- package/dist/hooks/useAsyncResource.d.ts +45 -0
- package/dist/hooks/useAsyncResource.js +24 -0
- package/dist/hooks/useDebouncedValue.d.ts +30 -0
- package/dist/hooks/useDebouncedValue.js +26 -0
- package/dist/hooks/useDisclosure.d.ts +39 -0
- package/dist/hooks/useDisclosure.js +35 -0
- package/dist/hooks/useElementSize.d.ts +27 -0
- package/dist/hooks/useElementSize.js +29 -0
- package/dist/hooks/useHotkey.d.ts +8 -0
- package/dist/hooks/useHotkey.js +27 -15
- package/dist/hooks/useKapiTheme.d.ts +8 -1
- package/dist/hooks/useKapiTheme.js +57 -57
- package/dist/hooks/useToneFamilies.d.ts +14 -4
- package/dist/hooks/useToneFamilies.js +27 -23
- package/dist/index.js +234 -207
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/dist/logic.d.ts +45 -0
- package/dist/logic.js +46 -0
- package/package.json +13 -2
|
@@ -1,70 +1,74 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiAccessCard.css";
|
|
3
|
-
import {
|
|
3
|
+
import { useToneLook as e } from "../../hooks/useToneFamilies.js";
|
|
4
4
|
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { DEFAULT_LINK_LABELS as r } from "../locale/linkLabels.js";
|
|
7
|
+
import { accessCardAffordance as i, accessCardClasses as a, isActivationKey as o, linkAttrs as s } from "./accessCardLogic.js";
|
|
7
8
|
/* empty css */
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { ChevronRight as
|
|
9
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
import { ChevronRight as d, ExternalLink as f } from "lucide-react";
|
|
10
11
|
//#region src/components/layout/KapiAccessCard.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
tone:
|
|
14
|
-
className:
|
|
15
|
-
}),
|
|
16
|
-
|
|
12
|
+
var p = ({ icon: p, tone: m, title: h, description: g, external: _ = !1, href: v, newTab: y, onClick: b, className: x, style: S, id: C, ref: w, labels: T }) => {
|
|
13
|
+
let E = n("link", r, T), D = t(w), O = e("KapiAccessCard", m), k = a({
|
|
14
|
+
tone: O.tone,
|
|
15
|
+
className: x
|
|
16
|
+
}), A = O.style ? {
|
|
17
|
+
...O.style,
|
|
18
|
+
...S
|
|
19
|
+
} : S, j = /* @__PURE__ */ u(c, { children: [
|
|
20
|
+
/* @__PURE__ */ l("span", {
|
|
17
21
|
className: "kapi-accesscard__icon",
|
|
18
22
|
"aria-hidden": "true",
|
|
19
|
-
children:
|
|
23
|
+
children: p
|
|
20
24
|
}),
|
|
21
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ u("span", {
|
|
22
26
|
className: "kapi-accesscard__txt",
|
|
23
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ l("span", {
|
|
24
28
|
className: "kapi-accesscard__title",
|
|
25
|
-
children: m
|
|
26
|
-
}), h !== void 0 && /* @__PURE__ */ c("span", {
|
|
27
|
-
className: "kapi-accesscard__desc",
|
|
28
29
|
children: h
|
|
30
|
+
}), g !== void 0 && /* @__PURE__ */ l("span", {
|
|
31
|
+
className: "kapi-accesscard__desc",
|
|
32
|
+
children: g
|
|
29
33
|
})]
|
|
30
34
|
}),
|
|
31
|
-
|
|
35
|
+
i(_) === "external" ? /* @__PURE__ */ l(f, {
|
|
32
36
|
className: "kapi-accesscard__go kapi-accesscard__go--ext",
|
|
33
37
|
size: 16,
|
|
34
38
|
"aria-hidden": "true"
|
|
35
|
-
}) : /* @__PURE__ */
|
|
39
|
+
}) : /* @__PURE__ */ l(d, {
|
|
36
40
|
className: "kapi-accesscard__go kapi-flip-rtl",
|
|
37
41
|
size: 16,
|
|
38
42
|
"aria-hidden": "true"
|
|
39
43
|
})
|
|
40
44
|
] });
|
|
41
|
-
return
|
|
42
|
-
ref:
|
|
43
|
-
className:
|
|
44
|
-
style:
|
|
45
|
-
id:
|
|
45
|
+
return v === void 0 ? /* @__PURE__ */ l("div", {
|
|
46
|
+
ref: D,
|
|
47
|
+
className: k,
|
|
48
|
+
style: A,
|
|
49
|
+
id: C,
|
|
46
50
|
role: "button",
|
|
47
51
|
tabIndex: 0,
|
|
48
|
-
onClick:
|
|
52
|
+
onClick: b,
|
|
49
53
|
onKeyDown: (e) => {
|
|
50
|
-
|
|
54
|
+
o(e.key) && (e.preventDefault(), b?.());
|
|
51
55
|
},
|
|
52
|
-
children:
|
|
53
|
-
}) : /* @__PURE__ */
|
|
54
|
-
ref:
|
|
55
|
-
className:
|
|
56
|
-
style:
|
|
57
|
-
id:
|
|
58
|
-
href:
|
|
59
|
-
...
|
|
60
|
-
external:
|
|
61
|
-
newTab:
|
|
56
|
+
children: j
|
|
57
|
+
}) : /* @__PURE__ */ u("a", {
|
|
58
|
+
ref: D,
|
|
59
|
+
className: k,
|
|
60
|
+
style: A,
|
|
61
|
+
id: C,
|
|
62
|
+
href: v,
|
|
63
|
+
...s({
|
|
64
|
+
external: _,
|
|
65
|
+
newTab: y
|
|
62
66
|
}),
|
|
63
|
-
children: [
|
|
67
|
+
children: [j, y && /* @__PURE__ */ u("span", {
|
|
64
68
|
className: "kapi-accesscard__sr",
|
|
65
|
-
children: [" ",
|
|
69
|
+
children: [" ", E.newTab]
|
|
66
70
|
})]
|
|
67
71
|
});
|
|
68
72
|
};
|
|
69
73
|
//#endregion
|
|
70
|
-
export {
|
|
74
|
+
export { p as KapiAccessCard };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "#kapi-css/components/overlays/overlays.css";
|
|
3
3
|
import "#kapi-css/components/layout/KapiAccountMenu.css";
|
|
4
4
|
import { joinClasses as e } from "../rootProps.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
6
|
+
import { useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
7
7
|
import { activeElementOf as r } from "../../hooks/ownerDocument.js";
|
|
8
|
-
import {
|
|
8
|
+
import { enabledIndexes as ee, focusedMenuIndex as te, menuKeyIntent as ne, nextEnabledIndex as i } from "../overlays/menuKeyboardLogic.js";
|
|
9
9
|
import { useDismiss as a } from "../../hooks/useDismiss.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { useExitPresence as o } from "../overlays/useExitPresence.js";
|
|
@@ -50,7 +50,7 @@ var _ = {
|
|
|
50
50
|
});
|
|
51
51
|
}, b = "[role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]", x = [], S = [];
|
|
52
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 =
|
|
53
|
+
let { preference: L, setPreference: R } = re(), z = n("accountMenu", _, M), B = n("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,7 +63,7 @@ function C({ open: m, onClose: C, user: w, notificationsCount: T = 0, onNotifica
|
|
|
63
63
|
key: "system",
|
|
64
64
|
label: z.themeSystem
|
|
65
65
|
}
|
|
66
|
-
], W = ae(null), pe =
|
|
66
|
+
], W = ae(null), pe = t(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) => ee(e.length, (t) => e[t].getAttribute("aria-disabled") === "true"), { restore: J } = f(m, {
|
|
67
67
|
container: W,
|
|
68
68
|
target: F
|
|
69
69
|
}), Y = (e) => {
|
|
@@ -83,11 +83,11 @@ function C({ open: m, onClose: C, user: w, notificationsCount: T = 0, onNotifica
|
|
|
83
83
|
let X = (e) => () => {
|
|
84
84
|
e?.(), Y("item-selected");
|
|
85
85
|
}, ge = (e) => {
|
|
86
|
-
let t =
|
|
86
|
+
let t = ne(e.key);
|
|
87
87
|
if (t.kind === "move") {
|
|
88
88
|
e.preventDefault();
|
|
89
89
|
let n = K();
|
|
90
|
-
n[
|
|
90
|
+
n[i(te(r(e.currentTarget)), t.dir, q(n))]?.focus();
|
|
91
91
|
} else c(e.key, {
|
|
92
92
|
hasSubmenu: Z() >= 0,
|
|
93
93
|
nested: !1
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
/** Atributos nativos (`id`, `style`, `data-*`…) van al contenedor del colapsable. */
|
|
3
|
+
export type KapiCollapseProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
4
|
+
/** Ref al `<div>` raíz. */
|
|
5
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Si el contenido se ve.
|
|
8
|
+
*
|
|
9
|
+
* CONTROLADO Y SIN `onOpenChange`, a diferencia del resto del estado controlado de la librería:
|
|
10
|
+
* este componente no trae disparador, así que nada de adentro puede cambiarlo y un callback de
|
|
11
|
+
* cambio sería una prop muerta. El botón lo pone la app, y es la app la que manda.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
open?: boolean | undefined;
|
|
15
|
+
/** Lo que se pliega. */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Muestra u oculta contenido con una animación de alto, sin cabecera propia.
|
|
20
|
+
*
|
|
21
|
+
* NO ES `KapiAccordion` NI `KapiCollapsiblePanel`: esos traen su disparador y su cabecera. Éste es
|
|
22
|
+
* la pieza desnuda —el formulario de alta que aparece bajo un botón «Nueva aplicación», el detalle
|
|
23
|
+
* de una fila— donde el disparador ya existe en la pantalla y sólo falta plegar algo.
|
|
24
|
+
*
|
|
25
|
+
* EL CONTENIDO NO SE DESMONTA, y es la decisión que define al componente: desmontarlo tiraría lo
|
|
26
|
+
* escrito en un formulario a medio llenar cada vez que se pliega. El precio es que hay que sacarlo
|
|
27
|
+
* del teclado y de los lectores a mano, y de eso se encarga `inert`.
|
|
28
|
+
*
|
|
29
|
+
* EL ALTO SE ANIMA SIN MEDIR, con `grid-template-rows: 0fr → 1fr`: no hace falta JS, ni un
|
|
30
|
+
* `ResizeObserver`, ni un alto fijo, y el contenido puede cambiar de tamaño mientras está abierto.
|
|
31
|
+
* Es el mismo motor que usan `KapiAccordion` y `KapiPanelGroup`.
|
|
32
|
+
*
|
|
33
|
+
* ATARLO AL BOTÓN ES DE LA APP: dale un `id` y poné `aria-expanded` y `aria-controls` en tu
|
|
34
|
+
* disparador. La librería no lo hace sola porque no conoce al botón.
|
|
35
|
+
*
|
|
36
|
+
* <KapiButton aria-expanded={abierto} aria-controls="alta" onClick={alternar}>Nueva</KapiButton>
|
|
37
|
+
* <KapiCollapse id="alta" open={abierto}>…</KapiCollapse>
|
|
38
|
+
*/
|
|
39
|
+
export declare function KapiCollapse({ open, children, className, ...rest }: KapiCollapseProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "#kapi-css/components/layout/KapiCollapse.css";
|
|
3
|
+
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/layout/KapiCollapse.tsx
|
|
7
|
+
function n({ open: n = !1, children: r, className: i, ...a }) {
|
|
8
|
+
return /* @__PURE__ */ t("div", {
|
|
9
|
+
...a,
|
|
10
|
+
className: e("kapi-collapse", i),
|
|
11
|
+
"data-open": n ? "" : void 0,
|
|
12
|
+
inert: !n,
|
|
13
|
+
children: /* @__PURE__ */ t("div", {
|
|
14
|
+
className: "kapi-collapse__clip",
|
|
15
|
+
children: r
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as KapiCollapse };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/navigation/navigation.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
5
|
+
import { useLabels as ee } from "../locale/KapiLocaleProvider.js";
|
|
5
6
|
import { useControllableState as n } from "../../hooks/useControllableState.js";
|
|
6
7
|
import { directionOf as r, physicalSide as i } from "../../hooks/directionLogic.js";
|
|
7
|
-
import { useMergedRefs as ee } from "../../hooks/mergeRefs.js";
|
|
8
8
|
/* empty css */
|
|
9
9
|
import { KapiPanelMiniContext as te } from "../navigation/panelMini.js";
|
|
10
10
|
import { resolveGone as a, resolveMini as ne } from "../navigation/panelMiniLogic.js";
|
|
@@ -23,7 +23,7 @@ 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 =
|
|
26
|
+
let A = ee("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
27
|
u(() => {
|
|
28
28
|
let e = ue(R.current, L, z.current);
|
|
29
29
|
R.current = L, e !== null && e !== P && F(e);
|
|
@@ -34,7 +34,7 @@ var _ = {
|
|
|
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] = de(!1), H = f(null), Ee =
|
|
37
|
+
let [B, we] = n(ve, ye ?? null, be), [Te, V] = de(!1), H = f(null), Ee = t(H, k), U = f(null), W = B === null ? null : o(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 = {
|
|
@@ -8,10 +8,19 @@ export type KapiDividerProps = Omit<HTMLAttributes<HTMLDivElement>, "children">
|
|
|
8
8
|
orientation?: KapiDividerOrientation | undefined;
|
|
9
9
|
/** Texto centrado entre dos líneas (sólo horizontal). */
|
|
10
10
|
label?: ReactNode | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Línea punteada, para separar grupos DENTRO de una tarjeta (donde la sólida ya separa las
|
|
13
|
+
* tarjetas entre sí): una lista de parámetros, de permisos, una ficha con secciones.
|
|
14
|
+
*
|
|
15
|
+
* Está acá porque desde afuera es una trampa: la línea se dibuja con `background` y
|
|
16
|
+
* `height: 1px`, NO con un borde, así que el `border-top: dashed` que uno escribiría se pinta
|
|
17
|
+
* ENCIMA de la sólida y quedan dos rayas.
|
|
18
|
+
*/
|
|
19
|
+
dashed?: boolean | undefined;
|
|
11
20
|
/** Clase del separador. */
|
|
12
21
|
className?: string | undefined;
|
|
13
22
|
};
|
|
14
23
|
/** Clases del divisor. Pura y exportada. */
|
|
15
|
-
export declare const dividerClasses: ({ orientation, className }?: Pick<KapiDividerProps, "orientation" | "className">) => string;
|
|
24
|
+
export declare const dividerClasses: ({ orientation, dashed, className }?: Pick<KapiDividerProps, "orientation" | "dashed" | "className">) => string;
|
|
16
25
|
/** Separador horizontal (opcionalmente con texto) o vertical. */
|
|
17
|
-
export declare function KapiDivider({ orientation, label, className, ...rest }: KapiDividerProps): import("react").JSX.Element;
|
|
26
|
+
export declare function KapiDivider({ orientation, dashed, label, className, ...rest }: KapiDividerProps): import("react").JSX.Element;
|
|
@@ -4,37 +4,43 @@ import { joinClasses as e } from "../rootProps.js";
|
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/layout/KapiDivider.tsx
|
|
7
|
-
var r = ({ orientation: e = "horizontal",
|
|
7
|
+
var r = ({ orientation: e = "horizontal", dashed: t = !1, className: n = "" } = {}) => [
|
|
8
8
|
"kapi-divider",
|
|
9
9
|
e === "vertical" && "kapi-divider--vertical",
|
|
10
|
-
t
|
|
10
|
+
t && "kapi-divider--dashed",
|
|
11
|
+
n
|
|
11
12
|
].filter(Boolean).join(" ");
|
|
12
|
-
function i({ orientation: i = "horizontal",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
function i({ orientation: i = "horizontal", dashed: a = !1, label: o, className: s, ...c }) {
|
|
14
|
+
if (i === "horizontal" && o != null) {
|
|
15
|
+
let i = r({ dashed: a });
|
|
16
|
+
return /* @__PURE__ */ n("div", {
|
|
17
|
+
...c,
|
|
18
|
+
role: "separator",
|
|
19
|
+
className: e("kapi-divider-labeled", s),
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ t("span", {
|
|
22
|
+
className: i,
|
|
23
|
+
"aria-hidden": !0
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ t("span", {
|
|
26
|
+
className: "kapi-divider-labeled__text",
|
|
27
|
+
children: o
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ t("span", {
|
|
30
|
+
className: i,
|
|
31
|
+
"aria-hidden": !0
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ t("div", {
|
|
37
|
+
...c,
|
|
33
38
|
role: "separator",
|
|
34
39
|
"aria-orientation": i,
|
|
35
40
|
className: r({
|
|
36
41
|
orientation: i,
|
|
37
|
-
|
|
42
|
+
dashed: a,
|
|
43
|
+
className: s
|
|
38
44
|
})
|
|
39
45
|
});
|
|
40
46
|
}
|
|
@@ -4,10 +4,10 @@ import "#kapi-css/components/layout/gridSpan.css";
|
|
|
4
4
|
import { joinClasses as e } from "../rootProps.js";
|
|
5
5
|
import { useMergedRefs as t } from "../../hooks/mergeRefs.js";
|
|
6
6
|
import { gridProps as n } from "./layoutPrimitives.js";
|
|
7
|
-
/* empty css */
|
|
8
7
|
import { gridSpanStyle as r, normalizeColumns as i } from "./gridSpanLogic.js";
|
|
9
|
-
/* empty css */
|
|
10
8
|
import { useGridBreakpoint as a } from "./useGridBreakpoint.js";
|
|
9
|
+
/* empty css */
|
|
10
|
+
/* empty css */
|
|
11
11
|
import { useEffect as o, useRef as s } from "react";
|
|
12
12
|
import { jsx as c } from "react/jsx-runtime";
|
|
13
13
|
//#region src/components/layout/KapiGrid.tsx
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiNotificationBell.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useControllableState as
|
|
8
|
-
import {
|
|
4
|
+
import { useKapiFormatLocale as t, useLabels as n } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { activeElementOf as r } from "../../hooks/ownerDocument.js";
|
|
6
|
+
import { assignRef as i, focusLeaves as a } from "../inputs/fieldLogic.js";
|
|
7
|
+
import { useControllableState as o } from "../../hooks/useControllableState.js";
|
|
8
|
+
import { focusedMenuIndex as s, menuKeyIntent as ee, nextEnabledIndex as c } from "../overlays/menuKeyboardLogic.js";
|
|
9
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";
|
|
@@ -27,7 +27,7 @@ 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 =
|
|
30
|
+
let V = n("notificationBell", S, P), H = t(), [U, W] = o(j, M, N), G = m(), K = m(), q = g(null), J = g(null), [Y, ce] = _(null);
|
|
31
31
|
h(() => {
|
|
32
32
|
ce(U ? te(q.current) : null);
|
|
33
33
|
}, [U]);
|
|
@@ -52,19 +52,19 @@ function T({ items: T, onItemSelect: se, onMarkAllRead: E, onViewAll: D, loading
|
|
|
52
52
|
}, Q = p(T), $ = ie(Q, A), fe = (e) => {
|
|
53
53
|
R?.(e), !e.defaultPrevented && W(!U);
|
|
54
54
|
}, pe = (e) => {
|
|
55
|
-
let t =
|
|
55
|
+
let t = ee(e.key);
|
|
56
56
|
if (t.kind !== "move") return X(e);
|
|
57
57
|
let n = ue();
|
|
58
|
-
n.length !== 0 && (e.preventDefault(), n[s(
|
|
58
|
+
n.length !== 0 && (e.preventDefault(), n[c(s(r(e.currentTarget)), t.dir, n.map((e, t) => t))]?.focus());
|
|
59
59
|
}, me = (e) => {
|
|
60
|
-
|
|
60
|
+
a(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
64
|
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ b("button", {
|
|
65
65
|
...B,
|
|
66
66
|
ref: (e) => {
|
|
67
|
-
q.current = e,
|
|
67
|
+
q.current = e, i(I, e);
|
|
68
68
|
},
|
|
69
69
|
type: "button",
|
|
70
70
|
className: e("kapi-bell", L),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiPageHeader.css";
|
|
3
3
|
import "#kapi-css/components/navigation/navigation.css";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useMergedRefs as e } from "../../hooks/mergeRefs.js";
|
|
5
|
+
import { computedStyleOf as t, docOf as n } from "../../hooks/ownerDocument.js";
|
|
6
6
|
import { slot as r } from "../slotsLogic.js";
|
|
7
7
|
import { prefersReducedMotion as i } from "../../hooks/reducedMotion.js";
|
|
8
8
|
import { maxTransitionMs as a } from "../overlays/dialogUtils.js";
|
|
@@ -40,7 +40,7 @@ var y = "kapi-pageheader--collapsed", b = "kapi-pageheader--animating", x = "kap
|
|
|
40
40
|
n ? r() : (e.style.transition = "none", r(), e.getBoundingClientRect(), e.style.transition = "");
|
|
41
41
|
};
|
|
42
42
|
function E({ title: y, subtitle: x, meta: E, actions: D, chip: O, breadcrumbs: k, collapseOnScroll: A = !0, sticky: j = !0, scrollRoot: M = null, responsive: N = !0, className: P, classNames: F, ref: I, ...L }) {
|
|
43
|
-
let { collapsed: R, sentinelRef: z } = c({ root: M }), B = A && R, V = p(null), H =
|
|
43
|
+
let { collapsed: R, sentinelRef: z } = c({ root: M }), B = A && R, V = p(null), H = e(V, I), U = p({
|
|
44
44
|
expanded: 0,
|
|
45
45
|
collapsed: 0
|
|
46
46
|
}), W = p(B);
|
|
@@ -49,21 +49,21 @@ function E({ title: y, subtitle: x, meta: E, actions: D, chip: O, breadcrumbs: k
|
|
|
49
49
|
f(() => {
|
|
50
50
|
let e = V.current;
|
|
51
51
|
if (!e) return;
|
|
52
|
-
let
|
|
52
|
+
let t = () => {
|
|
53
53
|
K.current || (U.current = C(e, W.current), T(e, w(U.current, W.current), !1));
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
t();
|
|
56
56
|
let r = !0;
|
|
57
|
-
if (
|
|
58
|
-
r &&
|
|
57
|
+
if (n(e)?.fonts?.ready.then(() => {
|
|
58
|
+
r && t();
|
|
59
59
|
}), typeof ResizeObserver > "u") return () => {
|
|
60
60
|
r = !1;
|
|
61
61
|
};
|
|
62
62
|
let i = e.getBoundingClientRect().width, a = new ResizeObserver((e) => {
|
|
63
|
-
let
|
|
64
|
-
if (!
|
|
65
|
-
let r =
|
|
66
|
-
r !== i && (i = r,
|
|
63
|
+
let n = e[e.length - 1];
|
|
64
|
+
if (!n) return;
|
|
65
|
+
let r = n.borderBoxSize?.[0]?.inlineSize ?? n.contentRect.width;
|
|
66
|
+
r !== i && (i = r, t());
|
|
67
67
|
});
|
|
68
68
|
return a.observe(e), () => {
|
|
69
69
|
r = !1, a.disconnect();
|
|
@@ -78,25 +78,25 @@ function E({ title: y, subtitle: x, meta: E, actions: D, chip: O, breadcrumbs: k
|
|
|
78
78
|
A,
|
|
79
79
|
N
|
|
80
80
|
]), f(() => {
|
|
81
|
-
let
|
|
82
|
-
if (!
|
|
83
|
-
let { expanded: n } = U.current, r = l(U.current, B), o = G.current && !i(
|
|
81
|
+
let e = V.current;
|
|
82
|
+
if (!e) return;
|
|
83
|
+
let { expanded: n } = U.current, r = l(U.current, B), o = G.current && !i(e);
|
|
84
84
|
G.current = !0;
|
|
85
85
|
let s = () => {
|
|
86
|
-
K.current = !1,
|
|
86
|
+
K.current = !1, e.classList.remove(b), B || e.style.removeProperty("height");
|
|
87
87
|
};
|
|
88
88
|
if (!o) {
|
|
89
|
-
T(
|
|
89
|
+
T(e, w(U.current, B), !1);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
let c = (
|
|
94
|
-
|
|
92
|
+
e.style.height === "" && n > 0 && (e.style.height = `${n}px`, e.getBoundingClientRect()), K.current = !0, e.classList.add(b), T(e, r, !0);
|
|
93
|
+
let c = (t) => {
|
|
94
|
+
t.target === e && t.propertyName === "height" && s();
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
let u = e
|
|
96
|
+
e.addEventListener("transitionend", c);
|
|
97
|
+
let u = t(e), d = window.setTimeout(s, a(u.transitionDuration, u.transitionDelay) + S);
|
|
98
98
|
return () => {
|
|
99
|
-
|
|
99
|
+
e.removeEventListener("transitionend", c), window.clearTimeout(d);
|
|
100
100
|
};
|
|
101
101
|
}, [B]);
|
|
102
102
|
let q = [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/layout/KapiRail.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { assignRef as n } from "../inputs/fieldLogic.js";
|
|
6
6
|
import { slot as r } from "../slotsLogic.js";
|
|
7
7
|
import { useSlidingIndicator as i } from "../../hooks/useSlidingIndicator.js";
|
|
8
8
|
import { KapiTooltip as a } from "../overlays/KapiTooltip.js";
|
|
@@ -29,10 +29,10 @@ var k = {
|
|
|
29
29
|
moreCurrent: "sección actual",
|
|
30
30
|
account: "Cuenta"
|
|
31
31
|
}, A = ({ items: A, activeId: j, onSelect: M, brand: N, footer: P, variant: F = "labeled", "aria-label": ie, labels: I, className: L, classNames: R, ref: z, ...ae }) => {
|
|
32
|
-
let B =
|
|
32
|
+
let B = t("rail", k, I), oe = t("link", o, I), V = F === "compact", se = v(F), H = y(A), U = f(d), [W, G] = T(null);
|
|
33
33
|
p(W, U);
|
|
34
34
|
let ce = w((e) => {
|
|
35
|
-
G(e),
|
|
35
|
+
G(e), n(z, e);
|
|
36
36
|
}, [z]), { ref: K, edges: q } = u({ axis: "y" }), J = H.scroll, Y = J.filter((e) => !m(e)).length, le = x(K, {
|
|
37
37
|
enabled: U,
|
|
38
38
|
count: Y,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CSSProperties, type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
2
|
import { type KapiThemeState } from "../../hooks/useKapiTheme.js";
|
|
3
3
|
import type { KapiDensity } from "../../hooks/densityLogic.js";
|
|
4
|
+
import type { KapiTheme } from "../../hooks/useKapiTheme.js";
|
|
4
5
|
import type { KapiDir } from "../../hooks/directionLogic.js";
|
|
5
6
|
import type { KapiBrandTheme } from "../../hooks/themeColorsLogic.js";
|
|
6
7
|
import type { KapiToneFamilies } from "../../hooks/toneFamilyLogic.js";
|
|
@@ -14,6 +15,8 @@ export type KapiRootWiringOptions = {
|
|
|
14
15
|
toneFamilies?: KapiToneFamilies | undefined;
|
|
15
16
|
/** Densidad de la interfaz (ver `KapiRootProps.density`). */
|
|
16
17
|
density?: KapiDensity | undefined;
|
|
18
|
+
/** Tema impuesto por la app (ver `KapiRootProps.theme`). */
|
|
19
|
+
theme?: KapiTheme | undefined;
|
|
17
20
|
/** `style` del consumidor; las variables del tema van encima. */
|
|
18
21
|
style?: CSSProperties | undefined;
|
|
19
22
|
/** `ref` del consumidor al `<div>` raíz. */
|
|
@@ -46,7 +49,7 @@ export type KapiRootWiring = {
|
|
|
46
49
|
* `style`), `dir` y raíz de portales. Interno: lo comparten `KapiShell` y `KapiRoot`, que sólo
|
|
47
50
|
* difieren en lo que dibujan adentro.
|
|
48
51
|
*/
|
|
49
|
-
export declare const useKapiRootWiring: ({ storageNamespace, brandTheme, toneFamilies, density, style, ref }: KapiRootWiringOptions) => KapiRootWiring;
|
|
52
|
+
export declare const useKapiRootWiring: ({ storageNamespace, brandTheme, toneFamilies, density, theme, style, ref }: KapiRootWiringOptions) => KapiRootWiring;
|
|
50
53
|
/**
|
|
51
54
|
* Contextos que una raíz `.kapi` da a su subárbol: el tema y la raíz de portales. Los overlays sin
|
|
52
55
|
* ancla (modal, offcanvas, paleta de comandos, toasts…) se montan en ESTA raíz y no en el primer
|
|
@@ -97,6 +100,23 @@ export type KapiRootProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
|
97
100
|
* de la persona: no se guarda. No reemplaza a `size` (que elige un tamaño de UN control).
|
|
98
101
|
*/
|
|
99
102
|
density?: KapiDensity | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Tema que impone la APP: `"light"` o `"dark"`. Gana sobre lo guardado y sobre el sistema.
|
|
105
|
+
*
|
|
106
|
+
* Es para una app host que ya tiene su propio modo oscuro. Sin esto la raíz decide sola —con
|
|
107
|
+
* `localStorage` y `prefers-color-scheme`— y las dos quedan desincronizadas: el host se va a
|
|
108
|
+
* oscuro y lo de la librería se queda en claro, con la tinta clara sobre el fondo oscuro. Medido
|
|
109
|
+
* en un front real: **2,87:1, por debajo del 4,5:1 de WCAG AA**; con el tema sincronizado, 7,00:1.
|
|
110
|
+
*
|
|
111
|
+
* NO SE GUARDA, igual que `density`: es un ajuste de la app, no una preferencia de la persona, y
|
|
112
|
+
* `preference` sigue siendo la que ella eligió. Sin esta prop nada cambia.
|
|
113
|
+
*
|
|
114
|
+
* Y OJO CON LOS INTERRUPTORES DE TEMA DE ADENTRO: con `theme` puesto, un `setTheme()` de un
|
|
115
|
+
* componente del subárbol guarda la preferencia pero no mueve nada, porque lo que se ve es esta
|
|
116
|
+
* prop. Un botón de tema propio parecería roto. Si la app impone el tema, el interruptor es suyo:
|
|
117
|
+
* escondelo o hacelo cambiar el valor que le pasás acá.
|
|
118
|
+
*/
|
|
119
|
+
theme?: KapiTheme | undefined;
|
|
100
120
|
};
|
|
101
121
|
/**
|
|
102
122
|
* Raíz mínima para embeber componentes en una página que ya existe (una isla en un sitio hecho con
|
|
@@ -112,4 +132,4 @@ export type KapiRootProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
|
112
132
|
* <KapiButton onClick={…}>Inscribirme</KapiButton>
|
|
113
133
|
* </KapiRoot>
|
|
114
134
|
*/
|
|
115
|
-
export declare const KapiRoot: ({ children, className, storageNamespace, brandTheme, toneFamilies, density, style, ref, ...rest }: KapiRootProps) => import("react").JSX.Element;
|
|
135
|
+
export declare const KapiRoot: ({ children, className, storageNamespace, brandTheme, toneFamilies, density, theme, style, ref, ...rest }: KapiRootProps) => import("react").JSX.Element;
|