@matbea-ui/matbea-ui 0.2.0-dev.619284 → 0.2.0-dev.925901
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/matbea-ui.es.js
CHANGED
|
@@ -934,10 +934,9 @@ const Wrapper$1 = styled$1.div `
|
|
|
934
934
|
width: 100%;
|
|
935
935
|
`;
|
|
936
936
|
const Label$2 = styled$1(Typography).attrs({
|
|
937
|
-
variant: "form-input",
|
|
938
937
|
forwardedAs: "label",
|
|
939
938
|
}) `
|
|
940
|
-
color: ${({ theme }) => theme.colors.primary.darkBlue};
|
|
939
|
+
color: ${({ theme, $color }) => $color || theme.colors.primary.darkBlue};
|
|
941
940
|
`;
|
|
942
941
|
const FieldContainer$1 = styled$1.div `
|
|
943
942
|
display: flex;
|
|
@@ -1010,7 +1009,7 @@ const ErrorText$1 = styled$1.span `
|
|
|
1010
1009
|
color: ${({ theme }) => theme.colors.accent.red};
|
|
1011
1010
|
`;
|
|
1012
1011
|
|
|
1013
|
-
const TextField = forwardRef(({ value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, action, name, type = "text", onChange, onFocus, onBlur, className, labelVariant, }, ref) => {
|
|
1012
|
+
const TextField = forwardRef(({ value, defaultValue, placeholder = "Text", label, error, disabled = false, icon, action, name, type = "text", onChange, onFocus, onBlur, className, labelVariant, labelColor, }, ref) => {
|
|
1014
1013
|
const [focused, setFocused] = useState(false);
|
|
1015
1014
|
const hasError = Boolean(error);
|
|
1016
1015
|
const handleFocus = (evt) => {
|
|
@@ -1021,7 +1020,7 @@ const TextField = forwardRef(({ value, defaultValue, placeholder = "Text", label
|
|
|
1021
1020
|
setFocused(false);
|
|
1022
1021
|
onBlur?.(evt);
|
|
1023
1022
|
};
|
|
1024
|
-
return (jsxs(Wrapper$1, { className: className, children: [label && jsx(Label$2, { variant: labelVariant, children: label }), jsxs(FieldContainer$1, { "$hasError": hasError, "$disabled": disabled, "data-state": hasError ? "error" : focused ? "active" : undefined, children: [icon && jsx(LeadingIcon$1, { children: icon }), jsx(Input, { ref: ref, type: type, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, disabled: disabled, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur }), action && jsx(ActionSlot, { children: action })] }), error && jsx(ErrorText$1, { children: error })] }));
|
|
1023
|
+
return (jsxs(Wrapper$1, { className: className, children: [label && (jsx(Label$2, { variant: labelVariant || "form-input", "$color": labelColor, children: label })), jsxs(FieldContainer$1, { "$hasError": hasError, "$disabled": disabled, "data-state": hasError ? "error" : focused ? "active" : undefined, children: [icon && jsx(LeadingIcon$1, { children: icon }), jsx(Input, { ref: ref, type: type, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, disabled: disabled, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur }), action && jsx(ActionSlot, { children: action })] }), error && jsx(ErrorText$1, { children: error })] }));
|
|
1025
1024
|
});
|
|
1026
1025
|
TextField.displayName = "TextField";
|
|
1027
1026
|
|