@rovula/ui 0.1.36 → 0.1.37
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/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/package.json +1 -1
- package/src/components/Dialog/Dialog.stories.tsx +72 -32
- package/src/components/Dialog/Dialog.tsx +6 -0
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import * as yup from "yup";
|
|
4
4
|
import {
|
|
@@ -16,6 +16,7 @@ import { Label } from "../Label/Label";
|
|
|
16
16
|
import { Input } from "../Input/Input";
|
|
17
17
|
import { Field, Form, ValidationHintList, ValidationHintRule } from "../Form";
|
|
18
18
|
import PasswordInput from "../PasswordInput";
|
|
19
|
+
import { Menu } from "@/patterns/menu/Menu";
|
|
19
20
|
|
|
20
21
|
const meta = {
|
|
21
22
|
title: "Components/Dialog",
|
|
@@ -219,36 +220,75 @@ export const FigmaFunctionForm = {
|
|
|
219
220
|
} satisfies StoryObj;
|
|
220
221
|
|
|
221
222
|
export const FigmaFunctionFormWithAction = {
|
|
222
|
-
render: () =>
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
223
|
+
render: () => {
|
|
224
|
+
const [open, setOpen] = useState(false);
|
|
225
|
+
const handleOpenChange = (open: boolean) => {
|
|
226
|
+
setOpen(open);
|
|
227
|
+
};
|
|
228
|
+
const handleCancel = () => {
|
|
229
|
+
setOpen(false);
|
|
230
|
+
};
|
|
231
|
+
const handleConfirm = () => {
|
|
232
|
+
setOpen(false);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<div className="flex w-full">
|
|
237
|
+
<Menu
|
|
238
|
+
items={[
|
|
239
|
+
{
|
|
240
|
+
type: "item",
|
|
241
|
+
item: {
|
|
242
|
+
value: "edit",
|
|
243
|
+
label: "Edit",
|
|
244
|
+
onClick: () => handleOpenChange(true),
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: "item",
|
|
249
|
+
item: {
|
|
250
|
+
value: "delete",
|
|
251
|
+
label: "Delete",
|
|
252
|
+
onClick: () => handleOpenChange(true),
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
]}
|
|
256
|
+
trigger={<Button variant="outline">Open</Button>}
|
|
257
|
+
/>
|
|
258
|
+
<Dialog open={open} onOpenChange={handleOpenChange}>
|
|
259
|
+
<DialogContent>
|
|
260
|
+
<DialogHeader>
|
|
261
|
+
<DialogTitle>Title</DialogTitle>
|
|
262
|
+
<DialogDescription>Subtitle description</DialogDescription>
|
|
263
|
+
</DialogHeader>
|
|
264
|
+
<DialogBody>
|
|
265
|
+
<div className="flex items-center justify-center bg-ramps-secondary-150 h-[200px] w-full rounded-sm">
|
|
266
|
+
<p className="typography-body3 text-text-contrast-max">
|
|
267
|
+
Content - Form Area
|
|
268
|
+
</p>
|
|
269
|
+
</div>
|
|
270
|
+
</DialogBody>
|
|
271
|
+
<DialogFooter className="justify-between">
|
|
272
|
+
<Button variant="outline" color="secondary" fullwidth={false}>
|
|
273
|
+
Medium
|
|
247
274
|
</Button>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
275
|
+
<div className="flex items-center gap-4">
|
|
276
|
+
<Button
|
|
277
|
+
variant="outline"
|
|
278
|
+
color="primary"
|
|
279
|
+
fullwidth={false}
|
|
280
|
+
onClick={handleCancel}
|
|
281
|
+
>
|
|
282
|
+
Cancel
|
|
283
|
+
</Button>
|
|
284
|
+
<Button disabled fullwidth={false} onClick={handleConfirm}>
|
|
285
|
+
Confirm
|
|
286
|
+
</Button>
|
|
287
|
+
</div>
|
|
288
|
+
</DialogFooter>
|
|
289
|
+
</DialogContent>
|
|
290
|
+
</Dialog>
|
|
291
|
+
</div>
|
|
292
|
+
);
|
|
293
|
+
},
|
|
254
294
|
} satisfies StoryObj;
|
|
@@ -55,6 +55,12 @@ const DialogContent = React.forwardRef<
|
|
|
55
55
|
className,
|
|
56
56
|
)}
|
|
57
57
|
{...props}
|
|
58
|
+
onCloseAutoFocus={(event) => {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
document.body.style.pointerEvents = "auto";
|
|
61
|
+
|
|
62
|
+
props?.onCloseAutoFocus?.(event);
|
|
63
|
+
}}
|
|
58
64
|
>
|
|
59
65
|
{children}
|
|
60
66
|
{showCloseButton && (
|