@rovula/ui 0.1.36 → 0.1.38
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/cjs/bundle.js +4 -4
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/patterns/confirm-dialog/ConfirmDialog.d.ts +5 -0
- package/dist/cjs/types/patterns/confirm-dialog/ConfirmDialog.stories.d.ts +5 -0
- package/dist/components/Dialog/Dialog.js +6 -1
- package/dist/components/Dialog/Dialog.stories.js +32 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/patterns/confirm-dialog/ConfirmDialog.d.ts +5 -0
- package/dist/esm/types/patterns/confirm-dialog/ConfirmDialog.stories.d.ts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/patterns/confirm-dialog/ConfirmDialog.js +3 -3
- package/package.json +1 -1
- package/src/components/Dialog/Dialog.stories.tsx +72 -32
- package/src/components/Dialog/Dialog.tsx +6 -0
- package/src/patterns/confirm-dialog/ConfirmDialog.tsx +18 -4
|
@@ -24,6 +24,11 @@ export type ConfirmDialogProps = {
|
|
|
24
24
|
/** When true, shows a loading spinner on the confirm button and disables all interactive controls. */
|
|
25
25
|
isLoading?: boolean;
|
|
26
26
|
testId?: string;
|
|
27
|
+
contentClassName?: string;
|
|
28
|
+
headerClassName?: string;
|
|
29
|
+
titleClassName?: string;
|
|
30
|
+
descriptionClassName?: string;
|
|
31
|
+
footerClassName?: string;
|
|
27
32
|
cancelClassName?: string;
|
|
28
33
|
confirmClassName?: string;
|
|
29
34
|
};
|
|
@@ -24,6 +24,11 @@ declare const meta: {
|
|
|
24
24
|
hideCancelButton?: boolean | undefined;
|
|
25
25
|
isLoading?: boolean | undefined;
|
|
26
26
|
testId?: string | undefined;
|
|
27
|
+
contentClassName?: string | undefined;
|
|
28
|
+
headerClassName?: string | undefined;
|
|
29
|
+
titleClassName?: string | undefined;
|
|
30
|
+
descriptionClassName?: string | undefined;
|
|
31
|
+
footerClassName?: string | undefined;
|
|
27
32
|
cancelClassName?: string | undefined;
|
|
28
33
|
confirmClassName?: string | undefined;
|
|
29
34
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -26,7 +26,12 @@ const DialogOverlay = React.forwardRef((_a, ref) => {
|
|
|
26
26
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
27
27
|
const DialogContent = React.forwardRef((_a, ref) => {
|
|
28
28
|
var { className, children, showCloseButton = false, closeButtonClassName } = _a, props = __rest(_a, ["className", "children", "showCloseButton", "closeButtonClassName"]);
|
|
29
|
-
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 flex w-[calc(100%-32px)] max-w-[650px] translate-x-[-50%] translate-y-[-50%] flex-col gap-6 rounded-md bg-modal-surface p-8 text-text-g-contrast-medium shadow-[0px_12px_24px_-4px_rgba(0,0,0,0.12)] duration-200 focus:outline-none focus-visible:outline-none 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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", className) }, props, {
|
|
29
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 flex w-[calc(100%-32px)] max-w-[650px] translate-x-[-50%] translate-y-[-50%] flex-col gap-6 rounded-md bg-modal-surface p-8 text-text-g-contrast-medium shadow-[0px_12px_24px_-4px_rgba(0,0,0,0.12)] duration-200 focus:outline-none focus-visible:outline-none 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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", className) }, props, { onCloseAutoFocus: (event) => {
|
|
30
|
+
var _a;
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
document.body.style.pointerEvents = "auto";
|
|
33
|
+
(_a = props === null || props === void 0 ? void 0 : props.onCloseAutoFocus) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
34
|
+
}, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { className: cn("absolute right-8 top-8 rounded-sm opacity-70 ring-offset-bg-bg1 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-input-active-stroke focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-primary data-[state=open]:text-state-primary-text-solid", closeButtonClassName), children: [_jsx(XMarkIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] }))] }));
|
|
30
35
|
});
|
|
31
36
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
32
37
|
const DialogHeader = (_a) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import * as yup from "yup";
|
|
3
4
|
import { Dialog, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./Dialog";
|
|
4
5
|
import Button from "../Button/Button";
|
|
5
6
|
import { Label } from "../Label/Label";
|
|
6
7
|
import { Input } from "../Input/Input";
|
|
8
|
+
import { Menu } from "@/patterns/menu/Menu";
|
|
7
9
|
const meta = {
|
|
8
10
|
title: "Components/Dialog",
|
|
9
11
|
component: Dialog,
|
|
@@ -97,5 +99,34 @@ export const FigmaFunctionForm = {
|
|
|
97
99
|
render: () => (_jsx("div", { className: "flex w-full", children: _jsx(Dialog, { defaultOpen: true, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Title" }), _jsx(DialogDescription, { children: "Subtitle description" })] }), _jsx(DialogBody, { children: _jsx("div", { className: "flex items-center justify-center bg-ramps-secondary-150 h-[200px] w-full rounded-sm", children: _jsx("p", { className: "typography-body3 text-text-contrast-max", children: "Content - Form Area" }) }) }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", color: "primary", fullwidth: false, children: "Cancel" }), _jsx(Button, { disabled: true, fullwidth: false, children: "Confirm" })] })] }) }) })),
|
|
98
100
|
};
|
|
99
101
|
export const FigmaFunctionFormWithAction = {
|
|
100
|
-
render: () =>
|
|
102
|
+
render: () => {
|
|
103
|
+
const [open, setOpen] = useState(false);
|
|
104
|
+
const handleOpenChange = (open) => {
|
|
105
|
+
setOpen(open);
|
|
106
|
+
};
|
|
107
|
+
const handleCancel = () => {
|
|
108
|
+
setOpen(false);
|
|
109
|
+
};
|
|
110
|
+
const handleConfirm = () => {
|
|
111
|
+
setOpen(false);
|
|
112
|
+
};
|
|
113
|
+
return (_jsxs("div", { className: "flex w-full", children: [_jsx(Menu, { items: [
|
|
114
|
+
{
|
|
115
|
+
type: "item",
|
|
116
|
+
item: {
|
|
117
|
+
value: "edit",
|
|
118
|
+
label: "Edit",
|
|
119
|
+
onClick: () => handleOpenChange(true),
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: "item",
|
|
124
|
+
item: {
|
|
125
|
+
value: "delete",
|
|
126
|
+
label: "Delete",
|
|
127
|
+
onClick: () => handleOpenChange(true),
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
], trigger: _jsx(Button, { variant: "outline", children: "Open" }) }), _jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Title" }), _jsx(DialogDescription, { children: "Subtitle description" })] }), _jsx(DialogBody, { children: _jsx("div", { className: "flex items-center justify-center bg-ramps-secondary-150 h-[200px] w-full rounded-sm", children: _jsx("p", { className: "typography-body3 text-text-contrast-max", children: "Content - Form Area" }) }) }), _jsxs(DialogFooter, { className: "justify-between", children: [_jsx(Button, { variant: "outline", color: "secondary", fullwidth: false, children: "Medium" }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Button, { variant: "outline", color: "primary", fullwidth: false, onClick: handleCancel, children: "Cancel" }), _jsx(Button, { disabled: true, fullwidth: false, onClick: handleConfirm, children: "Confirm" })] })] })] }) })] }));
|
|
131
|
+
},
|
|
101
132
|
};
|