@g4rcez/components 0.0.28 → 0.0.30

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 (65) hide show
  1. package/dist/components/core/button.js +1 -1
  2. package/dist/components/core/polymorph.d.ts +1 -1
  3. package/dist/components/core/polymorph.d.ts.map +1 -1
  4. package/dist/components/core/resizable.d.ts.map +1 -1
  5. package/dist/components/core/resizable.js +43 -4
  6. package/dist/components/display/alert.d.ts +2 -3
  7. package/dist/components/display/alert.d.ts.map +1 -1
  8. package/dist/components/display/alert.js +6 -6
  9. package/dist/components/display/calendar.d.ts +1 -1
  10. package/dist/components/display/calendar.d.ts.map +1 -1
  11. package/dist/components/display/calendar.js +6 -5
  12. package/dist/components/display/card.d.ts +4 -3
  13. package/dist/components/display/card.d.ts.map +1 -1
  14. package/dist/components/display/card.js +2 -2
  15. package/dist/components/display/list.d.ts +16 -0
  16. package/dist/components/display/list.d.ts.map +1 -0
  17. package/dist/components/display/list.js +35 -0
  18. package/dist/components/display/tabs.d.ts.map +1 -1
  19. package/dist/components/floating/modal.d.ts +4 -3
  20. package/dist/components/floating/modal.d.ts.map +1 -1
  21. package/dist/components/floating/modal.js +13 -12
  22. package/dist/components/form/autocomplete.d.ts.map +1 -1
  23. package/dist/components/form/autocomplete.js +26 -19
  24. package/dist/components/form/checkbox.d.ts +3 -1
  25. package/dist/components/form/checkbox.d.ts.map +1 -1
  26. package/dist/components/form/checkbox.js +5 -4
  27. package/dist/components/form/date-picker.d.ts +3 -3
  28. package/dist/components/form/date-picker.d.ts.map +1 -1
  29. package/dist/components/form/date-picker.js +12 -7
  30. package/dist/components/form/input-field.d.ts.map +1 -1
  31. package/dist/components/form/input-field.js +2 -2
  32. package/dist/components/form/input.d.ts.map +1 -1
  33. package/dist/components/form/input.js +4 -5
  34. package/dist/components/form/select.d.ts.map +1 -1
  35. package/dist/components/form/select.js +8 -7
  36. package/dist/components/form/switch.d.ts +4 -3
  37. package/dist/components/form/switch.d.ts.map +1 -1
  38. package/dist/components/form/switch.js +28 -7
  39. package/dist/components/table/index.js +5 -5
  40. package/dist/components/table/sort.d.ts.map +1 -1
  41. package/dist/components/table/sort.js +7 -6
  42. package/dist/hooks/use-click-outside.d.ts +3 -0
  43. package/dist/hooks/use-click-outside.d.ts.map +1 -0
  44. package/dist/hooks/use-click-outside.js +17 -0
  45. package/dist/hooks/use-form.d.ts +18 -5
  46. package/dist/hooks/use-form.d.ts.map +1 -1
  47. package/dist/hooks/use-form.js +62 -18
  48. package/dist/index.css +1 -1
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +1 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/index.mjs +6673 -6644
  54. package/dist/index.mjs.map +1 -1
  55. package/dist/index.umd.js +49 -49
  56. package/dist/index.umd.js.map +1 -1
  57. package/dist/lib/dom.d.ts +2 -1
  58. package/dist/lib/dom.d.ts.map +1 -1
  59. package/dist/lib/dom.js +11 -12
  60. package/dist/preset/preset.tailwind.d.ts.map +1 -1
  61. package/dist/preset/preset.tailwind.js +4 -2
  62. package/dist/preset/src/styles/theme.js +6 -6
  63. package/dist/styles/theme.js +6 -6
  64. package/package.json +3 -3
  65. package/README.md +0 -36
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
4
4
  import { forwardRef } from "react";
5
5
  import { css } from "../../lib/dom";
6
6
  import { Polymorph } from "./polymorph";
