@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
- <div className="flex w-full">
224
- <Dialog defaultOpen>
225
- <DialogContent>
226
- <DialogHeader>
227
- <DialogTitle>Title</DialogTitle>
228
- <DialogDescription>Subtitle description</DialogDescription>
229
- </DialogHeader>
230
- <DialogBody>
231
- <div className="flex items-center justify-center bg-ramps-secondary-150 h-[200px] w-full rounded-sm">
232
- <p className="typography-body3 text-text-contrast-max">
233
- Content - Form Area
234
- </p>
235
- </div>
236
- </DialogBody>
237
- <DialogFooter className="justify-between">
238
- <Button variant="outline" color="secondary" fullwidth={false}>
239
- Medium
240
- </Button>
241
- <div className="flex items-center gap-4">
242
- <Button variant="outline" color="primary" fullwidth={false}>
243
- Cancel
244
- </Button>
245
- <Button disabled fullwidth={false}>
246
- Confirm
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
- </div>
249
- </DialogFooter>
250
- </DialogContent>
251
- </Dialog>
252
- </div>
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 && (