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