@bloom-housing/ui-components 12.0.18 → 12.0.20
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./Textarea.scss";
|
|
2
|
-
import { UseFormMethods } from "react-hook-form";
|
|
2
|
+
import { UseFormMethods, RegisterOptions } from "react-hook-form";
|
|
3
3
|
type WrapOptions = "soft" | "hard";
|
|
4
4
|
export interface TextareaProps {
|
|
5
5
|
cols?: number;
|
|
@@ -16,6 +16,7 @@ export interface TextareaProps {
|
|
|
16
16
|
register?: UseFormMethods["register"];
|
|
17
17
|
resize?: boolean;
|
|
18
18
|
rows?: number;
|
|
19
|
+
validation?: RegisterOptions;
|
|
19
20
|
wrap?: WrapOptions;
|
|
20
21
|
readerOnly?: boolean;
|
|
21
22
|
inputProps?: Record<string, unknown>;
|
|
@@ -31,7 +31,7 @@ export var Textarea = function (props) {
|
|
|
31
31
|
var inputProps = __assign({}, props.inputProps);
|
|
32
32
|
return (React.createElement("div", null,
|
|
33
33
|
React.createElement("label", { className: labelClassnames.join(" "), htmlFor: (_a = props.id) !== null && _a !== void 0 ? _a : props.name }, props.label),
|
|
34
|
-
React.createElement("textarea", __assign({ className: textareaClassnames.join(" "), cols: (_b = props.cols) !== null && _b !== void 0 ? _b : 40, disabled: props.disabled, defaultValue: props.defaultValue, id: (_c = props.id) !== null && _c !== void 0 ? _c : props.name, maxLength: (_d = props.maxLength) !== null && _d !== void 0 ? _d : 1000, name: props.name, placeholder: (_e = props.placeholder) !== null && _e !== void 0 ? _e : t("t.description"), ref: props.register, rows: (_f = props.rows) !== null && _f !== void 0 ? _f : 4, wrap: (_g = props.wrap) !== null && _g !== void 0 ? _g : "soft", title: props.label }, inputProps, { "data-testid": props.dataTestId })),
|
|
34
|
+
React.createElement("textarea", __assign({ className: textareaClassnames.join(" "), cols: (_b = props.cols) !== null && _b !== void 0 ? _b : 40, disabled: props.disabled, defaultValue: props.defaultValue, id: (_c = props.id) !== null && _c !== void 0 ? _c : props.name, maxLength: (_d = props.maxLength) !== null && _d !== void 0 ? _d : 1000, name: props.name, placeholder: (_e = props.placeholder) !== null && _e !== void 0 ? _e : t("t.description"), ref: props.register && props.register(props.validation), rows: (_f = props.rows) !== null && _f !== void 0 ? _f : 4, wrap: (_g = props.wrap) !== null && _g !== void 0 ? _g : "soft", title: props.label }, inputProps, { "data-testid": props.dataTestId })),
|
|
35
35
|
props.note && React.createElement("p", { className: "field-note font-normal mb-2" }, props.note),
|
|
36
36
|
props.errorMessage && React.createElement("span", { className: "textarea-error-message" }, props.errorMessage)));
|
|
37
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/forms/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,iBAAiB,CAAA;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/forms/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,iBAAiB,CAAA;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAA;AA2BzC,MAAM,CAAC,IAAM,QAAQ,GAAG,UAAC,KAAoB;;IAC3C,IAAM,kBAAkB,GAAG,CAAC,UAAU,CAAC,CAAA;IACvC,IAAI,KAAK,CAAC,QAAQ;QAAE,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAChE,IAAI,KAAK,CAAC,YAAY;QAAE,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IACjE,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK;QAAE,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;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QACD,KAAK,CAAC,IAAI,IAAI,2BAAG,SAAS,EAAC,6BAA6B,IAAE,KAAK,CAAC,IAAI,CAAK;QACzE,KAAK,CAAC,YAAY,IAAI,8BAAM,SAAS,EAAC,wBAAwB,IAAE,KAAK,CAAC,YAAY,CAAQ,CACvF,CACP,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.20",
|
|
4
4
|
"author": "Sean Albert <sean.albert@exygy.com>",
|
|
5
5
|
"description": "Shared user interface components for Bloom affordable housing system",
|
|
6
6
|
"homepage": "https://github.com/bloom-housing/ui-components",
|
package/src/forms/Textarea.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react"
|
|
2
2
|
import "./Textarea.scss"
|
|
3
3
|
import { t } from "../helpers/translator"
|
|
4
|
-
import { UseFormMethods } from "react-hook-form"
|
|
4
|
+
import { UseFormMethods, RegisterOptions } from "react-hook-form"
|
|
5
5
|
|
|
6
6
|
type WrapOptions = "soft" | "hard"
|
|
7
7
|
|
|
@@ -20,6 +20,7 @@ export interface TextareaProps {
|
|
|
20
20
|
register?: UseFormMethods["register"]
|
|
21
21
|
resize?: boolean
|
|
22
22
|
rows?: number
|
|
23
|
+
validation?: RegisterOptions
|
|
23
24
|
wrap?: WrapOptions
|
|
24
25
|
readerOnly?: boolean
|
|
25
26
|
inputProps?: Record<string, unknown>
|
|
@@ -52,7 +53,7 @@ export const Textarea = (props: TextareaProps) => {
|
|
|
52
53
|
maxLength={props.maxLength ?? 1000}
|
|
53
54
|
name={props.name}
|
|
54
55
|
placeholder={props.placeholder ?? t("t.description")}
|
|
55
|
-
ref={props.register}
|
|
56
|
+
ref={props.register && props.register(props.validation)}
|
|
56
57
|
rows={props.rows ?? 4}
|
|
57
58
|
wrap={props.wrap ?? "soft"}
|
|
58
59
|
title={props.label}
|