@g4rcez/components 0.0.34 → 0.0.35

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 (58) hide show
  1. package/dist/components/core/button.d.ts.map +1 -1
  2. package/dist/components/core/resizable.d.ts.map +1 -1
  3. package/dist/components/core/resizable.js +21 -18
  4. package/dist/components/core/tag.d.ts +5 -1
  5. package/dist/components/core/tag.d.ts.map +1 -1
  6. package/dist/components/core/tag.js +20 -7
  7. package/dist/components/display/calendar.d.ts +39 -8
  8. package/dist/components/display/calendar.d.ts.map +1 -1
  9. package/dist/components/display/calendar.js +111 -53
  10. package/dist/components/display/list.d.ts.map +1 -1
  11. package/dist/components/display/list.js +1 -3
  12. package/dist/components/display/timeline.d.ts +32 -0
  13. package/dist/components/display/timeline.d.ts.map +1 -0
  14. package/dist/components/display/timeline.js +21 -0
  15. package/dist/components/floating/dropdown.d.ts.map +1 -1
  16. package/dist/components/floating/dropdown.js +1 -2
  17. package/dist/components/floating/expand.d.ts +9 -0
  18. package/dist/components/floating/expand.d.ts.map +1 -0
  19. package/dist/components/floating/expand.js +25 -0
  20. package/dist/components/floating/menu.d.ts +5 -2
  21. package/dist/components/floating/menu.d.ts.map +1 -1
  22. package/dist/components/floating/menu.js +5 -4
  23. package/dist/components/floating/modal.d.ts +1 -0
  24. package/dist/components/floating/modal.d.ts.map +1 -1
  25. package/dist/components/floating/modal.js +3 -1
  26. package/dist/components/floating/tooltip.d.ts +3 -1
  27. package/dist/components/floating/tooltip.d.ts.map +1 -1
  28. package/dist/components/floating/tooltip.js +9 -16
  29. package/dist/components/form/autocomplete.d.ts.map +1 -1
  30. package/dist/components/form/autocomplete.js +14 -23
  31. package/dist/components/form/date-picker.d.ts +56 -2
  32. package/dist/components/form/date-picker.d.ts.map +1 -1
  33. package/dist/components/form/date-picker.js +16 -11
  34. package/dist/components/form/input.d.ts.map +1 -1
  35. package/dist/components/form/input.js +1 -1
  36. package/dist/components/form/switch.d.ts +1 -1
  37. package/dist/components/form/switch.d.ts.map +1 -1
  38. package/dist/components/form/switch.js +1 -1
  39. package/dist/components/index.d.ts +1 -0
  40. package/dist/components/index.d.ts.map +1 -1
  41. package/dist/components/index.js +1 -0
  42. package/dist/hooks/use-form.d.ts.map +1 -1
  43. package/dist/hooks/use-form.js +1 -3
  44. package/dist/hooks/use-translate-context.d.ts +5 -1
  45. package/dist/hooks/use-translate-context.d.ts.map +1 -1
  46. package/dist/hooks/use-translate-context.js +3 -1
  47. package/dist/index.css +1 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/index.mjs +7414 -7324
  50. package/dist/index.mjs.map +1 -1
  51. package/dist/index.umd.js +47 -42
  52. package/dist/index.umd.js.map +1 -1
  53. package/dist/lib/fns.d.ts +1 -0
  54. package/dist/lib/fns.d.ts.map +1 -1
  55. package/dist/lib/fns.js +10 -0
  56. package/dist/preset/src/styles/theme.js +2 -2
  57. package/dist/styles/theme.js +2 -2
  58. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { FloatingFocusManager, FloatingPortal, useClick, useDismiss, useFloating, useInteractions, useRole } from "@floating-ui/react";
4
+ import { AnimatePresence, motion } from "framer-motion";
5
+ import { useId, useRef, useState } from "react";
6
+ import { Button } from "../core/button";
7
+ export const Expand = (props) => {
8
+ const root = useRef(null);
9
+ const id = useId();
10
+ const wrapperId = `${id}:wrapper`;
11
+ const titleId = `${id}:title`;
12
+ const [open, setOpen] = useState(false);
13
+ const { context, refs } = useFloating({
14
+ transform: true,
15
+ open: open !== null,
16
+ onOpenChange: setOpen,
17
+ nodeId: id,
18
+ strategy: "absolute",
19
+ });
20
+ const click = useClick(context);
21
+ const role = useRole(context);
22
+ const dismiss = useDismiss(context, { escapeKey: true, referencePress: true, outsidePress: true });
23
+ const { getFloatingProps, getReferenceProps } = useInteractions([click, role, dismiss]);
24
+ return (_jsxs("div", { className: "relative inline-flex items-center justify-center", ref: root, children: [_jsx(Button, Object.assign({}, getReferenceProps(props), { as: motion.button, layoutId: wrapperId, ref: refs.setReference, size: "small", onClick: () => setOpen(true), children: _jsx(motion.span, { layoutId: titleId, children: props.trigger }) })), _jsx(AnimatePresence, { children: open ? (_jsx(FloatingPortal, { root: root, children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsx(motion.div, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, layoutId: wrapperId, className: "absolute -left-1/4 -top-3/4", children: props.children })) }) })) : null })] }));
25
+ };
@@ -2,6 +2,7 @@ import { LucideProps } from "lucide-react";
2
2
  import React from "react";
3
3
  import { Override } from "../../types";
