@kapiuara/ui 0.13.0 → 0.14.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 +5 -0
- package/dist/components/chat/KapiChatDivider.d.ts +7 -3
- package/dist/components/chat/KapiChatDivider.js +6 -6
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/display/KapiAnnotation.js +4 -4
- package/dist/components/feedback/KapiFab.js +4 -4
- package/dist/components/feedback/KapiToastContainer.js +5 -5
- package/dist/components/feedback/KapiTour.js +4 -4
- package/dist/components/inputs/KapiDatePicker.js +124 -122
- package/dist/components/inputs/KapiDateRangePicker.js +138 -136
- package/dist/components/inputs/KapiFacetedSearch.js +8 -8
- package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
- package/dist/components/inputs/KapiMaskedInput.js +66 -53
- package/dist/components/inputs/KapiNumberStepper.js +29 -29
- package/dist/components/inputs/KapiRating.js +61 -59
- package/dist/components/inputs/KapiSegmented.js +68 -58
- package/dist/components/inputs/KapiSelect.js +204 -194
- package/dist/components/inputs/KapiTagInput.js +82 -80
- package/dist/components/inputs/misuseWarnings.d.ts +37 -0
- package/dist/components/inputs/misuseWarnings.js +36 -0
- package/dist/components/inputs/numberStepLogic.d.ts +10 -0
- package/dist/components/inputs/numberStepLogic.js +16 -7
- package/dist/components/layout/KapiAccountMenu.js +4 -4
- package/dist/components/navigation/CtxSlidingList.js +4 -4
- package/dist/components/navigation/KapiTabs.js +58 -51
- package/dist/components/navigation/KapiTree.js +5 -5
- package/dist/components/overlays/KapiContextMenu.js +4 -4
- package/dist/components/overlays/KapiMenuButton.js +4 -4
- package/dist/components/overlays/KapiPhotoView.js +1 -1
- package/dist/components/overlays/KapiPopover.js +4 -4
- package/dist/components/overlays/KapiShapeSheet.js +4 -4
- package/dist/components/overlays/KapiTooltip.js +1 -1
- package/dist/css/components/chat/chat.css +1 -1
- package/dist/hooks/useControllableState.d.ts +6 -2
- package/dist/hooks/useControllableState.js +14 -11
- package/dist/hooks/useFormReset.d.ts +22 -0
- package/dist/hooks/useFormReset.js +17 -0
- package/dist/kapi.css +1 -1
- package/dist/kapi.layered.css +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -2026,6 +2026,9 @@ const { register, formState: { errors } } = useForm<Alta>();
|
|
|
2026
2026
|
o calendario no cuenta. `KapiFileUpload` sincroniza su `<input type="file">` con la lista vía
|
|
2027
2027
|
`DataTransfer`; donde no exista, arma el `FormData` con lo que emite `onChange`.
|
|
2028
2028
|
|
|
2029
|
+
El `reset` de un `<form>` nativo devuelve estos controles a su valor inicial, igual que a un campo
|
|
2030
|
+
nativo, siempre que estén **sin controlar**. Con `value` el estado es tuyo y el reset es cosa tuya.
|
|
2031
|
+
|
|
2029
2032
|
**Qué envía cada control con `name`** (inputs ocultos salvo los nativos):
|
|
2030
2033
|
|
|
2031
2034
|
| Control | Valor en el `FormData` |
|
|
@@ -2036,6 +2039,8 @@ o calendario no cuenta. `KapiFileUpload` sincroniza su `<input type="file">` con
|
|
|
2036
2039
|
| `KapiSlider` / `KapiRating` | el número |
|
|
2037
2040
|
| `KapiSegmented` | el `id` elegido (nada con `disabled`, como un campo nativo) |
|
|
2038
2041
|
| `KapiCheckbox` / `KapiSwitch` / `KapiRadio` | `value` (o `on`) solo si está marcado |
|
|
2042
|
+
| `KapiDniInput` / `KapiCuitInput` | los dígitos, sin puntos ni guiones (`12345678`, `20123456789`) |
|
|
2043
|
+
| `KapiCurrencyInput` | el número (`1234.5`), no el texto con `$` ni puntos de miles |
|
|
2039
2044
|
|
|
2040
2045
|
## Textos y locale
|
|
2041
2046
|
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode, Ref } from "react";
|
|
2
2
|
/** Qué separa un `KapiChatDivider`: un día del hilo o el corte de mensajes no leídos. */
|
|
3
|
-
export type
|
|
3
|
+
export type KapiChatDividerVariant = "day" | "unread";
|
|
4
|
+
/** @deprecated Usar `KapiChatDividerVariant`: lo que separa no es un color, y `tone` es el color. */
|
|
5
|
+
export type KapiChatDividerTone = KapiChatDividerVariant;
|
|
4
6
|
/** Atributos nativos (`className`, `style`, `id`, `data-*`…) van al `<div>` del separador. */
|
|
5
7
|
export type KapiChatDividerProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
6
8
|
/** Qué separa: un día del hilo o el corte de mensajes no leídos. @default "day" */
|
|
7
|
-
|
|
9
|
+
variant?: KapiChatDividerVariant | undefined;
|
|
10
|
+
/** Nombre anterior de `variant`, deprecado. @deprecated Usar `variant` (mismos valores). */
|
|
11
|
+
tone?: KapiChatDividerVariant | undefined;
|
|
8
12
|
/** Texto del separador (p. ej. la etiqueta de `formatDayLabel`). */
|
|
9
13
|
children: ReactNode;
|
|
10
14
|
/** Ref al `<div>`. */
|
|
11
15
|
ref?: Ref<HTMLDivElement> | undefined;
|
|
12
16
|
};
|
|
13
17
|
/** Separador de un hilo de chat: una línea con el texto centrado en una cápsula (día o "no leídos"). */
|
|
14
|
-
export declare const KapiChatDivider: ({ tone, children, ref, className, ...rest }: KapiChatDividerProps) => import("react").JSX.Element;
|
|
18
|
+
export declare const KapiChatDivider: ({ variant, tone, children, ref, className, ...rest }: KapiChatDividerProps) => import("react").JSX.Element;
|
|
@@ -4,14 +4,14 @@ import { joinClasses as e } from "../rootProps.js";
|
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/chat/KapiChatDivider.tsx
|
|
7
|
-
var n = ({
|
|
8
|
-
...
|
|
9
|
-
ref:
|
|
10
|
-
className: e("kapi-chatdiv",
|
|
11
|
-
"data-
|
|
7
|
+
var n = ({ variant: n, tone: r, children: i, ref: a, className: o, ...s }) => /* @__PURE__ */ t("div", {
|
|
8
|
+
...s,
|
|
9
|
+
ref: a,
|
|
10
|
+
className: e("kapi-chatdiv", o),
|
|
11
|
+
"data-variant": n ?? r ?? "day",
|
|
12
12
|
children: /* @__PURE__ */ t("span", {
|
|
13
13
|
className: "kapi-chatdiv__label",
|
|
14
|
-
children:
|
|
14
|
+
children: i
|
|
15
15
|
})
|
|
16
16
|
});
|
|
17
17
|
//#endregion
|
|
@@ -10,7 +10,7 @@ export { DEFAULT_CHAT_THREAD_LABELS, KapiChatThread } from "./KapiChatThread.js"
|
|
|
10
10
|
export { DEFAULT_MESSAGE_BUBBLE_LABELS, KapiMessageBubble } from "./KapiMessageBubble.js";
|
|
11
11
|
export { DEFAULT_TYPING_INDICATOR_LABELS, KapiTypingIndicator } from "./KapiTypingIndicator.js";
|
|
12
12
|
export type { KapiChatEntry, KapiChatGroupOptions, KapiChatGrouping, KapiChatMessage, KapiChatStatus } from "./chatLogic.js";
|
|
13
|
-
export type { KapiChatDividerProps, KapiChatDividerTone } from "./KapiChatDivider.js";
|
|
13
|
+
export type { KapiChatDividerProps, KapiChatDividerVariant, KapiChatDividerTone } from "./KapiChatDivider.js";
|
|
14
14
|
export type { KapiChatConversation, KapiChatListLabels, KapiChatListProps } from "./KapiChatList.js";
|
|
15
15
|
export type { KapiChatThreadLabels, KapiChatThreadProps } from "./KapiChatThread.js";
|
|
16
16
|
export type { KapiComposerLabels, KapiComposerProps } from "./KapiComposer.js";
|
|
@@ -3,8 +3,8 @@ import "#kapi-css/components/display/KapiAnnotation.css";
|
|
|
3
3
|
import { joinIds as e } from "../inputs/fieldLogic.js";
|
|
4
4
|
import { resolveKapiRoot as t } from "../../hooks/kapiRoot.js";
|
|
5
5
|
import { usePlacement as n } from "../../hooks/usePlacement.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useMergedRefs as r } from "../../hooks/mergeRefs.js";
|
|
7
|
+
import { useDismiss as i } from "../../hooks/useDismiss.js";
|
|
8
8
|
import { KapiTooltip as a } from "../overlays/KapiTooltip.js";
|
|
9
9
|
import { annotationClasses as ee, annotationRole as o } from "./annotationLogic.js";
|
|
10
10
|
/* empty css */
|
|
@@ -14,7 +14,7 @@ import { createPortal as p } from "react-dom";
|
|
|
14
14
|
//#region src/components/display/KapiAnnotation.tsx
|
|
15
15
|
var m = 8, h = 8, g = 150;
|
|
16
16
|
function _({ children: _, info: v, underline: y = "dotted", tone: b = "primary", onClick: x, popover: S, interactive: C = !1, className: w, "aria-label": T, ref: E, ...D }) {
|
|
17
|
-
let O = u(), k = d(null), A =
|
|
17
|
+
let O = u(), k = d(null), A = r(k, E), [j, M] = f(!1), [N, P] = f(!1), F = d(null), I = d(void 0), { element: L, tabIndex: R, mode: z } = o(x, S, v), B = ee({
|
|
18
18
|
underline: y,
|
|
19
19
|
tone: b,
|
|
20
20
|
clickable: !!x,
|
|
@@ -43,7 +43,7 @@ function _({ children: _, info: v, underline: y = "dotted", tone: b = "primary",
|
|
|
43
43
|
top: q.top,
|
|
44
44
|
left: q.centerX,
|
|
45
45
|
side: q.side === "top" ? "top" : "bottom"
|
|
46
|
-
} : null, Y =
|
|
46
|
+
} : null, Y = i(j && C, {
|
|
47
47
|
zones: [k, F],
|
|
48
48
|
onDismiss: (e) => {
|
|
49
49
|
if (e === "outside") return W();
|
|
@@ -6,8 +6,8 @@ import { useKapiRoot as i } from "../../hooks/kapiRoot.js";
|
|
|
6
6
|
import { onViewportChange as a } from "../../hooks/rafThrottle.js";
|
|
7
7
|
import { placementViewport as o } from "../../hooks/viewportInsetLogic.js";
|
|
8
8
|
import { resolveDirection as ee } from "../../hooks/directionLogic.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useMergedRefs as te } from "../../hooks/mergeRefs.js";
|
|
10
|
+
import { useDismiss as s } from "../../hooks/useDismiss.js";
|
|
11
11
|
/* empty css */
|
|
12
12
|
import { clampFabPosition as c, fabPanelPlacement as ne, isDragMove as re, resolveFabCorner as l } from "./fabLogic.js";
|
|
13
13
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
@@ -29,7 +29,7 @@ var v = {
|
|
|
29
29
|
let N = f((e) => {
|
|
30
30
|
let t = typeof e == "function" ? e(M.current) : e;
|
|
31
31
|
t !== M.current && (k || A(t), w?.(t));
|
|
32
|
-
}, [k, w]), P = x != null && x !== !1, F = g(null), I = g(null), L = m(), [R, z] = _(null), [ve, B] = _(!1), V = g(null), ye =
|
|
32
|
+
}, [k, w]), P = x != null && x !== !1, F = g(null), I = g(null), L = m(), [R, z] = _(null), [ve, B] = _(!1), V = g(null), ye = te(V, ge), H = g(!1), U = i(), be = e(), W = !P && y.length > 0, G = f((e) => {
|
|
33
33
|
let t = V.current;
|
|
34
34
|
if (!t) return e;
|
|
35
35
|
let n = t.getBoundingClientRect();
|
|
@@ -37,7 +37,7 @@ var v = {
|
|
|
37
37
|
width: n.width,
|
|
38
38
|
height: n.height
|
|
39
39
|
}, o(t));
|
|
40
|
-
}, []), xe =
|
|
40
|
+
}, []), xe = s(j, {
|
|
41
41
|
zones: [V],
|
|
42
42
|
outside: !(P && T),
|
|
43
43
|
onDismiss: (e) => {
|
|
@@ -4,8 +4,8 @@ import { useLabels as e } from "../locale/KapiLocaleProvider.js";
|
|
|
4
4
|
import { joinClasses as t } from "../rootProps.js";
|
|
5
5
|
import { activeElementOf as n, docOf as r } from "../../hooks/ownerDocument.js";
|
|
6
6
|
import { usePortalRootOverride as i } from "../../hooks/portalRoot.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useMergedRefs as a } from "../../hooks/mergeRefs.js";
|
|
8
|
+
import { modalStack as o } from "../overlays/modalStack.js";
|
|
9
9
|
import { getPortalRoot as s } from "../overlays/useNativeDialog.js";
|
|
10
10
|
/* empty css */
|
|
11
11
|
import { moveNode as c, raisePopover as l } from "./toastLayer.js";
|
|
@@ -33,18 +33,18 @@ var w = { close: "Cerrar" }, T = {
|
|
|
33
33
|
color: "var(--kapi-warning)"
|
|
34
34
|
}
|
|
35
35
|
}, E = (e) => e ? u.pause() : u.resume(), D = () => typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function", O = ({ closeLabel: y, labels: b, className: x, style: S, id: O, ref: k }) => {
|
|
36
|
-
let A = e("toast", w, b), j = y ?? A.close, M = v(u.subscribe, u.getSnapshot, u.getSnapshot), N = g(null), P =
|
|
36
|
+
let A = e("toast", w, b), j = y ?? A.close, M = v(u.subscribe, u.getSnapshot, u.getSnapshot), N = g(null), P = a(N, k), F = i(), [I, L] = _(null);
|
|
37
37
|
m(() => {
|
|
38
38
|
let e = r(F);
|
|
39
39
|
if (!e) return;
|
|
40
40
|
let t = e.createElement("div");
|
|
41
41
|
t.className = "kapi-toasts-host", t.style.display = "contents";
|
|
42
42
|
let n = () => {
|
|
43
|
-
let n =
|
|
43
|
+
let n = o.topOf(e) ?? F ?? s();
|
|
44
44
|
n && (c(t, n), N.current && l(N.current));
|
|
45
45
|
};
|
|
46
46
|
n(), L(t);
|
|
47
|
-
let i =
|
|
47
|
+
let i = o.subscribe(n);
|
|
48
48
|
return () => {
|
|
49
49
|
i(), t.remove();
|
|
50
50
|
};
|
|
@@ -7,8 +7,8 @@ import { usePortalRootOverride as a } from "../../hooks/portalRoot.js";
|
|
|
7
7
|
import { useKapiRoot as o } from "../../hooks/kapiRoot.js";
|
|
8
8
|
import { onViewportChange as s } from "../../hooks/rafThrottle.js";
|
|
9
9
|
import { usePlacement as c } from "../../hooks/usePlacement.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useMergedRefs as l } from "../../hooks/mergeRefs.js";
|
|
11
|
+
import { useDismiss as u } from "../../hooks/useDismiss.js";
|
|
12
12
|
import { trapTabKey as d } from "../../hooks/focusLogic.js";
|
|
13
13
|
/* empty css */
|
|
14
14
|
import { TOUR_PLACEMENT as f, filterAvailableSteps as p, highlightBox as m, markTourSeen as h } from "./tourLogic.js";
|
|
@@ -23,7 +23,7 @@ var T = {
|
|
|
23
23
|
close: "Cerrar",
|
|
24
24
|
of: "de"
|
|
25
25
|
}, E = ({ steps: E, open: D, onClose: O, markSeen: k, labels: A, className: ee, style: te, id: j, ref: M }) => {
|
|
26
|
-
let N = e("tour", T, A), P = a(), F = o(), I = P ?? F, L = (e) => (r(I) ?? document).querySelector(e), [R, z] = C([]), [B, V] = C(0), [H, U] = C(null), W = S(null), G =
|
|
26
|
+
let N = e("tour", T, A), P = a(), F = o(), I = P ?? F, L = (e) => (r(I) ?? document).querySelector(e), [R, z] = C([]), [B, V] = C(0), [H, U] = C(null), W = S(null), G = l(W, M), K = b(), q = v(() => {
|
|
27
27
|
k && h(typeof k == "string" ? k : void 0), O();
|
|
28
28
|
}, [k, O]), J = E.map((e) => e.element).join("|"), Y = S(E);
|
|
29
29
|
Y.current = E, y(() => {
|
|
@@ -77,7 +77,7 @@ var T = {
|
|
|
77
77
|
});
|
|
78
78
|
if (x(() => {
|
|
79
79
|
X && Q();
|
|
80
|
-
}, [X, Q]),
|
|
80
|
+
}, [X, Q]), u(!!X, {
|
|
81
81
|
zones: [W],
|
|
82
82
|
outside: !1,
|
|
83
83
|
onDismiss: q
|
|
@@ -1,161 +1,163 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "#kapi-css/components/inputs/KapiDatePicker.css";
|
|
3
|
-
import { assignRef as e, fieldControlProps as t, focusLeaves as n, resolveReadOnly as
|
|
4
|
-
import { useOwnField as
|
|
5
|
-
import { useKapiLocale as
|
|
6
|
-
import { resolveChipLabel as
|
|
7
|
-
import { useControllableState as
|
|
8
|
-
import { activeHTMLElementOf as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { assignRef as e, fieldControlProps as t, focusLeaves as n, resolveReadOnly as r } from "./fieldLogic.js";
|
|
4
|
+
import { useOwnField as ee } from "./ownField.js";
|
|
5
|
+
import { useKapiLocale as te, useLabels as ne } from "../locale/KapiLocaleProvider.js";
|
|
6
|
+
import { resolveChipLabel as re } from "./selectLogic.js";
|
|
7
|
+
import { useControllableState as ie } from "../../hooks/useControllableState.js";
|
|
8
|
+
import { activeHTMLElementOf as ae } from "../../hooks/ownerDocument.js";
|
|
9
|
+
import { useFormReset as oe } from "../../hooks/useFormReset.js";
|
|
10
|
+
import { useMergedRefs as se } from "../../hooks/mergeRefs.js";
|
|
11
|
+
import { useOutsidePress as ce } from "../../hooks/useOutsidePress.js";
|
|
12
|
+
import { chipFieldSize as le, datePatternFor as ue, formDateValue as de, formatValue as i, hasCalendar as fe, hasTime as pe, localizedCalendarLabels as me, maskInput as he, minuteOptions as ge, monthTitle as _e, pad as a, parseText as ve, pickerIsChip as ye, sameDay as o, validDateOrNull as s } from "./datePickerLogic.js";
|
|
11
13
|
/* empty css */
|
|
12
|
-
import { KapiCalendarGrid as
|
|
13
|
-
import { useCalendarFocus as
|
|
14
|
-
import { useDatePopSide as
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { useId as
|
|
17
|
-
import { Calendar as
|
|
14
|
+
import { KapiCalendarGrid as be } from "./KapiCalendarGrid.js";
|
|
15
|
+
import { useCalendarFocus as xe } from "./useCalendarFocus.js";
|
|
16
|
+
import { useDatePopSide as Se } from "./useDatePopSide.js";
|
|
17
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
18
|
+
import { useId as Ce, useMemo as we, useRef as u, useState as d } from "react";
|
|
19
|
+
import { Calendar as Te, ChevronLeft as Ee, ChevronRight as De, Clock as Oe } from "lucide-react";
|
|
18
20
|
//#region src/components/inputs/KapiDatePicker.tsx
|
|
19
|
-
var
|
|
20
|
-
let
|
|
21
|
-
variant:
|
|
22
|
-
icon:
|
|
23
|
-
chipLabel:
|
|
24
|
-
label:
|
|
25
|
-
}), { chipLabel:
|
|
26
|
-
chip:
|
|
27
|
-
chipLabel:
|
|
28
|
-
label:
|
|
29
|
-
}),
|
|
21
|
+
var ke = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t, Ae = Array.from({ length: 24 }, (e, t) => t), f = ({ mode: f = "date", value: p, defaultValue: je, onChange: Me, placeholder: Ne, variant: Pe, icon: m, chipLabel: h, label: g, help: Fe, fieldClassName: _, readOnly: v, disabled: y = !1, id: b, name: x, className: Ie, style: Le, "aria-label": Re, labels: ze, minuteStep: Be = 1, invalid: S, required: C, ref: Ve, onBlur: He, weekStartsOn: Ue }) => {
|
|
22
|
+
let w = te(), T = ne("calendar", me(w), ze), E = we(() => ue(w), [w]), D = fe(f), O = pe(f), k = ye({
|
|
23
|
+
variant: Pe,
|
|
24
|
+
icon: m,
|
|
25
|
+
chipLabel: h,
|
|
26
|
+
label: g
|
|
27
|
+
}), { chipLabel: A, fieldLabel: We } = re({
|
|
28
|
+
chip: k,
|
|
29
|
+
chipLabel: h,
|
|
30
|
+
label: g
|
|
31
|
+
}), j = ee({
|
|
30
32
|
id: b,
|
|
31
|
-
label:
|
|
32
|
-
help:
|
|
33
|
-
required:
|
|
34
|
-
invalid:
|
|
33
|
+
label: We,
|
|
34
|
+
help: Fe,
|
|
35
|
+
required: C,
|
|
36
|
+
invalid: S,
|
|
35
37
|
readOnly: v,
|
|
36
|
-
fieldClassName:
|
|
37
|
-
}),
|
|
38
|
-
(
|
|
39
|
-
let e =
|
|
40
|
-
e &&
|
|
38
|
+
fieldClassName: _
|
|
39
|
+
}), M = j.field, N = r(v, M), P = Ne ?? ke(f, E.placeholder), Ge = Ce(), F = b ?? M?.controlId ?? (k ? Ge : void 0), [I, L] = d(!1), Ke = p !== void 0, [R, qe, , Je] = ie(p === void 0 ? void 0 : s(p), s(je ?? null), Me), [z, B] = d(() => i(R, f, E)), [V, H] = d(() => R ?? /* @__PURE__ */ new Date()), U = u(null), Ye = se(U, oe(Je)), W = u(null), G = u(null), { inputRef: Xe, focusRequest: Ze, openFromKeyboard: K, openFromFocus: Qe, returnFocus: q } = xe(L), J = R ? R.getTime() : null, [$e, et] = d(J), [tt, Y] = d(f), [nt, rt] = d(E);
|
|
40
|
+
($e !== J || tt !== f || nt !== E) && (et(J), Y(f), rt(E), B(i(R, f, E)), R && H(R)), ce(I, [U], () => {
|
|
41
|
+
let e = ae(U.current);
|
|
42
|
+
e && G.current?.contains(e) && e.blur(), L(!1);
|
|
41
43
|
});
|
|
42
44
|
let X = (e) => {
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
if (!
|
|
46
|
-
|
|
45
|
+
qe(e), B(i(Ke ? R : e, f, E));
|
|
46
|
+
}, it = () => {
|
|
47
|
+
if (!z.trim()) {
|
|
48
|
+
R && X(null);
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
49
|
-
let e =
|
|
50
|
-
e === void 0 ?
|
|
51
|
+
let e = ve(z, f, R, /* @__PURE__ */ new Date(), E);
|
|
52
|
+
e === void 0 ? B(i(R, f, E)) : (e && R && e.getTime() === R.getTime() ? B(i(e, f, E)) : X(e), e && H(e));
|
|
51
53
|
}, Z = (e) => {
|
|
52
|
-
let t =
|
|
53
|
-
|
|
54
|
+
let t = R ?? /* @__PURE__ */ new Date(), n = new Date(e);
|
|
55
|
+
O && n.setHours(t.getHours(), t.getMinutes()), X(n), O || q();
|
|
54
56
|
}, Q = (e, t) => {
|
|
55
|
-
let n = new Date(
|
|
57
|
+
let n = new Date(R ?? /* @__PURE__ */ new Date());
|
|
56
58
|
e != null && n.setHours(e), t != null && n.setMinutes(t), X(n);
|
|
57
|
-
}, $ = (e) =>
|
|
58
|
-
return
|
|
59
|
+
}, $ = (e) => H(new Date(V.getFullYear(), V.getMonth() + e, 1)), at = Se(I && !y && !N, W, G);
|
|
60
|
+
return j.wrap(/* @__PURE__ */ l("div", {
|
|
59
61
|
className: [
|
|
60
62
|
"kapi-dp",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
k && "kapi-dp--chip",
|
|
64
|
+
N && "kapi-dp--readonly",
|
|
65
|
+
Ie
|
|
64
66
|
].filter(Boolean).join(" "),
|
|
65
|
-
style:
|
|
66
|
-
ref:
|
|
67
|
+
style: Le,
|
|
68
|
+
ref: Ye,
|
|
67
69
|
onBlur: (e) => {
|
|
68
|
-
n(e.relatedTarget, e.currentTarget) &&
|
|
70
|
+
n(e.relatedTarget, e.currentTarget) && He?.(e);
|
|
69
71
|
},
|
|
70
72
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
className: ["kapi-dp__field",
|
|
73
|
-
ref:
|
|
73
|
+
/* @__PURE__ */ l("div", {
|
|
74
|
+
className: ["kapi-dp__field", k && "kapi-filterchip"].filter(Boolean).join(" "),
|
|
75
|
+
ref: W,
|
|
74
76
|
children: [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
k && m,
|
|
78
|
+
A && /* @__PURE__ */ l("label", {
|
|
77
79
|
className: "kapi-dp__label",
|
|
78
|
-
htmlFor:
|
|
79
|
-
children: [
|
|
80
|
+
htmlFor: F,
|
|
81
|
+
children: [A, ":"]
|
|
80
82
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ c("input", {
|
|
82
84
|
ref: (t) => {
|
|
83
|
-
|
|
85
|
+
Xe.current = t, e(Ve, t);
|
|
84
86
|
},
|
|
85
|
-
...t(
|
|
86
|
-
id:
|
|
87
|
-
invalid:
|
|
88
|
-
required:
|
|
87
|
+
...t(M, {
|
|
88
|
+
id: F,
|
|
89
|
+
invalid: S,
|
|
90
|
+
required: C
|
|
89
91
|
}),
|
|
90
|
-
...
|
|
92
|
+
...k ? { size: le(P) } : {},
|
|
91
93
|
className: "kapi-input kapi-dp__input",
|
|
92
|
-
value:
|
|
93
|
-
placeholder:
|
|
94
|
+
value: z,
|
|
95
|
+
placeholder: P,
|
|
94
96
|
disabled: y,
|
|
95
|
-
readOnly:
|
|
96
|
-
"aria-label":
|
|
97
|
+
readOnly: N || void 0,
|
|
98
|
+
"aria-label": Re,
|
|
97
99
|
autoComplete: "off",
|
|
98
100
|
inputMode: "numeric",
|
|
99
|
-
onChange: (e) =>
|
|
100
|
-
onFocus:
|
|
101
|
-
onBlur:
|
|
101
|
+
onChange: (e) => B(he(e.target.value, f, E)),
|
|
102
|
+
onFocus: N ? void 0 : Qe,
|
|
103
|
+
onBlur: it,
|
|
102
104
|
onKeyDown: (e) => {
|
|
103
|
-
e.key === "Escape" &&
|
|
105
|
+
e.key === "Escape" && I && (e.preventDefault(), e.stopPropagation(), L(!1)), e.key === "ArrowDown" && D && !N && (e.preventDefault(), K());
|
|
104
106
|
}
|
|
105
107
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ c("button", {
|
|
107
109
|
type: "button",
|
|
108
110
|
className: "kapi-dp__toggle",
|
|
109
|
-
disabled: y ||
|
|
110
|
-
"aria-label":
|
|
111
|
-
"aria-expanded":
|
|
112
|
-
onClick: () =>
|
|
113
|
-
children:
|
|
111
|
+
disabled: y || N,
|
|
112
|
+
"aria-label": T.openPicker,
|
|
113
|
+
"aria-expanded": I,
|
|
114
|
+
onClick: () => I ? L(!1) : K(),
|
|
115
|
+
children: c(D ? Te : Oe, {
|
|
114
116
|
size: 16,
|
|
115
117
|
strokeWidth: 1.9
|
|
116
118
|
})
|
|
117
119
|
})
|
|
118
120
|
]
|
|
119
121
|
}),
|
|
120
|
-
x && /* @__PURE__ */
|
|
122
|
+
x && /* @__PURE__ */ c("input", {
|
|
121
123
|
type: "hidden",
|
|
122
124
|
name: x,
|
|
123
|
-
value:
|
|
125
|
+
value: de(R, f),
|
|
124
126
|
disabled: y
|
|
125
127
|
}),
|
|
126
|
-
|
|
127
|
-
ref:
|
|
128
|
-
className: `kapi-dp__pop${
|
|
128
|
+
I && !y && !N && /* @__PURE__ */ l("div", {
|
|
129
|
+
ref: G,
|
|
130
|
+
className: `kapi-dp__pop${at === "top" ? " kapi-dp__pop--up" : ""}`,
|
|
129
131
|
onKeyDown: (e) => {
|
|
130
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
132
|
+
e.key === "Escape" && (e.preventDefault(), q());
|
|
131
133
|
},
|
|
132
|
-
children: [
|
|
134
|
+
children: [D && /* @__PURE__ */ l("div", {
|
|
133
135
|
className: "kapi-dp__cal",
|
|
134
136
|
children: [
|
|
135
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ l("div", {
|
|
136
138
|
className: "kapi-dp__head",
|
|
137
139
|
children: [
|
|
138
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ c("button", {
|
|
139
141
|
type: "button",
|
|
140
142
|
className: "kapi-dp__nav",
|
|
141
|
-
"aria-label":
|
|
143
|
+
"aria-label": T.prevMonth,
|
|
142
144
|
onClick: () => $(-1),
|
|
143
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ c(Ee, {
|
|
144
146
|
className: "kapi-flip-rtl",
|
|
145
147
|
size: 15,
|
|
146
148
|
strokeWidth: 2.2
|
|
147
149
|
})
|
|
148
150
|
}),
|
|
149
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ c("span", {
|
|
150
152
|
className: "kapi-dp__title",
|
|
151
|
-
children:
|
|
153
|
+
children: _e(V, T.months)
|
|
152
154
|
}),
|
|
153
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ c("button", {
|
|
154
156
|
type: "button",
|
|
155
157
|
className: "kapi-dp__nav",
|
|
156
|
-
"aria-label":
|
|
158
|
+
"aria-label": T.nextMonth,
|
|
157
159
|
onClick: () => $(1),
|
|
158
|
-
children: /* @__PURE__ */
|
|
160
|
+
children: /* @__PURE__ */ c(De, {
|
|
159
161
|
className: "kapi-flip-rtl",
|
|
160
162
|
size: 15,
|
|
161
163
|
strokeWidth: 2.2
|
|
@@ -163,56 +165,56 @@ var Ee = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
163
165
|
})
|
|
164
166
|
]
|
|
165
167
|
}),
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
weekStartsOn:
|
|
168
|
-
view:
|
|
169
|
-
onViewChange:
|
|
170
|
-
labels:
|
|
171
|
-
focusTarget:
|
|
172
|
-
focusRequest:
|
|
173
|
-
isSelected: (e) =>
|
|
174
|
-
dayClassName: (e) =>
|
|
168
|
+
/* @__PURE__ */ c(be, {
|
|
169
|
+
weekStartsOn: Ue,
|
|
170
|
+
view: V,
|
|
171
|
+
onViewChange: H,
|
|
172
|
+
labels: T,
|
|
173
|
+
focusTarget: R,
|
|
174
|
+
focusRequest: Ze,
|
|
175
|
+
isSelected: (e) => o(e, R),
|
|
176
|
+
dayClassName: (e) => o(e, R) && "kapi-dp__day--sel",
|
|
175
177
|
onPick: Z
|
|
176
178
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ l("div", {
|
|
178
180
|
className: "kapi-dp__foot",
|
|
179
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ c("button", {
|
|
180
182
|
type: "button",
|
|
181
183
|
className: "kapi-dp__link",
|
|
182
184
|
onClick: () => {
|
|
183
|
-
X(null),
|
|
185
|
+
X(null), L(!1);
|
|
184
186
|
},
|
|
185
|
-
children:
|
|
186
|
-
}), /* @__PURE__ */
|
|
187
|
+
children: T.clear
|
|
188
|
+
}), /* @__PURE__ */ c("button", {
|
|
187
189
|
type: "button",
|
|
188
190
|
className: "kapi-dp__link",
|
|
189
191
|
onClick: () => {
|
|
190
192
|
let e = /* @__PURE__ */ new Date();
|
|
191
|
-
e.setHours(0, 0, 0, 0),
|
|
193
|
+
e.setHours(0, 0, 0, 0), H(e), Z(e);
|
|
192
194
|
},
|
|
193
|
-
children:
|
|
195
|
+
children: T.today
|
|
194
196
|
})]
|
|
195
197
|
})
|
|
196
198
|
]
|
|
197
|
-
}),
|
|
199
|
+
}), O && /* @__PURE__ */ c("div", {
|
|
198
200
|
className: "kapi-dp__time",
|
|
199
|
-
children: /* @__PURE__ */
|
|
201
|
+
children: /* @__PURE__ */ l("div", {
|
|
200
202
|
className: "kapi-dp__time-cols",
|
|
201
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ c("div", {
|
|
202
204
|
className: "kapi-dp__time-col",
|
|
203
|
-
children:
|
|
205
|
+
children: Ae.map((e) => /* @__PURE__ */ c("button", {
|
|
204
206
|
type: "button",
|
|
205
|
-
className: `kapi-dp__time-opt${
|
|
207
|
+
className: `kapi-dp__time-opt${R?.getHours() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
206
208
|
onClick: () => Q(e, null),
|
|
207
|
-
children:
|
|
209
|
+
children: a(e)
|
|
208
210
|
}, e))
|
|
209
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ c("div", {
|
|
210
212
|
className: "kapi-dp__time-col",
|
|
211
|
-
children:
|
|
213
|
+
children: ge(Be, R?.getMinutes()).map((e) => /* @__PURE__ */ c("button", {
|
|
212
214
|
type: "button",
|
|
213
|
-
className: `kapi-dp__time-opt${
|
|
215
|
+
className: `kapi-dp__time-opt${R?.getMinutes() === e ? " kapi-dp__time-opt--sel" : ""}`,
|
|
214
216
|
onClick: () => Q(null, e),
|
|
215
|
-
children:
|
|
217
|
+
children: a(e)
|
|
216
218
|
}, e))
|
|
217
219
|
})]
|
|
218
220
|
})
|
|
@@ -222,4 +224,4 @@ var Ee = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t,
|
|
|
222
224
|
}));
|
|
223
225
|
};
|
|
224
226
|
//#endregion
|
|
225
|
-
export {
|
|
227
|
+
export { f as KapiDatePicker };
|