7
- const buttonVariants = cva("inline-flex duration-700 enabled:hover:bg-opacity-70 data-[loading=true]:opacity-30 data-[loading=true]:animate-pulse gap-1.5 text-main-foreground border-2 border-transparent items-center justify-center align-middle cursor-pointer whitespace-nowrap font-medium transition-colors ease-in disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring", {
7
+ const buttonVariants = cva("inline-flex duration-700 enabled:hover:bg-opacity-80 data-[loading=true]:opacity-30 data-[loading=true]:animate-pulse gap-1.5 text-main-foreground border-2 border-transparent items-center justify-center align-middle cursor-pointer whitespace-nowrap font-medium transition-colors ease-in disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring ease-normal", {
8
8
  variants: {
9
9
  size: {
10
10
  default: "h-10 px-4 py-2",
@@ -3,7 +3,7 @@ import { Override } from "../../types";
3
3
  type Polymorphism<T extends React.ElementType> = React.PropsWithChildren<{
4
4
  as?: T;
5
5
  }>;
6
- export type Props<T extends React.ElementType = React.ElementType> = Polymorphism<T> & Omit<React.ComponentPropsWithRef<T>, keyof Polymorphism<T>>;
6
+ type Props<T extends React.ElementType = React.ElementType> = Polymorphism<T> & Omit<React.ComponentPropsWithRef<T>, keyof Polymorphism<T>>;
7
7
  export type PolymorphicProps<P extends {}, T extends React.ElementType = React.ElementType> = Omit<T extends string ? Override<React.ComponentProps<T> & Props<T>, P> : Override<Props<T>, P>, keyof Polymorphism<T>> & Polymorphism<T>;
8
8
  export declare const Polymorph: React.ForwardRefExoticComponent<Omit<Props<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<any>>;
9
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"polymorph.d.ts","sourceRoot":"","sources":["../../../src/components/core/polymorph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,KAAK,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,iBAAiB,CAAC;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAErF,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnJ,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAC9F,CAAC,SAAS,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1F,MAAM,YAAY,CAAC,CAAC,CAAC,CACxB,GACG,YAAY,CAAC,CAAC,CAAC,CAAC;AAEpB,eAAO,MAAM,SAAS,2IAGpB,CAAC"}
1
+ {"version":3,"file":"polymorph.d.ts","sourceRoot":"","sources":["../../../src/components/core/polymorph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,KAAK,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,iBAAiB,CAAC;IAAE,EAAE,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAErF,KAAK,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5I,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAC9F,CAAC,SAAS,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1F,MAAM,YAAY,CAAC,CAAC,CAAC,CACxB,GACG,YAAY,CAAC,CAAC,CAAC,CAAC;AAEpB,eAAO,MAAM,SAAS,2IAGpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resizable.d.ts","sourceRoot":"","sources":["../../../src/components/core/resizable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,SAAS,iBAAkB,KAAK,CAAC,iBAAiB,4CAO9D,CAAC"}
1
+ {"version":3,"file":"resizable.d.ts","sourceRoot":"","sources":["../../../src/components/core/resizable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAkD5D,eAAO,MAAM,SAAS,iBAAkB,KAAK,CAAC,iBAAiB,4CAQ9D,CAAC"}
@@ -1,8 +1,47 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { motion } from "framer-motion";
4
- import useMeasure from "react-use-measure";
3
+ import { motion, useMotionValue } from "framer-motion";
4
+ import { useEffect, useMemo, useState } from "react";
5
+ const defaultState = {
6
+ x: 0,
7
+ y: 0,
8
+ width: 0,
9
+ height: 0,
10
+ top: 0,
11
+ left: 0,
12
+ bottom: 0,
13
+ right: 0,
14
+ };
15
+ const useElementRect = () => {
16
+ const [element, ref] = useState(null);
17
+ const motion = useMotionValue(defaultState);
18
+ const observer = useMemo(() => new window.ResizeObserver((entries) => {
19
+ if (entries[0]) {
20
+ const rect = entries[0].contentRect;
21
+ motion.set({
22
+ x: rect.x,
23
+ y: rect.y,
24
+ width: rect.width,
25
+ height: rect.height,
26
+ top: rect.top,
27
+ left: rect.left,
28
+ bottom: rect.bottom,
29
+ right: rect.right,
30
+ });
31
+ }
32
+ }), []);
33
+ useEffect(() => {
34
+ if (!element)
35
+ return;
36
+ observer.observe(element);
37
+ return () => {
38
+ observer.disconnect();
39
+ };
40
+ }, [element]);
41
+ return [ref, motion];
42
+ };
5
43
  export const Resizable = ({ children }) => {
6
- const [ref, bounds] = useMeasure();
7
- return (_jsx(motion.div, { animate: { height: bounds.height > 0 ? bounds.height : "auto" }, children: _jsx("div", { ref: ref, children: children }) }));
44
+ const [ref, bounds] = useElementRect();
45
+ const h = bounds.get().height;
46
+ return (_jsx(motion.div, { animate: { height: h > 0 ? h : "auto" }, children: _jsx("div", { ref: ref, children: children }) }));
8
47
  };
@@ -1,8 +1,7 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
- import React from "react";
3
- import { PolymorphicProps } from "../core/polymorph";
4
2
  import { HTMLMotionProps } from "framer-motion";
5
- import { PropsWithChildren } from "react";
3
+ import React, { PropsWithChildren } from "react";
4
+ import { PolymorphicProps } from "../core/polymorph";
6
5
  type CollapseProps = {
7
6
  open: boolean;
8
7
  } & HTMLMotionProps<"section">;
@@ -1 +1 @@
1
- {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/components/display/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAU,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAc1C,KAAK,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAEpE,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,aAAa,CAAC,4CAgB/D,CAAC;AAEF,QAAA,MAAM,aAAa;;mFASjB,CAAC;AAEH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI,gBAAgB,CAC1E,YAAY,CAAC,OAAO,aAAa,CAAC,GAC9B,OAAO,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC,EACN,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,GAsCxE,CAAC"}
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/components/display/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAU,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAahE,KAAK,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAEpE,eAAO,MAAM,QAAQ,UAAW,iBAAiB,CAAC,aAAa,CAAC,4CAgB/D,CAAC;AAEF,QAAA,MAAM,aAAa;;mFASjB,CAAC;AAEH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI,gBAAgB,CAC1E,YAAY,CAAC,OAAO,aAAa,CAAC,GAC9B,OAAO,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC,EACN,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,GAsCxE,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cva } from "class-variance-authority";
4
+ import { motion } from "framer-motion";
4
5
  import { CheckCircleIcon, CircleAlertIcon, XIcon } from "lucide-react";
5
6
  import { forwardRef } from "react";
6
- import { Polymorph } from "../core/polymorph";
7
- import { motion } from "framer-motion";
8
7
  import { css } from "../../lib/dom";
8
+ import { Polymorph } from "../core/polymorph";
9
9
  const variants = {
10
10
  true: { opacity: 1, height: "auto" },
11
11
  false: { opacity: [0.7, 0.3, 0], height: 0 },
@@ -15,19 +15,19 @@ const transition = {
15
15
  duration: 0.7,
16
16
  ease: [0.04, 0.62, 0.23, 0.98],
17
17
  };
18
- export const Collapse = (props) => (_jsx(motion.section, Object.assign({}, props, { layout: true, layoutRoot: true, layoutScroll: true, initial: props.open, animate: props.open.toString(), "aria-hidden": !props.open, className: props.className, exit: variants.false, transition: transition, variants: variants, children: props.children })));
18
+ export const Collapse = (props) => (_jsx(motion.section, Object.assign({}, props, { layout: true, layoutRoot: true, layoutScroll: true, initial: !props.open, animate: props.open.toString(), "aria-hidden": !props.open, className: props.className, exit: variants.false, transition: transition, variants: variants, children: props.children })));
19
19
  const alertVariants = cva("px-4 py-4 border relative rounded-lg text-sm", {
20
20
  variants: {
21
21
  theme: {
22
22
  neutral: "border-border bg-background",
23
23
  danger: "text-danger-contrast bg-danger/10 border-danger/50",
24
- success: "text-success-contrast bg-success/10 border-success/50",
24
+ success: "text-success-foreground bg-success/10 border-success/50",
25
25
  },
26
26
  },
27
27
  defaultVariants: { theme: "neutral" },
28
28
  });
29
29
  export const Alert = forwardRef(function Alert(_a, ref) {
30
30
  var _b;
31
- var { className, theme, onClose, open } = _a, props = __rest(_a, ["className", "theme", "onClose", "open"]);
32
- return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, className: "data-[open=true]:mb-4 isolate data-[open=true]:pointer-events-auto pointer-events-none", children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, Object.assign({}, props, { className: css(alertVariants({ theme }), className), ref: ref, "data-theme": theme, role: "alert", as: (_b = props.as) !== null && _b !== void 0 ? _b : "div", children: [_jsxs("h4", { className: "mb-2 flex items-center gap-2", children: [theme === "success" ? _jsx(CheckCircleIcon, { size: 20 }) : null, theme === "danger" ? _jsx(CircleAlertIcon, { size: 20 }) : null, _jsx("span", { className: "tracking-3 text-balance text-lg font-semibold", children: props.title })] }), props.children, open !== undefined ? (_jsx("button", { type: "button", onClick: () => onClose === null || onClose === void 0 ? void 0 : onClose(false), className: "text-foreground hover:text-danger absolute right-3 top-3 transition-colors duration-300 ease-in-out", children: _jsx(XIcon, { size: 20 }) })) : null] })) }) }));
31
+ var { className, theme, onClose, open = true } = _a, props = __rest(_a, ["className", "theme", "onClose", "open"]);
32
+ return (_jsx("div", { "data-open": !!open, "aria-hidden": !open, className: "pointer-events-none isolate data-[open=true]:pointer-events-auto data-[open=true]:mb-4", children: _jsx(Collapse, { "data-open": !!open, open: !!open, children: _jsxs(Polymorph, Object.assign({}, props, { className: css(alertVariants({ theme }), className), ref: ref, "data-theme": theme, role: "alert", as: (_b = props.as) !== null && _b !== void 0 ? _b : "div", children: [_jsxs("h4", { className: "mb-2 flex items-center gap-2", children: [theme === "success" ? _jsx(CheckCircleIcon, { size: 20 }) : null, theme === "danger" ? _jsx(CircleAlertIcon, { size: 20 }) : null, _jsx("span", { className: "tracking-3 text-balance text-lg font-semibold", children: props.title })] }), props.children, onClose !== undefined ? (_jsx("button", { type: "button", onClick: () => onClose(false), className: "duration-300 ease-in-out absolute right-3 top-3 text-foreground transition-colors hover:text-danger", children: _jsx(XIcon, { size: 20 }) })) : null] })) }) }));
33
33
  });
@@ -5,7 +5,7 @@ export type CalendarProps = {
5
5
  locale?: Locales;
6
6
  markToday?: boolean;
7
7
  autoFocusToday?: boolean;
8
- onChange?: (d: Date) => void;
8
+ onChange?: (d: Date | undefined) => void;
9
9
  };
10
10
  export declare const Calendar: ({ locale, disabledDate, markToday, autoFocusToday, date, onChange }: CalendarProps) => import("react/jsx-runtime").JSX.Element;
11
11
  //# sourceMappingURL=calendar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/components/display/calendar.tsx"],"names":[],"mappings":"AAsBA,OAAqB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAmBvD,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACvC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC,CAAC;AAmDF,eAAO,MAAM,QAAQ,wEAAuF,aAAa,4CAmMxH,CAAC"}
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/components/display/calendar.tsx"],"names":[],"mappings":"AAsBA,OAAqB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAoBvD,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACvC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;CAC5C,CAAC;AAmDF,eAAO,MAAM,QAAQ,wEAAuF,aAAa,4CAqMxH,CAAC"}
@@ -8,6 +8,7 @@ import { Is } from "sidekicker";
8
8
  import TheMaskInput from "the-mask-input";
9
9
  import { useReducer } from "use-typed-reducer";
10
10
  import { useDebounce } from "../../hooks/use-debounce";
11
+ import { css } from "../../lib/dom";
11
12
  import { Resizable } from "../core/resizable";
12
13
  const transition = { type: "spring", bounce: 0.1, duration: 0.3 };
13
14
  const dir = (mod) => (n = 1) => ({ x: `${100 * mod * n}%`, opacity: 0.5 });
@@ -137,20 +138,20 @@ export const Calendar = ({ locale, disabledDate, markToday = true, autoFocusToda
137
138
  d.setFullYear(+y);
138
139
  return d;
139
140
  });
140
- }, 700);
141
+ }, 1200);
141
142
  const onChangeYear = (e) => {
142
143
  const value = e.currentTarget.value;
143
144
  dispatch.onChangeYear(value);
144
145
  defer(value);
145
146
  };
