@almach/ui 0.1.8 → 0.1.10
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/.tsbuildinfo +1 -1
- package/dist/components/family-modal.d.ts +79 -0
- package/dist/components/family-modal.d.ts.map +1 -0
- package/dist/components/family-modal.js +112 -0
- package/dist/components/family-modal.js.map +1 -0
- package/dist/components/modal.d.ts +61 -6
- package/dist/components/modal.d.ts.map +1 -1
- package/dist/components/modal.js +140 -19
- package/dist/components/modal.js.map +1 -1
- package/dist/components/toaster.d.ts.map +1 -1
- package/dist/components/toaster.js +6 -1
- package/dist/components/toaster.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type ViewComponent = React.ComponentType<Record<string, unknown>>;
|
|
4
|
+
interface ViewsRegistry {
|
|
5
|
+
[viewName: string]: ViewComponent;
|
|
6
|
+
}
|
|
7
|
+
interface FamilyModalCtxValue {
|
|
8
|
+
view: string;
|
|
9
|
+
setView: (view: string) => void;
|
|
10
|
+
views: ViewsRegistry | undefined;
|
|
11
|
+
contentHeight: number;
|
|
12
|
+
setContentHeight: (h: number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare function useFamilyModal(): FamilyModalCtxValue;
|
|
15
|
+
interface FamilyModalRootProps {
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
defaultView?: string;
|
|
21
|
+
onViewChange?: (view: string) => void;
|
|
22
|
+
views?: ViewsRegistry;
|
|
23
|
+
}
|
|
24
|
+
declare function FamilyModalRoot({ children, open: controlledOpen, defaultOpen, onOpenChange, defaultView, onViewChange, views: customViews, }: FamilyModalRootProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
interface FamilyModalContentProps {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
interface FamilyModalAnimatedWrapperProps {
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
declare function FamilyModalAnimatedWrapper({ children, className }: FamilyModalAnimatedWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
interface FamilyModalAnimatedContentProps {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
declare function FamilyModalAnimatedContent({ children }: FamilyModalAnimatedContentProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
interface FamilyModalViewContentProps {
|
|
39
|
+
views?: ViewsRegistry;
|
|
40
|
+
}
|
|
41
|
+
declare function FamilyModalViewContent({ views: propViews }?: FamilyModalViewContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
42
|
+
interface FamilyModalCloseProps {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
declare function FamilyModalClose({ children, className }: FamilyModalCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
interface FamilyModalHeaderProps {
|
|
48
|
+
icon?: React.ReactNode;
|
|
49
|
+
title: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
declare function FamilyModalHeader({ icon, title, description, className }: FamilyModalHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
interface FamilyModalButtonProps {
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
onClick?: () => void;
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
declare function FamilyModalButton({ children, onClick, className }: FamilyModalButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
interface FamilyModalSecondaryButtonProps {
|
|
61
|
+
children: React.ReactNode;
|
|
62
|
+
onClick?: () => void;
|
|
63
|
+
className: string;
|
|
64
|
+
}
|
|
65
|
+
declare function FamilyModalSecondaryButton({ children, onClick, className, }: FamilyModalSecondaryButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
declare const FamilyModal: typeof FamilyModalRoot & {
|
|
67
|
+
Trigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
68
|
+
Content: React.ForwardRefExoticComponent<FamilyModalContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
|
+
AnimatedWrapper: typeof FamilyModalAnimatedWrapper;
|
|
70
|
+
AnimatedContent: typeof FamilyModalAnimatedContent;
|
|
71
|
+
ViewContent: typeof FamilyModalViewContent;
|
|
72
|
+
Close: typeof FamilyModalClose;
|
|
73
|
+
Header: typeof FamilyModalHeader;
|
|
74
|
+
Button: typeof FamilyModalButton;
|
|
75
|
+
SecondaryButton: typeof FamilyModalSecondaryButton;
|
|
76
|
+
};
|
|
77
|
+
export { FamilyModal, useFamilyModal };
|
|
78
|
+
export type { ViewsRegistry, ViewComponent };
|
|
79
|
+
//# sourceMappingURL=family-modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-modal.d.ts","sourceRoot":"","sources":["../../src/components/family-modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,KAAK,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAElE,UAAU,aAAa;IACtB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;CAClC;AAGD,UAAU,mBAAmB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,MA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ragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "@almach/utils";
|
|
6
|
+
const FamilyModalCtx = React.createContext(undefined);
|
|
7
|
+
const DisplayedViewCtx = React.createContext("default");
|
|
8
|
+
function useFamilyModal() {
|
|
9
|
+
const ctx = React.useContext(FamilyModalCtx);
|
|
10
|
+
if (!ctx)
|
|
11
|
+
throw new Error("FamilyModal components must be used within FamilyModal");
|
|
12
|
+
return ctx;
|
|
13
|
+
}
|
|
14
|
+
function FamilyModalRoot({ children, open: controlledOpen, defaultOpen = false, onOpenChange, defaultView = "default", onViewChange, views: customViews, }) {
|
|
15
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
16
|
+
const [view, setView] = React.useState(defaultView);
|
|
17
|
+
const [contentHeight, setContentHeight] = React.useState(0);
|
|
18
|
+
const isOpen = controlledOpen !== undefined ? controlledOpen : internalOpen;
|
|
19
|
+
const setIsOpen = onOpenChange ?? setInternalOpen;
|
|
20
|
+
const handleViewChange = (newView) => {
|
|
21
|
+
setView(newView);
|
|
22
|
+
onViewChange?.(newView);
|
|
23
|
+
};
|
|
24
|
+
const views = customViews && Object.keys(customViews).length > 0 ? customViews : undefined;
|
|
25
|
+
return (_jsx(FamilyModalCtx.Provider, { value: { view, setView: handleViewChange, views, contentHeight, setContentHeight }, children: _jsx(DialogPrimitive.Root, { open: isOpen, onOpenChange: setIsOpen, children: children }) }));
|
|
26
|
+
}
|
|
27
|
+
const FamilyModalContent = React.forwardRef(({ children, className }, ref) => {
|
|
28
|
+
const { contentHeight } = useFamilyModal();
|
|
29
|
+
return (_jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: cn("fixed inset-0 z-50 bg-black/30", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0") }), _jsx(DialogPrimitive.Content, { ref: ref, className: cn("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2", "w-[calc(100%-2rem)] max-w-[361px]", "overflow-hidden rounded-[36px] bg-background shadow-xl outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", className), style: {
|
|
30
|
+
height: contentHeight > 0 ? contentHeight : undefined,
|
|
31
|
+
transition: "height 0.27s cubic-bezier(0.25, 1, 0.5, 1)",
|
|
32
|
+
}, children: children ?? (_jsxs(_Fragment, { children: [_jsx(FamilyModalClose, {}), _jsx(FamilyModalAnimatedWrapper, { children: _jsx(FamilyModalAnimatedContent, { children: _jsx(FamilyModalViewContent, {}) }) })] })) })] }));
|
|
33
|
+
});
|
|
34
|
+
FamilyModalContent.displayName = "FamilyModal.Content";
|
|
35
|
+
function FamilyModalAnimatedWrapper({ children, className }) {
|
|
36
|
+
const { setContentHeight } = useFamilyModal();
|
|
37
|
+
const ref = React.useRef(null);
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
const el = ref.current;
|
|
40
|
+
if (!el)
|
|
41
|
+
return;
|
|
42
|
+
const observer = new ResizeObserver(() => {
|
|
43
|
+
setContentHeight(el.offsetHeight);
|
|
44
|
+
});
|
|
45
|
+
observer.observe(el);
|
|
46
|
+
setContentHeight(el.offsetHeight);
|
|
47
|
+
return () => observer.disconnect();
|
|
48
|
+
}, [setContentHeight]);
|
|
49
|
+
return (_jsx("div", { ref: ref, className: cn("px-6 pb-6 pt-2.5 antialiased", className), children: children }));
|
|
50
|
+
}
|
|
51
|
+
function FamilyModalAnimatedContent({ children }) {
|
|
52
|
+
const { view } = useFamilyModal();
|
|
53
|
+
const [displayedView, setDisplayedView] = React.useState(view);
|
|
54
|
+
const [visible, setVisible] = React.useState(true);
|
|
55
|
+
const pendingRef = React.useRef(view);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (view === displayedView)
|
|
58
|
+
return;
|
|
59
|
+
pendingRef.current = view;
|
|
60
|
+
setVisible(false);
|
|
61
|
+
const t = setTimeout(() => {
|
|
62
|
+
setDisplayedView(pendingRef.current);
|
|
63
|
+
setVisible(true);
|
|
64
|
+
}, 120);
|
|
65
|
+
return () => clearTimeout(t);
|
|
66
|
+
}, [view, displayedView]);
|
|
67
|
+
return (_jsx(DisplayedViewCtx.Provider, { value: displayedView, children: _jsx("div", { style: {
|
|
68
|
+
opacity: visible ? 1 : 0,
|
|
69
|
+
transform: visible ? "scale(1)" : "scale(0.96)",
|
|
70
|
+
transition: "opacity 0.12s ease, transform 0.12s ease",
|
|
71
|
+
}, children: children }) }));
|
|
72
|
+
}
|
|
73
|
+
function FamilyModalViewContent({ views: propViews } = {}) {
|
|
74
|
+
const { views: contextViews } = useFamilyModal();
|
|
75
|
+
const displayedView = React.useContext(DisplayedViewCtx);
|
|
76
|
+
const views = propViews ?? contextViews;
|
|
77
|
+
if (!views) {
|
|
78
|
+
throw new Error("FamilyModalViewContent requires views via props or FamilyModal root");
|
|
79
|
+
}
|
|
80
|
+
const ViewComponent = views[displayedView] ?? views.default;
|
|
81
|
+
return ViewComponent ? _jsx(ViewComponent, {}) : null;
|
|
82
|
+
}
|
|
83
|
+
function FamilyModalClose({ children, className }) {
|
|
84
|
+
return (_jsx(DialogPrimitive.Close, { className: cn("absolute right-8 top-7 z-10 flex h-8 w-8 items-center justify-center", "rounded-full bg-muted text-muted-foreground", "transition-transform focus:scale-95 active:scale-75 cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: children ?? _jsx(FamilyModalCloseIcon, {}) }));
|
|
85
|
+
}
|
|
86
|
+
function FamilyModalHeader({ icon, title, description, className }) {
|
|
87
|
+
return (_jsxs("header", { className: cn("mt-[21px]", className), children: [icon, _jsx(DialogPrimitive.Title, { className: "mt-2.5 text-[22px] font-semibold text-foreground md:font-medium", children: title }), description && (_jsx(DialogPrimitive.Description, { className: "mt-3 text-[17px] font-medium leading-[24px] text-muted-foreground md:font-normal", children: description }))] }));
|
|
88
|
+
}
|
|
89
|
+
function FamilyModalButton({ children, onClick, className }) {
|
|
90
|
+
return (_jsx("button", { type: "button", className: cn("flex h-12 w-full items-center gap-[15px] rounded-[16px] bg-muted px-4", "text-[17px] font-semibold text-foreground md:font-medium", "transition-transform focus:scale-95 active:scale-95 cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), onClick: onClick, children: children }));
|
|
91
|
+
}
|
|
92
|
+
function FamilyModalSecondaryButton({ children, onClick, className, }) {
|
|
93
|
+
return (_jsx("button", { type: "button", className: cn("flex h-12 w-full items-center justify-center gap-[15px] rounded-full", "text-center text-[19px] font-semibold md:font-medium", "transition-transform focus:scale-95 active:scale-95 cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), onClick: onClick, children: children }));
|
|
94
|
+
}
|
|
95
|
+
/* ── Close Icon ───────────────────────────────────────────────────────────── */
|
|
96
|
+
function FamilyModalCloseIcon() {
|
|
97
|
+
return (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("title", { children: "Close" }), _jsx("path", { d: "M10.4854 1.99998L2.00007 10.4853", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.4854 10.4844L2.00007 1.99908", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
98
|
+
}
|
|
99
|
+
/* ── Compound export ──────────────────────────────────────────────────────── */
|
|
100
|
+
const FamilyModal = Object.assign(FamilyModalRoot, {
|
|
101
|
+
Trigger: DialogPrimitive.Trigger,
|
|
102
|
+
Content: FamilyModalContent,
|
|
103
|
+
AnimatedWrapper: FamilyModalAnimatedWrapper,
|
|
104
|
+
AnimatedContent: FamilyModalAnimatedContent,
|
|
105
|
+
ViewContent: FamilyModalViewContent,
|
|
106
|
+
Close: FamilyModalClose,
|
|
107
|
+
Header: FamilyModalHeader,
|
|
108
|
+
Button: FamilyModalButton,
|
|
109
|
+
SecondaryButton: FamilyModalSecondaryButton,
|
|
110
|
+
});
|
|
111
|
+
export { FamilyModal, useFamilyModal };
|
|
112
|
+
//# sourceMappingURL=family-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-modal.js","sourceRoot":"","sources":["../../src/components/family-modal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAkBnC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAkC,SAAS,CAAC,CAAC;AACvF,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAS,SAAS,CAAC,CAAC;AAEhE,SAAS,cAAc;IACtB,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC7C,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IACpF,OAAO,GAAG,CAAC;AACZ,CAAC;AAaD,SAAS,eAAe,CAAC,EACxB,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,WAAW,GAAG,KAAK,EACnB,YAAY,EACZ,WAAW,GAAG,SAAS,EACvB,YAAY,EACZ,KAAK,EAAE,WAAW,GACI;IACtB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACpE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA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ViewComponent = React.ComponentType<Record<string, unknown>>;
|
|
3
|
+
interface ViewsRegistry {
|
|
4
|
+
[viewName: string]: ViewComponent;
|
|
5
|
+
}
|
|
6
|
+
/** Use inside any view component to read/change the current view. */
|
|
7
|
+
declare function useModal(): {
|
|
8
|
+
view: string;
|
|
9
|
+
setView: (v: string) => void;
|
|
10
|
+
};
|
|
2
11
|
interface ModalRootProps {
|
|
12
|
+
children?: React.ReactNode;
|
|
3
13
|
open?: boolean;
|
|
14
|
+
defaultOpen?: boolean;
|
|
4
15
|
onOpenChange?: (open: boolean) => void;
|
|
5
|
-
|
|
16
|
+
/** Shorthand: wraps element in Modal.Trigger */
|
|
17
|
+
trigger?: React.ReactNode;
|
|
18
|
+
/** Shorthand: renders Modal.Header + Modal.Title (regular mode only) */
|
|
19
|
+
title?: string;
|
|
20
|
+
/** Shorthand: renders Modal.Description below the title */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Enable family multi-view mode — map of view name → component */
|
|
23
|
+
views?: ViewsRegistry;
|
|
24
|
+
/** Starting view for family mode (default: "default") */
|
|
25
|
+
defaultView?: string;
|
|
26
|
+
/** Called whenever the active view changes */
|
|
27
|
+
onViewChange?: (view: string) => void;
|
|
6
28
|
}
|
|
7
|
-
declare function ModalRoot({ open, onOpenChange,
|
|
29
|
+
declare function ModalRoot({ children, open, defaultOpen, onOpenChange, trigger, title, description, views: customViews, defaultView, onViewChange, }: ModalRootProps): import("react/jsx-runtime").JSX.Element;
|
|
8
30
|
interface ModalTriggerProps {
|
|
9
31
|
asChild?: boolean;
|
|
10
32
|
children: React.ReactNode;
|
|
11
33
|
}
|
|
12
34
|
declare function ModalTrigger({ asChild, children }: ModalTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
35
|
interface ModalContentProps {
|
|
36
|
+
children?: React.ReactNode;
|
|
14
37
|
className?: string;
|
|
15
|
-
children: React.ReactNode;
|
|
16
38
|
}
|
|
17
|
-
declare function ModalContent({ className, children }: ModalContentProps): import("react/jsx-runtime").JSX.Element;
|
|
18
39
|
declare function ModalHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
19
40
|
declare function ModalFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
20
41
|
interface ModalCloseProps {
|
|
@@ -23,14 +44,48 @@ interface ModalCloseProps {
|
|
|
23
44
|
className?: string;
|
|
24
45
|
}
|
|
25
46
|
declare function ModalClose({ asChild, children, className }: ModalCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
declare function ModalAnimatedWrapper({ children, className, }: {
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
className?: string;
|
|
50
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare function ModalAnimatedContent({ children }: {
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function ModalViewContent({ views: propViews }?: {
|
|
55
|
+
views?: ViewsRegistry;
|
|
56
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
57
|
+
interface ModalViewHeaderProps {
|
|
58
|
+
icon?: React.ReactNode;
|
|
59
|
+
title: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
declare function ModalViewHeader({ icon, title, description, className }: ModalViewHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
declare function ModalNavButton({ children, onClick, className, }: {
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
onClick?: () => void;
|
|
67
|
+
className?: string;
|
|
68
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
declare function ModalActionButton({ children, onClick, className, }: {
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
onClick?: () => void;
|
|
72
|
+
className: string;
|
|
73
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
26
74
|
declare const Modal: typeof ModalRoot & {
|
|
27
75
|
Trigger: typeof ModalTrigger;
|
|
28
|
-
Content:
|
|
76
|
+
Content: React.ForwardRefExoticComponent<ModalContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
77
|
Header: typeof ModalHeader;
|
|
30
78
|
Footer: typeof ModalFooter;
|
|
31
79
|
Title: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
|
|
32
80
|
Description: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
33
81
|
Close: typeof ModalClose;
|
|
82
|
+
ViewHeader: typeof ModalViewHeader;
|
|
83
|
+
ViewContent: typeof ModalViewContent;
|
|
84
|
+
AnimatedWrapper: typeof ModalAnimatedWrapper;
|
|
85
|
+
AnimatedContent: typeof ModalAnimatedContent;
|
|
86
|
+
NavButton: typeof ModalNavButton;
|
|
87
|
+
ActionButton: typeof ModalActionButton;
|
|
34
88
|
};
|
|
35
|
-
export { Modal };
|
|
89
|
+
export { Modal, useModal };
|
|
90
|
+
export type { ViewsRegistry, ViewComponent };
|
|
36
91
|
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/components/modal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/components/modal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,KAAK,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAElE,UAAU,aAAa;IACtB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;CAClC;AA4BD,qEAAqE;AACrE,iBAAS,QAAQ;;iBAtBH,MAAM,KAAK,IAAI;EAyB5B;AAGD,UAAU,cAAc;IACvB,QAAQ,CAAC,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AAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CAClB,2CAgBA;AAcD,QAAA,MAAM,KAAK;;;;;;;;;;;;;;CAeT,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/components/modal.js
CHANGED
|
@@ -1,45 +1,90 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
4
|
import * as React from "react";
|
|
5
|
+
import { cn } from "@almach/utils";
|
|
4
6
|
import { useIsMobile } from "../hooks/use-media-query";
|
|
5
7
|
import { Dialog } from "./dialog";
|
|
6
8
|
import { Drawer } from "./drawer";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const ModalCtx = React.createContext({
|
|
10
|
+
isMobile: false,
|
|
11
|
+
views: undefined,
|
|
12
|
+
view: "default",
|
|
13
|
+
setView: () => { },
|
|
14
|
+
contentHeight: 0,
|
|
15
|
+
setContentHeight: () => { },
|
|
16
|
+
});
|
|
17
|
+
/* Internal: tracks which view is currently rendered (lags during transition) */
|
|
18
|
+
const DisplayedViewCtx = React.createContext("default");
|
|
19
|
+
function useModalCtx() {
|
|
20
|
+
return React.useContext(ModalCtx);
|
|
21
|
+
}
|
|
22
|
+
/** Use inside any view component to read/change the current view. */
|
|
23
|
+
function useModal() {
|
|
24
|
+
const { view, setView } = useModalCtx();
|
|
25
|
+
return { view, setView };
|
|
26
|
+
}
|
|
27
|
+
function ModalRoot({ children, open, defaultOpen, onOpenChange, trigger, title, description, views: customViews, defaultView = "default", onViewChange, }) {
|
|
11
28
|
const isMobile = useIsMobile();
|
|
12
29
|
const Root = isMobile ? Drawer : Dialog;
|
|
13
|
-
|
|
30
|
+
const [view, setView] = React.useState(defaultView);
|
|
31
|
+
const [contentHeight, setContentHeight] = React.useState(0);
|
|
32
|
+
const views = customViews && Object.keys(customViews).length > 0 ? customViews : undefined;
|
|
33
|
+
const handleViewChange = (v) => {
|
|
34
|
+
setView(v);
|
|
35
|
+
onViewChange?.(v);
|
|
36
|
+
};
|
|
37
|
+
const rootProps = {
|
|
38
|
+
...(open !== undefined && { open }),
|
|
39
|
+
...(defaultOpen !== undefined && { defaultOpen }),
|
|
40
|
+
...(onOpenChange !== undefined && { onOpenChange }),
|
|
41
|
+
};
|
|
42
|
+
const isFamilyMode = !!views;
|
|
43
|
+
const hasShorthand = trigger !== undefined || title !== undefined;
|
|
44
|
+
const inner = hasShorthand ? (_jsxs(_Fragment, { children: [trigger !== undefined && (_jsx(ModalTrigger, { asChild: true, children: trigger })), isFamilyMode ? (_jsx(ModalContent, {})) : (_jsxs(ModalContent, { children: [title !== undefined && (_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: title }), description && _jsx(ModalDescription, { children: description })] })), children] }))] })) : (children);
|
|
45
|
+
return (_jsx(ModalCtx.Provider, { value: { isMobile, views, view, setView: handleViewChange, contentHeight, setContentHeight }, children: _jsx(Root, { ...rootProps, children: inner }) }));
|
|
14
46
|
}
|
|
15
47
|
function ModalTrigger({ asChild, children }) {
|
|
16
|
-
const isMobile =
|
|
48
|
+
const { isMobile } = useModalCtx();
|
|
17
49
|
const Trigger = isMobile ? Drawer.Trigger : Dialog.Trigger;
|
|
18
50
|
return _jsx(Trigger, { ...(asChild !== undefined && { asChild }), children: children });
|
|
19
51
|
}
|
|
20
|
-
|
|
21
|
-
const isMobile =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
52
|
+
const ModalContent = React.forwardRef(({ children, className }, ref) => {
|
|
53
|
+
const { isMobile, views, contentHeight } = useModalCtx();
|
|
54
|
+
const isFamilyMode = !!views;
|
|
55
|
+
const familyContent = children ?? (_jsxs(_Fragment, { children: [_jsx(ModalFamilyClose, {}), _jsx(ModalAnimatedWrapper, { children: _jsx(ModalAnimatedContent, { children: _jsx(ModalViewContent, {}) }) })] }));
|
|
56
|
+
/* Mobile — Vaul bottom sheet */
|
|
57
|
+
if (isMobile) {
|
|
58
|
+
return (_jsx(Drawer.Content, { className: className, children: isFamilyMode ? familyContent : children }));
|
|
59
|
+
}
|
|
60
|
+
/* Desktop, family mode — bare DialogPrimitive with height animation */
|
|
61
|
+
if (isFamilyMode) {
|
|
62
|
+
return (_jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: cn("fixed inset-0 z-50 bg-black/30", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0") }), _jsx(DialogPrimitive.Content, { ref: ref, className: cn("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2", "w-[calc(100%-2rem)] max-w-[361px] overflow-hidden rounded-[36px]", "bg-background shadow-xl outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", className), style: {
|
|
63
|
+
height: contentHeight > 0 ? contentHeight : undefined,
|
|
64
|
+
transition: "height 0.27s cubic-bezier(0.25, 1, 0.5, 1)",
|
|
65
|
+
}, children: familyContent })] }));
|
|
66
|
+
}
|
|
67
|
+
/* Desktop, regular mode — standard Dialog */
|
|
68
|
+
return (_jsx(Dialog.Content, { ref: ref, className: className, children: children }));
|
|
69
|
+
});
|
|
70
|
+
ModalContent.displayName = "Modal.Content";
|
|
26
71
|
/* ── Header ──────────────────────────────────────────────────────────────── */
|
|
27
72
|
function ModalHeader({ className, ...props }) {
|
|
28
|
-
const isMobile =
|
|
73
|
+
const { isMobile } = useModalCtx();
|
|
29
74
|
if (isMobile)
|
|
30
75
|
return _jsx(Drawer.Header, { className: className, ...props });
|
|
31
76
|
return _jsx(Dialog.Header, { className: className, ...props });
|
|
32
77
|
}
|
|
33
78
|
/* ── Footer ──────────────────────────────────────────────────────────────── */
|
|
34
79
|
function ModalFooter({ className, ...props }) {
|
|
35
|
-
const isMobile =
|
|
80
|
+
const { isMobile } = useModalCtx();
|
|
36
81
|
if (isMobile)
|
|
37
82
|
return _jsx(Drawer.Footer, { className: className, ...props });
|
|
38
83
|
return _jsx(Dialog.Footer, { className: className, ...props });
|
|
39
84
|
}
|
|
40
85
|
/* ── Title ───────────────────────────────────────────────────────────────── */
|
|
41
86
|
const ModalTitle = React.forwardRef(({ className, ...props }, ref) => {
|
|
42
|
-
const isMobile =
|
|
87
|
+
const { isMobile } = useModalCtx();
|
|
43
88
|
if (isMobile)
|
|
44
89
|
return _jsx(Drawer.Title, { ref: ref, className: className, ...props });
|
|
45
90
|
return _jsx(Dialog.Title, { ref: ref, className: className, ...props });
|
|
@@ -47,17 +92,86 @@ const ModalTitle = React.forwardRef(({ className, ...props }, ref) => {
|
|
|
47
92
|
ModalTitle.displayName = "Modal.Title";
|
|
48
93
|
/* ── Description ─────────────────────────────────────────────────────────── */
|
|
49
94
|
const ModalDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
50
|
-
const isMobile =
|
|
95
|
+
const { isMobile } = useModalCtx();
|
|
51
96
|
if (isMobile)
|
|
52
97
|
return _jsx(Drawer.Description, { ref: ref, className: className, ...props });
|
|
53
98
|
return _jsx(Dialog.Description, { ref: ref, className: className, ...props });
|
|
54
99
|
});
|
|
55
100
|
ModalDescription.displayName = "Modal.Description";
|
|
56
101
|
function ModalClose({ asChild, children, className }) {
|
|
57
|
-
const isMobile =
|
|
102
|
+
const { isMobile } = useModalCtx();
|
|
58
103
|
const Close = isMobile ? Drawer.Close : Dialog.Close;
|
|
59
104
|
return (_jsx(Close, { ...(asChild !== undefined && { asChild }), ...(className !== undefined && { className }), children: children }));
|
|
60
105
|
}
|
|
106
|
+
/* ── Family: animated wrapper (measures height) ───────────────────────────── */
|
|
107
|
+
function ModalAnimatedWrapper({ children, className, }) {
|
|
108
|
+
const { setContentHeight } = useModalCtx();
|
|
109
|
+
const ref = React.useRef(null);
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
const el = ref.current;
|
|
112
|
+
if (!el)
|
|
113
|
+
return;
|
|
114
|
+
const observer = new ResizeObserver(() => setContentHeight(el.offsetHeight));
|
|
115
|
+
observer.observe(el);
|
|
116
|
+
setContentHeight(el.offsetHeight);
|
|
117
|
+
return () => observer.disconnect();
|
|
118
|
+
}, [setContentHeight]);
|
|
119
|
+
return (_jsx("div", { ref: ref, className: cn("px-6 pb-6 pt-2.5 antialiased", className), children: children }));
|
|
120
|
+
}
|
|
121
|
+
/* ── Family: animated content (view transitions) ─────────────────────────── */
|
|
122
|
+
function ModalAnimatedContent({ children }) {
|
|
123
|
+
const { view } = useModalCtx();
|
|
124
|
+
const [displayedView, setDisplayedView] = React.useState(view);
|
|
125
|
+
const [visible, setVisible] = React.useState(true);
|
|
126
|
+
const pendingRef = React.useRef(view);
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
if (view === displayedView)
|
|
129
|
+
return;
|
|
130
|
+
pendingRef.current = view;
|
|
131
|
+
setVisible(false);
|
|
132
|
+
const t = setTimeout(() => {
|
|
133
|
+
setDisplayedView(pendingRef.current);
|
|
134
|
+
setVisible(true);
|
|
135
|
+
}, 120);
|
|
136
|
+
return () => clearTimeout(t);
|
|
137
|
+
}, [view, displayedView]);
|
|
138
|
+
return (_jsx(DisplayedViewCtx.Provider, { value: displayedView, children: _jsx("div", { style: {
|
|
139
|
+
opacity: visible ? 1 : 0,
|
|
140
|
+
transform: visible ? "scale(1)" : "scale(0.96)",
|
|
141
|
+
transition: "opacity 0.12s ease, transform 0.12s ease",
|
|
142
|
+
}, children: children }) }));
|
|
143
|
+
}
|
|
144
|
+
/* ── Family: view content renderer ───────────────────────────────────────── */
|
|
145
|
+
function ModalViewContent({ views: propViews } = {}) {
|
|
146
|
+
const { views: contextViews } = useModalCtx();
|
|
147
|
+
const displayedView = React.useContext(DisplayedViewCtx);
|
|
148
|
+
const views = propViews ?? contextViews;
|
|
149
|
+
if (!views)
|
|
150
|
+
throw new Error("Modal.ViewContent requires views on the Modal root");
|
|
151
|
+
const ViewComponent = views[displayedView] ?? views.default;
|
|
152
|
+
return ViewComponent ? _jsx(ViewComponent, {}) : null;
|
|
153
|
+
}
|
|
154
|
+
/* ── Family: floating close button ───────────────────────────────────────── */
|
|
155
|
+
function ModalFamilyClose({ children, className, }) {
|
|
156
|
+
const { isMobile } = useModalCtx();
|
|
157
|
+
const Close = isMobile ? Drawer.Close : DialogPrimitive.Close;
|
|
158
|
+
return (_jsx(Close, { className: cn("absolute right-8 top-7 z-10 flex h-8 w-8 items-center justify-center", "rounded-full bg-muted text-muted-foreground cursor-pointer", "transition-transform focus:scale-95 active:scale-75", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: children ?? _jsx(ModalCloseIcon, {}) }));
|
|
159
|
+
}
|
|
160
|
+
function ModalViewHeader({ icon, title, description, className }) {
|
|
161
|
+
return (_jsxs("header", { className: cn("mt-[21px]", className), children: [icon, _jsx(DialogPrimitive.Title, { className: "mt-2.5 text-[22px] font-semibold text-foreground md:font-medium", children: title }), description && (_jsx(DialogPrimitive.Description, { className: "mt-3 text-[17px] font-medium leading-[24px] text-muted-foreground md:font-normal", children: description }))] }));
|
|
162
|
+
}
|
|
163
|
+
/* ── Family: navigation button ────────────────────────────────────────────── */
|
|
164
|
+
function ModalNavButton({ children, onClick, className, }) {
|
|
165
|
+
return (_jsx("button", { type: "button", onClick: onClick, className: cn("flex h-12 w-full items-center gap-[15px] rounded-[16px] bg-muted px-4", "text-[17px] font-semibold text-foreground md:font-medium cursor-pointer", "transition-transform focus:scale-95 active:scale-95", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: children }));
|
|
166
|
+
}
|
|
167
|
+
/* ── Family: action button (pill) ─────────────────────────────────────────── */
|
|
168
|
+
function ModalActionButton({ children, onClick, className, }) {
|
|
169
|
+
return (_jsx("button", { type: "button", onClick: onClick, className: cn("flex h-12 w-full items-center justify-center gap-[15px] rounded-full", "text-center text-[19px] font-semibold md:font-medium cursor-pointer", "transition-transform focus:scale-95 active:scale-95", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className), children: children }));
|
|
170
|
+
}
|
|
171
|
+
/* ── Close icon ───────────────────────────────────────────────────────────── */
|
|
172
|
+
function ModalCloseIcon() {
|
|
173
|
+
return (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("title", { children: "Close" }), _jsx("path", { d: "M10.4854 1.99998L2.00007 10.4853", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.4854 10.4844L2.00007 1.99908", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
174
|
+
}
|
|
61
175
|
/* ── Compound export ─────────────────────────────────────────────────────── */
|
|
62
176
|
const Modal = Object.assign(ModalRoot, {
|
|
63
177
|
Trigger: ModalTrigger,
|
|
@@ -67,6 +181,13 @@ const Modal = Object.assign(ModalRoot, {
|
|
|
67
181
|
Title: ModalTitle,
|
|
68
182
|
Description: ModalDescription,
|
|
69
183
|
Close: ModalClose,
|
|
184
|
+
/* Family mode */
|
|
185
|
+
ViewHeader: ModalViewHeader,
|
|
186
|
+
ViewContent: ModalViewContent,
|
|
187
|
+
AnimatedWrapper: ModalAnimatedWrapper,
|
|
188
|
+
AnimatedContent: ModalAnimatedContent,
|
|
189
|
+
NavButton: ModalNavButton,
|
|
190
|
+
ActionButton: ModalActionButton,
|
|
70
191
|
});
|
|
71
|
-
export { Modal };
|
|
192
|
+
export { Modal, useModal };
|
|
72
193
|
//# sourceMappingURL=modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../src/components/modal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../src/components/modal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAmBlC,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAgB;IACnD,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC1B,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAS,SAAS,CAAC,CAAC;AAEhE,SAAS,WAAW;IACnB,OAAO,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED,qEAAqE;AACrE,SAAS,QAAQ;IAChB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC;IACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC;AAsBD,SAAS,SA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AC;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;IACtC,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE,UAAU;IACjB,iBAAiB;IACjB,UAAU,EAAE,eAAe;IAC3B,WAAW,EAAE,gBAAgB;IAC7B,eAAe,EAAE,oBAAoB;IACrC,eAAe,EAAE,oBAAoB;IACrC,SAAS,EAAE,cAAc;IACzB,YAAY,EAAE,iBAAiB;CAC/B,CAAC,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,4CA8BtB"}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Toaster as SonnerToaster } from "sonner";
|
|
4
4
|
export function Toaster() {
|
|
5
|
-
return (_jsx(SonnerToaster, { position: "bottom-right", toastOptions: {
|
|
5
|
+
return (_jsx(SonnerToaster, { position: "bottom-right", theme: "system", toastOptions: {
|
|
6
|
+
style: {
|
|
7
|
+
background: "hsl(var(--background))",
|
|
8
|
+
border: "1px solid hsl(var(--border))",
|
|
9
|
+
color: "hsl(var(--foreground))",
|
|
10
|
+
},
|
|
6
11
|
classNames: {
|
|
7
12
|
toast: "!bg-background !border !border-border !text-foreground !rounded-2xl !shadow-lg font-sans",
|
|
8
13
|
title: "!text-sm !font-semibold",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.js","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,QAAQ,CAAC;AAElD,MAAM,UAAU,OAAO;IACtB,OAAO,CACN,KAAC,aAAa,IACb,QAAQ,EAAC,cAAc,EACvB,YAAY,EAAE;YACb,UAAU,EAAE;gBACX,KAAK,EACJ,0FAA0F;gBAC3F,KAAK,EAAE,yBAAyB;gBAChC,WAAW,EAAE,iCAAiC;gBAC9C,YAAY,EACX,4DAA4D;gBAC7D,YAAY,EACX,wDAAwD;gBACzD,WAAW,EACV,6EAA6E;gBAC9E,KAAK,EAAE,+CAA+C;gBACtD,OAAO,EAAE,uCAAuC;gBAChD,OAAO,EAAE,uCAAuC;gBAChD,IAAI,EAAE,gBAAgB;aACtB;SACD,GACA,CACF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"toaster.js","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,QAAQ,CAAC;AAElD,MAAM,UAAU,OAAO;IACtB,OAAO,CACN,KAAC,aAAa,IACb,QAAQ,EAAC,cAAc,EACvB,KAAK,EAAC,QAAQ,EACd,YAAY,EAAE;YACb,KAAK,EAAE;gBACN,UAAU,EAAE,wBAAwB;gBACpC,MAAM,EAAE,8BAA8B;gBACtC,KAAK,EAAE,wBAAwB;aAC/B;YACD,UAAU,EAAE;gBACX,KAAK,EACJ,0FAA0F;gBAC3F,KAAK,EAAE,yBAAyB;gBAChC,WAAW,EAAE,iCAAiC;gBAC9C,YAAY,EACX,4DAA4D;gBAC7D,YAAY,EACX,wDAAwD;gBACzD,WAAW,EACV,6EAA6E;gBAC9E,KAAK,EAAE,+CAA+C;gBACtD,OAAO,EAAE,uCAAuC;gBAChD,OAAO,EAAE,uCAAuC;gBAChD,IAAI,EAAE,gBAAgB;aACtB;SACD,GACA,CACF,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export type { InputProps, InputDateProps, DateInputProps } from "./components/in
|
|
|
22
22
|
export { InputCurrency, CURRENCIES, CurrencyFlagBadge } from "./components/currency-input";
|
|
23
23
|
export type { CurrencyDef, CurrencyValue, InputCurrencyProps, CurrencySelectorMode } from "./components/currency-input";
|
|
24
24
|
export { Label } from "./components/label";
|
|
25
|
-
export {
|
|
25
|
+
export { FamilyModal, useFamilyModal } from "./components/family-modal";
|
|
26
|
+
export { Modal, useModal } from "./components/modal";
|
|
27
|
+
export type { ViewsRegistry, ViewComponent } from "./components/modal";
|
|
26
28
|
export { Popover } from "./components/popover";
|
|
27
29
|
export { Progress } from "./components/progress";
|
|
28
30
|
export { Radio } from "./components/radio";
|