@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
|
@@ -2,40 +2,43 @@
|
|
|
2
2
|
import "#kapi-css/components/layout/KapiRoot.css";
|
|
3
3
|
import { ToneFamilyNamesContext as e, useToneFamilyProblemWarning as t, useToneFamilyRegistry as n } from "../../hooks/useToneFamilies.js";
|
|
4
4
|
import { joinClasses as r } from "../rootProps.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
|
|
6
|
+
import { useKapiDir as a } from "../locale/KapiLocaleProvider.js";
|
|
7
|
+
import { KapiPortalRootProvider as o, usePortalRootOverride as s } from "../../hooks/portalRoot.js";
|
|
8
8
|
import { KapiThemeContext as c, themeRootStyle as l, useKapiThemeState as u } from "../../hooks/useKapiTheme.js";
|
|
9
9
|
import { densityAttribute as d } from "../../hooks/densityLogic.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { createContext as f, useContext as p, useMemo as m, useState as h } from "react";
|
|
12
12
|
import { jsx as g } from "react/jsx-runtime";
|
|
13
13
|
//#region src/components/layout/KapiRoot.tsx
|
|
14
|
-
var _ = f(null), v = ({ storageNamespace: e, brandTheme: r, toneFamilies:
|
|
15
|
-
let
|
|
16
|
-
|
|
14
|
+
var _ = f(null), v = ({ storageNamespace: e, brandTheme: r, toneFamilies: o, density: c, theme: f, style: g, ref: v }) => {
|
|
15
|
+
let y = u({
|
|
16
|
+
namespace: e,
|
|
17
|
+
theme: f
|
|
18
|
+
}), b = a(), x = m(() => l(y, r, o), [
|
|
19
|
+
y,
|
|
17
20
|
r,
|
|
18
|
-
|
|
19
|
-
]), { names:
|
|
20
|
-
t(
|
|
21
|
-
let [
|
|
21
|
+
o
|
|
22
|
+
]), { names: S, problems: C } = n(o);
|
|
23
|
+
t(C);
|
|
24
|
+
let [w, T] = h(null), E = i(T, v), D = s(), O = p(_), k = D && D !== O ? D : w;
|
|
22
25
|
return {
|
|
23
|
-
themeState:
|
|
24
|
-
toneNames:
|
|
25
|
-
dir:
|
|
26
|
+
themeState: y,
|
|
27
|
+
toneNames: S,
|
|
28
|
+
dir: b,
|
|
26
29
|
attrs: {
|
|
27
|
-
ref:
|
|
28
|
-
"data-theme":
|
|
29
|
-
"data-motion":
|
|
30
|
+
ref: E,
|
|
31
|
+
"data-theme": y.theme,
|
|
32
|
+
"data-motion": y.motion === "reduced" ? "reduced" : void 0,
|
|
30
33
|
"data-density": d(c),
|
|
31
34
|
style: {
|
|
32
|
-
...
|
|
33
|
-
...
|
|
35
|
+
...g,
|
|
36
|
+
...x
|
|
34
37
|
},
|
|
35
38
|
suppressHydrationWarning: !0
|
|
36
39
|
},
|
|
37
|
-
element:
|
|
38
|
-
portalRoot:
|
|
40
|
+
element: w,
|
|
41
|
+
portalRoot: k
|
|
39
42
|
};
|
|
40
43
|
}, y = ({ wiring: t, children: n }) => /* @__PURE__ */ g(c.Provider, {
|
|
41
44
|
value: t.themeState,
|
|
@@ -43,28 +46,29 @@ var _ = f(null), v = ({ storageNamespace: e, brandTheme: r, toneFamilies: a, den
|
|
|
43
46
|
value: t.toneNames,
|
|
44
47
|
children: /* @__PURE__ */ g(_.Provider, {
|
|
45
48
|
value: t.element,
|
|
46
|
-
children: /* @__PURE__ */ g(
|
|
49
|
+
children: /* @__PURE__ */ g(o, {
|
|
47
50
|
root: t.portalRoot,
|
|
48
51
|
children: n
|
|
49
52
|
})
|
|
50
53
|
})
|
|
51
54
|
})
|
|
52
|
-
}), b = ({ children: e, className: t, storageNamespace: n, brandTheme: i, toneFamilies: a, density: o,
|
|
53
|
-
let
|
|
55
|
+
}), b = ({ children: e, className: t, storageNamespace: n, brandTheme: i, toneFamilies: a, density: o, theme: s, style: c, ref: l, ...u }) => {
|
|
56
|
+
let d = v({
|
|
54
57
|
storageNamespace: n,
|
|
55
58
|
brandTheme: i,
|
|
56
59
|
toneFamilies: a,
|
|
57
60
|
density: o,
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
theme: s,
|
|
62
|
+
style: c,
|
|
63
|
+
ref: l
|
|
60
64
|
});
|
|
61
65
|
return /* @__PURE__ */ g(y, {
|
|
62
|
-
wiring:
|
|
66
|
+
wiring: d,
|
|
63
67
|
children: /* @__PURE__ */ g("div", {
|
|
64
|
-
...
|
|
65
|
-
...
|
|
68
|
+
...d.dir ? { dir: d.dir } : {},
|
|
69
|
+
...u,
|
|
66
70
|
className: r("kapi", "kapi--embed", t),
|
|
67
|
-
...
|
|
71
|
+
...d.attrs,
|
|
68
72
|
children: e
|
|
69
73
|
})
|
|
70
74
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
2
|
import type { KapiDensity } from "../../hooks/densityLogic.js";
|
|
3
|
+
import type { KapiTheme } from "../../hooks/useKapiTheme.js";
|
|
3
4
|
import type { KapiBrandTheme } from "../../hooks/themeColorsLogic.js";
|
|
4
5
|
import type { KapiToneFamilies } from "../../hooks/toneFamilyLogic.js";
|
|
5
6
|
import { type KapiMenuItem } from "../overlays/KapiContextMenu.js";
|
|
@@ -71,6 +72,13 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
|
|
|
71
72
|
* de la persona: no se guarda. No reemplaza a `size` (que elige un tamaño de UN control).
|
|
72
73
|
*/
|
|
73
74
|
density?: KapiDensity | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Tema que impone la APP: `"light"` o `"dark"`. Gana sobre lo guardado y sobre el sistema.
|
|
77
|
+
*
|
|
78
|
+
* Para una app host que ya tiene su propio modo oscuro: sin esto la raíz decide sola y las dos
|
|
79
|
+
* quedan desincronizadas. No se guarda, igual que `density`. Ver `KapiRootProps.theme`.
|
|
80
|
+
*/
|
|
81
|
+
theme?: KapiTheme | undefined;
|
|
74
82
|
};
|
|
75
83
|
/**
|
|
76
84
|
* Marco de la app. Es la raíz `.kapi` (tokens, tema, fuente, raíz de portales) y compone:
|
|
@@ -98,4 +106,4 @@ export type KapiShellProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> &
|
|
|
98
106
|
* // sin rail (otra navegación, p. ej. tabs arriba o router propio)
|
|
99
107
|
* <KapiShell><MiTopNav /><Pagina /></KapiShell>
|
|
100
108
|
*/
|
|
101
|
-
export declare const KapiShell: ({ rail, panel, panelRight, children, contextMenuItems, rightClick, overlays, className, classNames, contentClassName, storageNamespace, brandTheme, toneFamilies, density, style, ref, ...rest }: KapiShellProps) => import("react").JSX.Element;
|
|
109
|
+
export declare const KapiShell: ({ rail, panel, panelRight, children, contextMenuItems, rightClick, overlays, className, classNames, contentClassName, storageNamespace, brandTheme, toneFamilies, density, theme, style, ref, ...rest }: KapiShellProps) => import("react").JSX.Element;
|
|
@@ -11,53 +11,54 @@ import { useCallback as s, useMemo as c, useState as l } from "react";
|
|
|
11
11
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
12
|
import { ChevronsLeft as f, ChevronsRight as p } from "lucide-react";
|
|
13
13
|
//#region src/components/layout/KapiShell.tsx
|
|
14
|
-
var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, rightClick: y = !0, overlays: b, className: x, classNames: S, contentClassName: C = "", storageNamespace: w, brandTheme: T, toneFamilies: E, density: D,
|
|
15
|
-
let
|
|
14
|
+
var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, rightClick: y = !0, overlays: b, className: x, classNames: S, contentClassName: C = "", storageNamespace: w, brandTheme: T, toneFamilies: E, density: D, theme: O, style: k, ref: A, ...j }) => {
|
|
15
|
+
let M = a({
|
|
16
16
|
storageNamespace: w,
|
|
17
17
|
brandTheme: T,
|
|
18
18
|
toneFamilies: E,
|
|
19
19
|
density: D,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
theme: O,
|
|
21
|
+
style: k,
|
|
22
|
+
ref: A
|
|
23
|
+
}), [N, P] = l(null);
|
|
23
24
|
n({
|
|
24
25
|
enabled: y,
|
|
25
|
-
onMenu: v?.length ? (e, t) =>
|
|
26
|
+
onMenu: v?.length ? (e, t) => P({
|
|
26
27
|
x: e,
|
|
27
28
|
y: t
|
|
28
29
|
}) : void 0
|
|
29
30
|
});
|
|
30
|
-
let [
|
|
31
|
-
info:
|
|
32
|
-
publish:
|
|
33
|
-
hosts:
|
|
34
|
-
addHost:
|
|
31
|
+
let [F, I] = l(null), [L, R] = l(0), z = s(() => (R((e) => e + 1), () => R((e) => e - 1)), []), B = c(() => ({
|
|
32
|
+
info: F,
|
|
33
|
+
publish: I,
|
|
34
|
+
hosts: L,
|
|
35
|
+
addHost: z
|
|
35
36
|
}), [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
F,
|
|
38
|
+
L,
|
|
39
|
+
z
|
|
39
40
|
]);
|
|
40
41
|
return /* @__PURE__ */ u(i, {
|
|
41
|
-
wiring:
|
|
42
|
+
wiring: M,
|
|
42
43
|
children: /* @__PURE__ */ u(o.Provider, {
|
|
43
|
-
value:
|
|
44
|
+
value: B,
|
|
44
45
|
children: /* @__PURE__ */ d("div", {
|
|
45
|
-
...
|
|
46
|
-
...
|
|
46
|
+
...M.dir ? { dir: M.dir } : {},
|
|
47
|
+
...j,
|
|
47
48
|
...e(r, "root", S, x),
|
|
48
|
-
...
|
|
49
|
+
...M.attrs,
|
|
49
50
|
children: [
|
|
50
51
|
m,
|
|
51
52
|
h,
|
|
52
53
|
/* @__PURE__ */ d("main", {
|
|
53
54
|
...e(r, "content", S, C),
|
|
54
55
|
tabIndex: 0,
|
|
55
|
-
children: [
|
|
56
|
+
children: [F && L === 0 && /* @__PURE__ */ u("button", {
|
|
56
57
|
type: "button",
|
|
57
58
|
...e(r, "reopen", S, "kapi-paneltoggle"),
|
|
58
|
-
onClick:
|
|
59
|
-
"aria-label":
|
|
60
|
-
children:
|
|
59
|
+
onClick: F.expand,
|
|
60
|
+
"aria-label": F.label,
|
|
61
|
+
children: F.side === "right" ? /* @__PURE__ */ u(f, {
|
|
61
62
|
className: "kapi-flip-rtl",
|
|
62
63
|
size: 16,
|
|
63
64
|
strokeWidth: 2,
|
|
@@ -72,12 +73,12 @@ var m = ({ rail: m, panel: h, panelRight: g, children: _, contextMenuItems: v, r
|
|
|
72
73
|
}),
|
|
73
74
|
g,
|
|
74
75
|
b,
|
|
75
|
-
|
|
76
|
+
N && v && /* @__PURE__ */ u(t, {
|
|
76
77
|
open: !0,
|
|
77
|
-
x:
|
|
78
|
-
y:
|
|
78
|
+
x: N.x,
|
|
79
|
+
y: N.y,
|
|
79
80
|
items: v,
|
|
80
|
-
onClose: () =>
|
|
81
|
+
onClose: () => P(null)
|
|
81
82
|
})
|
|
82
83
|
]
|
|
83
84
|
})
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type KapiFamilyTone } from "../tone.js";
|
|
2
|
+
/** The semantic colours of an access card, or a tone family the app registered. */
|
|
3
|
+
export type KapiAccessCardTone = "primary" | "success" | "warning" | "danger" | "info" | KapiFamilyTone;
|
|
2
4
|
export type KapiAccessCardAffordance = "external" | "chevron";
|
|
3
5
|
/** Which trailing icon to show: a cross-system/new-tab link gets the arrow, in-app navigation the chevron. */
|
|
4
6
|
export declare const accessCardAffordance: (external: boolean | undefined) => KapiAccessCardAffordance;
|
|
@@ -10,6 +12,11 @@ export declare const linkAttrs: (opts: {
|
|
|
10
12
|
target?: "_blank" | undefined;
|
|
11
13
|
rel?: string | undefined;
|
|
12
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Classes of an access card. A tone family does NOT go by its name — `.kapi-accesscard--ucuBlue`
|
|
17
|
+
* exists in no stylesheet and the icon tile would lose its colour — it goes through the fixed
|
|
18
|
+
* `--family` class, which reads the local slots the component sets inline.
|
|
19
|
+
*/
|
|
13
20
|
export declare const accessCardClasses: (opts?: {
|
|
14
21
|
tone?: KapiAccessCardTone | undefined;
|
|
15
22
|
className?: string | undefined;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { isFamilyTone as e } from "../tone.js";
|
|
1
2
|
//#region src/components/layout/accessCardLogic.ts
|
|
2
|
-
var
|
|
3
|
+
var t = (e) => e ? "external" : "chevron", n = (e) => {
|
|
3
4
|
let t = {};
|
|
4
5
|
return e.newTab && (t.target = "_blank"), (e.newTab || e.external) && (t.rel = "noopener noreferrer"), t;
|
|
5
|
-
},
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
}, r = (t = {}) => {
|
|
7
|
+
let n = t.tone ?? "primary";
|
|
8
|
+
return [
|
|
9
|
+
"kapi-accesscard",
|
|
10
|
+
`kapi-accesscard--${e(n) ? "family" : n}`,
|
|
11
|
+
t.className
|
|
12
|
+
].filter(Boolean).join(" ");
|
|
13
|
+
}, i = (e) => e === "Enter" || e === " ";
|
|
10
14
|
//#endregion
|
|
11
|
-
export {
|
|
15
|
+
export { t as accessCardAffordance, r as accessCardClasses, i as isActivationKey, n as linkAttrs };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { KapiShell } from "./KapiShell.js";
|
|
2
2
|
export type { KapiShellClassNames, KapiShellProps } from "./KapiShell.js";
|
|
3
|
+
export { KapiCollapse } from "./KapiCollapse.js";
|
|
4
|
+
export type { KapiCollapseProps } from "./KapiCollapse.js";
|
|
3
5
|
export { KapiRoot } from "./KapiRoot.js";
|
|
4
6
|
export type { KapiRootProps } from "./KapiRoot.js";
|
|
5
7
|
export { KapiThemeScript } from "./KapiThemeScript.js";
|
|
@@ -7,6 +7,10 @@ import type { KapiTableLabels } from "../data/KapiTable.js";
|
|
|
7
7
|
import type { KapiTableFilterLabels } from "../data/KapiTableFilter.js";
|
|
8
8
|
import type { KapiPaginationLabels } from "../data/KapiPagination.js";
|
|
9
9
|
import type { KapiAlertLabels } from "../feedback/KapiAlert.js";
|
|
10
|
+
import type { KapiSpinnerLabels } from "../feedback/KapiSpinner.js";
|
|
11
|
+
import type { KapiShortcutsHelpLabels } from "../overlays/KapiShortcutsHelp.js";
|
|
12
|
+
import type { KapiViewportLabels } from "../overlays/KapiViewport.js";
|
|
13
|
+
import type { KapiImageViewerLabels } from "../overlays/KapiImageViewer.js";
|
|
10
14
|
import type { KapiBulkBarLabels } from "../feedback/KapiBulkBar.js";
|
|
11
15
|
import type { KapiUnsavedBarLabels } from "../feedback/KapiUnsavedBar.js";
|
|
12
16
|
import type { KapiOfflineBannerLabels } from "../feedback/KapiOfflineBanner.js";
|
|
@@ -18,7 +22,12 @@ import type { KapiSearchChipLabels } from "../inputs/KapiSearchChip.js";
|
|
|
18
22
|
import type { KapiSelectLabels } from "../inputs/KapiSelect.js";
|
|
19
23
|
import type { KapiChecklistLabels } from "../inputs/KapiChecklist.js";
|
|
20
24
|
import type { KapiNumberStepperLabels } from "../inputs/KapiNumberStepper.js";
|
|
25
|
+
import type { KapiPinInputLabels } from "../inputs/KapiPinInput.js";
|
|
26
|
+
import type { KapiCodeBlockLabels } from "../display/KapiCodeBlock.js";
|
|
27
|
+
import type { KapiDiffLabels } from "../display/KapiDiff.js";
|
|
28
|
+
import type { KapiTocLabels } from "../navigation/KapiToc.js";
|
|
21
29
|
import type { KapiFileUploadLabels } from "../inputs/KapiFileUpload.js";
|
|
30
|
+
import type { KapiCopyButtonLabels } from "../inputs/KapiCopyButton.js";
|
|
22
31
|
import type { KapiInputLabels } from "../inputs/KapiInput.js";
|
|
23
32
|
import type { KapiTagInputLabels } from "../inputs/KapiTagInput.js";
|
|
24
33
|
import type { KapiContextSlotLabels } from "../layout/KapiContextSlot.js";
|
|
@@ -73,6 +82,10 @@ import type { UnsavedGuardLabels } from "../../hooks/useUnsavedGuard.js";
|
|
|
73
82
|
export interface KapiLabelRegistry {
|
|
74
83
|
accountMenu: KapiAccountMenuLabels;
|
|
75
84
|
alert: KapiAlertLabels;
|
|
85
|
+
spinner: KapiSpinnerLabels;
|
|
86
|
+
shortcutsHelp: KapiShortcutsHelpLabels;
|
|
87
|
+
viewport: KapiViewportLabels;
|
|
88
|
+
imageViewer: KapiImageViewerLabels;
|
|
76
89
|
autocomplete: KapiAutocompleteLabels;
|
|
77
90
|
avatarGroup: KapiAvatarGroupLabels;
|
|
78
91
|
breadcrumb: KapiBreadcrumbLabels;
|
|
@@ -100,14 +113,18 @@ export interface KapiLabelRegistry {
|
|
|
100
113
|
fileViewer: KapiFileViewerLabels;
|
|
101
114
|
filterChips: KapiFilterChipsLabels;
|
|
102
115
|
heatmap: KapiHeatmapLabels;
|
|
116
|
+
copyButton: KapiCopyButtonLabels;
|
|
103
117
|
eventCalendar: KapiEventCalendarLabels;
|
|
104
118
|
input: KapiInputLabels;
|
|
119
|
+
codeBlock: KapiCodeBlockLabels;
|
|
120
|
+
diff: KapiDiffLabels;
|
|
105
121
|
link: KapiLinkLabels;
|
|
106
122
|
loading: KapiLoadingLabels;
|
|
107
123
|
messageBubble: KapiMessageBubbleLabels;
|
|
108
124
|
modal: KapiModalLabels;
|
|
109
125
|
notificationBell: KapiNotificationBellLabels;
|
|
110
126
|
numberStepper: KapiNumberStepperLabels;
|
|
127
|
+
pinInput: KapiPinInputLabels;
|
|
111
128
|
offcanvas: KapiOffcanvasLabels;
|
|
112
129
|
offlineBanner: KapiOfflineBannerLabels;
|
|
113
130
|
pagination: KapiPaginationLabels;
|
|
@@ -117,6 +134,7 @@ export interface KapiLabelRegistry {
|
|
|
117
134
|
scrollArea: KapiScrollAreaLabels;
|
|
118
135
|
searchChip: KapiSearchChipLabels;
|
|
119
136
|
select: KapiSelectLabels;
|
|
137
|
+
toc: KapiTocLabels;
|
|
120
138
|
shapeSheet: KapiShapeSheetLabels;
|
|
121
139
|
sparkline: KapiSparklineLabels;
|
|
122
140
|
splitModal: KapiSplitModalLabels;
|
|
@@ -1,8 +1,8 @@
|
|
|
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 {
|
|
4
|
+
import { useControllableState as t } from "../../hooks/useControllableState.js";
|
|
5
|
+
import { enabledIndexes as n, navKeyOf as r, nextEnabledIndex as i } from "../overlays/menuKeyboardLogic.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { normalizeOpenIds as a, toggleOpenId as o } from "./accordionLogic.js";
|
|
8
8
|
import { useId as s } from "react";
|
|
@@ -11,17 +11,17 @@ import { ChevronDown as u } from "lucide-react";
|
|
|
11
11
|
//#region src/components/navigation/KapiAccordion.tsx
|
|
12
12
|
var d = ":scope > .kapi-accordion__item > .kapi-accordion__heading > .kapi-accordion__trigger:not(:disabled)", f = (e) => {
|
|
13
13
|
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
|
14
|
-
let
|
|
15
|
-
if (!
|
|
16
|
-
let a = Array.from(
|
|
17
|
-
!s || o < 0 || (e.preventDefault(), a[
|
|
14
|
+
let t = e.currentTarget.closest(".kapi-accordion");
|
|
15
|
+
if (!t) return;
|
|
16
|
+
let a = Array.from(t.querySelectorAll(d)), o = a.indexOf(e.currentTarget), s = r(e.key, "vertical");
|
|
17
|
+
!s || o < 0 || (e.preventDefault(), a[i(o, s, n(a.length))]?.focus());
|
|
18
18
|
};
|
|
19
|
-
function p({ items:
|
|
20
|
-
let g = s(), [_, v] = i
|
|
19
|
+
function p({ items: n, single: r = !0, openIds: i, defaultOpenIds: d = [], onOpenIdsChange: p, className: m, ...h }) {
|
|
20
|
+
let g = s(), [_, v] = t(i, () => a(d, r), p), y = a(_, r), b = (e) => v(o(y, e, r));
|
|
21
21
|
return /* @__PURE__ */ c("div", {
|
|
22
22
|
...h,
|
|
23
23
|
className: e("kapi-accordion", m),
|
|
24
|
-
children:
|
|
24
|
+
children: n.map((e) => {
|
|
25
25
|
let t = y.includes(e.id), n = `${g}-b-${e.id}`, r = `${g}-p-${e.id}`;
|
|
26
26
|
return /* @__PURE__ */ l("div", {
|
|
27
27
|
className: t ? "kapi-accordion__item kapi-accordion__item--open" : "kapi-accordion__item",
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "#kapi-css/components/navigation/navigation.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
4
|
import { renderSlot as t } from "../renderSlot.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { useMergedRefs as n } from "../../hooks/mergeRefs.js";
|
|
6
|
+
import { useLabels as r } from "../locale/KapiLocaleProvider.js";
|
|
7
|
+
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
8
|
+
import { directionOf as a, physicalSide as o } from "../../hooks/directionLogic.js";
|
|
9
9
|
import { DEFAULT_LINK_LABELS as s } from "../locale/linkLabels.js";
|
|
10
10
|
import "./navBadgeLogic.js";
|
|
11
11
|
import { KapiNavBadge as c } from "./KapiNavBadge.js";
|
|
@@ -129,8 +129,8 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
|
129
129
|
e.trailing
|
|
130
130
|
]
|
|
131
131
|
});
|
|
132
|
-
}, k = ({ sections: e, activeId: t, onSelect:
|
|
133
|
-
let c =
|
|
132
|
+
}, k = ({ sections: e, activeId: t, onSelect: n, search: i, hint: a, labels: o }) => {
|
|
133
|
+
let c = r("link", s, o);
|
|
134
134
|
return /* @__PURE__ */ w(S, { children: [
|
|
135
135
|
i && /* @__PURE__ */ C(p, {
|
|
136
136
|
placeholder: i.placeholder,
|
|
@@ -138,10 +138,10 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
|
138
138
|
...i["aria-label"] === void 0 ? {} : { "aria-label": i["aria-label"] },
|
|
139
139
|
onChange: (e) => i.onChange?.(e.target.value)
|
|
140
140
|
}),
|
|
141
|
-
e.map((e,
|
|
141
|
+
e.map((e, r) => /* @__PURE__ */ w("div", {
|
|
142
142
|
className: "kapi-ctxsection",
|
|
143
143
|
children: [
|
|
144
|
-
|
|
144
|
+
r > 0 && /* @__PURE__ */ C("div", { className: "kapi-ctxdivider" }),
|
|
145
145
|
e.label && /* @__PURE__ */ C("div", {
|
|
146
146
|
className: "kapi-ct",
|
|
147
147
|
children: e.label
|
|
@@ -151,7 +151,7 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
|
151
151
|
children: e.items.map((e) => /* @__PURE__ */ C(O, {
|
|
152
152
|
item: e,
|
|
153
153
|
active: e.id === t,
|
|
154
|
-
onSelect:
|
|
154
|
+
onSelect: n,
|
|
155
155
|
newTabLabel: c.newTab
|
|
156
156
|
}, e.id))
|
|
157
157
|
})
|
|
@@ -168,7 +168,7 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
|
168
168
|
expand: "Desplegar panel",
|
|
169
169
|
region: "Panel contextual"
|
|
170
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 =
|
|
171
|
+
let R = r("contextPanel", A, M), re = d ?? R.collapse, ie = f ?? R.expand, z = j ?? R.region, [B, ae] = i(c, l ?? !1, u), [V, H] = x(null), [oe, U] = x(!1), W = b(null), G = b(null), K = n(G, I), q = b(null), [J, Y] = x(null);
|
|
172
172
|
y(() => {
|
|
173
173
|
J && (B === J.next && q.current?.focus(), Y(null));
|
|
174
174
|
}, [J, B]);
|
|
@@ -189,11 +189,11 @@ var O = ({ item: e, active: n, onSelect: r, newTabLabel: i }) => {
|
|
|
189
189
|
}, e.currentTarget.setPointerCapture(e.pointerId), U(!0), e.preventDefault());
|
|
190
190
|
}, de = (e) => {
|
|
191
191
|
let t = W.current;
|
|
192
|
-
t && H(g(
|
|
192
|
+
t && H(g(o(p, a(e.currentTarget)), t.startWidth, t.startX, e.clientX, D, O));
|
|
193
193
|
}, $ = (e) => {
|
|
194
194
|
W.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), U(!1);
|
|
195
195
|
}, fe = (e) => {
|
|
196
|
-
let t = _(
|
|
196
|
+
let t = _(o(p, a(e.currentTarget)), Q(), e.key, D, O);
|
|
197
197
|
t !== null && (e.preventDefault(), H(t));
|
|
198
198
|
};
|
|
199
199
|
if (B) {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { CSSProperties, Ref } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { KapiToneName } from "../tone.js";
|
|
3
3
|
import { type KapiNavBadgeValue } from "./navBadgeLogic.js";
|
|
4
4
|
export type KapiNavBadgeProps = {
|
|
5
5
|
/** Contador o `"dot"` (aviso sin número). Sin valor o 0 no dibuja nada. */
|
|
6
6
|
value?: KapiNavBadgeValue | undefined;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Color por rol, igual que `KapiBadge` (`danger` para vencidos, `warning` para por vencer…), o
|
|
9
|
+
* una familia propia de la app (`toneFamilies`). @default "primary"
|
|
10
|
+
*/
|
|
11
|
+
tone?: KapiToneName | undefined;
|
|
9
12
|
/** Texto accesible (p. ej. "3 trámites vencidos"); sin él se lee el número. */
|
|
10
13
|
label?: string | undefined;
|
|
11
14
|
/** `inline`: al final de un ítem de lista. `corner`: burbuja sobre la esquina del ícono (rail). @default "inline" */
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/navigation/KapiNavBadge.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useToneLook as e } from "../../hooks/useToneFamilies.js";
|
|
4
|
+
import { joinClasses as t } from "../rootProps.js";
|
|
5
|
+
import { badgeClasses as n } from "../display/KapiBadge.js";
|
|
6
|
+
import { navBadgeA11yText as r, navBadgeView as i } from "./navBadgeLogic.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
import { Fragment as
|
|
8
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
9
|
//#region src/components/navigation/KapiNavBadge.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
max:
|
|
12
|
-
showZero:
|
|
10
|
+
var c = ({ value: c, tone: l = "primary", label: u, placement: d = "inline", max: f, showZero: p, announce: m = !0, className: h, style: g, ref: _ }) => {
|
|
11
|
+
let v = e("KapiNavBadge", l), y = i(c, {
|
|
12
|
+
max: f,
|
|
13
|
+
showZero: p
|
|
13
14
|
});
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
ref:
|
|
18
|
-
style:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
if (y === null) return null;
|
|
16
|
+
let b = m ? r(c, u, { showZero: p }) : null, x = y.kind === "dot";
|
|
17
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("span", {
|
|
18
|
+
ref: _,
|
|
19
|
+
style: v.style ? {
|
|
20
|
+
...v.style,
|
|
21
|
+
...g
|
|
22
|
+
} : g,
|
|
23
|
+
className: t(n({
|
|
24
|
+
tone: v.tone,
|
|
25
|
+
variant: d === "corner" || x ? "solid" : "subtle",
|
|
22
26
|
size: "sm"
|
|
23
|
-
}), "kapi-navbadge", `kapi-navbadge--${
|
|
27
|
+
}), "kapi-navbadge", `kapi-navbadge--${d}`, x && "kapi-navbadge--dot", h),
|
|
24
28
|
"aria-hidden": "true",
|
|
25
|
-
children:
|
|
26
|
-
}),
|
|
29
|
+
children: x ? null : y.text
|
|
30
|
+
}), b !== null && /* @__PURE__ */ s(a, { children: [
|
|
27
31
|
" ",
|
|
28
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ o("span", {
|
|
29
33
|
className: "kapi-navbadge__sr",
|
|
30
|
-
children:
|
|
34
|
+
children: b
|
|
31
35
|
}),
|
|
32
36
|
" "
|
|
33
37
|
] })] });
|
|
34
38
|
};
|
|
35
39
|
//#endregion
|
|
36
|
-
export {
|
|
40
|
+
export { c as KapiNavBadge };
|
|
@@ -12,6 +12,12 @@ export type KapiStep<Id extends string = string> = {
|
|
|
12
12
|
description?: ReactNode | undefined;
|
|
13
13
|
/** Estado explícito; gana sobre el derivado de `current`. */
|
|
14
14
|
status?: KapiStepStatus | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Con `onSelect`, deja el paso sin apretar: es un `<button disabled>`, así que el teclado lo
|
|
17
|
+
* saltea solo. Sin `onSelect` no hace nada. Sirve para un paso al que todavía no se puede saltar.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean | undefined;
|
|
15
21
|
};
|
|
16
22
|
/** Texto oculto que anuncia el estado de cada paso a lectores de pantalla. */
|
|
17
23
|
export type KapiStepsLabels = Record<KapiStepStatus, string>;
|
|
@@ -19,8 +25,13 @@ export declare const DEFAULT_STEPS_LABELS: KapiStepsLabels;
|
|
|
19
25
|
/**
|
|
20
26
|
* Atributos nativos (`id`, `style`, `aria-label`, `data-*`…) van al `<ol>`. `Id` se infiere de `steps`,
|
|
21
27
|
* sin escribir el argumento de tipo.
|
|
28
|
+
*
|
|
29
|
+
* `onSelect` se omite del tipo nativo porque choca: React ya declara un `onSelect` para el evento
|
|
30
|
+
* `select` del DOM, y sin omitirlo el parámetro de nuestro handler llega como
|
|
31
|
+
* `string | SyntheticEvent` y el consumidor no puede usar el id sin castear. Un evento `select`
|
|
32
|
+
* sobre un `<ol>` no significa nada, así que no se pierde nada.
|
|
22
33
|
*/
|
|
23
|
-
export type KapiStepsProps<Id extends string = string> = Omit<OlHTMLAttributes<HTMLOListElement>, "children"> & {
|
|
34
|
+
export type KapiStepsProps<Id extends string = string> = Omit<OlHTMLAttributes<HTMLOListElement>, "children" | "onSelect"> & {
|
|
24
35
|
/** Pasos del circuito, en orden. */
|
|
25
36
|
steps: readonly KapiStep<Id>[];
|
|
26
37
|
/** Id del paso actual: los anteriores quedan completos y los siguientes pendientes (salvo `status` explícito). */
|
|
@@ -31,12 +42,22 @@ export type KapiStepsProps<Id extends string = string> = Omit<OlHTMLAttributes<H
|
|
|
31
42
|
size?: KapiStepsSize | undefined;
|
|
32
43
|
/** Textos de estado para lectores de pantalla (clave `steps`). */
|
|
33
44
|
labels?: KapiLabelsOverride<KapiStepsLabels> | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Avisa con el id del paso apretado. **Pasarla vuelve cada paso un `<button>`**; sin ella el
|
|
47
|
+
* componente queda de solo lectura y su markup no cambia. `NoInfer` para que un literal suelto
|
|
48
|
+
* acá no ancle `Id`: los ids salen de `steps`.
|
|
49
|
+
*/
|
|
50
|
+
onSelect?: ((id: NoInfer<Id>) => void) | undefined;
|
|
34
51
|
/** Ref al `<ol>`. */
|
|
35
52
|
ref?: Ref<HTMLOListElement> | undefined;
|
|
36
53
|
};
|
|
37
54
|
/**
|
|
38
|
-
* Pasos de un circuito
|
|
39
|
-
*
|
|
40
|
-
*
|
|
55
|
+
* Pasos de un circuito (p. ej. los estados de un trámite). Es un `<ol>` con `aria-current="step"`
|
|
56
|
+
* en el paso actual y el estado de cada paso como texto oculto.
|
|
57
|
+
*
|
|
58
|
+
* **De solo lectura por defecto, e interactivo sólo con `onSelect`**, que envuelve cada paso en un
|
|
59
|
+
* `<button>`. Es el indicador, no el flujo: un formulario por pasos —que dibuja el contenido de
|
|
60
|
+
* cada uno y controla el avance— sigue siendo `KapiWizard`. Acá los pasos se muestran y, si el
|
|
61
|
+
* consumidor quiere, se saltan.
|
|
41
62
|
*/
|
|
42
|
-
export declare function KapiSteps<Id extends string = string>({ steps, current, orientation, size, labels, className, ref, ...rest }: KapiStepsProps<Id>): import("react").JSX.Element;
|
|
63
|
+
export declare function KapiSteps<Id extends string = string>({ steps, current, orientation, size, labels, onSelect, className, ref, ...rest }: KapiStepsProps<Id>): import("react").JSX.Element;
|