@plexui/ui 0.7.43 → 0.7.44
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/es/components/Dialog/Dialog.js +63 -0
- package/dist/es/components/Dialog/Dialog.js.map +1 -0
- package/dist/es/components/Dialog/Dialog.module.css +128 -0
- package/dist/es/components/Dialog/index.js +2 -0
- package/dist/es/components/Dialog/index.js.map +1 -0
- package/dist/types/components/Dialog/Dialog.d.ts +31 -0
- package/dist/types/components/Dialog/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { Dialog as RadixDialog } from "radix-ui";
|
|
5
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from "react";
|
|
6
|
+
import { useEscCloseStack } from "../../hooks/useEscCloseStack";
|
|
7
|
+
import { preventDefaultHandler, toCssVariables } from "../../lib/helpers";
|
|
8
|
+
import { TransitionGroup } from "../Transition";
|
|
9
|
+
import s from "./Dialog.module.css";
|
|
10
|
+
const DialogContext = createContext(null);
|
|
11
|
+
const useDialogContext = () => {
|
|
12
|
+
const context = useContext(DialogContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error("Dialog compound components must be used inside <Dialog>");
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
};
|
|
18
|
+
export const Dialog = ({ open: controlledOpen, onOpenChange: controlledOnOpenChange, children, }) => {
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const isOpen = controlledOpen ?? open;
|
|
21
|
+
const handleOpenChange = useCallback((nextState) => {
|
|
22
|
+
controlledOnOpenChange?.(nextState);
|
|
23
|
+
setOpen(nextState);
|
|
24
|
+
}, [controlledOnOpenChange]);
|
|
25
|
+
const store = useMemo(() => ({
|
|
26
|
+
open: isOpen,
|
|
27
|
+
setOpen: handleOpenChange,
|
|
28
|
+
}), [isOpen, handleOpenChange]);
|
|
29
|
+
return (_jsx(DialogContext, { value: store, children: _jsx(RadixDialog.Root, { open: isOpen, onOpenChange: handleOpenChange, children: children }) }));
|
|
30
|
+
};
|
|
31
|
+
const Trigger = ({ children }) => {
|
|
32
|
+
return _jsx(RadixDialog.Trigger, { asChild: true, children: children });
|
|
33
|
+
};
|
|
34
|
+
const Content = ({ children, width = 480, showClose = true, className }) => {
|
|
35
|
+
const { open, setOpen } = useDialogContext();
|
|
36
|
+
useEscCloseStack(open, () => {
|
|
37
|
+
setOpen(false);
|
|
38
|
+
});
|
|
39
|
+
return (_jsx(RadixDialog.Portal, { forceMount: true, children: _jsx(TransitionGroup, { enterDuration: 250, exitDuration: 150, className: s.Transition, disableAnimations: true, children: open && (_jsxs("div", { children: [_jsx(RadixDialog.Overlay, { className: s.Overlay }), _jsx(RadixDialog.Content, { forceMount: true, className: s.Content, style: toCssVariables({ "dialog-width": width }), onEscapeKeyDown: preventDefaultHandler, children: _jsxs("div", { className: clsx(s.Panel, className), children: [showClose && (_jsx(RadixDialog.Close, { asChild: true, children: _jsx("button", { type: "button", className: s.CloseButton, "aria-label": "Close dialog", children: _jsx("svg", { className: s.CloseIcon, viewBox: "0 0 20 20", width: "20", height: "20", "aria-hidden": "true", children: _jsx("path", { fill: "currentColor", d: "M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06" }) }) }) })), children] }) })] }, "dialog")) }) }));
|
|
40
|
+
};
|
|
41
|
+
const Header = ({ children, className }) => {
|
|
42
|
+
return _jsx("div", { className: clsx(s.Header, className), children: children });
|
|
43
|
+
};
|
|
44
|
+
const Footer = ({ children, className }) => {
|
|
45
|
+
return _jsx("div", { className: clsx(s.Footer, className), children: children });
|
|
46
|
+
};
|
|
47
|
+
const Title = ({ children, className }) => {
|
|
48
|
+
return _jsx(RadixDialog.Title, { className: clsx(s.Title, className), children: children });
|
|
49
|
+
};
|
|
50
|
+
const Description = ({ children, className }) => {
|
|
51
|
+
return (_jsx(RadixDialog.Description, { className: clsx(s.Description, className), children: children }));
|
|
52
|
+
};
|
|
53
|
+
const Close = ({ children }) => {
|
|
54
|
+
return _jsx(RadixDialog.Close, { asChild: true, children: children });
|
|
55
|
+
};
|
|
56
|
+
Dialog.Trigger = Trigger;
|
|
57
|
+
Dialog.Content = Content;
|
|
58
|
+
Dialog.Header = Header;
|
|
59
|
+
Dialog.Footer = Footer;
|
|
60
|
+
Dialog.Title = Title;
|
|
61
|
+
Dialog.Description = Description;
|
|
62
|
+
Dialog.Close = Close;
|
|
63
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,GAET,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,CAAC,MAAM,qBAAqB,CAAA;AAOnC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAA;AAEpE,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAA;IAEzC,I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ix-ui\"\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type ReactNode,\n} from \"react\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { TransitionGroup } from \"../Transition\"\nimport s from \"./Dialog.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n className?: string\n}\n\nconst Content = ({ children, width = 480, showClose = true, className }: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n\n useEscCloseStack(open, () => {\n setOpen(false)\n })\n\n return (\n <RadixDialog.Portal forceMount>\n <TransitionGroup\n enterDuration={250}\n exitDuration={150}\n className={s.Transition}\n disableAnimations\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay className={s.Overlay} />\n <RadixDialog.Content\n forceMount\n className={s.Content}\n style={toCssVariables({ \"dialog-width\": width })}\n onEscapeKeyDown={preventDefaultHandler}\n >\n <div className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <button type=\"button\" className={s.CloseButton} aria-label=\"Close dialog\">\n <svg\n className={s.CloseIcon}\n viewBox=\"0 0 20 20\"\n width=\"20\"\n height=\"20\"\n aria-hidden=\"true\"\n >\n <path\n fill=\"currentColor\"\n d=\"M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06\"\n />\n </svg>\n </button>\n </RadixDialog.Close>\n )}\n {children}\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </RadixDialog.Portal>\n )\n}\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\nconst Header = ({ children, className }: DialogSlotProps) => {\n return <div className={clsx(s.Header, className)}>{children}</div>\n}\n\nconst Footer = ({ children, className }: DialogSlotProps) => {\n return <div className={clsx(s.Footer, className)}>{children}</div>\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n return <RadixDialog.Title className={clsx(s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n return (\n <RadixDialog.Description className={clsx(s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.Close = Close\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
@layer components {.Transition {
|
|
2
|
+
position: relative;
|
|
3
|
+
}.Overlay {
|
|
4
|
+
position: fixed;
|
|
5
|
+
inset: 0;
|
|
6
|
+
z-index: 50;
|
|
7
|
+
background: rgb(0 0 0 / 0.5);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.Transition[data-entering] .Overlay {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.Transition[data-entering-active] .Overlay,
|
|
15
|
+
.Transition[data-entering][data-interrupted] .Overlay {
|
|
16
|
+
opacity: 1;
|
|
17
|
+
transition: opacity 0.2s var(--cubic-enter);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.Transition[data-exiting] .Overlay {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.Transition[data-exiting-active] .Overlay,
|
|
25
|
+
.Transition[data-exiting][data-interrupted] .Overlay {
|
|
26
|
+
opacity: 0;
|
|
27
|
+
transition: opacity 0.15s var(--cubic-exit);
|
|
28
|
+
}.Content {
|
|
29
|
+
position: fixed;
|
|
30
|
+
inset: 0;
|
|
31
|
+
z-index: 50;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
padding: 1rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.Content:focus {
|
|
39
|
+
outline: none;
|
|
40
|
+
}.Panel {
|
|
41
|
+
position: relative;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: 1rem;
|
|
45
|
+
width: var(--dialog-width, 480px);
|
|
46
|
+
max-width: 100%;
|
|
47
|
+
max-height: calc(100vh - 2rem);
|
|
48
|
+
overflow: auto;
|
|
49
|
+
border-radius: var(--radius-xl);
|
|
50
|
+
background: var(--color-surface-elevated);
|
|
51
|
+
box-shadow: var(--shadow-lg), var(--shadow-hairline);
|
|
52
|
+
padding: 1.25rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.Transition[data-entering] .Panel {
|
|
56
|
+
opacity: 0;
|
|
57
|
+
transform: scale(0.95) translateY(8px);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.Transition[data-entering-active] .Panel,
|
|
61
|
+
.Transition[data-entering][data-interrupted] .Panel {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
transform: scale(1) translateY(0);
|
|
64
|
+
transition: opacity 0.25s var(--cubic-enter), transform 0.25s var(--cubic-enter);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.Transition[data-exiting] .Panel {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
transform: scale(1) translateY(0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.Transition[data-exiting-active] .Panel,
|
|
73
|
+
.Transition[data-exiting][data-interrupted] .Panel {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transform: scale(0.95) translateY(8px);
|
|
76
|
+
transition: opacity 0.15s var(--cubic-exit), transform 0.15s var(--cubic-exit);
|
|
77
|
+
}.CloseButton {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0.75rem;
|
|
80
|
+
right: 0.75rem;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
width: 2rem;
|
|
85
|
+
height: 2rem;
|
|
86
|
+
border: 0;
|
|
87
|
+
border-radius: 0.5rem;
|
|
88
|
+
background: transparent;
|
|
89
|
+
color: var(--color-text-tertiary);
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
transition: background-color 0.2s var(--cubic-enter), color 0.2s var(--cubic-enter);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.CloseButton:hover {
|
|
95
|
+
background: color-mix(in srgb, var(--color-text-tertiary) 12%, transparent);
|
|
96
|
+
color: var(--color-text);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.CloseButton:focus-visible {
|
|
100
|
+
outline: 2px solid var(--color-text);
|
|
101
|
+
outline-offset: 2px;
|
|
102
|
+
}.CloseIcon {
|
|
103
|
+
display: block;
|
|
104
|
+
}.Header {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
gap: 0.25rem;
|
|
108
|
+
}.Footer {
|
|
109
|
+
display: flex;
|
|
110
|
+
justify-content: flex-end;
|
|
111
|
+
gap: 0.5rem;
|
|
112
|
+
}.Title {
|
|
113
|
+
margin: 0;
|
|
114
|
+
font-size: 1.125rem;
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
line-height: 1.4;
|
|
117
|
+
color: var(--color-text);
|
|
118
|
+
}.Description {
|
|
119
|
+
margin: 0;
|
|
120
|
+
font-size: 0.875rem;
|
|
121
|
+
line-height: 1.5;
|
|
122
|
+
color: var(--color-text-secondary);
|
|
123
|
+
}@media (width <= 640px) {
|
|
124
|
+
.Footer {
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA6C,MAAM,UAAU,CAAA","sourcesContent":["export { Dialog, type DialogContentProps, type DialogProps } from \"./Dialog\"\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type DialogProps = {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
onOpenChange?: (open: boolean) => void;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const Dialog: {
|
|
8
|
+
({ open: controlledOpen, onOpenChange: controlledOnOpenChange, children, }: DialogProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Trigger: ({ children }: {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
Content: ({ children, width, showClose, className }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
Header: ({ children, className }: DialogSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Footer: ({ children, className }: DialogSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
Title: ({ children, className }: DialogSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Description: ({ children, className }: DialogSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
Close: ({ children }: {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
export type DialogContentProps = {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
width?: number | string;
|
|
24
|
+
showClose?: boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
};
|
|
27
|
+
type DialogSlotProps = {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
className?: string;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Dialog, type DialogContentProps, type DialogProps } from "./Dialog";
|