@rovula/ui 0.1.33 → 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.33",
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",
@@ -19,7 +19,7 @@ const PopoverContent = React.forwardRef<
19
19
  align={align}
20
20
  sideOffset={sideOffset}
21
21
  className={cn(
22
- "z-50 min-w-72 rounded-md border bg-modal-surface border-bg-stroke3 overflow-hidden p-0 text-text-g-contrast-medium shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
22
+ "z-50 min-w-72 rounded-md border bg-modal-surface border-bg-stroke3 overflow-hidden p-0 text-text-contrast-max shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23
23
  className,
24
24
  )}
25
25
  {...props}
@@ -55,8 +55,9 @@ export const NonFloatingLabel = {
55
55
  <div className="flex w-full max-w-4xl flex-col gap-8">
56
56
  <div className="flex flex-col gap-3">
57
57
  <h4 className="typography-subtitle4 text-text-g-contrast-medium">
58
- Placeholder only — empty <code className="typography-small2">label</code>{" "}
59
- (no floating label, no label node)
58
+ Placeholder only — empty{" "}
59
+ <code className="typography-small2">label</code> (no floating label,
60
+ no label node)
60
61
  </h4>
61
62
  <p className="typography-small2 text-text-g-contrast-low max-w-2xl">
62
63
  Tab order follows DOM, like native inputs in a row.
@@ -495,8 +496,8 @@ const TrimOnCommitDemo = () => {
495
496
  <div className="flex flex-col gap-6 w-full max-w-md">
496
497
  <p className="text-sm text-text-g-contrast-low">
497
498
  <code>trimOnCommit</code> trims leading and trailing whitespace when the
498
- user blurs the input or presses Enter. Try typing{" "}
499
- <code>"hello "</code> then click outside or press Enter.
499
+ user blurs the input or presses Enter. Try typing <code>"hello "</code>{" "}
500
+ then click outside or press Enter.
500
501
  </p>
501
502
  <TextInput
502
503
  id="trim-commit-demo"
@@ -116,11 +116,7 @@ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
116
116
  const hasRightSectionIcon = !!endIcon || !!renderEndIcon;
117
117
  const feedbackStatus =
118
118
  status ||
119
- (error || !!errorMessage
120
- ? "error"
121
- : warning || !!warningMessage
122
- ? "warning"
123
- : "default");
119
+ (error ? "error" : warning || !!warningMessage ? "warning" : "default");
124
120
  const isError = feedbackStatus === "error";
125
121
  const isWarning = feedbackStatus === "warning";
126
122
  const feedbackMessage =
@@ -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"}