@a2v2ai/uikit 0.0.31 → 0.0.33
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/Textarea/Textarea.d.ts +1 -0
- package/Textarea/Textarea.js +4 -2
- package/package.json +1 -1
package/Textarea/Textarea.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextArea
|
|
|
12
12
|
label?: string;
|
|
13
13
|
labelVariant?: TextVariant;
|
|
14
14
|
labelColor?: TextColor;
|
|
15
|
+
error?: string;
|
|
15
16
|
}
|
|
16
17
|
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
17
18
|
export { Textarea, textareaVariants };
|
package/Textarea/Textarea.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
5
|
import { Label } from "../Label/Label";
|
|
6
|
+
import { Typography } from "../Typography/Typography";
|
|
6
7
|
import {} from "../lib/typography-types";
|
|
7
8
|
const textareaVariants = cva("flex min-h-[80px] w-full rounded-lg border bg-white px-3 py-2 text-sm font-normal font-sans transition-colors placeholder:text-grey-400 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-grey-50", {
|
|
8
9
|
variants: {
|
|
@@ -22,8 +23,9 @@ const textareaVariants = cva("flex min-h-[80px] w-full rounded-lg border bg-whit
|
|
|
22
23
|
resize: "vertical",
|
|
23
24
|
},
|
|
24
25
|
});
|
|
25
|
-
const Textarea = React.forwardRef(({ className, variant, resize, label, labelVariant = "body2", labelColor = "main-800", id, ...props }, ref) => {
|
|
26
|
-
|
|
26
|
+
const Textarea = React.forwardRef(({ className, variant, resize, label, labelVariant = "body2", labelColor = "main-800", error, id, ...props }, ref) => {
|
|
27
|
+
const computedVariant = error ? "error" : variant;
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-col gap-2 w-full", children: [label && (_jsx(Label, { htmlFor: id, variant: labelVariant, color: labelColor, children: label })), _jsx("textarea", { id: id, className: cn(textareaVariants({ variant: computedVariant, resize }), className), ref: ref, ...props }), error && (_jsx(Typography, { variant: "caption", color: "error-600", className: "mt-1", children: error }))] }));
|
|
27
29
|
});
|
|
28
30
|
Textarea.displayName = "Textarea";
|
|
29
31
|
export { Textarea, textareaVariants };
|