146
- return (_jsx(MotionConfig, { transition: transition, children: _jsxs("div", { className: "relative overflow-hidden", children: [_jsx("div", { className: "flex flex-col justify-center rounded text-center", children: _jsx(Resizable, { children: _jsx(AnimatePresence, { presenceAffectsLayout: true, mode: "popLayout", initial: false, custom: state.direction, onExitComplete: dispatch.onExitComplete, children: _jsxs(motion.div, { initial: "enter", animate: "middle", exit: "exit", children: [_jsxs("header", { className: "relative flex justify-between", children: [_jsx(motion.button, { onClick: dispatch.previousMonth, variants: removeImmediately, className: "z-calendar rounded-full p-1.5 hover:bg-primary", children: _jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), _jsx(motion.span, { variants: variants, custom: state.direction, className: "absolute z-normal isolate inset-0 flex items-center justify-center font-semibold", children: _jsxs("span", { className: "w-fit flex items-center justify-center gap-0.5 py-1", children: [_jsx("select", { style: { width: `${monthString.length}ch` }, value: monthString, onChange: dispatch.onChangeMonth, className: "appearance-none capitalize bg-transparent proportional-nums hover:text-primary cursor-pointer w-fit", children: state.months }), _jsx(TheMaskInput, { mask: "int", value: state.year, maxLength: 4, placeholder: "YYYY", onChange: onChangeYear, style: { width: `${state.year.length}ch` }, className: "w-16 bg-transparent appearance-none hover:text-primary cursor-pointer" })] }) }), _jsx(motion.button, { variants: removeImmediately, className: "z-calendar rounded-full p-1.5 hover:bg-primary", onClick: dispatch.nextMonth, children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
147
+ return (_jsx(MotionConfig, { transition: transition, children: _jsxs("div", { className: "relative overflow-hidden", children: [_jsx("div", { className: "flex flex-col justify-center rounded text-center", children: _jsx(Resizable, { children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", presenceAffectsLayout: true, custom: state.direction, onExitComplete: dispatch.onExitComplete, children: _jsxs(motion.div, { initial: "enter", animate: "middle", exit: "exit", children: [_jsxs("header", { className: "relative flex justify-between", children: [_jsx(motion.button, { onClick: dispatch.previousMonth, variants: removeImmediately, className: "z-calendar rounded-full p-1.5 hover:bg-primary", children: _jsx(ChevronLeftIcon, { className: "h-4 w-4" }) }), _jsx(motion.span, { variants: variants, custom: state.direction, className: "absolute inset-0 isolate z-normal flex items-center justify-center font-semibold", children: _jsxs("span", { className: "flex w-fit items-center justify-center gap-0.5 py-1", children: [_jsx("select", { style: { width: `${monthString.length}ch` }, value: monthString, onChange: dispatch.onChangeMonth, className: "w-fit cursor-pointer appearance-none bg-transparent capitalize proportional-nums hover:text-primary", children: state.months }), _jsx(TheMaskInput, { mask: "int", value: state.year, maxLength: 4, placeholder: "YYYY", onChange: onChangeYear, style: { width: `${state.year.length}ch` }, className: "w-16 cursor-pointer appearance-none bg-transparent hover:text-primary" })] }) }), _jsx(motion.button, { variants: removeImmediately, className: "z-calendar rounded-full p-1.5 hover:bg-primary", onClick: dispatch.nextMonth, children: _jsx(ChevronRightIcon, { className: "h-4 w-4" }) }), _jsx("div", { className: "absolute inset-0", style: {
147
148
  backgroundImage: "linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)",
148
- } })] }), _jsx("div", { className: "mt-4 grid grid-cols-7 gap-y-4", children: state.week.map((dayOfWeek) => (_jsx("span", { className: "font-medium capitalize text-sm", children: dayOfWeek.toLocaleDateString(locale, { weekday: "short" }) }, dayOfWeek.toString()))) }), _jsx(motion.ul, { onKeyDown: dispatch.onKeyDown, variants: variants, custom: state.direction, className: "mt-4 pb-2 grid grid-cols-7 gap-y-4", children: days.map((day) => {
149
+ } })] }), _jsx("div", { className: "mt-4 grid grid-cols-7 gap-y-4", children: state.week.map((dayOfWeek) => (_jsx("span", { className: "text-sm font-medium capitalize", children: dayOfWeek.toLocaleDateString(locale, { weekday: "short" }) }, dayOfWeek.toString()))) }), _jsx(motion.ul, { onKeyDown: dispatch.onKeyDown, variants: variants, custom: state.direction, className: "mt-4 grid grid-cols-7 gap-y-4 pb-2", children: days.map((day) => {
149
150
  const key = day.toISOString();
150
151
  const isSelected = key === currentAsString;
151
152
  const today = isToday(day) && markToday;
152
153
  const disabledByFn = (disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(day)) || false;
153
154
  const disableDate = !isSameMonth(day, state.date) || disabledByFn;
154
- return (_jsx("li", { className: "w-full flex items-center justify-center", children: _jsx("button", { type: "button", "data-date": key, disabled: disabledByFn, onClick: dispatch.onSelectDate, "data-view": state.date.getMonth().toString(), className: `size-8 disabled:cursor-not-allowed rounded-full font-semibold flex items-center justify-center proportional-nums ${today ? "text-primary" : ""} ${disableDate ? "text-disabled" : ""} ${isSelected ? "bg-primary text-primary-foreground" : ""}`, children: day.getDate() }) }, key));
155
- }) })] }, monthString) }) }) }), _jsx("footer", { className: "text-center text-primary mt-2", children: _jsx("button", { className: "hover:scale-105 transition-transform duration-300", type: "button", onClick: dispatch.setToday, children: "Today" }) })] }) }));
155
+ return (_jsx("li", { className: "flex w-full items-center justify-center", children: _jsx("button", { type: "button", "data-date": key, disabled: disabledByFn, onClick: dispatch.onSelectDate, "data-view": state.date.getMonth().toString(), className: css(`flex size-8 items-center justify-center rounded-full font-semibold proportional-nums disabled:cursor-not-allowed ${today ? "text-primary" : ""} ${disableDate ? "text-disabled" : ""} ${isSelected ? "bg-primary text-primary-foreground" : ""}`), children: day.getDate() }) }, key));
156
+ }) })] }, monthString) }) }) }), _jsx("footer", { className: "mt-2 text-center text-primary", children: _jsx("button", { className: "duration-300 transition-transform hover:scale-105", type: "button", onClick: dispatch.setToday, children: "Today" }) })] }) }));
156
157
  };
