@m4l/components 9.2.21 → 9.2.22

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.
@@ -30,7 +30,8 @@ const TextField = forwardRef(function TextField2(props, ref) {
30
30
  disabled,
31
31
  paletteColor,
32
32
  variant,
33
- error
33
+ error,
34
+ color: error ? "error" : "default"
34
35
  };
35
36
  const isSkeleton = useModuleSkeleton();
36
37
  if (isSkeleton) {
@@ -117,6 +117,21 @@ const textFieldStyles = {
117
117
  borderRight: 0,
118
118
  borderBottom: theme.vars.size.borderStroke.actionInput
119
119
  }
120
+ },
121
+ // Variant Contained TextField
122
+ ...ownerState.variant === "contained" && {
123
+ [`&.${TEXT_FIELD_CLASSES.contained} .MuiInputBase-root`]: {
124
+ border: "none",
125
+ backgroundColor: theme.vars.palette[ownerState.color || "default"][ownerState.error ? "toneOpacity" : "enabled"]
126
+ },
127
+ ...ownerState.error && {
128
+ border: theme.vars.size.borderStroke.actionInput,
129
+ borderColor: `${ownerState.paletteColor?.enabled}!important`
130
+ },
131
+ "&:focus-within": {
132
+ border: theme.vars.size.borderStroke.actionInput,
133
+ borderColor: `${ownerState.paletteColor?.enabled}!important`
134
+ }
120
135
  }
121
136
  }),
122
137
  /**
@@ -3,6 +3,7 @@ export declare const TEXT_FIELD_KEY_COMPONENT = "M4LTextField";
3
3
  export declare const COMBINATED_TEXTFIELD_ENUMS: {
4
4
  outlined: TexFieldComplementaryClasses.outlined;
5
5
  text: TexFieldComplementaryClasses.text;
6
+ contained: TexFieldComplementaryClasses.contained;
6
7
  root: TextFieldSlots.root;
7
8
  skeleton: TextFieldSlots.skeleton;
8
9
  };
@@ -4,5 +4,6 @@ export declare enum TextFieldSlots {
4
4
  }
5
5
  export declare enum TexFieldComplementaryClasses {
6
6
  outlined = "outlined",
7
- text = "text"
7
+ text = "text",
8
+ contained = "contained"
8
9
  }
@@ -6,6 +6,7 @@ var TextFieldSlots = /* @__PURE__ */ ((TextFieldSlots2) => {
6
6
  var TexFieldComplementaryClasses = /* @__PURE__ */ ((TexFieldComplementaryClasses2) => {
7
7
  TexFieldComplementaryClasses2["outlined"] = "outlined";
8
8
  TexFieldComplementaryClasses2["text"] = "text";
9
+ TexFieldComplementaryClasses2["contained"] = "contained";
9
10
  return TexFieldComplementaryClasses2;
10
11
  })(TexFieldComplementaryClasses || {});
11
12
  export {
@@ -2,12 +2,12 @@ import { TextFieldProps as MUITextFieldProps } from '@mui/material/TextField';
2
2
  import { Theme, PaletteColor } from '@mui/material';
3
3
  import { TextFieldSlots } from './slots/TextFieldEnum';
4
4
  import { TEXT_FIELD_KEY_COMPONENT } from './constants';
5
- import { Sizes } from '@m4l/styles';
5
+ import { ComponentPalletColor, Sizes } from '@m4l/styles';
6
6
  import { M4LOverridesStyleRules } from '../../../@types/augmentations';
7
7
  /**
8
8
  * Variants for the TextField component.
9
9
  */
10
- export type TextFieldVariants = 'outlined' | 'text';
10
+ export type TextFieldVariants = 'outlined' | 'text' | 'contained';
11
11
  /**
12
12
  * Variants for the Skeleton component.
13
13
  */
@@ -61,6 +61,7 @@ export interface TextFieldOwnerState {
61
61
  * Indica si el campo de texto es error.
62
62
  */
63
63
  error?: boolean;
64
+ color?: Extract<ComponentPalletColor, 'default' | 'error'>;
64
65
  }
65
66
  export type TextFieldSlotsType = keyof typeof TextFieldSlots;
66
67
  export type TextFieldStyles = M4LOverridesStyleRules<TextFieldSlotsType, typeof TEXT_FIELD_KEY_COMPONENT, Theme>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.2.21",
3
+ "version": "9.2.22",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0 --no-warn-ignored"