@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,129 +1,142 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiFileUpload.css";
|
|
3
3
|
import { joinClasses as e } from "../rootProps.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { useLabels as t } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { fieldControlProps as n, joinIds as r } from "./fieldLogic.js";
|
|
6
|
+
import { useKapiField as i } from "./KapiField.js";
|
|
7
7
|
import { formatFileSize as a, isActivationKey as o, matchesAccept as s, mergeFiles as c, removeFileAt as l } from "./fileUploadLogic.js";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { KapiProgress as u } from "../feedback/KapiProgress.js";
|
|
10
|
+
import { useEffect as d, useId as f, useRef as p, useState as m } from "react";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { FileText as _, UploadCloud as v, X as y } from "lucide-react";
|
|
12
13
|
//#region src/components/inputs/KapiFileUpload.tsx
|
|
13
|
-
var
|
|
14
|
+
var b = {
|
|
14
15
|
drop: "Arrastra archivos o",
|
|
15
16
|
choose: "elige",
|
|
16
17
|
remove: "Quitar",
|
|
17
|
-
hint: "PDF, JPG, PNG · hasta 10MB"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
hint: "PDF, JPG, PNG · hasta 10MB",
|
|
19
|
+
uploading: "Subiendo"
|
|
20
|
+
}, x = ({ multiple: x = !0, accept: S, hint: C, onChange: w, disabled: T = !1, className: E, style: D, labels: O, name: k, id: A, onBlur: j, invalid: M, progress: N, paste: P = !1, "aria-describedby": F, ref: I }) => {
|
|
21
|
+
let L = t("fileUpload", b, O), R = C ?? L.hint, z = i(), [B, V] = m([]), [H, U] = m(!1), W = p(null), G = f(), K = `${G}-title`, q = `${G}-hint`, J = !!z?.labelId, Y = n(z, {
|
|
22
|
+
id: A,
|
|
23
|
+
describedBy: r(J && q, F),
|
|
24
|
+
invalid: M
|
|
23
25
|
});
|
|
24
|
-
|
|
25
|
-
let e =
|
|
26
|
-
if (!
|
|
26
|
+
d(() => {
|
|
27
|
+
let e = W.current;
|
|
28
|
+
if (!k || !e || typeof DataTransfer > "u" || B.length === 0 && !e.files?.length) return;
|
|
27
29
|
let t = new DataTransfer();
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
},
|
|
30
|
+
B.forEach((e) => t.items.add(e)), e.files = t.files;
|
|
31
|
+
}, [B, k]);
|
|
32
|
+
let X = (e) => {
|
|
33
|
+
V(e), w?.(e);
|
|
34
|
+
}, Z = (e) => {
|
|
33
35
|
let t = Array.from(e ?? []);
|
|
34
|
-
t.length !== 0 &&
|
|
35
|
-
},
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
className: e("kapi-upload-wrap",
|
|
38
|
-
style:
|
|
36
|
+
t.length !== 0 && X(c(B, t, x));
|
|
37
|
+
}, Q = () => W.current?.click();
|
|
38
|
+
return /* @__PURE__ */ g("div", {
|
|
39
|
+
className: e("kapi-upload-wrap", E),
|
|
40
|
+
style: D,
|
|
39
41
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
ref:
|
|
42
|
-
id:
|
|
43
|
-
"aria-describedby":
|
|
44
|
-
"aria-invalid":
|
|
45
|
-
"aria-labelledby":
|
|
46
|
-
onBlur:
|
|
47
|
-
className: `kapi-upload${
|
|
48
|
-
onClick:
|
|
42
|
+
/* @__PURE__ */ g("div", {
|
|
43
|
+
ref: I,
|
|
44
|
+
id: Y.id,
|
|
45
|
+
"aria-describedby": Y["aria-describedby"],
|
|
46
|
+
"aria-invalid": Y["aria-invalid"],
|
|
47
|
+
"aria-labelledby": J ? r(z?.labelId, K) : void 0,
|
|
48
|
+
onBlur: j,
|
|
49
|
+
className: `kapi-upload${H ? " is-over" : ""}`,
|
|
50
|
+
onClick: Q,
|
|
49
51
|
onKeyDown: (e) => {
|
|
50
|
-
o(e.key) && (e.preventDefault(),
|
|
52
|
+
o(e.key) && (e.preventDefault(), Q());
|
|
51
53
|
},
|
|
52
54
|
onDragOver: (e) => {
|
|
53
|
-
e.preventDefault(),
|
|
55
|
+
e.preventDefault(), T || U(!0);
|
|
54
56
|
},
|
|
55
|
-
onDragLeave: () =>
|
|
57
|
+
onDragLeave: () => U(!1),
|
|
56
58
|
onDrop: (e) => {
|
|
57
|
-
if (e.preventDefault(),
|
|
58
|
-
let t = Array.from(e.dataTransfer.files).filter((e) => s(e,
|
|
59
|
-
t.length !== 0 &&
|
|
59
|
+
if (e.preventDefault(), U(!1), T) return;
|
|
60
|
+
let t = Array.from(e.dataTransfer.files).filter((e) => s(e, S));
|
|
61
|
+
t.length !== 0 && X(c(B, t, x));
|
|
62
|
+
},
|
|
63
|
+
onPaste: (e) => {
|
|
64
|
+
if (!P || T) return;
|
|
65
|
+
let t = Array.from(e.clipboardData?.files ?? []).filter((e) => s(e, S));
|
|
66
|
+
t.length !== 0 && (e.preventDefault(), X(c(B, t, x)));
|
|
60
67
|
},
|
|
61
68
|
role: "button",
|
|
62
|
-
tabIndex:
|
|
63
|
-
"aria-disabled":
|
|
64
|
-
children: [/* @__PURE__ */
|
|
69
|
+
tabIndex: T ? -1 : 0,
|
|
70
|
+
"aria-disabled": T || void 0,
|
|
71
|
+
children: [/* @__PURE__ */ h("span", {
|
|
65
72
|
className: "kapi-upload__ico",
|
|
66
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ h(v, {
|
|
67
74
|
size: 22,
|
|
68
75
|
strokeWidth: 1.9
|
|
69
76
|
})
|
|
70
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ g("div", {
|
|
71
78
|
className: "kapi-upload__body",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
id:
|
|
79
|
+
children: [/* @__PURE__ */ g("div", {
|
|
80
|
+
id: K,
|
|
74
81
|
className: "kapi-upload__t",
|
|
75
82
|
children: [
|
|
76
|
-
|
|
83
|
+
L.drop,
|
|
77
84
|
" ",
|
|
78
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ h("b", { children: L.choose })
|
|
79
86
|
]
|
|
80
|
-
}), /* @__PURE__ */
|
|
81
|
-
id:
|
|
87
|
+
}), /* @__PURE__ */ h("div", {
|
|
88
|
+
id: q,
|
|
82
89
|
className: "kapi-upload__s",
|
|
83
|
-
children:
|
|
90
|
+
children: R
|
|
84
91
|
})]
|
|
85
92
|
})]
|
|
86
93
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
ref:
|
|
94
|
+
/* @__PURE__ */ h("input", {
|
|
95
|
+
ref: W,
|
|
89
96
|
className: "kapi-upload__input",
|
|
90
97
|
type: "file",
|
|
91
98
|
hidden: !0,
|
|
92
|
-
name:
|
|
93
|
-
multiple:
|
|
94
|
-
accept:
|
|
95
|
-
disabled:
|
|
99
|
+
name: k,
|
|
100
|
+
multiple: x,
|
|
101
|
+
accept: S,
|
|
102
|
+
disabled: T,
|
|
96
103
|
tabIndex: -1,
|
|
97
104
|
onChange: (e) => {
|
|
98
|
-
|
|
105
|
+
Z(e.target.files), e.target.value = "";
|
|
99
106
|
}
|
|
100
107
|
}),
|
|
101
|
-
|
|
108
|
+
B.length > 0 && /* @__PURE__ */ h("div", {
|
|
102
109
|
className: "kapi-upload__list",
|
|
103
|
-
children:
|
|
110
|
+
children: B.map((e, t) => /* @__PURE__ */ g("div", {
|
|
104
111
|
className: "kapi-upload__file",
|
|
105
112
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ h(_, {
|
|
107
114
|
className: "kapi-upload__fileico",
|
|
108
115
|
size: 16,
|
|
109
116
|
strokeWidth: 1.9
|
|
110
117
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ h("span", {
|
|
112
119
|
className: "kapi-upload__name",
|
|
113
120
|
children: e.name
|
|
114
121
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ h("span", {
|
|
116
123
|
className: "kapi-upload__size",
|
|
117
124
|
children: a(e.size)
|
|
118
125
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ h("button", {
|
|
120
127
|
type: "button",
|
|
121
|
-
"aria-label": `${
|
|
122
|
-
onClick: () =>
|
|
123
|
-
children: /* @__PURE__ */
|
|
128
|
+
"aria-label": `${L.remove} ${e.name}`,
|
|
129
|
+
onClick: () => X(l(B, t)),
|
|
130
|
+
children: /* @__PURE__ */ h(y, {
|
|
124
131
|
size: 15,
|
|
125
132
|
strokeWidth: 2.2
|
|
126
133
|
})
|
|
134
|
+
}),
|
|
135
|
+
N?.(e, t) !== void 0 && /* @__PURE__ */ h(u, {
|
|
136
|
+
className: "kapi-upload__progress",
|
|
137
|
+
value: N(e, t) ?? 0,
|
|
138
|
+
size: "sm",
|
|
139
|
+
label: `${L.uploading} ${e.name}`
|
|
127
140
|
})
|
|
128
141
|
]
|
|
129
142
|
}, `${e.name}-${t}`))
|
|
@@ -132,4 +145,4 @@ var y = {
|
|
|
132
145
|
});
|
|
133
146
|
};
|
|
134
147
|
//#endregion
|
|
135
|
-
export {
|
|
148
|
+
export { b as DEFAULT_FILE_UPLOAD_LABELS, x as KapiFileUpload };
|
|
@@ -10,7 +10,14 @@ type KapiInputOwnProps = {
|
|
|
10
10
|
invalid?: boolean | undefined;
|
|
11
11
|
/** Validación no erróneo: borde verde (`ok`) u ocupado (`pending`). El valor `err` está deprecado: usa `invalid`. */
|
|
12
12
|
status?: KapiFieldStatus | undefined;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Angosto y centrado (notas, cantidades en celdas).
|
|
15
|
+
*
|
|
16
|
+
* **Es sólo la FORMA, no el comportamiento**: no valida, no limita, no pone flechas y no cambia
|
|
17
|
+
* el `type`. Para un campo numérico de verdad —con − / +, mínimo, máximo y ajuste al salir— va
|
|
18
|
+
* `KapiNumberStepper`. El nombre corto se presta a confusión y ya costó un error en una
|
|
19
|
+
* migración real.
|
|
20
|
+
*/
|
|
14
21
|
num?: boolean | undefined;
|
|
15
22
|
/** Etiqueta. Si hay `label` o `help`, el control se envuelve en un `KapiField`. */
|
|
16
23
|
label?: ReactNode | undefined;
|
|
@@ -18,6 +25,12 @@ type KapiInputOwnProps = {
|
|
|
18
25
|
required?: boolean | undefined;
|
|
19
26
|
/** Ayuda / mensaje de error bajo el control (toma el color de `invalid` o `status`). */
|
|
20
27
|
help?: ReactNode | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
|
|
30
|
+
* `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
|
|
31
|
+
* Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
|
|
32
|
+
*/
|
|
33
|
+
error?: ReactNode | undefined;
|
|
21
34
|
/** Clase del `KapiField` contenedor (si lo hay). `className` va al control. */
|
|
22
35
|
fieldClassName?: string | undefined;
|
|
23
36
|
};
|
|
@@ -25,6 +38,10 @@ type KapiInputOwnProps = {
|
|
|
25
38
|
export type KapiInputLabels = {
|
|
26
39
|
/** `aria-label` del botón de limpiar. */
|
|
27
40
|
clear: string;
|
|
41
|
+
/** Nombre del botón del ojo cuando la contraseña está oculta (ver `reveal`). */
|
|
42
|
+
show: string;
|
|
43
|
+
/** Nombre del botón del ojo cuando la contraseña está a la vista. */
|
|
44
|
+
hide: string;
|
|
28
45
|
};
|
|
29
46
|
export declare const DEFAULT_INPUT_LABELS: KapiInputLabels;
|
|
30
47
|
/**
|
|
@@ -42,6 +59,17 @@ type KapiInputAdornmentProps = {
|
|
|
42
59
|
suffix?: ReactNode;
|
|
43
60
|
/** Botón para vaciar el campo; aparece sólo con valor. Dispara `onChange` con `""` y deja el foco en el input. */
|
|
44
61
|
clearable?: boolean | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Ojo para ver y tapar la contraseña. Va con `type="password"`.
|
|
64
|
+
*
|
|
65
|
+
* **Se alcanza con Tab, a diferencia del botón de limpiar.** Ese se deja fuera del tabulador
|
|
66
|
+
* porque tiene alternativa —seleccionar todo y borrar—; el ojo no tiene ninguna, y quien escribe
|
|
67
|
+
* con el teclado y quiere revisar lo que tipeó se quedaría sin forma de hacerlo. Anuncia su
|
|
68
|
+
* estado con `aria-pressed` y cambia de nombre (`show` / `hide` del locale).
|
|
69
|
+
*
|
|
70
|
+
* No se guarda nada: al volver a montar el campo, la contraseña arranca tapada.
|
|
71
|
+
*/
|
|
72
|
+
reveal?: boolean | undefined;
|
|
45
73
|
/** Avisa que se limpió (además del `onChange`). */
|
|
46
74
|
onClear?: (() => void) | undefined;
|
|
47
75
|
/**
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/inputsExtra.css";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
4
|
+
import { hasAdornments as t, hasValue as n, inputBoxClasses as r, present as i, tipoDeCampo as ee } from "./inputLogic.js";
|
|
5
|
+
import { fieldControlProps as te, joinIds as a, resolveFieldMessage as o } from "./fieldLogic.js";
|
|
6
|
+
import { useOwnField as s } from "./ownField.js";
|
|
7
|
+
import { resolveGroupSize as c } from "./inputGroupLogic.js";
|
|
8
|
+
import { useKapiInputGroup as ne } from "./KapiInputGroup.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import {
|
|
11
|
-
import { jsx as
|
|
12
|
-
import {
|
|
10
|
+
import { useEffect as re, useId as ie, useRef as l, useState as u } from "react";
|
|
11
|
+
import { jsx as d, jsxs as ae } from "react/jsx-runtime";
|
|
12
|
+
import { Eye as oe, EyeOff as f, X as p } from "lucide-react";
|
|
13
13
|
//#region src/components/inputs/KapiInput.tsx
|
|
14
|
-
var
|
|
14
|
+
var m = {
|
|
15
|
+
clear: "Limpiar",
|
|
16
|
+
show: "Mostrar la contraseña",
|
|
17
|
+
hide: "Ocultar la contraseña"
|
|
18
|
+
}, se = (e) => {
|
|
15
19
|
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set?.call(e, ""), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
16
20
|
}, h = ({ size: e = "md", status: t, num: n = !1, className: r = "" } = {}) => [
|
|
17
21
|
"kapi-input",
|
|
@@ -20,104 +24,123 @@ var p = { clear: "Limpiar" }, m = (e) => {
|
|
|
20
24
|
t && `kapi-input--${t}`,
|
|
21
25
|
r
|
|
22
26
|
].filter(Boolean).join(" "), g = (g) => {
|
|
23
|
-
let { size:
|
|
27
|
+
let { size: _, invalid: v, status: y, num: ce, label: le, required: b, help: x, error: S, fieldClassName: C, className: w, multiline: T, id: ue, startIcon: E, endIcon: D, prefix: O, suffix: k, clearable: A, onClear: de, reveal: j, shortcut: M, labels: N, ref: P, ...F } = g, I = P, { invalid: L, status: R } = o(S, x, v, y), z = e("input", m, N), B = c(_, ne()?.size), V = !T && t({
|
|
24
28
|
startIcon: E,
|
|
25
29
|
endIcon: D,
|
|
26
30
|
prefix: O,
|
|
27
31
|
suffix: k,
|
|
28
32
|
clearable: A,
|
|
33
|
+
reveal: j,
|
|
29
34
|
shortcut: M
|
|
30
|
-
}), H
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
}), [H, U] = u(!1), W = l(null), G = F;
|
|
36
|
+
re(() => {
|
|
37
|
+
G.disabled && U(!1);
|
|
38
|
+
}, [G.disabled]);
|
|
39
|
+
let K = ee({
|
|
40
|
+
reveal: j,
|
|
41
|
+
revealed: H,
|
|
42
|
+
disabled: G.disabled
|
|
43
|
+
}), [fe, q] = u(() => n(G.defaultValue)), J = s({
|
|
44
|
+
id: ue,
|
|
45
|
+
label: le,
|
|
46
|
+
help: x,
|
|
47
|
+
error: S,
|
|
48
|
+
required: b,
|
|
49
|
+
invalid: v,
|
|
50
|
+
status: y,
|
|
37
51
|
fieldClassName: C
|
|
38
|
-
}), { controlId:
|
|
39
|
-
...
|
|
40
|
-
id:
|
|
41
|
-
describedBy:
|
|
52
|
+
}), { controlId: pe, helpId: me } = J, Y = ie(), X = V && i(O) ? `${Y}-prefix` : void 0, Z = V && i(k) ? `${Y}-suffix` : void 0, Q = {
|
|
53
|
+
...te(J.outer, {
|
|
54
|
+
id: pe,
|
|
55
|
+
describedBy: a(me, F["aria-describedby"], X, Z),
|
|
42
56
|
invalid: L
|
|
43
57
|
}),
|
|
44
|
-
required:
|
|
58
|
+
required: b,
|
|
45
59
|
className: V ? "kapi-inputbox__control" : h({
|
|
46
60
|
size: B,
|
|
47
61
|
status: R,
|
|
48
|
-
num:
|
|
62
|
+
num: ce,
|
|
49
63
|
className: w
|
|
50
64
|
})
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
}, $ =
|
|
54
|
-
let e =
|
|
55
|
-
e && (
|
|
56
|
-
},
|
|
65
|
+
}, he = (e) => {
|
|
66
|
+
W.current = e, typeof I == "function" ? I(e) : I && (I.current = e);
|
|
67
|
+
}, $ = G.value === void 0 ? fe : n(G.value), ge = () => {
|
|
68
|
+
let e = W.current;
|
|
69
|
+
e && (se(e), q(!1), e.focus(), de?.());
|
|
70
|
+
}, _e = T ? /* @__PURE__ */ d("textarea", {
|
|
57
71
|
ref: I,
|
|
58
72
|
...F,
|
|
59
73
|
...Q
|
|
60
|
-
}) : V ? /* @__PURE__ */
|
|
61
|
-
className:
|
|
74
|
+
}) : V ? /* @__PURE__ */ ae("div", {
|
|
75
|
+
className: r({
|
|
62
76
|
size: B,
|
|
63
77
|
status: R,
|
|
64
|
-
disabled:
|
|
78
|
+
disabled: G.disabled,
|
|
65
79
|
className: w
|
|
66
80
|
}),
|
|
67
81
|
onMouseDown: (e) => {
|
|
68
|
-
e.target ===
|
|
82
|
+
e.target === W.current || G.disabled || (e.preventDefault(), W.current?.focus());
|
|
69
83
|
},
|
|
70
84
|
children: [
|
|
71
|
-
|
|
85
|
+
i(E) && /* @__PURE__ */ d("span", {
|
|
72
86
|
className: "kapi-inputbox__icon",
|
|
73
87
|
"aria-hidden": "true",
|
|
74
88
|
children: E
|
|
75
89
|
}),
|
|
76
|
-
|
|
90
|
+
i(O) && /* @__PURE__ */ d("span", {
|
|
77
91
|
id: X,
|
|
78
92
|
className: "kapi-inputbox__affix",
|
|
79
93
|
children: O
|
|
80
94
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
ref:
|
|
83
|
-
...
|
|
95
|
+
/* @__PURE__ */ d("input", {
|
|
96
|
+
ref: he,
|
|
97
|
+
...G,
|
|
84
98
|
...Q,
|
|
85
|
-
|
|
99
|
+
...K ? { type: K } : {},
|
|
100
|
+
"aria-keyshortcuts": G["aria-keyshortcuts"] ?? (M || void 0),
|
|
86
101
|
onChange: (e) => {
|
|
87
|
-
|
|
102
|
+
q(n(e.target.value)), G.onChange?.(e);
|
|
88
103
|
}
|
|
89
104
|
}),
|
|
90
|
-
|
|
105
|
+
i(k) && /* @__PURE__ */ d("span", {
|
|
91
106
|
id: Z,
|
|
92
107
|
className: "kapi-inputbox__affix",
|
|
93
108
|
children: k
|
|
94
109
|
}),
|
|
95
|
-
|
|
110
|
+
j && !G.disabled && /* @__PURE__ */ d("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
className: "kapi-inputbox__reveal",
|
|
113
|
+
"aria-label": H ? z.hide : z.show,
|
|
114
|
+
"aria-pressed": H,
|
|
115
|
+
onClick: () => U((e) => !e),
|
|
116
|
+
children: d(H ? f : oe, { "aria-hidden": "true" })
|
|
117
|
+
}),
|
|
118
|
+
A && $ && !G.disabled && !G.readOnly && /* @__PURE__ */ d("button", {
|
|
96
119
|
type: "button",
|
|
97
120
|
tabIndex: -1,
|
|
98
121
|
className: "kapi-inputbox__clear",
|
|
99
122
|
"aria-label": z.clear,
|
|
100
|
-
onClick:
|
|
101
|
-
children: /* @__PURE__ */
|
|
123
|
+
onClick: ge,
|
|
124
|
+
children: /* @__PURE__ */ d(p, { "aria-hidden": "true" })
|
|
102
125
|
}),
|
|
103
|
-
M && !$ && /* @__PURE__ */
|
|
126
|
+
M && !$ && /* @__PURE__ */ d("kbd", {
|
|
104
127
|
className: "kapi-inputbox__kbd",
|
|
105
128
|
"aria-hidden": "true",
|
|
106
129
|
children: M
|
|
107
130
|
}),
|
|
108
|
-
|
|
131
|
+
i(D) && /* @__PURE__ */ d("span", {
|
|
109
132
|
className: "kapi-inputbox__icon",
|
|
110
133
|
"aria-hidden": "true",
|
|
111
134
|
children: D
|
|
112
135
|
})
|
|
113
136
|
]
|
|
114
|
-
}) : /* @__PURE__ */
|
|
137
|
+
}) : /* @__PURE__ */ d("input", {
|
|
115
138
|
ref: I,
|
|
116
|
-
...
|
|
139
|
+
...G,
|
|
117
140
|
...Q
|
|
118
141
|
});
|
|
119
|
-
return
|
|
142
|
+
return J.wrap(_e);
|
|
120
143
|
};
|
|
121
144
|
g.displayName = "KapiInput";
|
|
122
145
|
//#endregion
|
|
123
|
-
export {
|
|
146
|
+
export { m as DEFAULT_INPUT_LABELS, g as KapiInput, h as inputClasses };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
3
|
+
import { activeElementOf as t } from "../../hooks/ownerDocument.js";
|
|
4
|
+
import { assignRef as n } from "./fieldLogic.js";
|
|
5
|
+
import { KapiInput as r } from "./KapiInput.js";
|
|
6
|
+
import { useControllableState as i } from "../../hooks/useControllableState.js";
|
|
7
7
|
import { useFormReset as a } from "../../hooks/useFormReset.js";
|
|
8
8
|
import { caretForSignificant as o, countSignificant as s, formatCuit as c, formatCurrency as l, formatDni as u, isValidCuit as d, maskCurrencyInput as f, onlyDigits as p, parseCurrency as m } from "./maskLogic.js";
|
|
9
9
|
import { useCallback as h, useRef as g, useState as _ } from "react";
|
|
@@ -14,26 +14,26 @@ var x = (e, t, n) => e ? /* @__PURE__ */ y("input", {
|
|
|
14
14
|
name: e,
|
|
15
15
|
value: t,
|
|
16
16
|
disabled: n
|
|
17
|
-
}) : null, S = (
|
|
18
|
-
setRef: h((
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
apply: (
|
|
22
|
-
let a =
|
|
23
|
-
if (
|
|
24
|
-
let e = Math.max(0, c - (a.value.length -
|
|
25
|
-
return a.value =
|
|
17
|
+
}) : null, S = (e, r, i, a) => ({
|
|
18
|
+
setRef: h((e) => {
|
|
19
|
+
n(r, e), a?.(e);
|
|
20
|
+
}, [r, a]),
|
|
21
|
+
apply: (n, r) => {
|
|
22
|
+
let a = n.target, c = a.selectionStart ?? a.value.length;
|
|
23
|
+
if (i !== void 0 && p(a.value).length > i) {
|
|
24
|
+
let e = Math.max(0, c - (a.value.length - r.length));
|
|
25
|
+
return a.value = r, a.setSelectionRange(e, e), r;
|
|
26
26
|
}
|
|
27
|
-
let l = s(a.value, c), u =
|
|
28
|
-
if (a.value = u,
|
|
27
|
+
let l = s(a.value, c), u = e(a.value);
|
|
28
|
+
if (a.value = u, t(a) === a) {
|
|
29
29
|
let e = o(u, l);
|
|
30
30
|
a.setSelectionRange(e, e);
|
|
31
31
|
}
|
|
32
32
|
return u;
|
|
33
33
|
}
|
|
34
|
-
}), C = ({ value: e, defaultValue: t = "", onValueChange:
|
|
35
|
-
let [m, h, , g] =
|
|
36
|
-
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(
|
|
34
|
+
}), C = ({ value: e, defaultValue: t = "", onValueChange: n, onChange: o, ref: s, name: c, disabled: l, placeholder: d = "12.345.678", ...f }) => {
|
|
35
|
+
let [m, h, , g] = i(e, () => p(t, 8), n), _ = p(m, 8), { setRef: C, apply: w } = S(u, s, 8, a(g));
|
|
36
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(r, {
|
|
37
37
|
...f,
|
|
38
38
|
ref: C,
|
|
39
39
|
disabled: l,
|
|
@@ -46,9 +46,9 @@ var x = (e, t, n) => e ? /* @__PURE__ */ y("input", {
|
|
|
46
46
|
t !== _ && h(t), o?.(e);
|
|
47
47
|
}
|
|
48
48
|
}), x(c, _, l)] });
|
|
49
|
-
}, w = { invalid: "CUIT inválido: revisa el dígito verificador" }, T = ({ value:
|
|
50
|
-
let D =
|
|
51
|
-
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(
|
|
49
|
+
}, w = { invalid: "CUIT inválido: revisa el dígito verificador" }, T = ({ value: t, defaultValue: n = "", onValueChange: o, onChange: s, invalidMessage: l, invalid: u, status: f, help: m, label: h, ref: g, name: _, disabled: C, placeholder: T = "20-12345678-9", ...E }) => {
|
|
50
|
+
let D = e("cuitInput", w), [O, k, , A] = i(t, () => p(n, 11), o && ((e) => o(e, d(e)))), j = p(O, 11), M = a(A), N = j.length === 11 && !d(j), P = u !== void 0 || f !== void 0, F = h != null || !!m, { setRef: I, apply: L } = S(c, g, 11, M);
|
|
51
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(r, {
|
|
52
52
|
...E,
|
|
53
53
|
ref: I,
|
|
54
54
|
disabled: C,
|
|
@@ -65,13 +65,13 @@ var x = (e, t, n) => e ? /* @__PURE__ */ y("input", {
|
|
|
65
65
|
t !== j && k(t), s?.(e);
|
|
66
66
|
}
|
|
67
67
|
}), x(_, j, C)] });
|
|
68
|
-
}, E = ({ value: e, defaultValue: t = null, onValueChange:
|
|
68
|
+
}, E = ({ value: e, defaultValue: t = null, onValueChange: n, onChange: i, onBlur: o, ref: s, name: c, disabled: u, placeholder: d = "$ 0,00", ...p }) => {
|
|
69
69
|
let [h, C] = _(() => l(e === void 0 ? t : e)), w = g(m(h)), T = g(h), [E, D] = _(e);
|
|
70
70
|
e !== void 0 && e !== E && (D(e), e !== m(h) && (C(l(e)), w.current = e));
|
|
71
71
|
let O = a(() => {
|
|
72
72
|
e === void 0 && (C(T.current), w.current = m(T.current));
|
|
73
73
|
}), { setRef: k, apply: A } = S(f, s, void 0, O), j = m(h);
|
|
74
|
-
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(
|
|
74
|
+
return /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(r, {
|
|
75
75
|
...p,
|
|
76
76
|
ref: k,
|
|
77
77
|
disabled: u,
|
|
@@ -82,8 +82,8 @@ var x = (e, t, n) => e ? /* @__PURE__ */ y("input", {
|
|
|
82
82
|
onChange: (e) => {
|
|
83
83
|
let t = A(e, h);
|
|
84
84
|
C(t);
|
|
85
|
-
let
|
|
86
|
-
|
|
85
|
+
let r = m(t);
|
|
86
|
+
r !== w.current && (w.current = r, n?.(r)), i?.(e);
|
|
87
87
|
},
|
|
88
88
|
onBlur: (e) => {
|
|
89
89
|
C(l(m(h))), o?.(e);
|
|
@@ -29,6 +29,12 @@ export type KapiNumberStepperProps = Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
29
29
|
label?: ReactNode;
|
|
30
30
|
/** Texto de ayuda o error bajo el control. */
|
|
31
31
|
help?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* El motivo por el que el campo está mal. Reemplaza a `help` y lo marca inválido (rojo, ícono y
|
|
34
|
+
* `role="alert"`). Es lo que entregan las librerías de formularios: un mensaje, no un booleano.
|
|
35
|
+
* Un error que React no pinta (`true`, `""`, `null`) no marca nada. Gana sobre `invalid` y `status`.
|
|
36
|
+
*/
|
|
37
|
+
error?: ReactNode | undefined;
|
|
32
38
|
/** Clase del contenedor del control (`.kapi-stepper`, botones + input). `className` va al `<input>`. */
|
|
33
39
|
fieldClassName?: string | undefined;
|
|
34
40
|
/**
|
|
@@ -53,4 +59,4 @@ export type KapiNumberStepperLabels = {
|
|
|
53
59
|
increase: string;
|
|
54
60
|
};
|
|
55
61
|
export declare const DEFAULT_NUMBER_STEPPER_LABELS: KapiNumberStepperLabels;
|
|
56
|
-
export declare const KapiNumberStepper: ({ value: valueProp, defaultValue, onChange, min, max, step, size, invalid: invalidProp, status: statusProp, required, label, help, fieldClassName, wrapperClassName, labels, className, disabled, readOnly: readOnlyProp, id, ...rest }: KapiNumberStepperProps) => ReactNode;
|
|
62
|
+
export declare const KapiNumberStepper: ({ value: valueProp, defaultValue, onChange, min, max, step, size, invalid: invalidProp, status: statusProp, required, label, help, error, fieldClassName, wrapperClassName, labels, className, disabled, readOnly: readOnlyProp, id, ...rest }: KapiNumberStepperProps) => ReactNode;
|