@@ -1,9 +1,10 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
  import { Label, Override } from "../../types";
3
- export type CardProps = Override<React.ComponentProps<"div">, {
3
+ import { PolymorphicProps } from "../core/polymorph";
4
+ export type CardProps = PolymorphicProps<Override<React.ComponentProps<"div">, {
4
5
  title?: Label;
5
6
  container?: string;
6
7
  header?: React.ReactElement | null;
7
- }>;
8
- export declare const Card: ({ children, title, container, header, className, ...props }: PropsWithChildren<CardProps>) => import("react/jsx-runtime").JSX.Element;
8
+ }>, "div">;
9
+ export declare const Card: ({ children, title, as, container, header, className, ...props }: PropsWithChildren<CardProps>) => import("react/jsx-runtime").JSX.Element;
9
10
  //# sourceMappingURL=card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/display/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG9C,MAAM,MAAM,SAAS,GAAG,QAAQ,CAC5B,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAC3B;IACI,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CACtC,CACJ,CAAC;AAEF,eAAO,MAAM,IAAI,gEAAkF,iBAAiB,CAAC,SAAS,CAAC,4CAS9H,CAAC"}
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/display/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,gBAAgB,CACpC,QAAQ,CACJ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAC3B;IACI,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CACtC,CACJ,EACD,KAAK,CACR,CAAC;AAEF,eAAO,MAAM,IAAI,oEAA8F,iBAAiB,CAAC,SAAS,CAAC,4CAS1I,CAAC"}
@@ -3,6 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { css } from "../../lib/dom";
4
4
  import { Polymorph } from "../core/polymorph";
