@firecms/ui 3.0.0-canary.205 → 3.0.0-canary.207

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.
@@ -6,7 +6,6 @@ export type TextFieldProps<T extends string | number> = {
6
6
  onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
7
7
  label?: React.ReactNode;
8
8
  multiline?: boolean;
9
- rows?: number;
10
9
  disabled?: boolean;
11
10
  invisible?: boolean;
12
11
  error?: boolean;
@@ -19,6 +18,15 @@ export type TextFieldProps<T extends string | number> = {
19
18
  inputClassName?: string;
20
19
  inputStyle?: React.CSSProperties;
21
20
  inputRef?: React.ForwardedRef<any>;
21
+ /**
22
+ * Maximum number of rows to display.
23
+ */
24
+ maxRows?: number | string;
25
+ /**
26
+ * Minimum number of rows to display.
27
+ * @default 1
28
+ */
29
+ minRows?: number | string;
22
30
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">;
23
31
  export declare const TextField: React.ForwardRefExoticComponent<{
24
32
  type?: InputType;
@@ -26,7 +34,6 @@ export declare const TextField: React.ForwardRefExoticComponent<{
26
34
  onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
27
35
  label?: React.ReactNode;
28
36
  multiline?: boolean;
29
- rows?: number;
30
37
  disabled?: boolean;
31
38
  invisible?: boolean;
32
39
  error?: boolean;
@@ -39,4 +46,13 @@ export declare const TextField: React.ForwardRefExoticComponent<{
39
46
  inputClassName?: string;
40
47
  inputStyle?: React.CSSProperties;
41
48
  inputRef?: React.ForwardedRef<any>;
49
+ /**
50
+ * Maximum number of rows to display.
51
+ */
52
+ maxRows?: number | string;
53
+ /**
54
+ * Minimum number of rows to display.
55
+ * @default 1
56
+ */
57
+ minRows?: number | string;
42
58
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLDivElement>>;
package/dist/index.es.js CHANGED
@@ -31274,7 +31274,8 @@ const TextField = forwardRef(({
31274
31274
  type = "text",
31275
31275
  multiline = false,
31276
31276
  invisible,
31277
- rows,
31277
+ maxRows,
31278
+ minRows,
31278
31279
  disabled,
31279
31280
  error,
31280
31281
  endAdornment,
@@ -31302,7 +31303,7 @@ const TextField = forwardRef(({
31302
31303
  element?.removeEventListener("wheel", handleWheel);
31303
31304
  };
31304
31305
  }, [inputRef, type]);
31305
- const input = multiline ? /* @__PURE__ */ jsx(TextareaAutosize, { ...inputProps, ref: inputRef, placeholder: focused || hasValue || !label ? placeholder : void 0, autoFocus, rows, value: value ?? "", onChange, style: inputStyle, className: cls(invisible ? focusedInvisibleMixin : "", "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-8", disabled && "outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500", inputClassName) }) : /* @__PURE__ */ jsx("input", { ...inputProps, ref: inputRef, disabled, style: inputStyle, className: cls("w-full outline-none bg-transparent leading-normal px-3", "rounded-md", "focused:text-text-primary focused:dark:text-text-primary-dark", invisible ? focusedInvisibleMixin : "", disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin, size === "small" ? "min-h-[32px]" : size === "medium" ? "min-h-[48px]" : "min-h-[64px]", label ? size === "large" ? "pt-8 pb-2" : "pt-4 pb-2" : "py-2", endAdornment ? "pr-10" : "pr-3", disabled && "outline-none opacity-50 dark:opacity-50 text-surface-accent-800 dark:text-white", inputClassName), placeholder: focused || hasValue || !label ? placeholder : void 0, autoFocus, onFocus: () => setFocused(true), onBlur: () => setFocused(false), type, value: type === "number" && Number.isNaN(value) ? "" : value ?? "", onChange });
31306
+ const input = multiline ? /* @__PURE__ */ jsx(TextareaAutosize, { ...inputProps, ref: inputRef, placeholder: focused || hasValue || !label ? placeholder : void 0, autoFocus, minRows, maxRows, value: value ?? "", onChange, style: inputStyle, className: cls(invisible ? focusedInvisibleMixin : "", "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-8", disabled && "outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500", inputClassName) }) : /* @__PURE__ */ jsx("input", { ...inputProps, ref: inputRef, disabled, style: inputStyle, className: cls("w-full outline-none bg-transparent leading-normal px-3", "rounded-md", "focused:text-text-primary focused:dark:text-text-primary-dark", invisible ? focusedInvisibleMixin : "", disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin, size === "small" ? "min-h-[32px]" : size === "medium" ? "min-h-[48px]" : "min-h-[64px]", label ? size === "large" ? "pt-8 pb-2" : "pt-4 pb-2" : "py-2", endAdornment ? "pr-10" : "pr-3", disabled && "outline-none opacity-50 dark:opacity-50 text-surface-accent-800 dark:text-white", inputClassName), placeholder: focused || hasValue || !label ? placeholder : void 0, autoFocus, onFocus: () => setFocused(true), onBlur: () => setFocused(false), type, value: type === "number" && Number.isNaN(value) ? "" : value ?? "", onChange });
31306
31307
  return /* @__PURE__ */ jsxs("div", { ref, className: cls("rounded-md relative max-w-full", invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin, disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin, error ? "border border-red-500 dark:border-red-600" : "", {
31307
31308
  "min-h-[32px]": !invisible && size === "small",
31308
31309
  "min-h-[48px]": !invisible && size === "medium",