@rovula/ui 0.1.34 → 0.1.35

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.
@@ -31,6 +31,11 @@ export type FormDialogProps = {
31
31
  extraAction?: FormDialogAction;
32
32
  scrollable?: boolean;
33
33
  className?: string;
34
+ headerClassName?: string;
35
+ titleClassName?: string;
36
+ descriptionClassName?: string;
37
+ bodyClassName?: string;
38
+ footerClassName?: string;
34
39
  /**
35
40
  * When provided, the confirm button becomes type="submit" and is linked to this form id.
36
41
  * Use together with a <Form id={formId} .../> inside children.
@@ -20,6 +20,11 @@ declare const meta: {
20
20
  extraAction?: import("./FormDialog").FormDialogAction | undefined;
21
21
  scrollable?: boolean | undefined;
22
22
  className?: string | undefined;
23
+ headerClassName?: string | undefined;
24
+ titleClassName?: string | undefined;
25
+ descriptionClassName?: string | undefined;
26
+ bodyClassName?: string | undefined;
27
+ footerClassName?: string | undefined;
23
28
  formId?: string | undefined;
24
29
  testId?: string | undefined;
25
30
  }>) => import("react/jsx-runtime").JSX.Element)[];
package/dist/index.d.ts CHANGED
@@ -1728,6 +1728,11 @@ type FormDialogProps = {
1728
1728
  extraAction?: FormDialogAction;
1729
1729
  scrollable?: boolean;
1730
1730
  className?: string;
1731
+ headerClassName?: string;
1732
+ titleClassName?: string;
1733
+ descriptionClassName?: string;
1734
+ bodyClassName?: string;
1735
+ footerClassName?: string;
1731
1736
  /**
1732
1737
  * When provided, the confirm button becomes type="submit" and is linked to this form id.
1733
1738
  * Use together with a <Form id={formId} .../> inside children.
@@ -2,9 +2,10 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogBody, DialogFooter, DialogTrigger, } from "@/components/Dialog/Dialog";
4
4
  import Button from "@/components/Button/Button";
5
- export const FormDialog = ({ open, onOpenChange, title, description, children, trigger, confirmAction, cancelAction, extraAction, scrollable = false, className, formId, testId, }) => {
5
+ import { cn } from "@/utils/cn";
6
+ export const FormDialog = ({ open, onOpenChange, title, description, children, trigger, confirmAction, cancelAction, extraAction, scrollable = false, className, headerClassName, titleClassName, descriptionClassName, bodyClassName, footerClassName, formId, testId, }) => {
6
7
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7
8
  const hasFooter = confirmAction || cancelAction || extraAction;
8
- return (_jsxs(Dialog, { open: open, onOpenChange: onOpenChange, children: [trigger && _jsx(DialogTrigger, { asChild: true, children: trigger }), _jsxs(DialogContent, { className: className, "data-testid": testId, children: [_jsxs(DialogHeader, { children: [title && (_jsx(DialogTitle, { "data-testid": testId && `${testId}-title`, children: title })), description && (_jsx(DialogDescription, { "data-testid": testId && `${testId}-description`, children: description }))] }), children && (_jsx(DialogBody, { scrollable: scrollable, children: children })), hasFooter && (_jsxs(DialogFooter, { className: extraAction ? "justify-between" : undefined, children: [extraAction && (_jsx(Button, { type: (_a = extraAction.type) !== null && _a !== void 0 ? _a : "button", variant: (_b = extraAction.variant) !== null && _b !== void 0 ? _b : "outline", color: (_c = extraAction.color) !== null && _c !== void 0 ? _c : "secondary", fullwidth: false, disabled: extraAction.disabled, isLoading: extraAction.isLoading, onClick: extraAction.onClick, className: extraAction.className, "data-testid": testId && `${testId}-extra-button`, children: extraAction.label })), _jsxs("div", { className: "flex items-center gap-4", children: [cancelAction && (_jsx(Button, { type: (_d = cancelAction.type) !== null && _d !== void 0 ? _d : "button", variant: (_e = cancelAction.variant) !== null && _e !== void 0 ? _e : "outline", color: (_f = cancelAction.color) !== null && _f !== void 0 ? _f : "primary", fullwidth: false, disabled: cancelAction.disabled, isLoading: cancelAction.isLoading, onClick: cancelAction.onClick, className: cancelAction.className, "data-testid": testId && `${testId}-cancel-button`, children: cancelAction.label })), confirmAction && (_jsx(Button, { type: formId ? "submit" : (_g = confirmAction.type) !== null && _g !== void 0 ? _g : "button", form: formId, variant: (_h = confirmAction.variant) !== null && _h !== void 0 ? _h : "solid", color: (_j = confirmAction.color) !== null && _j !== void 0 ? _j : "primary", fullwidth: false, disabled: confirmAction.disabled, isLoading: confirmAction.isLoading, onClick: confirmAction.onClick, className: confirmAction.className, "data-testid": testId && `${testId}-confirm-button`, children: confirmAction.label }))] })] }))] })] }));
9
+ return (_jsxs(Dialog, { open: open, onOpenChange: onOpenChange, children: [trigger && _jsx(DialogTrigger, { asChild: true, children: trigger }), _jsxs(DialogContent, { className: className, "data-testid": testId, children: [_jsxs(DialogHeader, { className: headerClassName, children: [title && (_jsx(DialogTitle, { className: titleClassName, "data-testid": testId && `${testId}-title`, children: title })), description && (_jsx(DialogDescription, { className: descriptionClassName, "data-testid": testId && `${testId}-description`, children: description }))] }), children && (_jsx(DialogBody, { className: bodyClassName, scrollable: scrollable, children: children })), hasFooter && (_jsxs(DialogFooter, { className: cn(extraAction && "justify-between", footerClassName), children: [extraAction && (_jsx(Button, { type: (_a = extraAction.type) !== null && _a !== void 0 ? _a : "button", variant: (_b = extraAction.variant) !== null && _b !== void 0 ? _b : "outline", color: (_c = extraAction.color) !== null && _c !== void 0 ? _c : "secondary", fullwidth: false, disabled: extraAction.disabled, isLoading: extraAction.isLoading, onClick: extraAction.onClick, className: extraAction.className, "data-testid": testId && `${testId}-extra-button`, children: extraAction.label })), _jsxs("div", { className: "flex items-center gap-4", children: [cancelAction && (_jsx(Button, { type: (_d = cancelAction.type) !== null && _d !== void 0 ? _d : "button", variant: (_e = cancelAction.variant) !== null && _e !== void 0 ? _e : "outline", color: (_f = cancelAction.color) !== null && _f !== void 0 ? _f : "primary", fullwidth: false, disabled: cancelAction.disabled, isLoading: cancelAction.isLoading, onClick: cancelAction.onClick, className: cancelAction.className, "data-testid": testId && `${testId}-cancel-button`, children: cancelAction.label })), confirmAction && (_jsx(Button, { type: formId ? "submit" : (_g = confirmAction.type) !== null && _g !== void 0 ? _g : "button", form: formId, variant: (_h = confirmAction.variant) !== null && _h !== void 0 ? _h : "solid", color: (_j = confirmAction.color) !== null && _j !== void 0 ? _j : "primary", fullwidth: false, disabled: confirmAction.disabled, isLoading: confirmAction.isLoading, onClick: confirmAction.onClick, className: confirmAction.className, "data-testid": testId && `${testId}-confirm-button`, children: confirmAction.label }))] })] }))] })] }));
9
10
  };
10
11
  FormDialog.displayName = "FormDialog";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,7 @@ import {
13
13
  } from "@/components/Dialog/Dialog";
14
14
  import Button from "@/components/Button/Button";
15
15
  import Loading from "@/components/Loading/Loading";
16
+ import { cn } from "@/utils/cn";
16
17
 
17
18
  export type FormDialogAction = {
18
19
  label: string;
@@ -46,6 +47,11 @@ export type FormDialogProps = {
46
47
  extraAction?: FormDialogAction;
47
48
  scrollable?: boolean;
48
49
  className?: string;
50
+ headerClassName?: string;
51
+ titleClassName?: string;
52
+ descriptionClassName?: string;
53
+ bodyClassName?: string;
54
+ footerClassName?: string;
49
55
  /**
50
56
  * When provided, the confirm button becomes type="submit" and is linked to this form id.
51
57
  * Use together with a <Form id={formId} .../> inside children.
@@ -66,6 +72,11 @@ export const FormDialog: React.FC<FormDialogProps> = ({
66
72
  extraAction,
67
73
  scrollable = false,
68
74
  className,
75
+ headerClassName,
76
+ titleClassName,
77
+ descriptionClassName,
78
+ bodyClassName,
79
+ footerClassName,
69
80
  formId,
70
81
  testId,
71
82
  }) => {
@@ -75,25 +86,25 @@ export const FormDialog: React.FC<FormDialogProps> = ({
75
86
  <Dialog open={open} onOpenChange={onOpenChange}>
76
87
  {trigger && <DialogTrigger asChild>{trigger}</DialogTrigger>}
77
88
  <DialogContent className={className} data-testid={testId}>
78
- <DialogHeader>
89
+ <DialogHeader className={headerClassName}>
79
90
  {title && (
80
- <DialogTitle data-testid={testId && `${testId}-title`}>
91
+ <DialogTitle className={titleClassName} data-testid={testId && `${testId}-title`}>
81
92
  {title}
82
93
  </DialogTitle>
83
94
  )}
84
95
  {description && (
85
- <DialogDescription data-testid={testId && `${testId}-description`}>
96
+ <DialogDescription className={descriptionClassName} data-testid={testId && `${testId}-description`}>
86
97
  {description}
87
98
  </DialogDescription>
88
99
  )}
89
100
  </DialogHeader>
90
101
 
91
102
  {children && (
92
- <DialogBody scrollable={scrollable}>{children}</DialogBody>
103
+ <DialogBody className={bodyClassName} scrollable={scrollable}>{children}</DialogBody>
93
104
  )}
94
105
 
95
106
  {hasFooter && (
96
- <DialogFooter className={extraAction ? "justify-between" : undefined}>
107
+ <DialogFooter className={cn(extraAction && "justify-between", footerClassName)}>
97
108
  {extraAction && (
98
109
  <Button
99
110
  type={extraAction.type ?? "button"}