5
5
  export const Card = (_a) => {
6
- var { children, title, container = "", header = null, className = "" } = _a, props = __rest(_a, ["children", "title", "container", "header", "className"]);
7
- return (_jsxs(Polymorph, Object.assign({}, props, { as: "div", className: css("rounded-card flex flex-col gap-4 bg-card-background py-4 pb-8 border-card-border border shadow", container), children: [title ? _jsx("header", { className: "w-full px-8 pb-4 mb-2 border-b border-card-border font-medium text-xl", children: title }) : header, _jsx("div", { className: `min-w-full px-8 ${className}`, children: children })] })));
6
+ var { children, title, as = "div", container = "", header = null, className = "" } = _a, props = __rest(_a, ["children", "title", "as", "container", "header", "className"]);
7
+ return (_jsxs(Polymorph, Object.assign({}, props, { as: as, className: css("flex flex-col gap-4 rounded-card border border-card-border bg-card-background py-4 pb-8 shadow", container), children: [title ? _jsx("header", { className: "mb-2 w-full border-b border-card-border px-8 pb-4 text-xl font-medium", children: title }) : header, _jsx("div", { className: css("min-w-full px-8", className), children: children })] })));
8
8
  };
@@ -0,0 +1,16 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ import { Label } from "../../types";
3
+ type AnimatedItemProps = {
4
+ title: Label;
5
+ description: Label;
6
+ children: Label;
7
+ avatar?: Label;
8
+ leading?: React.FC<{
9
+ open: () => void;
10
+ }>;
11
+ };
12
+ type AnimatedListProps = {};
13
+ export declare const AnimatedList: (props: PropsWithChildren<AnimatedListProps>) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const AnimatedListItem: (props: PropsWithChildren<AnimatedItemProps>) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/components/display/list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAY,iBAAiB,EAAmD,MAAM,OAAO,CAAC;AAE5G,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,KAAK,iBAAiB,GAAG;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,KAAK,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CAC5C,CAAC;AAIF,KAAK,iBAAiB,GAAG,EAAE,CAAC;AA0D5B,eAAO,MAAM,YAAY,UAAW,iBAAiB,CAAC,iBAAiB,CAAC,4CA4DvE,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,iBAAiB,CAAC,iBAAiB,CAAC,4CAA0C,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AnimatePresence, motion } from "framer-motion";
3
+ import { XIcon } from "lucide-react";
4
+ import React, { Fragment, useCallback, useEffect, useId, useRef, useState } from "react";
5
+ import { useOnClickOutside } from "../../hooks/use-click-outside";
6
+ const FloatItem = ({ item, setter }) => {
7
+ const ref = useRef(null);
8
+ useOnClickOutside(ref, setter);
9
+ useEffect(() => {
10
+ function onKeyDown(event) {
11
+ if (event.key === "Escape")
12
+ setter();
13
+ }
14
+ window.addEventListener("keydown", onKeyDown);
15
+ return () => window.removeEventListener("keydown", onKeyDown);
16
+ }, []);
17
+ return (_jsxs(Fragment, { children: [_jsx(AnimatePresence, { children: item ? (_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: "pointer-events-none absolute inset-0 z-floating h-screen w-screen bg-floating-overlay/70" })) : null }), _jsx(AnimatePresence, { children: item ? (_jsx("div", { className: "absolute inset-0 z-tooltip flex items-center justify-center", children: _jsxs(motion.div, { layout: true, ref: ref, layoutId: `item-${item.id}`, className: "relative flex h-min w-min min-w-xs flex-col gap-4 rounded-card border border-card-border bg-card-background p-6 py-4 pb-8 shadow", children: [_jsx("nav", { className: "absolute right-4 top-1 lg:right-2", children: _jsx("button", { type: "button", onClick: setter, className: "p-1 opacity-70 transition-colors hover:text-danger hover:opacity-100 focus:text-danger", children: _jsx(XIcon, {}) }) }), _jsxs("header", { className: "flex w-full flex-wrap items-center justify-between gap-2", children: [_jsx("h3", { className: "min-w-full text-balance text-2xl font-medium", children: item.title }), _jsx("p", { className: "text-sm leading-snug text-secondary", children: item.description })] }), item.children] }) })) : null })] }));
18
+ };
19
+ export const AnimatedList = (props) => {
20
+ const [selected, setSelected] = useState(null);
21
+ const id = useId();
22
+ const clear = useCallback(() => {
23
+ setSelected(null);
24
+ }, []);
25
+ const items = React.Children.toArray(props.children);
26
+ return (_jsxs(Fragment, { children: [_jsx(FloatItem, { item: selected, setter: clear }), _jsx("ul", { role: "list", children: items.map((x, index) => {
27
+ const item = x.props;
28
+ const isLast = index === items.length - 1;
29
+ const innerId = `${id}-${index}`;
30
+ const setter = () => setSelected(Object.assign(Object.assign({}, item), { id: innerId }));
31
+ const Leading = item.leading;
32
+ return (_jsx(motion.li, { layout: true, layoutId: `item-${innerId}`, className: `border-b border-card-border py-2 last:border-transparent`, children: _jsx(motion.div, { layoutId: `toast-${innerId}`, className: "relative", children: _jsx("div", { className: "relative flex items-start space-x-3", children: _jsxs(Fragment, { children: [item.avatar ? (_jsx("div", { children: _jsx("div", { className: "relative px-1", children: _jsx("button", { onClick: setter, className: "flex size-10 items-center justify-center ring-primary", children: item.avatar }) }) })) : null, _jsx("div", { className: "min-w-0 flex-1 py-1 text-foreground", children: _jsxs("div", { className: "flex flex-row flex-nowrap justify-between gap-4", children: [_jsxs("button", { onClick: setter, className: "ease-out cursor-pointer text-left transition-all hover:scale-105 hover:text-primary", children: [_jsx("h3", { children: item.title }), _jsx("p", { className: "text-sm leading-snug text-secondary", children: item.description })] }), Leading ? _jsx(Leading, { open: setter }) : null] }) })] }) }) }) }, innerId));
33
+ }) })] }));
34
+ };
35
+ export const AnimatedListItem = (props) => _jsx(Fragment, { children: props.children });
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAEzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,eAAO,MAAM,IAAI,UAAW,iBAAiB,CAAC,SAAS,CAAC,4CA6GvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpI,eAAO,MAAM,GAAG,UAAW,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAAiC,MAAM,OAAO,CAAC;AAEzG,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIpC,MAAM,MAAM,SAAS,GAAG;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAIF,eAAO,MAAM,IAAI,UAAW,iBAAiB,CAAC,SAAS,CAAC,4CA6GvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpI,eAAO,MAAM,GAAG,UAAW,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
@@ -1,16 +1,17 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
  import { Label } from "../../types";