4
4
  export type MenuProps = Partial<{
5
+ hover: boolean;
5
6
  nested: boolean;
6
7
  isParent: boolean;
7
8
  children: React.ReactNode;
@@ -23,14 +24,16 @@ type MenuItemProps = {
23
24
  Right?: React.FC<LucideProps>;
24
25
  };
25
26
  export declare const MenuItem: React.ForwardRefExoticComponent<Override<React.ButtonHTMLAttributes<HTMLButtonElement>, MenuItemProps> & React.RefAttributes<HTMLButtonElement>>;
26
- export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "asChild" | "nested" | "isParent"> & Partial<{
27
+ export declare const Menu: React.ForwardRefExoticComponent<(Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "asChild" | "hover" | "nested" | "isParent"> & Partial<{
28
+ hover: boolean;
27
29
  nested: boolean;
28
30
  isParent: boolean;
29
31
  children: React.ReactNode;
30
32
  asChild: boolean;
31
33
  } & {
32
34
  label: string;
33
- }>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "asChild" | "nested" | "isParent"> & Partial<{
35
+ }>, "ref"> | Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "label" | "children" | "asChild" | "hover" | "nested" | "isParent"> & Partial<{
36
+ hover: boolean;
34
37
  nested: boolean;
35
38
  isParent: boolean;
36
39
  children: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/floating/menu.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAA2E,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAC3B;IACI,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CACpB,GAAG,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CACzE,CAAC;AA6JF,KAAK,aAAa,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,GACpE;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEtG,eAAO,MAAM,QAAQ,kJAiCpB,CAAC;AAEF,eAAO,MAAM,IAAI;YAzMD,OAAO;cACL,OAAO;cACP,KAAK,CAAC,SAAS;aAChB,OAAO;;WACN,MAAM;;YAJR,OAAO;cACL,OAAO;cACP,KAAK,CAAC,SAAS;aAChB,OAAO;;WACc,KAAK,CAAC,YAAY;WAAS,MAAM;qDA8MrE,CAAC"}
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/floating/menu.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAoB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAA2E,MAAM,OAAO,CAAC;AAGhG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAC3B;IACI,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CACpB,GAAG,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CACzE,CAAC;AA6JF,KAAK,aAAa,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,GACpE;IAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;AAEtG,eAAO,MAAM,QAAQ,kJAiCpB,CAAC;AAEF,eAAO,MAAM,IAAI;WA1MF,OAAO;YACN,OAAO;cACL,OAAO;cACP,KAAK,CAAC,SAAS;aAChB,OAAO;;WACN,MAAM;;WALT,OAAO;YACN,OAAO;cACL,OAAO;cACP,KAAK,CAAC,SAAS;aAChB,OAAO;;WACc,KAAK,CAAC,YAAY;WAAS,MAAM;qDA8MrE,CAAC"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { __rest } from "tslib";
2
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
4
  import { autoUpdate, flip, FloatingFocusManager, FloatingList, FloatingNode, FloatingPortal, FloatingTree, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, useHover, useInteractions, useListItem, useListNavigation, useMergeRefs, useRole, useTypeahead, } from "@floating-ui/react";
@@ -15,7 +16,7 @@ const MenuContext = createContext({
15
16
  setHasFocusInside: () => { },
16
17
  });
17
18
  const MenuComponent = React.forwardRef((_a, forwardedRef) => {
18
- var { children, isParent, label } = _a, props = __rest(_a, ["children", "isParent", "label"]);
19
+ var { children, hover = true, isParent, label } = _a, props = __rest(_a, ["children", "hover", "isParent", "label"]);
19
20
  const parentId = useFloatingParentNodeId();
20
21
  const isNested = parentId !== null;
21
22
  const [isOpen, setIsOpen] = useState(false);
@@ -38,8 +39,8 @@ const MenuComponent = React.forwardRef((_a, forwardedRef) => {
38
39
  });
39
40
  const role = useRole(context, { role: "menu", enabled: true });
40
41
  const dismiss = useDismiss(context, { bubbles: true });
41
- const hover = useHover(context, {
42
- enabled: true,
42
+ const hoverModule = useHover(context, {
43
+ enabled: hover,
43
44
  delay: { open: FLOATING_DELAY },
44
45
  handleClose: safePolygon({ blockPointerEvents: true }),
45
46
  });
@@ -64,7 +65,7 @@ const MenuComponent = React.forwardRef((_a, forwardedRef) => {
64
65
  listRef: labelsRef,
65
66
  onMatch: isOpen ? setActiveIndex : undefined,
66
67
  });
67
- const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([hover, click, role, dismiss, listNavigation, typeahead]);
68
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([hoverModule, click, role, dismiss, listNavigation, typeahead]);
68
69
  useEffect(() => {
69
70
  if (!tree)
70
71
  return;
@@ -1,6 +1,7 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
  import { Label } from "../../types";
3
3
  export type ModalProps = {
4
+ layoutId?: string;
4
5
  title?: Label;
5
6
  open: boolean;
6
7
  footer?: Label;
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAS,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAwDpC,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAoEF,eAAO,MAAM,KAAK,+EAOf,iBAAiB,CAAC,UAAU,CAAC,4CA+F/B,CAAC"}
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAS,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA2DpC,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAoEF,eAAO,MAAM,KAAK,+EAOf,iBAAiB,CAAC,UAAU,CAAC,4CAsG/B,CAAC"}
@@ -96,5 +96,7 @@ export const Modal = (_a) => {
96
96
  const Trigger = props.trigger;
97
97
  const value = useMotionValue(undefined);
98
98
  const onClose = () => props.onChange(false);
99
- return (_jsxs(Fragment, { children: [props.trigger ? (_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, Object.assign({ ref: refs.setReference }, getReferenceProps(), { children: Trigger }))) : (_jsx("button", Object.assign({ ref: refs.setReference }, getReferenceProps(), { type: "button", children: Trigger }))) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { presenceAffectsLayout: true, children: props.open ? (_jsx(FloatingOverlay, { lockScroll: true, className: `z-overlay inset-0 isolate h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "grid items-end justify-center lg:items-center"}`, children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, Object.assign({ animate: "enter", "aria-describedby": descriptionId, "aria-labelledby": headingId, className: variants({ position, type }), exit: "exit", initial: "initial", ref: refs.setFloating, style: type === "drawer" ? { width: value } : { height: value }, variants: animation }, getFloatingProps(), { children: [props.title ? (_jsx("header", { className: "relative w-full", children: props.title ? (_jsx("h2", { className: "border-b border-floating-border px-8 pb-2 text-3xl font-medium leading-relaxed", children: props.title })) : null })) : null, _jsx("section", { className: "py-1 flex-1 overflow-y-auto px-8", children: props.children }), props.footer ? (_jsx("footer", { className: "w-full border-t border-floating-border px-8 pt-4", children: props.footer })) : null, closable ? (_jsx("nav", { className: "absolute right-4 top-1", children: _jsx("button", { type: "button", onClick: onClose, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) })) : null, useResizer && resizer ? (_jsx(Draggable, { onChange: props.onChange, parent: refs.floating, position: position, sheet: type === "sheet", value: value })) : null] })) }) })) : null }) })] }));
99
+ return (_jsxs(Fragment, { children: [props.trigger ? (_jsx(Fragment, { children: props.asChild ? (_jsx(Slot, Object.assign({ ref: refs.setReference }, getReferenceProps({
100
+ layoutId: props.layoutId,
101
+ }), { children: Trigger }))) : (_jsx(motion.button, Object.assign({ ref: refs.setReference }, getReferenceProps(), { layoutId: props.layoutId, type: "button", children: Trigger }))) })) : null, _jsx(FloatingPortal, { children: _jsx(AnimatePresence, { presenceAffectsLayout: true, children: props.open ? (_jsx(FloatingOverlay, { lockScroll: true, className: `inset-0 isolate z-overlay h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "grid items-end justify-center lg:items-center"}`, children: _jsx(FloatingFocusManager, { visuallyHiddenDismiss: true, modal: true, closeOnFocusOut: true, context: context, children: _jsxs(motion.div, Object.assign({ animate: "enter", "aria-describedby": descriptionId, "aria-labelledby": headingId, className: variants({ position, type }), exit: "exit", layoutId: props.layoutId, initial: "initial", ref: refs.setFloating, style: type === "drawer" ? { width: value } : { height: value }, variants: animation }, getFloatingProps(), { children: [props.title ? (_jsx("header", { className: "relative w-full", children: props.title ? (_jsx("h2", { className: "border-b border-floating-border px-8 pb-2 text-3xl font-medium leading-relaxed", children: props.title })) : null })) : null, _jsx("section", { className: "flex-1 overflow-y-auto px-8 py-1", children: props.children }), props.footer ? (_jsx("footer", { className: "w-full border-t border-floating-border px-8 pt-4", children: props.footer })) : null, closable ? (_jsx("nav", { className: "absolute right-4 top-1 z-floating", children: _jsx("button", { type: "button", onClick: onClose, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) })) : null, useResizer && resizer ? (_jsx(Draggable, { onChange: props.onChange, parent: refs.floating, position: position, sheet: type === "sheet", value: value })) : null] })) }) })) : null }) })] }));
100
102
  };
@@ -1,9 +1,11 @@
1
+ import { type Placement } from "@floating-ui/react";
1
2
  import React from "react";
2
3
  import { PolymorphicProps } from "../../components/core/polymorph";
3
4
  import { ComponentLike, Label, Override } from "../../types";
4
5
  export type TooltipProps<T extends ComponentLike = "span"> = Override<PolymorphicProps<React.ComponentProps<T>, T>, {
5
6
  title: Label;
6
7
  enabled?: boolean;
8
+ placement?: Placement;
7
9
  }>;
8
- export declare const Tooltip: <T extends ComponentLike = "span">({ children, enabled, as, title, ...props }: TooltipProps<T>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Tooltip: <T extends ComponentLike = "span">({ children, placement, enabled, as, title, ...props }: TooltipProps<T>) => import("react/jsx-runtime").JSX.Element;
9
11
  //# sourceMappingURL=tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,IAAI,QAAQ,CACjE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5C;IACI,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,aAAa,uDAAuD,YAAY,CAAC,CAAC,CAAC,4CA6CpH,CAAC"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/floating/tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,SAAS,EAQjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAa,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,MAAM,IAAI,QAAQ,CACjE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5C;IACI,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB,CACJ,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,aAAa,kEAAkE,YAAY,CAAC,CAAC,CAAC,4CAsC/H,CAAC"}
@@ -6,29 +6,22 @@ import { Fragment, useRef, useState } from "react";
6
6
  import { Polymorph } from "../../components/core/polymorph";
7
7
  import { FLOATING_DELAY } from "../../constants";
8
8
  export const Tooltip = (_a) => {
9
- var { children, enabled, as, title } = _a, props = __rest(_a, ["children", "enabled", "as", "title"]);
10
- const [isOpen, setIsOpen] = useState(false);
9
+ var { children, placement, enabled, as, title } = _a, props = __rest(_a, ["children", "placement", "enabled", "as", "title"]);
10
+ const [open, setOpen] = useState(false);
11
11
  const arrowRef = useRef(null);
12
12
  const Component = as || "span";
13
13
  const { refs, floatingStyles, context } = useFloating({
14
- open: isOpen,
15
- onOpenChange: setIsOpen,
16
- whileElementsMounted: autoUpdate,
14
+ open,
15
+ placement,
17
16
  transform: true,
18
- middleware: [
19
- offset(5),
20
- flip({ fallbackAxisSideDirection: "start" }),
21
- shift(),
22
- arrow({
23
- element: arrowRef,
24
- padding: 5,
25
- }),
26
- ],
17
+ onOpenChange: setOpen,
18
+ whileElementsMounted: autoUpdate,
19
+ middleware: [offset(5), flip({ fallbackAxisSideDirection: "start" }), shift(), arrow({ element: arrowRef, padding: 5 })],
27
20
  });
28
- const hover = useHover(context, { move: true, delay: { open: FLOATING_DELAY } });
21
+ const hover = useHover(context, { move: true, enabled, delay: { open: FLOATING_DELAY } });
29
22
  const focus = useFocus(context, { enabled });
30
23
  const dismiss = useDismiss(context, { enabled });
31
24
  const role = useRole(context, { role: "tooltip", enabled });
32
25
  const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role]);
33
- return (_jsxs(Fragment, { children: [_jsx(Component, Object.assign({ ref: refs.setReference }, getReferenceProps(props), { children: title })), _jsx(FloatingPortal, { children: isOpen && (_jsxs(Polymorph, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, style: floatingStyles, className: "z-tooltip rounded-lg border border-tooltip-border bg-tooltip-background p-3 text-tooltip-foreground", children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-tooltip-background stroke-tooltip-border" }), children] }))) })] }));
26
+ return (_jsxs(Fragment, { children: [_jsx(Component, Object.assign({ ref: refs.setReference }, getReferenceProps(props), { children: title })), _jsx(FloatingPortal, { children: open && (_jsxs(Polymorph, Object.assign({}, getFloatingProps(), { ref: refs.setFloating, style: floatingStyles, className: "z-tooltip rounded-lg border border-tooltip-border bg-tooltip-background p-3 text-tooltip-foreground shadow-lg", children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-tooltip-background stroke-tooltip-border" }), children] }))) })] }));
34
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAKvE,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,KAAK,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,MAAM,8FAYjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAaF,eAAO,MAAM,YAAY,yGAwPxB,CAAC"}
1
+ {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,KAAK,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,GAAG;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,MAAM,8FAmBjB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAaF,eAAO,MAAM,YAAY,yGAmPxB,CAAC"}
@@ -4,9 +4,8 @@ import { createElement as _createElement } from "react";
4
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  import { autoUpdate, FloatingFocusManager, FloatingPortal, offset, size, useDismiss, useFloating, useInteractions, useListNavigation, useRole, useTransitionStyles, } from "@floating-ui/react";
6
6
  import Fuzzy from "fuzzy-search";
7
- import { ChevronDown } from "lucide-react";
7
+ import { CheckIcon, ChevronDown } from "lucide-react";
8
8
  import { forwardRef, useEffect, useRef, useState } from "react";
9
- import { usePrevious } from "../../hooks/use-previous";
10
9
  import { useTranslations } from "../../hooks/use-translate-context";
11
10
  import { css, dispatchInput, initializeInputDataset } from "../../lib/dom";
12
11
  import { safeRegex } from "../../lib/fns";
@@ -14,7 +13,7 @@ import { InputField } from "./input-field";
14
13
  export const Option = forwardRef((_a, ref) => {
15
14
  var _b;
16
15
  var { selected, active, onClick, option } = _a, rest = __rest(_a, ["selected", "active", "onClick", "option"]);
17
- return (_jsx("li", Object.assign({}, rest, { ref: ref, role: "option", "aria-selected": selected, className: "w-full border-b border-tooltip-border last:border-transparent", children: _jsx("button", { type: "button", "data-value": option.value, onClick: onClick, "aria-selected": selected, className: `w-full cursor-pointer p-2 text-left ${selected ? "bg-primary text-primary-foreground" : ""} ${active ? "bg-primary-subtle text-primary-foreground" : ""}`, children: (_b = option.label) !== null && _b !== void 0 ? _b : option.value }) })));
16
+ return (_jsx("li", Object.assign({}, rest, { ref: ref, role: "option", "aria-selected": active, className: "w-full border-b border-tooltip-border last:border-transparent", children: _jsxs("button", { type: "button", "data-value": option.value, onClick: onClick, "aria-selected": active, "aria-checked": active, "aria-current": active, className: `flex w-full cursor-pointer justify-between p-2 text-left ${active ? "bg-primary text-primary-foreground" : ""} ${selected ? "bg-primary/70 text-primary-foreground" : ""}`, children: [(_b = option.label) !== null && _b !== void 0 ? _b : option.value, active ? (_jsx("span", { children: _jsx(CheckIcon, { "aria-hidden": true, className: "text-current", absoluteStrokeWidth: true, strokeWidth: 2, size: 22 }) })) : null] }) })));
18
17
  });
19
18
  const transitionStyles = {
20
19
  duration: 300,
@@ -35,7 +34,6 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
35
34
  const [label, setLabel] = useState((_e = (_d = props.value) !== null && _d !== void 0 ? _d : props.defaultValue) !== null && _e !== void 0 ? _e : "");
36
35
  const [index, setIndex] = useState(null);
37
36
  const listRef = useRef(emptyRef);
38
- const previousIndex = usePrevious(index);
39
37
  const innerOptions = dynamicOption && shadow !== "" ? [{ value: shadow, label: shadow, "data-dynamic": "true" }, ...options] : options;
40
38
  const list = new Fuzzy(innerOptions, ["value", "label"], fuzzyOptions).search(shadow);
41
39
  const pattern = dynamicOption
@@ -77,28 +75,20 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
77
75
  useRole(context, { role: "listbox" }),
78
76
  useDismiss(context),
79
77
  useListNavigation(context, {
80
- listRef,
81
- loop: true,
82
78
  activeIndex: index,
83
79
  allowEscape: true,
80
+ cols: 0,
84
81
  focusItemOnOpen: "auto",
82
+ listRef,
83
+ loop: true,
85
84
  openOnArrowKeyDown: true,
86
85
  scrollItemIntoView: true,
87
86
  selectedIndex: index,
88
87
  virtual: true,
89
- onNavigate: (n) => {
90
- var _a;
91
- const lastIndex = list.length - 1;
92
- if (n === null && previousIndex === 0)
93
- return setIndex(lastIndex);
94
- if (n === null && previousIndex === lastIndex)
95
- return setIndex(0);
96
- const i = (_a = n !== null && n !== void 0 ? n : previousIndex) !== null && _a !== void 0 ? _a : null;
97
- return i === null ? undefined : setIndex(i);
98
- },
88
+ onNavigate: (n) => setIndex((prev) => n !== null && n !== void 0 ? n : prev),
99
89
  }),
100
90
  ]);
101
- const onSelect = (opt) => {
91
+ const onSelect = (opt, i) => {
102
92
  var _a, _b, _c;
103
93
  setValue(opt.value);
104
94
  (_a = refs.reference.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-value", opt.value);
@@ -108,6 +98,7 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
108
98
  (_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, fakeEvent);
109
99
  setOpen(false);
110
100
  setShadow("");
101
+ setIndex(i);
111
102
  };
112
103
  const onChange = (event) => {
113
104
  var _a;
@@ -132,7 +123,7 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
132
123
  setOpen(false);
133
124
  };
134
125
  const id = props.id || props.name;
135
- return (_jsxs(InputField, Object.assign({}, props, { container: css("group inline-block w-full", container), error: error, feedback: feedback, form: props.form, hideLeft: hideLeft, id: props.name || props.id, interactive: interactive, labelClassName: labelClassName, left: left, name: props.name, optionalText: optionalText, placeholder: props.placeholder, required: true, rightLabel: rightLabel, title: props.title, right: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsxs("button", { type: "button", className: "transition-colors link:text-primary", children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }), value ? (_jsx("button", { type: "button", onClick: onClose, className: "transition-colors link:text-danger", children: _jsx("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) })) : null] }), children: [_jsx("input", Object.assign({}, getReferenceProps(Object.assign(Object.assign({}, props), { onChange,
126
+ return (_jsxs(InputField, Object.assign({}, props, { container: css("group inline-block w-full", container), error: error, feedback: feedback, form: props.form, hideLeft: hideLeft, id: props.name || props.id, interactive: interactive, labelClassName: labelClassName, left: left, name: props.name, optionalText: optionalText, placeholder: props.placeholder, required: required, rightLabel: rightLabel, title: props.title, right: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsxs("button", { type: "button", className: "transition-colors link:text-primary", children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }), value ? (_jsx("button", { type: "button", onClick: onClose, className: "transition-colors link:text-danger", children: _jsx("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) })) : null] }), children: [_jsx("input", Object.assign({}, getReferenceProps(Object.assign(Object.assign({}, props), { onChange,
136
127
  onFocus,
137
128
  pattern, ref: refs.setReference, name: `${id}-shadow`, id: `${id}-shadow`, onClick: (e) => e.currentTarget.focus(), onKeyDown(event) {
138
129
  if (event.key === "Escape") {
@@ -142,18 +133,18 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
142
133
  if (event.key === "Enter") {
143
134
  if (index !== null && list[index]) {
144
135
  event.preventDefault();
145
- return onSelect(list[index]);
136
+ return onSelect(list[index], index);
146
137
  }
147
138
  if (list.length === 1) {
148
139
  event.preventDefault();
149
- return onSelect(list[0]);
140
+ return onSelect(list[0], 0);
150
141
  }
151
142
  }
152
- } })), { "data-value": value, "data-error": !!error, "data-name": id, "data-target": id, required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input placeholder-input-mask group h-10 py-1 px-2 w-full flex-1 rounded-md bg-transparent text-base text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right || shadow ? "pe-12" : "", !!left ? "ps-8" : "", props.className) })), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || value || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsx("ul", Object.assign({}, getFloatingProps({
143
+ } })), { "data-value": value, "data-error": !!error, "data-name": id, "data-target": id, required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input placeholder-input-mask group h-10 w-full flex-1 rounded-md bg-transparent px-2 py-1 text-base text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right || shadow ? "pe-12" : "", !!left ? "ps-8" : "", props.className) })), _jsx("input", { id: id, name: id, type: "hidden", "data-origin": id, ref: externalRef, required: required, defaultValue: props.value || value || undefined }), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsx("ul", Object.assign({}, getFloatingProps({
153
144
  ref: refs.setFloating,
154
145
  style: Object.assign({ position: strategy, left: x !== null && x !== void 0 ? x : 0, top: y !== null && y !== void 0 ? y : 0 }, transitions.styles),
155
- }), { "data-floating": "true", className: "z-floating m-0 origin-[top_center] list-none overflow-auto overflow-y-auto rounded-b-lg rounded-t-lg bg-floating-background p-0 text-foreground shadow-floating", children: list.map((option, i) => (_createElement(Option, Object.assign({}, getItemProps({
156
- onClick: () => onSelect(option),
146
+ }), { "data-floating": "true", className: "z-floating m-0 origin-[top_center] list-none overflow-auto overflow-y-auto rounded-b-lg rounded-t-lg border border-floating-border bg-floating-background p-0 text-foreground shadow-floating", children: list.map((option, i) => (_createElement(Option, Object.assign({}, getItemProps({
147
+ onClick: () => onSelect(option, i),
157
148
  ref: (node) => void (listRef.current[i] = node),
158
149
  selected: index === i,
159
150
  active: value === option.value,
@@ -2,6 +2,60 @@ import React from "react";
2
2
  import { Override } from "../../types";
3
3
  import { CalendarProps } from "../display/calendar";
4
4
  import { InputProps } from "./input";
5
- export type DatePickerProps = Override<InputProps, CalendarProps & {}>;
6
- export declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
5
+ export type DatePickerProps = Override<InputProps, CalendarProps<"date">>;
6
+ export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<Omit<InputProps, "onChange" | "date" | "locale" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
7
+ locale: import("the-mask-input").Locales;
8
+ markToday: boolean;
9
+ rangeMode: boolean;
10
+ changeOnlyOnClick: boolean;
11
+ onChangeMonth: (d: Date) => void;
12
+ onChangeYear: (d: Date) => void;
13
+ RenderOnDay: React.FC<{
14
+ date: Date;
15
+ }>;
16
+ disabledDate: (date: Date) => boolean;
17
+ styles: Partial<{
18
+ day: string;
19
+ week: string;
20
+ weekDay: string;
21
+ dayFrame: string;
22
+ calendar: string;
23
+ }>;
24
+ } & {
25
+ date: Date;
26
+ onChange: (d: Date | undefined) => void;
27
+ } & {
28
+ date: Date;
29
+ onChange: (d: Date | undefined) => void;
30
+ }>, "ref"> | Omit<Omit<InputProps, "onChange" | "date" | "locale" | "markToday" | "rangeMode" | "changeOnlyOnClick" | "onChangeMonth" | "onChangeYear" | "RenderOnDay" | "disabledDate" | "styles"> & Partial<{
31
+ locale: import("the-mask-input").Locales;
32
+ markToday: boolean;
33
+ rangeMode: boolean;
34
+ changeOnlyOnClick: boolean;
35
+ onChangeMonth: (d: Date) => void;
36
+ onChangeYear: (d: Date) => void;
37
+ RenderOnDay: React.FC<{
38
+ date: Date;
39
+ }>;
40
+ disabledDate: (date: Date) => boolean;
41
+ styles: Partial<{
42
+ day: string;
43
+ week: string;
44
+ weekDay: string;
45
+ dayFrame: string;
46
+ calendar: string;
47
+ }>;
48
+ } & {
49
+ date: Date;
50
+ onChange: (d: Date | undefined) => void;
51
+ } & {
52
+ range: {
53
+ from?: Date;
54
+ to?: Date;
55
+ };
56
+ onChange: (d: {
57
+ from?: Date;
58
+ to?: Date;
59
+ } | undefined) => void;
60
+ }>, "ref">) & React.RefAttributes<HTMLInputElement>>;
7
61
  //# sourceMappingURL=date-picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAI9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,UAAU,EAAE,aAAa,GAAG,EAAE,CAAC,CAAC;AAyBvE,eAAO,MAAM,UAAU,uGAuGtB,CAAC"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/form/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAmC1E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAyGtB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { format, parse, startOfDay } from "date-fns";
3
+ import { format, isValid, parse, startOfDay } from "date-fns";
4
4
  import { CalendarIcon } from "lucide-react";
5
5
  import { forwardRef, Fragment, useId, useMemo, useState } from "react";
6
6
  import { Is } from "sidekicker";
@@ -27,23 +27,27 @@ const partValues = {
27
27
  day: (date) => date.getDate().toString().padStart(2, "0"),
28
28
  month: (date) => (date.getMonth() + 1).toString().padStart(2, "0"),
29
29
  };
30
+ const formatParts = (datetimeFormat, date) => {
31
+ try {
32
+ return datetimeFormat.formatToParts(date);
33
+ }
34
+ catch (e) {
35
+ return [];
36
+ }
37
+ };
30
38
  export const DatePicker = forwardRef((_a, externalRef) => {
31
39
  var _b;
32
- var { date, locale, disabledDate, autoFocusToday, onChange, markToday } = _a, props = __rest(_a, ["date", "locale", "disabledDate", "autoFocusToday", "onChange", "markToday"]);
40
+ var { date, locale, disabledDate, onChange, markToday } = _a, props = __rest(_a, ["date", "locale", "disabledDate", "onChange", "markToday"]);
33
41
  const labelId = useId();
34
42
  const translation = useTranslations();
35
43
  const datetimeFormat = useMemo(() => new Intl.DateTimeFormat(locale), [locale]);
36
44
  const [innerDate, setInnerDate] = useState(date || undefined);
37
45
  const [open, setOpen] = useState(false);
38
- const mask = datetimeFormat.formatToParts(fixedDate).flatMap((x) => (Is.keyof(parts, x.type) ? parts[x.type](x.value) : []));
39
- const placeholder = datetimeFormat
40
- .formatToParts(fixedDate)
41
- .reduce((acc, x) => acc + (Is.keyof(placeholders, x.type) ? placeholders[x.type](x.value) : ""), "");
46
+ const mask = formatParts(datetimeFormat, fixedDate).flatMap((x) => (Is.keyof(parts, x.type) ? parts[x.type](x.value) : []));
47
+ const placeholder = formatParts(datetimeFormat, fixedDate).reduce((acc, x) => acc + (Is.keyof(placeholders, x.type) ? placeholders[x.type](x.value) : ""), "");
42
48
  const [value, setValue] = useState(!innerDate
43
49
  ? ""
44
- : datetimeFormat
45
- .formatToParts(innerDate)
46
- .reduce((acc, x) => acc + (Is.keyof(parts, x.type) ? partValues[x.type](innerDate, x.value) : ""), ""));
50
+ : formatParts(datetimeFormat, innerDate).reduce((acc, x) => acc + (Is.keyof(parts, x.type) ? partValues[x.type](innerDate, x.value) : ""), ""));
47
51
  const onChangeDateInput = (e) => {
48
52
  const v = e.target.value;
49
53
  setValue(v);
@@ -68,6 +72,7 @@ export const DatePicker = forwardRef((_a, externalRef) => {
68
72
  return setValue(format(d, placeholder));
69
73
  return setValue("");
70
74
  };
71
- const htmlValue = innerDate === null || innerDate === void 0 ? void 0 : innerDate.toISOString();
72
- return (_jsx(Input, Object.assign({}, props, { mask: mask, value: value, "data-value": htmlValue, "data-target": props.name, className: "uppercase", formNoValidate: !open, placeholder: placeholder, onChange: onChangeDateInput, required: (_b = props.required) !== null && _b !== void 0 ? _b : true, error: open ? undefined : props.error, name: undefined, id: undefined, right: _jsxs(Fragment, { children: [_jsx("input", { "data-origin": props.name, hidden: true, type: "date", id: props.name, ref: externalRef, name: props.name, defaultValue: htmlValue }), _jsx(Dropdown, { open: open, restoreFocus: true, onChange: setOpen, trigger: _jsxs("span", { "aria-labelledby": labelId, children: [_jsx("span", { id: labelId, className: "sr-only", children: translation.datePickerCalendarButtonLabel }), _jsx(CalendarIcon, {})] }), buttonProps: { "aria-describedby": labelId }, children: _jsx(Calendar, Object.assign({}, props, { locale: locale, date: innerDate, onChange: onChangeDate, markToday: markToday, disabledDate: disabledDate, autoFocusToday: autoFocusToday })) })] }) })));
75
+ const validDate = isValid(innerDate);
76
+ const htmlValue = validDate ? innerDate.toISOString() : undefined;
77
+ return (_jsx(Input, Object.assign({}, props, { mask: mask, value: value, "data-value": htmlValue, "data-target": props.name, className: "uppercase", formNoValidate: !open, placeholder: placeholder, onChange: onChangeDateInput, required: (_b = props.required) !== null && _b !== void 0 ? _b : true, error: open ? undefined : props.error, name: undefined, id: undefined, right: _jsxs(Fragment, { children: [_jsx("input", { "data-origin": props.name, hidden: true, type: "date", id: props.name, ref: externalRef, name: props.name, defaultValue: htmlValue }), _jsx(Dropdown, { open: open, onChange: setOpen, trigger: _jsxs("span", { "aria-labelledby": labelId, children: [_jsx("span", { id: labelId, className: "sr-only", children: translation.datePickerCalendarButtonLabel }), _jsx(CalendarIcon, {})] }), buttonProps: { "aria-describedby": labelId }, children: _jsx(Calendar, Object.assign({}, props, { locale: locale, changeOnlyOnClick: true, markToday: markToday, onChange: onChangeDate, disabledDate: disabledDate, date: validDate ? innerDate : undefined })) })] }) })));
73
78
  });
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/form/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAC7B,eAAe,CAAC,OAAO,CAAC,EACxB,YAAY,GACR,aAAa,GAAG;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CACR,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoF/B,CAAC"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/form/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAC7D,OAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9G,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoF/B,CAAC"}
@@ -34,5 +34,5 @@ export const Input = forwardRef((_a, ref) => {
34
34
  input.removeEventListener("keydown", goNextInputImpl);
35
35
  };
36
36
  }, []);
37
- return (_jsx(InputField, { info: info, container: css("group inline-block w-full", container), error: error, feedback: feedback, hideLeft: hideLeft, left: left, optionalText: optionalText, right: right, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: props.required, children: _jsx(MaskInput, Object.assign({}, props, { type: type, "data-next": next, ref: mergeRefs(ref, inputRef), id: id, name: id, className: css("input placeholder-input-mask group h-10 py-1 px-2 w-full flex-1 rounded-md bg-transparent text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right ? "pe-4" : "", !!left ? "ps-4" : "", props.className) })) }));
37
+ return (_jsx(InputField, { info: info, container: css("group inline-block w-full", container), error: error, feedback: feedback, hideLeft: hideLeft, left: left, optionalText: optionalText, right: right, rightLabel: rightLabel, interactive: interactive, form: props.form, id: props.name || props.id, name: props.name, labelClassName: labelClassName, title: props.title, placeholder: props.placeholder, required: props.required, children: _jsx(MaskInput, Object.assign({}, props, { type: type, "data-next": next, ref: mergeRefs(ref, inputRef), id: id, name: id, className: css("input placeholder-input-mask group h-10 w-full flex-1 rounded-md bg-transparent px-2 py-1 text-foreground outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right ? "pe-4" : "", !!left ? "ps-4" : "", props.className) })) }));
38
38
  });
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  export type SwitchProps = React.ComponentProps<"input"> & {
3
- onCheck?: (nextValue: boolean) => void;
4
3
  error?: string;
5
4
  container?: string;
5
+ onCheck?: (nextValue: boolean) => void;
6
6
  };
7
7
  export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
8
8
  //# sourceMappingURL=switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/form/switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAInG,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,MAAM,mGAwDjB,CAAC"}
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/form/switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8E,MAAM,OAAO,CAAC;AAInG,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,mGAwDjB,CAAC"}
@@ -36,5 +36,5 @@ export const Switch = forwardRef((_a, ref) => {
36
36
  innerRef.current.dispatchEvent(new Event("change", { bubbles: true }));
37
37
  }
38
38
  };
39
- return (_jsxs("fieldset", { className: css("flex flex-wrap items-center", container), children: [_jsx("input", Object.assign({}, props, { ref: innerRef, hidden: true, type: "checkbox", checked: checked, onChange: (e) => setInnerChecked(e.target.checked) })), _jsx("button", { type: "button", role: "switch", onClick: onCheck, "aria-checked": checked, "data-checked": checked, "aria-labelledby": `${id}-label`, className: "duration-300 ease-in-out relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary", children: _jsx("span", { "aria-hidden": "true", "data-checked": checked, className: "duration-300 duration-300 ease-in-out inline-block aspect-square size-5 transform rounded-full shadow ring-0 transition data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch" }) }), _jsx("span", { className: "ml-3 text-sm", id: `${id}-label`, children: _jsx("span", { className: "font-medium text-foreground", children: children }) }), _jsx("span", { className: "mt-1 flex-1 whitespace-nowrap text-xs text-danger empty:mt-0 empty:hidden", children: error })] }));
39
+ return (_jsxs("fieldset", { className: css("flex flex-wrap items-center", container), children: [_jsx("input", Object.assign({}, props, { id: props.id || id, ref: innerRef, hidden: true, type: "checkbox", checked: checked, onChange: (e) => setInnerChecked(e.target.checked) })), _jsx("button", { type: "button", role: "switch", onClick: onCheck, "aria-checked": checked, "data-checked": checked, "aria-labelledby": `${id}-label`, className: "duration-300 ease-in-out relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked=false]:bg-input-switch-bg data-[checked=true]:bg-primary", children: _jsx("span", { "aria-hidden": "true", "data-checked": checked, className: "duration-300 duration-300 ease-in-out inline-block aspect-square size-5 transform rounded-full shadow ring-0 transition data-[checked=false]:translate-x-0 data-[checked=true]:translate-x-5 data-[checked=false]:bg-disabled data-[checked=true]:bg-input-switch" }) }), _jsx("label", { htmlFor: props.id || id, className: "inline-block ml-3 text-sm", id: `${id}-label`, children: _jsx("span", { className: "font-medium text-foreground", children: children }) }), _jsx("span", { className: "mt-1 flex-1 whitespace-nowrap text-xs text-danger empty:mt-0 empty:hidden", children: error })] }));
40
40
  });
@@ -23,5 +23,6 @@ export * from "./form/switch";
23
23
  export * from "./form/transfer-list";
24
24
  export * from "./table/index";
25
25
  export * from "./floating/menu";
26
+ export * from "./floating/expand";
26
27
  export { createColumns, createOptionCols, type ColType, useTablePreferences, type TablePagination } from "./table/table-lib";
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -23,4 +23,5 @@ export * from "./form/switch";
23
23
  export * from "./form/transfer-list";
24
24
  export * from "./table/index";
25
25
  export * from "./floating/menu";
26
+ export * from "./floating/expand";
26
27
  export { createColumns, createOptionCols, useTablePreferences } from "./table/table-lib";
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAe,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,CAAC,EAAuB,MAAM,KAAK,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAiBxD,eAAO,MAAM,UAAU,SAAU,eAAe,KAAG,GAIlD,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,MAAM,aAAuD,CAAC;AAEhG,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,MAAM,UAAU,CAAC,MAKpE,CAAC;AAWf,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KAAK,GAAG,CAAC;AAEhG,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACnD,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAE9D,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAiD1C,KAAK,SAAS,UAAU,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;iBA7CtE,KAAK,SAAS,eAAe,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;eA8BlF,KAAK,SAAS,aAAa,GAAG,WAAW,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;aAf9F,KAAK,SAAS,WAAW,GAAG,iBAAiB,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;qBA6GrG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;uBApBrE,eAAe,aAAa,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;CAoD3E,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-form.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAe,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,CAAC,EAAuB,MAAM,KAAK,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAiBxD,eAAO,MAAM,UAAU,SAAU,eAAe,KAAG,GAIlD,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,MAAM,aAAuD,CAAC;AAEhG,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,MAAM,UAAU,CAAC,MAKpE,CAAC;AAWf,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KAAK,GAAG,CAAC;AAEhG,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACnD,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAE9D,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;YAiD1C,KAAK,SAAS,UAAU,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;iBA7CtE,KAAK,SAAS,eAAe,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;eA8BlF,KAAK,SAAS,aAAa,GAAG,WAAW,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;aAf9F,KAAK,SAAS,WAAW,GAAG,iBAAiB,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,KAAK,KAAG,KAAK;qBA2GrG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;uBApBrE,eAAe,aAAa,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC;;CAoD3E,CAAC"}
@@ -37,7 +37,7 @@ const getValueByType = (e) => {
37
37
  return e.checked;
38
38
  if (e.type === "number")
39
39
  return e.valueAsNumber;
40
- return e.value;
40
+ return e.value || e.getAttribute("value");
41
41
  };
42
42
  export const useForm = (schema) => {
43
43
  const [errors, setErrors] = useState(null);
@@ -85,10 +85,8 @@ export const useForm = (schema) => {
85
85
  const name = element.dataset.target || element.name;
86
86
  if (!name)
87
87
  return;
88
- console.log(e);
89
88
  const value = getValueByType(e.target) || (e.relatedTarget ? getValueByType(e.relatedTarget) : "");
90
89
  const validation = input.schema.safeParse(value);
91
- console.log({ name, value, validation });
92
90
  if (validation.success) {
93
91
  element.setCustomValidity("");
94
92
  return setErrors((prev) => {
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  declare const defaultTranslations: {
3
3
  inputCaretDown: string;
4
4
  datePickerCalendarButtonLabel: string;
@@ -40,6 +40,8 @@ declare const defaultTranslations: {
40
40
  current: number;
41
41
  select: React.ReactNode;
42
42
  }) => import("react/jsx-runtime").JSX.Element;
43
+ calendarFromDate: string;
44
+ calendarToDate: string;
43
45
  };
44
46
  type Translations = typeof defaultTranslations;
45
47
  export declare const ComponentsProvider: (props: PropsWithChildren<{
@@ -86,6 +88,8 @@ export declare const useTranslations: () => {
86
88
  current: number;
87
89
  select: React.ReactNode;
88
90
  }) => import("react/jsx-runtime").JSX.Element;
91
+ calendarFromDate: string;
92
+ calendarToDate: string;
89
93
  };
90
94
  export {};
91
95
  //# sourceMappingURL=use-translate-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-translate-context.d.ts","sourceRoot":"","sources":["../../src/hooks/use-translate-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAqB,MAAM,OAAO,CAAA;AAEvF,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA2Ca;QAClC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QACrE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;KACxB;CAIF,CAAA;AAED,KAAK,YAAY,GAAG,OAAO,mBAAmB,CAAC;AAI/C,eAAO,MAAM,kBAAkB,UAAW,iBAAiB,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAAE,CAAC,4CAG1F,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAlBU;QAClC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QACrE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;KACxB;CAmBF,CAAA"}
1
+ {"version":3,"file":"use-translate-context.d.ts","sourceRoot":"","sources":["../../src/hooks/use-translate-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,iBAAiB,EAAqB,MAAM,OAAO,CAAA;AAE9F,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA2Ca;QAClC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QACrE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;KACxB;;;CAOF,CAAA;AAED,KAAK,YAAY,GAAG,OAAO,mBAAmB,CAAC;AAI/C,eAAO,MAAM,kBAAkB,UAAW,iBAAiB,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAAE,CAAC,4CAG1F,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCArBU;QAClC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QACrE,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;KACxB;;;CAsBF,CAAA"}
@@ -34,7 +34,9 @@ const defaultTranslations = {
34
34
  tablePaginationPrevious: "Previous",
35
35
  tablePaginationNext: "Next",
36
36
  tablePaginationSelectLabel: "Select the size of page",
37
- tablePaginationFooter: (pagination) => _jsxs(Fragment, { children: [pagination.current, " to ", pagination.pages, " of ", pagination.totalItems, " items.", Array.isArray(pagination.sizes) ? (pagination.select) : null, " per page."] })
37
+ tablePaginationFooter: (pagination) => _jsxs(Fragment, { children: [pagination.current, " to ", pagination.pages, " of ", pagination.totalItems, " items.", Array.isArray(pagination.sizes) ? (pagination.select) : null, " per page."] }),
38
+ calendarFromDate: "From",
39
+ calendarToDate: "To",
38
40
  };
39
41
  const Context = createContext({ translations: defaultTranslations });
40
42
  export const ComponentsProvider = (props) => {