@firecms/ui 3.0.0-canary.178 → 3.0.0-canary.179
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/dist/components/TextField.d.ts +20 -1
- package/dist/index.es.js +8 -10
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +8 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/TextField.tsx +178 -153
- package/src/components/Tooltip.tsx +0 -1
package/dist/index.umd.js
CHANGED
@@ -31270,7 +31270,7 @@
|
|
31270
31270
|
ref.current = value;
|
31271
31271
|
}
|
31272
31272
|
}
|
31273
|
-
|
31273
|
+
const TextField = React.forwardRef(({
|
31274
31274
|
value,
|
31275
31275
|
onChange,
|
31276
31276
|
label,
|
@@ -31290,7 +31290,7 @@
|
|
31290
31290
|
inputStyle,
|
31291
31291
|
inputRef: inputRefProp,
|
31292
31292
|
...inputProps
|
31293
|
-
}) {
|
31293
|
+
}, ref) => {
|
31294
31294
|
const inputRef = inputRefProp ?? React.useRef(null);
|
31295
31295
|
const [focused, setFocused] = React.useState(document.activeElement === inputRef.current);
|
31296
31296
|
const hasValue = value !== void 0 && value !== null && value !== "";
|
@@ -31300,16 +31300,13 @@
|
|
31300
31300
|
if (event.target instanceof HTMLElement) event.target.blur();
|
31301
31301
|
};
|
31302
31302
|
const element = "current" in inputRef ? inputRef.current : inputRef;
|
31303
|
-
element
|
31303
|
+
element?.addEventListener("wheel", handleWheel);
|
31304
31304
|
return () => {
|
31305
|
-
element
|
31305
|
+
element?.removeEventListener("wheel", handleWheel);
|
31306
31306
|
};
|
31307
31307
|
}, [inputRef, type]);
|
31308
|
-
const
|
31309
|
-
|
31310
|
-
}, []);
|
31311
|
-
const input = multiline ? /* @__PURE__ */ jsxRuntime.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") }) : /* @__PURE__ */ jsxRuntime.jsx("input", { ...inputProps, ref: inputRef, onWheel: type === "number" ? numberInputOnWheelPreventChange : void 0, 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: Number.isNaN(value) ? "" : value ?? "", onChange });
|
31312
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cls("rounded-md relative max-w-full", invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin, disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin, error ? "border border-red-500 dark:border-red-600" : "", {
|
31308
|
+
const input = multiline ? /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.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 });
|
31309
|
+
return /* @__PURE__ */ jsxRuntime.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" : "", {
|
31313
31310
|
"min-h-[32px]": !invisible && size === "small",
|
31314
31311
|
"min-h-[48px]": !invisible && size === "medium",
|
31315
31312
|
"min-h-[64px]": !invisible && size === "large"
|
@@ -31322,7 +31319,8 @@
|
|
31322
31319
|
"mr-2": size === "small"
|
31323
31320
|
}), children: endAdornment })
|
31324
31321
|
] });
|
31325
|
-
}
|
31322
|
+
});
|
31323
|
+
TextField.displayName = "TextField";
|
31326
31324
|
const Tooltip = (t0) => {
|
31327
31325
|
const $ = reactCompilerRuntime.c(28);
|
31328
31326
|
const {
|