3
- export type DrawerProps = {
3
+ export type ModalProps = {
4
4
  title?: Label;
5
5
  open: boolean;
6
6
  footer?: Label;
7
7
  resizer?: boolean;
8
8
  asChild?: boolean;
9
9
  closable?: boolean;
10
- type?: "dialog" | "drawer";
11
10
  position?: "left" | "right";
12
11
  trigger?: Label | React.FC<any>;
12
+ type?: "dialog" | "drawer" | "sheet";
13
13
  onChange: (nextState: boolean) => void;
14
+ overlayClickClose?: boolean;
14
15
  };
15
- export declare const Modal: ({ type: _type, resizer, ...props }: PropsWithChildren<DrawerProps>) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const Modal: ({ type: _type, resizer, overlayClickClose, ...props }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
16
17
  //# sourceMappingURL=modal.d.ts.map
@@ -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;AAsDpC,MAAM,MAAM,WAAW,GAAG;IACtB,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,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAkEF,eAAO,MAAM,KAAK,uCAA0D,iBAAiB,CAAC,WAAW,CAAC,4CA6FzG,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;AAsDpC,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,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAoEF,eAAO,MAAM,KAAK,0DAAqF,iBAAiB,CAAC,UAAU,CAAC,4CAgGnI,CAAC"}
@@ -34,8 +34,8 @@ const variants = cva("isolate ring-0 outline-0 appearance-none flex flex-col gap
34
34
  variants: {
35
35
  type: {
36
36
  drawer: "max-h-screen max-w-[90%] w-auto h-screen min-h-0",
37
- dialog: "max-h-[calc(100lvh-10%)] container h-[inherit] rounded-lg py-8",
38
- sheet: "w-full absolute bottom-0 max-h-[90vh] max-h-[90svh] pt-6 pb-4 rounded-t-lg",
37
+ dialog: "max-h-[calc(100lvh-10%)] container h-min rounded-lg py-8",
38
+ sheet: "w-full absolute bottom-0 h-[85vh] max-h-[85vh] max-h-[85svh] pt-6 pb-4 rounded-t-lg",
39
39
  },
40
40
  position: {
41
41
  none: "",
@@ -45,7 +45,7 @@ const variants = cva("isolate ring-0 outline-0 appearance-none flex flex-col gap
45
45
  },
46
46
  defaultVariants: { position: "right", type: "dialog" },
47
47
  });
48
- const dragConstraints = { top: 0, left: 0, right: 0, bottom: 0 };
48
+ const dragConstraints = { top: 0, left: 0, right: 0, bottom: -1 };
49
49
  const calculateClose = (n) => n * 0.62;
50
50
  const Draggable = (props) => {
51
51
  const onDrag = (_, info) => {
@@ -53,7 +53,7 @@ const Draggable = (props) => {
53
53
  if (!props.sheet) {
54
54
  const div = props.parent.current;
55
55
  const v = props.value.get() || div.getBoundingClientRect().width;
56
- const delta = props.type === "right" ? -info.delta.x : info.delta.x;
56
+ const delta = props.position === "right" ? -info.delta.x : info.delta.x;
57
57
  return props.value.set(Math.abs(v + delta));
58
58
  }
59
59
  const div = props.parent.current;
@@ -68,20 +68,20 @@ const Draggable = (props) => {
68
68
  return props.value.set(result);
69
69
  }
70
70
  };
71
- return (_jsx(motion.div, { draggable: true, dragMomentum: true, onDrag: onDrag, animate: false, initial: false, dragElastic: 0.15, dragDirectionLock: true, dragSnapToOrigin: true, drag: props.sheet ? "y" : "x", dragConstraints: dragConstraints, whileDrag: { cursor: "grabbing" }, className: css("absolute rounded-lg cursor-grab", props.sheet ? "" : "bg-floating-border", props.sheet
72
- ? "w-full py-2 top-1 h-3 flex justify-center"
73
- : props.type === "left"
74
- ? "top-1/2 right-5 h-10 w-2"
75
- : "top-1/2 left-2 h-10 w-2"), children: props.sheet ? _jsx("div", { className: "bg-floating-border rounded-lg w-1/4 h-2" }) : null }));
71
+ return (_jsx(motion.div, { draggable: true, dragMomentum: true, dragListener: true, dragPropagation: true, onDrag: onDrag, animate: false, initial: false, dragElastic: 0, dragDirectionLock: true, dragSnapToOrigin: true, drag: props.sheet ? "y" : "x", dragConstraints: dragConstraints, whileDrag: { cursor: "grabbing" }, className: css("absolute rounded-lg", props.sheet ? "cursor-row-resize" : "cursor-col-resize bg-floating-border", props.sheet
72
+ ? "top-1 flex h-3 w-full justify-center py-2"
73
+ : props.position === "left"
74
+ ? "right-5 top-1/2 h-10 w-2"
75
+ : "left-2 top-1/2 h-10 w-2"), children: props.sheet ? _jsx("div", { className: "h-2 w-1/4 rounded-lg bg-floating-border" }) : null }));
76
76
  };
77
77
  const positions = { drawer: "right", sheet: "none", dialog: "none" };
78
78
  export const Modal = (_a) => {
79
- var { type: _type = "dialog", resizer = true } = _a, props = __rest(_a, ["type", "resizer"]);
79
+ var { type: _type = "dialog", resizer = true, overlayClickClose = false } = _a, props = __rest(_a, ["type", "resizer", "overlayClickClose"]);
80
80
  const headingId = useId();
81
81
  const descriptionId = useId();
82
82
  const isDesktop = useMediaQuery("(min-width: 48rem)");
83
83
  const useResizer = _type === "drawer" || !isDesktop;
84
- const position = isDesktop ? positions[_type] : positions.sheet;
84
+ const position = isDesktop ? (_type === "drawer" ? props.position : positions[_type]) : positions.sheet;
85
85
  const func = isDesktop ? animations[_type] : animations.sheet;
86
86
  const animation = typeof func === "function" ? func(position) : func;
87
87
  const type = isDesktop ? _type : "sheet";
@@ -92,5 +92,6 @@ export const Modal = (_a) => {
92
92
  const { getReferenceProps, getFloatingProps } = useInteractions([click, role, dismiss]);
93
93
  const Trigger = props.trigger;
94
94
  const value = useMotionValue(undefined);
95
- 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: `relative !overflow-clip h-[100dvh] z-floating bg-floating-overlay/70 ${type === "drawer" ? "" : "grid justify-center p-8"}`, children: _jsx(FloatingFocusManager, { 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, variants: animation, style: isDesktop ? { width: value } : { height: value } }, getFloatingProps(), { children: [useResizer && resizer ? (_jsx(Draggable, { onChange: props.onChange, sheet: !isDesktop, value: value, parent: refs.floating, type: position })) : null, props.title || props.closable ? (_jsxs("header", { className: "w-full relative", children: [props.title ? (_jsx("h2", { className: "px-8 pb-4 border-b border-floating-border text-3xl font-medium leading-relaxed", children: props.title })) : null, props.closable !== false ? (_jsx("nav", { className: "absolute -top-1 right-8", children: _jsx("button", { type: "button", onClick: () => props.onChange(false), className: "p-1 transition-colors hover:text-danger focus:text-danger", children: _jsx(XIcon, {}) }) })) : null] })) : null, _jsx("div", { className: "flex-1 px-8 overflow-y-auto", children: props.children }), props.footer ? (_jsx("footer", { className: "px-8 border-t border-floating-border pt-4 w-full", children: props.footer })) : null] })) }) })) }) })] }));
95
+ const onClose = () => props.onChange(false);
96
+ 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, onClick: overlayClickClose ? onClose : undefined, className: `relative z-floating h-[100dvh] !overflow-clip bg-floating-overlay/70 ${type === "drawer" ? "" : "grid justify-center p-8"}`, children: _jsx(FloatingFocusManager, { 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, variants: animation, style: isDesktop ? { width: value } : { height: value } }, getFloatingProps(), { children: [useResizer && resizer ? (_jsx(Draggable, { onChange: props.onChange, sheet: !isDesktop, value: value, parent: refs.floating, position: position })) : null, props.title || props.closable ? (_jsxs("header", { className: "relative w-full", children: [props.title ? (_jsx("h2", { className: "border-b border-floating-border px-8 pb-4 text-3xl font-medium leading-relaxed", children: props.title })) : null, props.closable !== false ? (_jsx("nav", { className: "absolute -top-2.5 right-4 lg:-top-1 lg:right-8", 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] })) : null, _jsx("section", { className: "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] })) }) })) }) })] }));
96
97
  };
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/form/autocomplete.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAuE,MAAM,OAAO,CAAC;AAG5F,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,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,8FAWjB,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,yGAmNxB,CAAC"}
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"}
@@ -5,16 +5,16 @@ 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
7
  import { ChevronDown } from "lucide-react";
8
- import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
8
+ import { forwardRef, useEffect, useRef, useState } from "react";
9
9
  import { usePrevious } from "../../hooks/use-previous";
10
- import { css, dispatchInput } from "../../lib/dom";
11
- import { InputField } from "./input-field";
12
- import { safeRegex } from "../../lib/fns";
13
10
  import { useTranslations } from "../../hooks/use-translate-context";
11
+ import { css, dispatchInput, initializeInputDataset } from "../../lib/dom";
12
+ import { safeRegex } from "../../lib/fns";
13
+ import { InputField } from "./input-field";
14
14
  export const Option = forwardRef((_a, ref) => {
15
15
  var _b;
16
16
  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 last:border-transparent border-b border-tooltip-border", children: _jsx("button", { type: "button", onClick: onClick, "aria-selected": selected, className: `p-2 w-full text-left cursor-pointer ${selected ? "bg-primary text-primary-foreground" : ""} ${active ? "bg-primary-subtle text-primary-foreground" : ""}`, children: (_b = option.label) !== null && _b !== void 0 ? _b : option.value }) })));
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 }) })));
18
18
  });
19
19
  const transitionStyles = {
20
20
  duration: 300,
@@ -36,16 +36,20 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
36
36
  const [index, setIndex] = useState(null);
37
37
  const listRef = useRef(emptyRef);
38
38
  const previousIndex = usePrevious(index);
39
- const innerOptions = dynamicOption && shadow !== "" ? [
40
- { value: shadow, label: shadow, "data-dynamic": "true" },
41
- ...options
42
- ] : options;
39
+ const innerOptions = dynamicOption && shadow !== "" ? [{ value: shadow, label: shadow, "data-dynamic": "true" }, ...options] : options;
43
40
  const list = new Fuzzy(innerOptions, ["value", "label"], fuzzyOptions).search(shadow);
44
- const pattern = dynamicOption ? undefined : `^(${options.map((x) => `${safeRegex(x.value)}${x.label ? "|" + safeRegex(x.label) : ""}`).join("|")})$`;
41
+ const pattern = dynamicOption
42
+ ? undefined
43
+ : `^(${options.map((x) => `${safeRegex(x.value)}${x.label ? "|" + safeRegex(x.label) : ""}`).join("|")})$`;
44
+ useEffect(() => {
45
+ const input = refs.reference.current;
46
+ if (!input)
47
+ return;
48
+ return initializeInputDataset(input);
49
+ }, []);
45
50
  useEffect(() => {
46
51
  var _a;
47
52
  if (props.value) {
48
- setValue(props.value);
49
53
  const item = options.find((x) => x.value === props.value);
50
54
  setValue((_a = item === null || item === void 0 ? void 0 : item.label) !== null && _a !== void 0 ? _a : props.value);
51
55
  }
@@ -68,7 +72,6 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
68
72
  }),
69
73
  ],
70
74
  });
