@kapiuara/ui 0.10.0 → 0.12.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 +10 -5
- package/dist/components/data/KapiBarChart.d.ts +93 -0
- package/dist/components/data/KapiBarChart.js +88 -0
- package/dist/components/data/KapiEventCalendar.d.ts +70 -0
- package/dist/components/data/KapiEventCalendar.js +225 -0
- package/dist/components/data/KapiHeatmap.d.ts +62 -0
- package/dist/components/data/KapiHeatmap.js +120 -0
- package/dist/components/data/KapiLineChart.d.ts +59 -0
- package/dist/components/data/KapiLineChart.js +106 -0
- package/dist/components/data/KapiPaginationFooter.js +1 -0
- package/dist/components/data/KapiSparkline.d.ts +41 -0
- package/dist/components/data/KapiSparkline.js +55 -0
- package/dist/components/data/KapiTable.d.ts +25 -2
- package/dist/components/data/KapiTable.js +371 -359
- package/dist/components/data/barChartLogic.d.ts +59 -0
- package/dist/components/data/barChartLogic.js +53 -0
- package/dist/components/data/chartFrame.d.ts +112 -0
- package/dist/components/data/chartFrame.js +89 -0
- package/dist/components/data/eventCalendarLogic.d.ts +70 -0
- package/dist/components/data/eventCalendarLogic.js +45 -0
- package/dist/components/data/heatmapLogic.d.ts +15 -0
- package/dist/components/data/heatmapLogic.js +15 -0
- package/dist/components/data/index.d.ts +20 -1
- package/dist/components/data/lineChartLogic.d.ts +30 -0
- package/dist/components/data/lineChartLogic.js +21 -0
- package/dist/components/data/sparklineLogic.d.ts +28 -0
- package/dist/components/data/sparklineLogic.js +18 -0
- package/dist/components/display/KapiStat.d.ts +1 -1
- package/dist/components/inputs/KapiDatePicker.d.ts +8 -2
- package/dist/components/inputs/KapiDatePicker.js +120 -106
- package/dist/components/inputs/KapiDateRangePicker.d.ts +26 -5
- package/dist/components/inputs/KapiDateRangePicker.js +146 -111
- package/dist/components/inputs/KapiFacetedSearch.d.ts +9 -2
- package/dist/components/inputs/KapiFacetedSearch.js +3 -3
- package/dist/components/inputs/KapiSearchChip.d.ts +79 -0
- package/dist/components/inputs/KapiSearchChip.js +73 -0
- package/dist/components/inputs/datePickerLogic.d.ts +9 -0
- package/dist/components/inputs/datePickerLogic.js +25 -25
- package/dist/components/inputs/dateRangeLogic.d.ts +23 -4
- package/dist/components/inputs/dateRangeLogic.js +48 -22
- package/dist/components/inputs/facetedSearchLogic.d.ts +1 -1
- package/dist/components/inputs/index.d.ts +2 -0
- package/dist/components/inputs/searchChipLogic.d.ts +33 -0
- package/dist/components/inputs/searchChipLogic.js +13 -0
- package/dist/components/labelsLogic.d.ts +11 -1
- package/dist/components/layout/KapiContextSlot.js +108 -88
- package/dist/components/layout/KapiMasonry.d.ts +30 -0
- package/dist/components/layout/KapiMasonry.js +33 -0
- package/dist/components/layout/KapiPageHeader.js +89 -71
- package/dist/components/layout/KapiRail.d.ts +8 -2
- package/dist/components/layout/KapiRail.js +118 -67
- package/dist/components/layout/KapiShell.js +67 -37
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/masonryLogic.d.ts +40 -0
- package/dist/components/layout/masonryLogic.js +8 -0
- package/dist/components/layout/railLogic.d.ts +41 -1
- package/dist/components/layout/railLogic.js +36 -4
- package/dist/components/layout/reopenBus.d.ts +53 -0
- package/dist/components/layout/reopenBus.js +6 -0
- package/dist/components/layout/useMasonrySpans.d.ts +32 -0
- package/dist/components/layout/useMasonrySpans.js +44 -0
- package/dist/components/layout/useRailOverflow.d.ts +17 -0
- package/dist/components/layout/useRailOverflow.js +41 -0
- package/dist/components/locale/labelRegistry.d.ts +12 -1
- package/dist/components/navigation/KapiFilterChips.js +1 -1
- package/dist/components/navigation/filterChipsLogic.d.ts +7 -1
- package/dist/components/navigation/filterChipsLogic.js +3 -3
- package/dist/components/overlays/KapiConfirm.d.ts +14 -2
- package/dist/components/overlays/KapiConfirm.js +2 -2
- package/dist/components/overlays/KapiContextMenu.d.ts +3 -0
- package/dist/components/overlays/KapiContextMenu.js +2 -1
- package/dist/components/overlays/KapiDropdown.d.ts +3 -1
- package/dist/components/overlays/KapiDropdown.js +29 -26
- package/dist/components/overlays/KapiMenuButton.js +1 -0
- package/dist/components/overlays/KapiOffcanvasStack.d.ts +2 -2
- package/dist/hooks/breakpointOpenLogic.d.ts +20 -5
- package/dist/hooks/breakpointOpenLogic.js +2 -2
- package/dist/hooks/dataColorLogic.d.ts +23 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/numberFormatLogic.d.ts +7 -0
- package/dist/hooks/numberFormatLogic.js +5 -2
- package/dist/hooks/seriesPaletteLogic.d.ts +24 -0
- package/dist/hooks/themeContrastLogic.js +1 -0
- package/dist/hooks/themeDeriveLogic.d.ts +8 -0
- package/dist/hooks/themeDeriveLogic.js +4 -2
- package/dist/hooks/useKapiTheme.js +27 -27
- package/dist/hooks/useMediaQuery.d.ts +7 -0
- package/dist/hooks/useMediaQuery.js +4 -4
- package/dist/index.js +149 -137
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +2 -6
|
@@ -1,182 +1,196 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { assignRef as e, fieldControlProps as t, focusLeaves as n } from "./fieldLogic.js";
|
|
3
|
-
import { useKapiField as
|
|
4
|
-
import { useKapiLocale as
|
|
5
|
-
import { formDateValue as
|
|
6
|
-
import { KapiCalendarGrid as
|
|
7
|
-
import { useCalendarFocus as
|
|
8
|
-
import { useDatePopSide as
|
|
3
|
+
import { useKapiField as ee } from "./KapiField.js";
|
|
4
|
+
import { useKapiLocale as te, useLabels as r } from "../locale/KapiLocaleProvider.js";
|
|
5
|
+
import { chipFieldSize as i, formDateValue as ne, formatValue as a, hasCalendar as re, hasTime as ie, localizedCalendarLabels as ae, maskInput as oe, minuteOptions as se, monthTitle as ce, pad as o, parseText as s, sameDay as c } from "./datePickerLogic.js";
|
|
6
|
+
import { KapiCalendarGrid as l } from "./KapiCalendarGrid.js";
|
|
7
|
+
import { useCalendarFocus as u } from "./useCalendarFocus.js";
|
|
8
|
+
import { useDatePopSide as d } from "./useDatePopSide.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { jsx as
|
|
11
|
-
import { useEffect as
|
|
12
|
-
import { Calendar as
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect as le, useId as ue, useRef as m, useState as h } from "react";
|
|
12
|
+
import { Calendar as de, ChevronLeft as fe, ChevronRight as pe, Clock as me } from "lucide-react";
|
|
13
13
|
//#region src/components/inputs/KapiDatePicker.tsx
|
|
14
|
-
var
|
|
14
|
+
var he = {
|
|
15
15
|
date: "dd/mm/aaaa",
|
|
16
16
|
time: "hh:mm",
|
|
17
17
|
datetime: "dd/mm/aaaa hh:mm"
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
(
|
|
18
|
+
}, ge = Array.from({ length: 24 }, (e, t) => t), g = ({ mode: g = "date", value: _ = null, onChange: _e, placeholder: ve, icon: v, label: y, disabled: b = !1, id: ye, name: x, className: be, style: S, "aria-label": C, labels: w, minuteStep: T = 1, ref: E, onBlur: D }) => {
|
|
19
|
+
let O = te(), k = r("calendar", ae(O), w), A = ee(), j = re(g), M = ie(g), N = !!v || !!y, P = ve ?? he[g], xe = ue(), F = ye ?? A?.controlId ?? (N ? xe : void 0), [I, L] = h(!1), [R, z] = h(_), [B, V] = h(() => a(_, g)), [H, U] = h(() => _ ?? /* @__PURE__ */ new Date()), W = m(null), G = m(null), K = m(null), { inputRef: Se, focusRequest: Ce, openFromKeyboard: q, openFromFocus: we, returnFocus: J } = u(L), Y = _ ? _.getTime() : null, [Te, Ee] = h(Y), [De, Oe] = h(g);
|
|
20
|
+
(Te !== Y || De !== g) && (Ee(Y), Oe(g), z(_), V(a(_, g)), _ && U(_)), le(() => {
|
|
21
21
|
let e = (e) => {
|
|
22
|
-
let t =
|
|
22
|
+
let t = W.current;
|
|
23
23
|
if (!t || t.contains(e.target)) return;
|
|
24
24
|
let n = document.activeElement;
|
|
25
|
-
n instanceof HTMLElement &&
|
|
25
|
+
n instanceof HTMLElement && K.current?.contains(n) && n.blur(), L(!1);
|
|
26
26
|
};
|
|
27
27
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
28
28
|
}, []);
|
|
29
29
|
let X = (e) => {
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
if (!
|
|
33
|
-
|
|
30
|
+
z(e), V(a(e, g)), _e?.(e);
|
|
31
|
+
}, ke = () => {
|
|
32
|
+
if (!B.trim()) {
|
|
33
|
+
R && X(null);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
let e =
|
|
37
|
-
e === void 0 ?
|
|
36
|
+
let e = s(B, g, R);
|
|
37
|
+
e === void 0 ? V(a(R, g)) : (e && R && e.getTime() === R.getTime() ? V(a(e, g)) : X(e), e && U(e));
|
|
38
38
|
}, Z = (e) => {
|
|
39
|
-
let t =
|
|
40
|
-
|
|
39
|
+
let t = R ?? /* @__PURE__ */ new Date(), n = new Date(e);
|
|
40
|
+
M && n.setHours(t.getHours(), t.getMinutes()), X(n), M || J();
|
|
41
41
|
}, Q = (e, t) => {
|
|
42
|
-
let n = new Date(
|
|
42
|
+
let n = new Date(R ?? /* @__PURE__ */ new Date());
|
|
43
43
|
e != null && n.setHours(e), t != null && n.setMinutes(t), X(n);
|
|
44
|
-
}, $ = (e) =>
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
className: [
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
}, $ = (e) => U(new Date(H.getFullYear(), H.getMonth() + e, 1)), Ae = d(I && !b, G, K);
|
|
45
|
+
return /* @__PURE__ */ p("div", {
|
|
46
|
+
className: [
|
|
47
|
+
"kapi-dp",
|
|
48
|
+
N && "kapi-dp--chip",
|
|
49
|
+
be
|
|
50
|
+
].filter(Boolean).join(" "),
|
|
51
|
+
style: S,
|
|
52
|
+
ref: W,
|
|
49
53
|
onBlur: (e) => {
|
|
50
|
-
n(e.relatedTarget, e.currentTarget) &&
|
|
54
|
+
n(e.relatedTarget, e.currentTarget) && D?.(e);
|
|
51
55
|
},
|
|
52
56
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
className: "kapi-dp__field",
|
|
55
|
-
ref:
|
|
56
|
-
children: [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
57
|
+
/* @__PURE__ */ p("div", {
|
|
58
|
+
className: ["kapi-dp__field", N && "kapi-filterchip"].filter(Boolean).join(" "),
|
|
59
|
+
ref: G,
|
|
60
|
+
children: [
|
|
61
|
+
v,
|
|
62
|
+
y && /* @__PURE__ */ p("label", {
|
|
63
|
+
className: "kapi-dp__label",
|
|
64
|
+
htmlFor: F,
|
|
65
|
+
children: [y, ":"]
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ f("input", {
|
|
68
|
+
ref: (t) => {
|
|
69
|
+
Se.current = t, e(E, t);
|
|
70
|
+
},
|
|
71
|
+
...t(A, { id: F }),
|
|
72
|
+
...N ? { size: i(P) } : {},
|
|
73
|
+
className: "kapi-input kapi-dp__input",
|
|
74
|
+
value: B,
|
|
75
|
+
placeholder: P,
|
|
76
|
+
disabled: b,
|
|
77
|
+
"aria-label": C,
|
|
78
|
+
autoComplete: "off",
|
|
79
|
+
inputMode: "numeric",
|
|
80
|
+
onChange: (e) => V(oe(e.target.value, g)),
|
|
81
|
+
onFocus: we,
|
|
82
|
+
onBlur: ke,
|
|
83
|
+
onKeyDown: (e) => {
|
|
84
|
+
e.key === "Escape" && L(!1), e.key === "ArrowDown" && j && (e.preventDefault(), q());
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ f("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
className: "kapi-dp__toggle",
|
|
90
|
+
disabled: b,
|
|
91
|
+
"aria-label": k.openPicker,
|
|
92
|
+
"aria-expanded": I,
|
|
93
|
+
onClick: () => I ? L(!1) : q(),
|
|
94
|
+
children: f(j ? de : me, {
|
|
95
|
+
size: 16,
|
|
96
|
+
strokeWidth: 1.9
|
|
97
|
+
})
|
|
84
98
|
})
|
|
85
|
-
|
|
99
|
+
]
|
|
86
100
|
}),
|
|
87
|
-
|
|
101
|
+
x && /* @__PURE__ */ f("input", {
|
|
88
102
|
type: "hidden",
|
|
89
|
-
name:
|
|
90
|
-
value:
|
|
91
|
-
disabled:
|
|
103
|
+
name: x,
|
|
104
|
+
value: ne(R, g),
|
|
105
|
+
disabled: b
|
|
92
106
|
}),
|
|
93
|
-
|
|
94
|
-
ref:
|
|
95
|
-
className: `kapi-dp__pop${
|
|
107
|
+
I && !b && /* @__PURE__ */ p("div", {
|
|
108
|
+
ref: K,
|
|
109
|
+
className: `kapi-dp__pop${Ae === "top" ? " kapi-dp__pop--up" : ""}`,
|
|
96
110
|
onKeyDown: (e) => {
|
|
97
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
111
|
+
e.key === "Escape" && (e.preventDefault(), J());
|
|
98
112
|
},
|
|
99
|
-
children: [
|
|
113
|
+
children: [j && /* @__PURE__ */ p("div", {
|
|
100
114
|
className: "kapi-dp__cal",
|
|
101
115
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ p("div", {
|
|
103
117
|
className: "kapi-dp__head",
|
|
104
118
|
children: [
|
|
105
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ f("button", {
|
|
106
120
|
type: "button",
|
|
107
121
|
className: "kapi-dp__nav",
|
|
108
|
-
"aria-label":
|
|
122
|
+
"aria-label": k.prevMonth,
|
|
109
123
|
onClick: () => $(-1),
|
|
110
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ f(fe, {
|
|
111
125
|
size: 15,
|
|
112
126
|
strokeWidth: 2.2
|
|
113
127
|
})
|
|
114
128
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ f("span", {
|
|
116
130
|
className: "kapi-dp__title",
|
|
117
|
-
children:
|
|
131
|
+
children: ce(H, k.months)
|
|
118
132
|
}),
|
|
119
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ f("button", {
|
|
120
134
|
type: "button",
|
|
121
135
|
className: "kapi-dp__nav",
|
|
122
|
-
"aria-label":
|
|
136
|
+
"aria-label": k.nextMonth,
|
|
123
137
|
onClick: () => $(1),
|
|
124
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ f(pe, {
|
|
125
139
|
size: 15,
|
|
126
140
|
strokeWidth: 2.2
|
|
127
141
|
})
|
|
128
142
|
})
|
|
129
143
|
]
|
|
130
144
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
view:
|
|
133
|
-
onViewChange:
|
|
134
|
-
labels:
|
|
135
|
-
focusTarget:
|
|
136
|
-
focusRequest:
|
|
137
|
-
isSelected: (e) =>
|
|
138
|
-
dayClassName: (e) =>
|
|
145
|
+
/* @__PURE__ */ f(l, {
|
|
146
|
+
view: H,
|
|
147
|
+
onViewChange: U,
|
|
148
|
+
labels: k,
|
|
149
|
+
focusTarget: R,
|
|
150
|
+
focusRequest: Ce,
|
|
151
|
+
isSelected: (e) => c(e, R),
|
|
152
|
+
dayClassName: (e) => c(e, R) && "kapi-dp__day--sel",
|
|
139
153
|
onPick: Z
|
|
140
154
|
}),
|
|
141
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ p("div", {
|
|
142
156
|
className: "kapi-dp__foot",
|
|
143
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ f("button", {
|
|
144
158
|
type: "button",
|
|
145
159
|
className: "kapi-dp__link",
|
|
146
160
|
onClick: () => {
|
|
147
|
-
X(null),
|
|
161
|
+
X(null), L(!1);
|
|
148
162
|
},
|
|
149
|
-
children:
|
|
150
|
-
}), /* @__PURE__ */
|
|
163
|
+
children: k.clear
|
|
164
|
+
}), /* @__PURE__ */ f("button", {
|
|
151
165
|
type: "button",
|
|
152
166
|
className: "kapi-dp__link",
|
|
153
167
|
onClick: () => {
|
|
154
168
|
let e = /* @__PURE__ */ new Date();
|
|
155
|
-
|
|
169
|
+
U(e), Z(e);
|
|
156
170
|
},
|
|
157
|
-
children:
|
|
171
|
+
children: k.today
|
|
158
172
|
})]
|
|
159
173
|
})
|
|
160
174
|
]
|
|
161
|
-
}),
|
|
175
|
+
}), M && /* @__PURE__ */ f("div", {
|
|
162
176
|
className: "kapi-dp__time",
|
|
163
|
-
children: /* @__PURE__ */
|
|
177
|
+
children: /* @__PURE__ */ p("div", {
|
|
164
178
|
className: "kapi-dp__time-cols",
|
|
165
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ f("div", {
|
|
166
180
|
className: "kapi-dp__time-col",
|
|
167
|
-
children:
|
|
181
|
+
children: ge.map((e) => /* @__PURE__ */ f("button", {
|
|
168
182
|
type: "button",
|
|
169
|
-
className: `kapi-dp__time-opt${
|
|
183
|
+
className: `kapi-dp__time-opt${R?.getHours() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
170
184
|
onClick: () => Q(e, null),
|
|
171
|
-
children:
|
|
185
|
+
children: o(e)
|
|
172
186
|
}, e))
|
|
173
|
-
}), /* @__PURE__ */
|
|
187
|
+
}), /* @__PURE__ */ f("div", {
|
|
174
188
|
className: "kapi-dp__time-col",
|
|
175
|
-
children:
|
|
189
|
+
children: se(T, R?.getMinutes()).map((e) => /* @__PURE__ */ f("button", {
|
|
176
190
|
type: "button",
|
|
177
|
-
className: `kapi-dp__time-opt${
|
|
191
|
+
className: `kapi-dp__time-opt${R?.getMinutes() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
178
192
|
onClick: () => Q(null, e),
|
|
179
|
-
children:
|
|
193
|
+
children: o(e)
|
|
180
194
|
}, e))
|
|
181
195
|
})]
|
|
182
196
|
})
|
|
@@ -186,4 +200,4 @@ var ue = {
|
|
|
186
200
|
});
|
|
187
201
|
};
|
|
188
202
|
//#endregion
|
|
189
|
-
export {
|
|
203
|
+
export { g as KapiDatePicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CSSProperties, type FocusEvent, type Ref } from "react";
|
|
1
|
+
import { type CSSProperties, type FocusEvent, type ReactNode, type Ref } from "react";
|
|
2
2
|
import { type KapiCalendarLabels } from "./datePickerLogic";
|
|
3
3
|
import { type KapiDateRange } from "./dateRangeLogic";
|
|
4
4
|
import "./KapiDatePicker.css";
|
|
@@ -6,17 +6,27 @@ import type { KapiLabelsOverride } from "../labelsLogic";
|
|
|
6
6
|
export type { KapiDateRange };
|
|
7
7
|
/** Textos del rango: los del calendario más la pista de qué punta se está eligiendo. */
|
|
8
8
|
export type KapiDateRangePickerLabels = KapiCalendarLabels & {
|
|
9
|
+
/** Pista del pie mientras no hay ninguna punta elegida. */
|
|
9
10
|
pickStart: string;
|
|
11
|
+
/** Pista del pie con una punta ya elegida. */
|
|
10
12
|
pickEnd: string;
|
|
13
|
+
/** Botón del pie que deja el rango sin fecha de fin, desde el día elegido. */
|
|
14
|
+
openEnd: string;
|
|
15
|
+
/** Botón del pie que deja el rango sin fecha de inicio, hasta el día elegido. */
|
|
16
|
+
openStart: string;
|
|
11
17
|
};
|
|
12
18
|
export declare const DEFAULT_DATE_RANGE_LABELS: KapiDateRangePickerLabels;
|
|
13
19
|
export type KapiDateRangePickerProps = {
|
|
14
20
|
/** Rango actual (`from`/`to`). Se re-sincroniza cada vez que cambia (componente controlado). */
|
|
15
21
|
value?: KapiDateRange | undefined;
|
|
16
|
-
/** Se llama con el rango completo
|
|
22
|
+
/** Se llama con el rango completo, con una sola punta abierta, o vacío al borrar. */
|
|
17
23
|
onChange?: ((value: KapiDateRange) => void) | undefined;
|
|
18
24
|
/** Texto de ejemplo del campo. */
|
|
19
25
|
placeholder?: string | undefined;
|
|
26
|
+
/** Ícono (lucide-react) a la izquierda del chip; con `icon` o `label` el campo se dibuja como chip de filtro. */
|
|
27
|
+
icon?: ReactNode | undefined;
|
|
28
|
+
/** Prefijo del chip ("Período: 01/10/2026 – 05/10/2026"); también nombra al campo si no hay `aria-label` ni `KapiField`. */
|
|
29
|
+
label?: string | undefined;
|
|
20
30
|
/** Deshabilita el campo y el botón del calendario. */
|
|
21
31
|
disabled?: boolean | undefined;
|
|
22
32
|
/** `id` del campo de texto (para asociarlo a un `<label>`). */
|
|
@@ -42,8 +52,19 @@ export type KapiDateRangePickerProps = {
|
|
|
42
52
|
/**
|
|
43
53
|
* Rango de fechas propio (sin librería), con el mismo look que `KapiDatePicker`. En el calendario, el
|
|
44
54
|
* primer click marca el inicio y el segundo el fin (en cualquier orden; el hover previsualiza). También
|
|
45
|
-
* se puede tipear `dd/mm/aaaa – dd/mm/aaaa` (se parsea al salir del campo).
|
|
46
|
-
*
|
|
55
|
+
* se puede tipear `dd/mm/aaaa – dd/mm/aaaa` (se parsea al salir del campo).
|
|
56
|
+
*
|
|
57
|
+
* LAS DOS PUNTAS SON INDEPENDIENTES: emite el rango completo, una sola punta («desde el 10 en
|
|
58
|
+
* adelante», «hasta el 10») o vacío. Exigir las dos es VALIDACIÓN y la hace la app, que la anuncia
|
|
59
|
+
* con `required` y `status` de `KapiField`, igual que en cualquier otro campo; el control reporta
|
|
60
|
+
* lo que la persona expresó y nunca lo descarta por su cuenta.
|
|
61
|
+
*
|
|
62
|
+
* Una punta sola se emite siempre por una acción EXPLÍCITA —los dos botones del pie, o el separador
|
|
63
|
+
* tipeado—, porque un primer click no puede saber si querés una punta o dos. Por eso son dos
|
|
64
|
+
* botones y no uno, y por eso cerrar con un borrador a medias restaura el último rango: ahí la
|
|
65
|
+
* persona no dijo cuál de las dos puntas dejaba abierta. Teclado igual que
|
|
47
66
|
* `KapiDatePicker` (grilla compartida `KapiCalendarGrid`): Enter/Espacio marcan cada punta.
|
|
67
|
+
* Con `label` o `icon` el campo se dibuja como el chip de `KapiDropdown` (la misma clase
|
|
68
|
+
* `.kapi-filterchip`), para una fila de filtros que mezcle los dos.
|
|
48
69
|
*/
|
|
49
|
-
export declare const KapiDateRangePicker: ({ value, onChange, placeholder, disabled, id, name, className, style, "aria-label": ariaLabel, labels, ref, onBlur: onBlurProp }: KapiDateRangePickerProps) => import("react").JSX.Element;
|
|
70
|
+
export declare const KapiDateRangePicker: ({ value, onChange, placeholder, icon, label, disabled, id, name, className, style, "aria-label": ariaLabel, labels, ref, onBlur: onBlurProp }: KapiDateRangePickerProps) => import("react").JSX.Element;
|