@g4rcez/components 0.0.34 → 0.0.36

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 (77) 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/tabs.d.ts +1 -1
  13. package/dist/components/display/tabs.d.ts.map +1 -1
  14. package/dist/components/display/tabs.js +9 -7
  15. package/dist/components/display/timeline.d.ts +32 -0
  16. package/dist/components/display/timeline.d.ts.map +1 -0
  17. package/dist/components/display/timeline.js +21 -0
  18. package/dist/components/floating/dropdown.d.ts.map +1 -1
  19. package/dist/components/floating/dropdown.js +1 -2
  20. package/dist/components/floating/expand.d.ts +9 -0
  21. package/dist/components/floating/expand.d.ts.map +1 -0
  22. package/dist/components/floating/expand.js +25 -0
  23. package/dist/components/floating/menu.d.ts +5 -2
  24. package/dist/components/floating/menu.d.ts.map +1 -1
  25. package/dist/components/floating/menu.js +5 -4
  26. package/dist/components/floating/modal.d.ts +1 -0
  27. package/dist/components/floating/modal.d.ts.map +1 -1
  28. package/dist/components/floating/modal.js +3 -1
  29. package/dist/components/floating/tooltip.d.ts +3 -1
  30. package/dist/components/floating/tooltip.d.ts.map +1 -1
  31. package/dist/components/floating/tooltip.js +9 -16
  32. package/dist/components/form/autocomplete.d.ts.map +1 -1
  33. package/dist/components/form/autocomplete.js +14 -23
  34. package/dist/components/form/checkbox.d.ts +3 -1
  35. package/dist/components/form/checkbox.d.ts.map +1 -1
  36. package/dist/components/form/checkbox.js +2 -2
  37. package/dist/components/form/date-picker.d.ts +56 -2
  38. package/dist/components/form/date-picker.d.ts.map +1 -1
  39. package/dist/components/form/date-picker.js +16 -11
  40. package/dist/components/form/input.d.ts.map +1 -1
  41. package/dist/components/form/input.js +1 -1
  42. package/dist/components/form/switch.d.ts +1 -1
  43. package/dist/components/form/switch.d.ts.map +1 -1
  44. package/dist/components/form/switch.js +1 -1
  45. package/dist/components/form/task-list.d.ts +3 -0
  46. package/dist/components/form/task-list.d.ts.map +1 -0
  47. package/dist/components/form/task-list.js +26 -0
  48. package/dist/components/index.d.ts +2 -0
  49. package/dist/components/index.d.ts.map +1 -1
  50. package/dist/components/index.js +2 -0
  51. package/dist/components/table/group.d.ts.map +1 -1
  52. package/dist/components/table/group.js +3 -1
  53. package/dist/components/table/thead.d.ts.map +1 -1
  54. package/dist/components/table/thead.js +1 -1
  55. package/dist/hooks/use-form.d.ts.map +1 -1
  56. package/dist/hooks/use-form.js +1 -3
  57. package/dist/hooks/use-stable-ref.d.ts +2 -0
  58. package/dist/hooks/use-stable-ref.d.ts.map +1 -0
  59. package/dist/hooks/use-stable-ref.js +8 -0
  60. package/dist/hooks/use-translate-context.d.ts +9 -1
  61. package/dist/hooks/use-translate-context.d.ts.map +1 -1
  62. package/dist/hooks/use-translate-context.js +5 -1
  63. package/dist/index.css +1 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.mjs +8022 -7685
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/index.umd.js +47 -42
  68. package/dist/index.umd.js.map +1 -1
  69. package/dist/lib/fns.d.ts +1 -0
  70. package/dist/lib/fns.d.ts.map +1 -1
  71. package/dist/lib/fns.js +10 -0
  72. package/dist/preset/preset.tailwind.d.ts +3 -0
  73. package/dist/preset/preset.tailwind.d.ts.map +1 -1
  74. package/dist/preset/preset.tailwind.js +9 -5
  75. package/dist/preset/src/styles/theme.js +2 -2
  76. package/dist/styles/theme.js +2 -2
  77. package/package.json +278 -200
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MessagesSquareIcon } from "lucide-react";
3
+ import { Fragment } from "react";
4
+ const typeMap = {
5
+ tag: () => null,
6
+ custom: () => null,
7
+ record: ({ item }) => {
8
+ var _a, _b, _c, _d;
9
+ return (_jsxs(Fragment, { children: [_jsxs("div", { className: "relative", children: [_jsx("img", { src: (_a = item.avatar) === null || _a === void 0 ? void 0 : _a.img, alt: (_b = item.avatar) === null || _b === void 0 ? void 0 : _b.name, className: "flex aspect-square size-12 items-center justify-center rounded-full bg-primary-hover" }), _jsx("span", { className: "absolute -bottom-0.5 -right-1 rounded-full rounded-tl bg-card-background px-0.5 py-px", children: _jsx(MessagesSquareIcon, { "aria-hidden": "true", className: "aspect-square size-5" }) })] }), _jsxs("div", { className: "min-w-0 flex-1 text-foreground", children: [_jsxs("div", { children: [_jsx("a", { href: (_c = item.avatar) === null || _c === void 0 ? void 0 : _c.profile, className: "text-base font-medium text-primary", children: (_d = item.avatar) === null || _d === void 0 ? void 0 : _d.name }), _jsxs("p", { className: "mt-0.5 text-sm", children: ["Commented ", item.date.toISOString()] })] }), _jsx("div", { className: "mt-2 text-wrap text-sm", children: _jsx("p", { children: item.text }) })] })] }));
10
+ },
11
+ };
12
+ export const Timeline = (props) => {
13
+ return (_jsx("div", { className: "flow-root", children: _jsx("ul", { role: "list", className: "-mb-8", children: props.items.map((item, index) => {
14
+ var _a;
15
+ const Render = (_a = typeMap[item.type]) !== null && _a !== void 0 ? _a : null;
16
+ if (Render === null && props.Custom) {
17
+ return _jsx(props.Custom, { item: item });
18
+ }
19
+ return (_jsx("li", { children: _jsxs("div", { className: "relative pb-8", children: [index !== props.items.length - 1 ? (_jsx("span", { "aria-hidden": "true", className: "absolute left-5 top-5 -ml-px h-full w-0.5 bg-card-border" })) : null, _jsx("div", { className: "relative flex items-start space-x-3", children: _jsx(Render, { item: item }) })] }) }, item.id));
20
+ }) }) }));
21
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/floating/dropdown.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAE7F,KAAK,aAAa,GAAG;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;IACtD,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,aAAa,CAAC,4CA0E/D,CAAC"}
1
+ {"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/floating/dropdown.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAE7F,KAAK,aAAa,GAAG;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;IACtD,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,aAAa,CAAC,4CAoE/D,CAAC"}
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { arrow, autoUpdate, flip, FloatingArrow, FloatingFocusManager, FloatingPortal, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole, } from "@floating-ui/react";
4
4
  import { Fragment, useId, useMemo, useRef, useState } from "react";
5
5
  export const Dropdown = (props) => {
6
- var _a, _b;
7
6
  const headingId = useId();
8
7
  const [open, setOpen] = useState(props.open);
9
8
  const arrowRef = useRef(null);
@@ -36,5 +35,5 @@ export const Dropdown = (props) => {
36
35
  const dismiss = useDismiss(context);
37
36
  const role = useRole(context);
38
37
  const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
39
- return (_jsxs(Fragment, { children: [_jsx("button", Object.assign({ ref: refs.setReference }, getReferenceProps(props.buttonProps), { type: "button", children: props.trigger })), open && (_jsx(FloatingPortal, { id: `${headingId}-portal`, children: _jsx(FloatingFocusManager, { restoreFocus: (_a = props.restoreFocus) !== null && _a !== void 0 ? _a : true, returnFocus: (_b = props.restoreFocus) !== null && _b !== void 0 ? _b : true, visuallyHiddenDismiss: true, context: context, modal: false, children: _jsxs("div", Object.assign({ className: "bg-floating-background relative min-w-96 isolate z-floating border shadow-2xl p-6 border-floating-border rounded-lg", ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-floating-background stroke-floating-border" }), _jsx("header", { className: "mb-2", children: _jsx("h3", { className: "leading-snug font-medium text-2xl tracking-wide text-left", children: props.title }) }), props.children] })) }) }))] }));
38
+ return (_jsxs(Fragment, { children: [_jsx("button", Object.assign({ ref: refs.setReference }, getReferenceProps(props.buttonProps), { type: "button", children: props.trigger })), open && (_jsx(FloatingPortal, { preserveTabOrder: true, id: `${headingId}-portal`, children: _jsx(FloatingFocusManager, { guards: true, restoreFocus: true, returnFocus: true, visuallyHiddenDismiss: true, context: context, modal: false, children: _jsxs("div", Object.assign({ className: "relative isolate z-floating min-w-96 rounded-lg border border-floating-border bg-floating-background p-6 shadow-2xl", ref: refs.setFloating, style: floatingStyles, "aria-labelledby": headingId }, getFloatingProps(), { children: [_jsx(FloatingArrow, { ref: arrowRef, context: context, strokeWidth: 0.1, className: "fill-floating-background stroke-floating-border" }), _jsx("header", { className: "mb-2", children: _jsx("h3", { className: "text-left text-2xl font-medium leading-snug tracking-wide", children: props.title }) }), props.children] })) }) }))] }));
40
39
  };
@@ -0,0 +1,9 @@
1
+ import { motion } from "framer-motion";
2
+ import { PropsWithChildren } from "react";
3
+ import { Label, Override } from "../../types";
4
+ import { ButtonProps } from "../core/button";
5
+ export type ExpandProps = Override<ButtonProps<typeof motion.button>, {
6
+ trigger: Label;
7
+ }>;
8
+ export declare const Expand: (props: PropsWithChildren<ExpandProps>) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=expand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/components/floating/expand.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAU,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE1F,eAAO,MAAM,MAAM,UAAW,iBAAiB,CAAC,WAAW,CAAC,4CA4C3D,CAAC"}
@@ -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,
@@ -1,9 +1,11 @@
1
1
  import React from "react";
2
2
  import { Override } from "../../types";
3
3
  export type CheckboxProps = Override<React.PropsWithChildren<React.ComponentProps<"input">>, {
4
- size?: "medium" | "large";
5
4
  error?: string;
5
+ asTask?: boolean;
6
6
  container?: string;
7
+ labelClassName?: string;
8
+ size?: "medium" | "large";
7
9
  }>;
8
10
  export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
9
11
  //# sourceMappingURL=checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/form/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAChC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACtD;IACI,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ,qGAoBpB,CAAC"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/form/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAChC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACtD;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC7B,CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ,qGA4BpB,CAAC"}
@@ -3,6 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef } from "react";
4
4
  import { css } from "../../lib/dom";
5
5
  export const Checkbox = forwardRef((_a, ref) => {
6
- var { children, error, className = "", size, container } = _a, props = __rest(_a, ["children", "error", "className", "size", "container"]);
7
- return (_jsxs("label", { "data-disabled": props.disabled, "aria-disabled": props.disabled, className: css("group flex flex-wrap items-center font-normal data-[disabled=true]:cursor-not-allowed w-fit", container), children: [_jsx("input", Object.assign({}, props, { ref: ref, type: "checkbox", className: css("form-checkbox mr-2 inline-block size-4 appearance-none rounded border-card-border bg-origin-border text-primary focus:ring-primary disabled:opacity-70 group-aria-disabled:cursor-not-allowed", className) })), children, _jsx("span", { className: "min-w-full flex-1 whitespace-nowrap text-xs text-danger empty:mt-0 empty:hidden", children: error })] }));
6
+ var { children, asTask = false, labelClassName, error, className = "", size, container } = _a, props = __rest(_a, ["children", "asTask", "labelClassName", "error", "className", "size", "container"]);
7
+ return (_jsxs("label", { "data-task": asTask, "data-disabled": props.disabled, "aria-disabled": props.disabled, className: css("group flex w-fit flex-wrap items-center font-normal data-[disabled=true]:cursor-not-allowed", asTask ? "group-checkbox-checked:line-through" : "", container), children: [_jsx("input", Object.assign({}, props, { ref: ref, type: "checkbox", "data-task": asTask, className: css("form-checkbox mr-2 inline-block size-4 appearance-none rounded border-card-border bg-origin-border text-primary focus:ring-primary disabled:opacity-70 group-aria-disabled:cursor-not-allowed", className) })), children, _jsx("span", { "data-name": "checkbox-label", className: css("min-w-full flex-1 text-xs text-danger empty:mt-0 empty:hidden", labelClassName), children: error })] }));
8
8
  });
@@ -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
  });
@@ -0,0 +1,3 @@
1
+ import { ComponentProps, PropsWithChildren } from "react";
2
+ export declare const TaskList: (props: PropsWithChildren<ComponentProps<"fieldset">>) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=task-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../../../src/components/form/task-list.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AAErE,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,4CA2B5E,CAAC"}