71
- useImperativeHandle(externalRef, () => { var _a; return (_a = refs.domReference) === null || _a === void 0 ? void 0 : _a.current; }, [refs]);
72
75
  const transitions = useTransitionStyles(context, transitionStyles);
73
76
  const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
74
77
  useRole(context, { role: "listbox" }),
@@ -96,12 +99,13 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
96
99
  }),
97
100
  ]);
98
101
  const onSelect = (opt) => {
99
- var _a, _b;
102
+ var _a, _b, _c;
100
103
  setValue(opt.value);
101
- setLabel((_a = opt.label) !== null && _a !== void 0 ? _a : "");
104
+ (_a = refs.reference.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-value", opt.value);
105
+ setLabel((_b = opt.label) !== null && _b !== void 0 ? _b : "");
102
106
  const fakeEvent = dispatchInput(ref.current, opt.value);
103
107
  if (fakeEvent)
104
- (_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, fakeEvent);
108
+ (_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, fakeEvent);
105
109
  setOpen(false);
106
110
  setShadow("");
107
111
  };
@@ -119,15 +123,18 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
119
123
  setShadow("");
120
124
  };
121
125
  const onClose = () => {
126
+ var _a;
122
127
  setShadow("");
123
128
  setValue("");
129
+ (_a = refs.reference.current) === null || _a === void 0 ? void 0 : _a.setAttribute("data-value", "");
124
130
  setLabel("");
125
131
  dispatchInput(refs.reference.current, "");
126
132
  setOpen(false);
127
133
  };
