@g4rcez/components 0.0.29 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/button.d.ts +1 -1
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.js +2 -1
- package/dist/components/core/polymorph.d.ts +1 -1
- package/dist/components/core/polymorph.d.ts.map +1 -1
- package/dist/components/core/resizable.d.ts.map +1 -1
- package/dist/components/core/resizable.js +43 -4
- package/dist/components/display/alert.d.ts +3 -4
- package/dist/components/display/alert.d.ts.map +1 -1
- package/dist/components/display/alert.js +8 -7
- package/dist/components/display/calendar.d.ts +1 -1
- package/dist/components/display/calendar.d.ts.map +1 -1
- package/dist/components/display/calendar.js +6 -5
- package/dist/components/display/card.d.ts +4 -3
- package/dist/components/display/card.d.ts.map +1 -1
- package/dist/components/display/card.js +2 -2
- package/dist/components/display/list.d.ts +16 -0
- package/dist/components/display/list.d.ts.map +1 -0
- package/dist/components/display/list.js +35 -0
- package/dist/components/display/tabs.d.ts.map +1 -1
- package/dist/components/display/tabs.js +21 -8
- package/dist/components/floating/modal.d.ts +5 -3
- package/dist/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.js +14 -13
- package/dist/components/form/autocomplete.d.ts.map +1 -1
- package/dist/components/form/autocomplete.js +26 -19
- package/dist/components/form/checkbox.d.ts +3 -1
- package/dist/components/form/checkbox.d.ts.map +1 -1
- package/dist/components/form/checkbox.js +5 -4
- package/dist/components/form/date-picker.d.ts +3 -3
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.js +12 -7
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.js +2 -2
- package/dist/components/form/input.d.ts.map +1 -1
- package/dist/components/form/input.js +4 -5
- package/dist/components/form/select.d.ts.map +1 -1
- package/dist/components/form/select.js +7 -6
- package/dist/components/form/switch.d.ts +4 -3
- package/dist/components/form/switch.d.ts.map +1 -1
- package/dist/components/form/switch.js +28 -7
- package/dist/hooks/use-click-outside.d.ts +3 -0
- package/dist/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/hooks/use-click-outside.js +17 -0
- package/dist/hooks/use-form.d.ts +18 -5
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +62 -18
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11962 -11936
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +49 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/dom.d.ts +2 -1
- package/dist/lib/dom.d.ts.map +1 -1
- package/dist/lib/dom.js +9 -13
- package/dist/preset/preset.tailwind.d.ts.map +1 -1
- package/dist/preset/preset.tailwind.js +4 -2
- package/dist/preset/src/styles/theme.js +4 -4
- package/dist/styles/theme.js +4 -4
- package/package.json +3 -3
- package/README.md +0 -36
|
@@ -5,7 +5,7 @@ import { PolymorphicProps } from "./polymorph";
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
6
|
size?: "big" | "small" | "default" | "icon" | null | undefined;
|
|
7
7
|
rounded?: "circle" | "default" | "rough" | "squared" | null | undefined;
|
|
8
|
-
theme?: "main" | "raw" | "warn" | "danger" | "secondary" | "success" | "info" | null | undefined;
|
|
8
|
+
theme?: "main" | "raw" | "primary" | "warn" | "danger" | "secondary" | "success" | "info" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
10
|
export type ButtonProps<T extends React.ElementType = "button"> = PolymorphicProps<VariantProps<typeof buttonVariants> & Partial<{
|
|
11
11
|
icon: Label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/core/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/core/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,cAAc;;;;mFA6BnB,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI,gBAAgB,CAC9E,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,EAChF,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,GAsB7E,CAAC;AAEZ,KAAK,KAAK,GAAG;IACT,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,KAAK,4CAkBvC,CAAC"}
|
|
@@ -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-
|
|
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",
|
|
@@ -20,6 +20,7 @@ const buttonVariants = cva("inline-flex duration-700 enabled:hover:bg-opacity-70
|
|
|
20
20
|
},
|
|
21
21
|
theme: {
|
|
22
22
|
raw: "",
|
|
23
|
+
primary: "bg-primary text-primary-foreground",
|
|
23
24
|
main: "bg-primary text-primary-foreground",
|
|
24
25
|
warn: "bg-warn text-warn-foreground",
|
|
25
26
|
danger: "bg-danger text-danger-foreground",
|
|
@@ -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
|
-
|
|
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,
|
|
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,
|
|
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
|
|
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] =
|
|
7
|
-
|
|
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,14 +1,13 @@
|
|
|
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">;
|
|
9
8
|
export declare const Collapse: (props: PropsWithChildren<CollapseProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
declare const alertVariants: (props?: ({
|
|
11
|
-
theme?: "danger" | "success" | "neutral" | null | undefined;
|
|
10
|
+
theme?: "danger" | "success" | "info" | "neutral" | null | undefined;
|
|
12
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
13
12
|
export type AlertProps<T extends React.ElementType = "div"> = PolymorphicProps<VariantProps<typeof alertVariants> & Partial<{
|
|
14
13
|
container: string;
|
|
@@ -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;
|
|
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;;mFAUjB,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,GAuCxE,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 { CheckCircleIcon, CircleAlertIcon, XIcon } from "lucide-react";
|
|
5
|
-
import { forwardRef } from "react";
|
|
6
|
-
import { Polymorph } from "../core/polymorph";
|
|
7
4
|
import { motion } from "framer-motion";
|
|
5
|
+
import { CheckCircleIcon, CircleAlertIcon, InfoIcon, XIcon } from "lucide-react";
|
|
6
|
+
import { forwardRef } from "react";
|
|
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,20 @@ 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:
|
|
18
|
+
export const Collapse = (props) => (_jsx(motion.section, Object.assign({}, props, { layout: true, layoutRoot: true, layoutScroll: true, initial: false, 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-
|
|
24
|
+
success: "text-success-foreground bg-success/10 border-success/50",
|
|
25
|
+
info: "text-info bg-info/10 border-info/50",
|
|
25
26
|
},
|
|
26
27
|
},
|
|
27
28
|
defaultVariants: { theme: "neutral" },
|
|
28
29
|
});
|
|
29
30
|
export const Alert = forwardRef(function Alert(_a, ref) {
|
|
30
31
|
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: "
|
|
32
|
+
var { className, theme, onClose, open = true } = _a, props = __rest(_a, ["className", "theme", "onClose", "open"]);
|
|
33
|
+
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 === "info" ? _jsx(InfoIcon, { 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
34
|
});
|
|
@@ -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;
|
|
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
|
-
},
|
|
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, {
|
|
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
|
|
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
|
|
155
|
-
}) })] }, monthString) }) }) }), _jsx("footer", { className: "text-center text-primary
|
|
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
|
-
|
|
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;
|
|
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:
|
|
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,
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/display/tabs.tsx"],"names":[],"mappings":"AAEA,OAAc,EAA2B,iBAAiB,EAA2C,MAAM,OAAO,CAAC;AAEnH,OAAO,EAAE,KAAK,EAAY,MAAM,aAAa,CAAC;AAK9C,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;AAmCF,eAAO,MAAM,IAAI,UAAW,iBAAiB,CAAC,SAAS,CAAC,4CAkGvD,CAAC;AAIF,MAAM,MAAM,QAAQ,GACd;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAChD;IACI,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAER,eAAO,MAAM,GAAG,UAAW,iBAAiB,CAAC,QAAQ,CAAC,4CAGrD,CAAC"}
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { motion, useMotionValue } from "framer-motion";
|
|
4
|
-
import React, { createContext, Fragment, useContext, useEffect, useRef } from "react";
|
|
4
|
+
import React, { createContext, Fragment, useContext, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { useReactive } from "../../hooks/use-reactive";
|
|
6
|
+
import { Button } from "../core/button";
|
|
7
|
+
import { Modal } from "../floating/modal";
|
|
6
8
|
import { Card } from "./card";
|
|
7
|
-
import { Select } from "../form/select";
|
|
8
9
|
const Context = createContext("");
|
|
10
|
+
const SelectTab = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const [view, setView] = useState(false);
|
|
13
|
+
const title = props.items.find((x) => {
|
|
14
|
+
const inner = x.props;
|
|
15
|
+
return inner.id === props.active;
|
|
16
|
+
});
|
|
17
|
+
return (_jsxs("div", { className: "my-4 px-8 flex min-w-full text-center lg:hidden", children: [_jsx(Button, { className: "min-w-full", onClick: () => setView(true), children: (_a = title === null || title === void 0 ? void 0 : title.props) === null || _a === void 0 ? void 0 : _a.title }), _jsx(Modal, { closable: true, forceType: true, onChange: setView, open: view, type: "dialog", children: _jsx("ul", { className: "mt-4 space-y-4", children: props.items.map((x) => {
|
|
18
|
+
const inner = x.props;
|
|
19
|
+
const onClick = () => {
|
|
20
|
+
props.setActive(inner.id);
|
|
21
|
+
setView(false);
|
|
22
|
+
};
|
|
23
|
+
return (_jsx("li", { className: "min-w-full", children: _jsx(Button, { className: "w-full", onClick: onClick, theme: inner.id === props.active ? "primary" : "secondary", children: inner.title }) }, inner.id));
|
|
24
|
+
}) }) })] }));
|
|
25
|
+
};
|
|
9
26
|
export const Tabs = (props) => {
|
|
10
27
|
const [active, setActive] = useReactive(props.active);
|
|
11
28
|
const left = useMotionValue(0);
|
|
@@ -54,13 +71,9 @@ export const Tabs = (props) => {
|
|
|
54
71
|
left.set(anchor.offsetLeft);
|
|
55
72
|
setActive(anchor.dataset.id || "");
|
|
56
73
|
};
|
|
57
|
-
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, {
|
|
58
|
-
var _a;
|
|
59
|
-
const inner = x.props;
|
|
60
|
-
return { value: inner.id, label: (_a = inner.label) !== null && _a !== void 0 ? _a : inner.title };
|
|
61
|
-
}) }), _jsx("ul", { className: "hidden lg:flex divide-x divide-card-border overflow-x-auto justify-between md:justify-start", children: items.map((x) => {
|
|
74
|
+
return (_jsx(Context.Provider, { value: active, children: _jsx(Card, { container: "pt-0", className: props.className, header: _jsxs("header", { ref: ref, className: "relative mb-2 border-b border-card-border", children: [_jsx(motion.div, { layout: true, initial: false, "aria-hidden": "true", style: { left, width }, transition: { type: "tween", left, width }, className: "duration-300 absolute bottom-0 hidden h-0.5 w-28 bg-primary transition-all lg:block" }), _jsxs("nav", { children: [_jsx(SelectTab, { setActive: setActive, items: items, active: active }), _jsx("ul", { className: "hidden justify-between divide-x divide-card-border overflow-x-auto md:justify-start lg:flex", children: items.map((x) => {
|
|
62
75
|
const inner = x.props;
|
|
63
|
-
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "data-[active=true]:text-primary
|
|
76
|
+
return (_jsx("li", { "data-id": inner.id, "data-active": active === inner.id, className: "w-full data-[active=true]:text-primary md:w-auto", children: _jsx(Render, { "data-id": inner.id, onClick: onClick, "aria-current": "page", className: "block w-full whitespace-nowrap px-10 py-4 font-medium", href: props.useHash ? `#${inner.id}` : undefined, children: inner.title }) }, `tab-header-${inner.id}`));
|
|
64
77
|
}) })] })] }), children: props.children }) }));
|
|
65
78
|
};
|
|
66
79
|
const useTabs = () => useContext(Context);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
import { Label } from "../../types";
|
|
3
|
-
export type
|
|
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
|
-
|
|
10
|
+
overlayClickClose?: boolean;
|
|
11
11
|
position?: "left" | "right";
|
|
12
12
|
trigger?: Label | React.FC<any>;
|
|
13
|
+
forceType?: boolean;
|
|
14
|
+
type?: "dialog" | "drawer" | "sheet";
|
|
13
15
|
onChange: (nextState: boolean) => void;
|
|
14
16
|
};
|
|
15
|
-
export declare const Modal: ({ type: _type, resizer, ...props }: PropsWithChildren<
|
|
17
|
+
export declare const Modal: ({ type: _type, resizer, overlayClickClose, forceType, ...props }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
//# 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,
|
|
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,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,qEAMf,iBAAiB,CAAC,UAAU,CAAC,4CAgG/B,CAAC"}
|
|
@@ -30,12 +30,12 @@ const animations = {
|
|
|
30
30
|
exit: { opacity: 0, scale: 0.97, animationDuration },
|
|
31
31
|
},
|
|
32
32
|
};
|
|
33
|
-
const variants = cva("isolate ring-0 outline-0 appearance-none flex flex-col gap-4 flex-nowrap min-w-xs bg-floating-background", {
|
|
33
|
+
const variants = cva("isolate relative ring-0 outline-0 appearance-none flex flex-col gap-4 flex-nowrap min-w-xs bg-floating-background", {
|
|
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-
|
|
38
|
-
sheet: "w-full absolute bottom-0 max-h-[85vh] max-h-[85svh] 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: "",
|
|
@@ -68,23 +68,23 @@ const Draggable = (props) => {
|
|
|
68
68
|
return props.value.set(result);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
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" : "bg-floating-border
|
|
72
|
-
? "
|
|
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
73
|
: props.position === "left"
|
|
74
|
-
? "top-1/2
|
|
75
|
-
: "top-1/2
|
|
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, forceType = false } = _a, props = __rest(_a, ["type", "resizer", "overlayClickClose", "forceType"]);
|
|
80
80
|
const headingId = useId();
|
|
81
81
|
const descriptionId = useId();
|
|
82
82
|
const isDesktop = useMediaQuery("(min-width: 48rem)");
|
|
83
|
-
const useResizer = _type === "drawer" || !isDesktop;
|
|
84
|
-
const position = isDesktop ? (_type === "drawer" ? props.position : positions[_type]) : positions.sheet;
|
|
85
|
-
const func = isDesktop ? animations[_type] : animations.sheet;
|
|
83
|
+
const useResizer = _type === "drawer" || (forceType ? false : !isDesktop);
|
|
84
|
+
const position = isDesktop ? (_type === "drawer" ? props.position : positions[_type]) : forceType ? positions[_type] : positions.sheet;
|
|
85
|
+
const func = isDesktop ? animations[_type] : forceType ? animations[_type] : animations.sheet;
|
|
86
86
|
const animation = typeof func === "function" ? func(position) : func;
|
|
87
|
-
const type = isDesktop ? _type : "sheet";
|
|
87
|
+
const type = isDesktop ? _type : forceType ? _type : "sheet";
|
|
88
88
|
const { refs, context } = useFloating({ open: props.open, onOpenChange: props.onChange });
|
|
89
89
|
const click = useClick(context);
|
|
90
90
|
const role = useRole(context);
|
|
@@ -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
|
-
|
|
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: [props.closable !== false ? (_jsx("nav", { className: "absolute top-2 right-2 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, useResizer && resizer ? (_jsx(Draggable, { onChange: props.onChange, sheet: !isDesktop, value: value, parent: refs.floating, position: position })) : null, props.title ? (_jsx("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 })) : 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,
|
|
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"}
|