@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.
Files changed (40) hide show
  1. package/README.md +5 -0
  2. package/dist/components/chat/KapiChatDivider.d.ts +7 -3
  3. package/dist/components/chat/KapiChatDivider.js +6 -6
  4. package/dist/components/chat/index.d.ts +1 -1
  5. package/dist/components/display/KapiAnnotation.js +4 -4
  6. package/dist/components/feedback/KapiFab.js +4 -4
  7. package/dist/components/feedback/KapiToastContainer.js +5 -5
  8. package/dist/components/feedback/KapiTour.js +4 -4
  9. package/dist/components/inputs/KapiDatePicker.js +124 -122
  10. package/dist/components/inputs/KapiDateRangePicker.js +138 -136
  11. package/dist/components/inputs/KapiFacetedSearch.js +8 -8
  12. package/dist/components/inputs/KapiMaskedInput.d.ts +8 -3
  13. package/dist/components/inputs/KapiMaskedInput.js +66 -53
  14. package/dist/components/inputs/KapiNumberStepper.js +29 -29
  15. package/dist/components/inputs/KapiRating.js +61 -59
  16. package/dist/components/inputs/KapiSegmented.js +68 -58
  17. package/dist/components/inputs/KapiSelect.js +204 -194
  18. package/dist/components/inputs/KapiTagInput.js +82 -80
  19. package/dist/components/inputs/misuseWarnings.d.ts +37 -0
  20. package/dist/components/inputs/misuseWarnings.js +36 -0
  21. package/dist/components/inputs/numberStepLogic.d.ts +10 -0
  22. package/dist/components/inputs/numberStepLogic.js +16 -7
  23. package/dist/components/layout/KapiAccountMenu.js +4 -4
  24. package/dist/components/navigation/CtxSlidingList.js +4 -4
  25. package/dist/components/navigation/KapiTabs.js +58 -51
  26. package/dist/components/navigation/KapiTree.js +5 -5
  27. package/dist/components/overlays/KapiContextMenu.js +4 -4
  28. package/dist/components/overlays/KapiMenuButton.js +4 -4
  29. package/dist/components/overlays/KapiPhotoView.js +1 -1
  30. package/dist/components/overlays/KapiPopover.js +4 -4
  31. package/dist/components/overlays/KapiShapeSheet.js +4 -4
  32. package/dist/components/overlays/KapiTooltip.js +1 -1
  33. package/dist/css/components/chat/chat.css +1 -1
  34. package/dist/hooks/useControllableState.d.ts +6 -2
  35. package/dist/hooks/useControllableState.js +14 -11
  36. package/dist/hooks/useFormReset.d.ts +22 -0
  37. package/dist/hooks/useFormReset.js +17 -0
  38. package/dist/kapi.css +1 -1
  39. package/dist/kapi.layered.css +1 -1
  40. 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 KapiChatDividerTone = "day" | "unread";
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
- tone?: KapiChatDividerTone | undefined;
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 = ({ tone: n = "day", children: r, ref: i, className: a, ...o }) => /* @__PURE__ */ t("div", {
8
- ...o,
9
- ref: i,
10
- className: e("kapi-chatdiv", a),
11
- "data-tone": n,
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: r
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 { useDismiss as r } from "../../hooks/useDismiss.js";
7
- import { useMergedRefs as i } from "../../hooks/mergeRefs.js";
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 = i(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({
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 = r(j && C, {
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 { useDismiss as te } from "../../hooks/useDismiss.js";
10
- import { useMergedRefs as s } from "../../hooks/mergeRefs.js";
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 = s(V, ge), H = g(!1), U = i(), be = e(), W = !P && y.length > 0, G = f((e) => {
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 = te(j, {
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 { modalStack as a } from "../overlays/modalStack.js";
8
- import { useMergedRefs as o } from "../../hooks/mergeRefs.js";
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 = o(N, k), F = i(), [I, L] = _(null);
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 = a.topOf(e) ?? F ?? s();
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 = a.subscribe(n);
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 { useDismiss as l } from "../../hooks/useDismiss.js";
11
- import { useMergedRefs as u } from "../../hooks/mergeRefs.js";
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 = u(W, M), K = b(), q = v(() => {
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]), l(!!X, {
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 ee } from "./fieldLogic.js";
4
- import { useOwnField as te } from "./ownField.js";
5
- import { useKapiLocale as ne, useLabels as re } from "../locale/KapiLocaleProvider.js";
6
- import { resolveChipLabel as ie } from "./selectLogic.js";
7
- import { useControllableState as ae } from "../../hooks/useControllableState.js";
8
- import { activeHTMLElementOf as oe } from "../../hooks/ownerDocument.js";
9
- import { useOutsidePress as se } from "../../hooks/useOutsidePress.js";
10
- import { chipFieldSize as ce, datePatternFor as le, formDateValue as ue, formatValue as r, hasCalendar as de, hasTime as fe, localizedCalendarLabels as i, maskInput as a, minuteOptions as pe, monthTitle as me, pad as o, parseText as he, pickerIsChip as ge, sameDay as s, validDateOrNull as c } from "./datePickerLogic.js";
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 _e } from "./KapiCalendarGrid.js";
13
- import { useCalendarFocus as ve } from "./useCalendarFocus.js";
14
- import { useDatePopSide as ye } from "./useDatePopSide.js";
15
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
16
- import { useId as be, useMemo as xe, useRef as d, useState as f } from "react";
17
- import { Calendar as Se, ChevronLeft as Ce, ChevronRight as we, Clock as Te } from "lucide-react";
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 Ee = (e, t) => e === "time" ? "hh:mm" : e === "datetime" ? `${t} hh:mm` : t, De = Array.from({ length: 24 }, (e, t) => t), p = ({ mode: p = "date", value: m, defaultValue: Oe, onChange: ke, placeholder: Ae, variant: je, icon: h, chipLabel: g, label: _, help: Me, fieldClassName: Ne, readOnly: v, disabled: y = !1, id: b, name: x, className: Pe, style: Fe, "aria-label": Ie, labels: S, minuteStep: Le = 1, invalid: C, required: w, ref: Re, onBlur: ze, weekStartsOn: Be }) => {
20
- let T = ne(), E = re("calendar", i(T), S), D = xe(() => le(T), [T]), O = de(p), k = fe(p), A = ge({
21
- variant: je,
22
- icon: h,
23
- chipLabel: g,
24
- label: _
25
- }), { chipLabel: j, fieldLabel: Ve } = ie({
26
- chip: A,
27
- chipLabel: g,
28
- label: _
29
- }), M = te({
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: Ve,
32
- help: Me,
33
- required: w,
34
- invalid: C,
33
+ label: We,
34
+ help: Fe,
35
+ required: C,
36
+ invalid: S,
35
37
  readOnly: v,
36
- fieldClassName: Ne
37
- }), N = M.field, P = ee(v, N), F = Ae ?? Ee(p, D.placeholder), He = be(), I = b ?? N?.controlId ?? (A ? He : void 0), [L, R] = f(!1), Ue = m !== void 0, [z, We] = ae(m === void 0 ? void 0 : c(m), c(Oe ?? null), ke), [B, V] = f(() => r(z, p, D)), [H, U] = f(() => z ?? /* @__PURE__ */ new Date()), W = d(null), G = d(null), K = d(null), { inputRef: Ge, focusRequest: Ke, openFromKeyboard: q, openFromFocus: qe, returnFocus: J } = ve(R), Y = z ? z.getTime() : null, [Je, Ye] = f(Y), [Xe, Ze] = f(p), [Qe, $e] = f(D);
38
- (Je !== Y || Xe !== p || Qe !== D) && (Ye(Y), Ze(p), $e(D), V(r(z, p, D)), z && U(z)), se(L, [W], () => {
39
- let e = oe(W.current);
40
- e && K.current?.contains(e) && e.blur(), R(!1);
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
- We(e), V(r(Ue ? z : e, p, D));
44
- }, et = () => {
45
- if (!B.trim()) {
46
- z && X(null);
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 = he(B, p, z, /* @__PURE__ */ new Date(), D);
50
- e === void 0 ? V(r(z, p, D)) : (e && z && e.getTime() === z.getTime() ? V(r(e, p, D)) : X(e), e && U(e));
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 = z ?? /* @__PURE__ */ new Date(), n = new Date(e);
53
- k && n.setHours(t.getHours(), t.getMinutes()), X(n), k || J();
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(z ?? /* @__PURE__ */ 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) => U(new Date(H.getFullYear(), H.getMonth() + e, 1)), tt = ye(L && !y && !P, G, K);
58
- return M.wrap(/* @__PURE__ */ u("div", {
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
- A && "kapi-dp--chip",
62
- P && "kapi-dp--readonly",
63
- Pe
63
+ k && "kapi-dp--chip",
64
+ N && "kapi-dp--readonly",
65
+ Ie
64
66
  ].filter(Boolean).join(" "),
65
- style: Fe,
66
- ref: W,
67
+ style: Le,
68
+ ref: Ye,
67
69
  onBlur: (e) => {
68
- n(e.relatedTarget, e.currentTarget) && ze?.(e);
70
+ n(e.relatedTarget, e.currentTarget) && He?.(e);
69
71
  },
70
72
  children: [
71
- /* @__PURE__ */ u("div", {
72
- className: ["kapi-dp__field", A && "kapi-filterchip"].filter(Boolean).join(" "),
73
- ref: G,
73
+ /* @__PURE__ */ l("div", {
74
+ className: ["kapi-dp__field", k && "kapi-filterchip"].filter(Boolean).join(" "),
75
+ ref: W,
74
76
  children: [
75
- A && h,
76
- j && /* @__PURE__ */ u("label", {
77
+ k && m,
78
+ A && /* @__PURE__ */ l("label", {
77
79
  className: "kapi-dp__label",
78
- htmlFor: I,
79
- children: [j, ":"]
80
+ htmlFor: F,
81
+ children: [A, ":"]
80
82
  }),
81
- /* @__PURE__ */ l("input", {
83
+ /* @__PURE__ */ c("input", {
82
84
  ref: (t) => {
83
- Ge.current = t, e(Re, t);
85
+ Xe.current = t, e(Ve, t);
84
86
  },
85
- ...t(N, {
86
- id: I,
87
- invalid: C,
88
- required: w
87
+ ...t(M, {
88
+ id: F,
89
+ invalid: S,
90
+ required: C
89
91
  }),
90
- ...A ? { size: ce(F) } : {},
92
+ ...k ? { size: le(P) } : {},
91
93
  className: "kapi-input kapi-dp__input",
92
- value: B,
93
- placeholder: F,
94
+ value: z,
95
+ placeholder: P,
94
96
  disabled: y,
95
- readOnly: P || void 0,
96
- "aria-label": Ie,
97
+ readOnly: N || void 0,
98
+ "aria-label": Re,
97
99
  autoComplete: "off",
98
100
  inputMode: "numeric",
99
- onChange: (e) => V(a(e.target.value, p, D)),
100
- onFocus: P ? void 0 : qe,
101
- onBlur: et,
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" && L && (e.preventDefault(), e.stopPropagation(), R(!1)), e.key === "ArrowDown" && O && !P && (e.preventDefault(), q());
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__ */ l("button", {
108
+ /* @__PURE__ */ c("button", {
107
109
  type: "button",
108
110
  className: "kapi-dp__toggle",
109
- disabled: y || P,
110
- "aria-label": E.openPicker,
111
- "aria-expanded": L,
112
- onClick: () => L ? R(!1) : q(),
113
- children: l(O ? Se : Te, {
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__ */ l("input", {
122
+ x && /* @__PURE__ */ c("input", {
121
123
  type: "hidden",
122
124
  name: x,
123
- value: ue(z, p),
125
+ value: de(R, f),
124
126
  disabled: y
125
127
  }),
126
- L && !y && !P && /* @__PURE__ */ u("div", {
127
- ref: K,
128
- className: `kapi-dp__pop${tt === "top" ? " kapi-dp__pop--up" : ""}`,
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(), J());
132
+ e.key === "Escape" && (e.preventDefault(), q());
131
133
  },
132
- children: [O && /* @__PURE__ */ u("div", {
134
+ children: [D && /* @__PURE__ */ l("div", {
133
135
  className: "kapi-dp__cal",
134
136
  children: [
135
- /* @__PURE__ */ u("div", {
137
+ /* @__PURE__ */ l("div", {
136
138
  className: "kapi-dp__head",
137
139
  children: [
138
- /* @__PURE__ */ l("button", {
140
+ /* @__PURE__ */ c("button", {
139
141
  type: "button",
140
142
  className: "kapi-dp__nav",
141
- "aria-label": E.prevMonth,
143
+ "aria-label": T.prevMonth,
142
144
  onClick: () => $(-1),
143
- children: /* @__PURE__ */ l(Ce, {
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__ */ l("span", {
151
+ /* @__PURE__ */ c("span", {
150
152
  className: "kapi-dp__title",
151
- children: me(H, E.months)
153
+ children: _e(V, T.months)
152
154
  }),
153
- /* @__PURE__ */ l("button", {
155
+ /* @__PURE__ */ c("button", {
154
156
  type: "button",
155
157
  className: "kapi-dp__nav",
156
- "aria-label": E.nextMonth,
158
+ "aria-label": T.nextMonth,
157
159
  onClick: () => $(1),
158
- children: /* @__PURE__ */ l(we, {
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__ */ l(_e, {
167
- weekStartsOn: Be,
168
- view: H,
169
- onViewChange: U,
170
- labels: E,
171
- focusTarget: z,
172
- focusRequest: Ke,
173
- isSelected: (e) => s(e, z),
174
- dayClassName: (e) => s(e, z) && "kapi-dp__day--sel",
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__ */ u("div", {
179
+ /* @__PURE__ */ l("div", {
178
180
  className: "kapi-dp__foot",
179
- children: [/* @__PURE__ */ l("button", {
181
+ children: [/* @__PURE__ */ c("button", {
180
182
  type: "button",
181
183
  className: "kapi-dp__link",
182
184
  onClick: () => {
183
- X(null), R(!1);
185
+ X(null), L(!1);
184
186
  },
185
- children: E.clear
186
- }), /* @__PURE__ */ l("button", {
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), U(e), Z(e);
193
+ e.setHours(0, 0, 0, 0), H(e), Z(e);
192
194
  },
193
- children: E.today
195
+ children: T.today
194
196
  })]
195
197
  })
196
198
  ]
197
- }), k && /* @__PURE__ */ l("div", {
199
+ }), O && /* @__PURE__ */ c("div", {
198
200
  className: "kapi-dp__time",
199
- children: /* @__PURE__ */ u("div", {
201
+ children: /* @__PURE__ */ l("div", {
200
202
  className: "kapi-dp__time-cols",
201
- children: [/* @__PURE__ */ l("div", {
203
+ children: [/* @__PURE__ */ c("div", {
202
204
  className: "kapi-dp__time-col",
203
- children: De.map((e) => /* @__PURE__ */ l("button", {
205
+ children: Ae.map((e) => /* @__PURE__ */ c("button", {
204
206
  type: "button",
205
- className: `kapi-dp__time-opt${z?.getHours() === e ? " kapi-dp__time-opt--sel" : ""}`,
207
+ className: `kapi-dp__time-opt${R?.getHours() === e ? " kapi-dp__time-opt--sel" : ""}`,
206
208
  onClick: () => Q(e, null),
207
- children: o(e)
209
+ children: a(e)
208
210
  }, e))
209
- }), /* @__PURE__ */ l("div", {
211
+ }), /* @__PURE__ */ c("div", {
210
212
  className: "kapi-dp__time-col",
211
- children: pe(Le, z?.getMinutes()).map((e) => /* @__PURE__ */ l("button", {
213
+ children: ge(Be, R?.getMinutes()).map((e) => /* @__PURE__ */ c("button", {
212
214
  type: "button",
213
- className: `kapi-dp__time-opt${z?.getMinutes() === e ? " kapi-dp__time-opt--sel" : ""}`,
215
+ className: `kapi-dp__time-opt${R?.getMinutes() === e ? " kapi-dp__time-opt--sel" : ""}`,
214
216
  onClick: () => Q(null, e),
215
- children: o(e)
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 { p as KapiDatePicker };
227
+ export { f as KapiDatePicker };