128
- 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: "link:text-primary transition-colors", children: [_jsx(ChevronDown, { size: 20 }), _jsx("span", { className: "sr-only", children: translation.inputCaretDown })] }), value ? (_jsx("button", { type: "button", onClick: onClose, className: "link:text-danger transition-colors", 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", { ref: ref, required: required, type: "hidden", name: props.name, defaultValue: props.value || value || undefined }), _jsx("input", Object.assign({}, getReferenceProps(Object.assign(Object.assign({}, props), { onChange,
134
+ 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,
129
136
  onFocus,
130
- pattern, ref: refs.setReference, name: undefined, onClick: (e) => e.currentTarget.focus(), onKeyDown(event) {
137
+ pattern, ref: refs.setReference, name: `${id}-shadow`, id: `${id}-shadow`, onClick: (e) => e.currentTarget.focus(), onKeyDown(event) {
131
138
  if (event.key === "Escape") {
132
139
  event.currentTarget.blur();
133
140
  return setOpen(false);
@@ -142,10 +149,10 @@ export const Autocomplete = forwardRef((_a, externalRef) => {
142
149
  return onSelect(list[0]);
143
150
  }
144
151
  }
145
- } })), { required: required, value: open ? shadow : label || value, "aria-autocomplete": "list", autoComplete: "off", className: css("input text-foreground text-base group h-11 w-full flex-1 rounded-md bg-transparent p-2 placeholder-input-mask outline-none transition-colors group-error:text-danger group-error:placeholder-input-mask-error", !!right || shadow ? "pe-12" : "", !!left ? "ps-8" : "", props.className) })), _jsx(FloatingPortal, { preserveTabOrder: true, children: open ? (_jsx(FloatingFocusManager, { guards: true, returnFocus: false, context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: _jsx("ul", Object.assign({}, getFloatingProps({
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-11 w-full flex-1 rounded-md bg-transparent p-2 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({
146
153
  ref: refs.setFloating,
147
154
  style: Object.assign({ position: strategy, left: x !== null && x !== void 0 ? x : 0, top: y !== null && y !== void 0 ? y : 0 }, transitions.styles),
148
- }), { "data-floating": "true", className: "bg-floating-background shadow-floating text-foreground list-none p-0 m-0 rounded-t-lg rounded-b-lg overflow-auto origin-[top_center] overflow-y-auto z-floating", children: list.map((option, i) => (_createElement(Option, Object.assign({}, getItemProps({
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({
149
156
  onClick: () => onSelect(option),
150
157
  ref: (node) => void (listRef.current[i] = node),
151
158
  selected: index === i,
@@ -2,6 +2,8 @@ import React from "react";
2
2
  import { Override } from "../../types";
3
3
  export type CheckboxProps = Override<React.PropsWithChildren<React.ComponentProps<"input">>, {
4
4
  size?: "medium" | "large";
5
+ error?: string;
6
+ container?: string;
5
7
  }>;
6
- export declare const Checkbox: ({ children, className, size, ...props }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
7
9
  //# 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,KAAK,MAAM,OAAO,CAAC;AAE1B,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;CAC7B,CACJ,CAAC;AAEF,eAAO,MAAM,QAAQ,4CAAkD,aAAa,4CAiBnF,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,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,7 +1,8 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from "react";
3
4
  import { css } from "../../lib/dom";
4
- export const Checkbox = (_a) => {
5
- var { children, className = "", size } = _a, props = __rest(_a, ["children", "className", "size"]);
6
- return (_jsxs("label", { "data-disabled": props.disabled, "aria-disabled": props.disabled, className: "group font-normal flex items-center gap-2 data-[disabled=true]:cursor-not-allowed", children: [_jsx("input", Object.assign({}, props, { type: "checkbox", className: css("form-checkbox size-4 rounded border-card-border text-primary focus:ring-primary appearance-none inline-block bg-origin-border group-aria-disabled:cursor-not-allowed disabled:opacity-70", className) }, props)), children] }));
7
- };
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 })] }));
8
+ });
@@ -1,7 +1,7 @@
1
+ import React from "react";
1
2
  import { Override } from "../../types";
2
3
  import { CalendarProps } from "../display/calendar";
3
4
  import { InputProps } from "./input";
4
- type DatePickerProps = Override<InputProps, CalendarProps & {}>;
5
- export declare const DatePicker: ({ date, locale, disabledDate, autoFocusToday, onChange, markToday, ...props }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
6
- export {};
5
+ export type DatePickerProps = Override<InputProps, CalendarProps & {}>;
6
+ export declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
7
7
  //# sourceMappingURL=date-picker.d.ts.map