Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): fix margin issues in TextField #299

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/primitives/src/design-tokens/oxygen/dark.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
"colors": {
"primary": {
"lighter": {
"value": "#14b8a5",
"value": "#ff9666",
"type": "color"
},
"light": {
"value": "#19e6ce",
"value": "#ff7433",
"type": "color"
},
"default": {
"value": "#47ebd8",
"value": "#ff5100",
"type": "color"
},
"dark": {
"value": "#75f0e1",
"value": "#cc4100",
"type": "color"
},
"darker": {
"value": "#a3f5eb",
"value": "#993000",
"type": "color"
}
},
Expand Down Expand Up @@ -63,7 +63,7 @@
"type": "color"
},
"primary": {
"value": "#75f0e1",
"value": "#cc4100",
"type": "color"
}
},
Expand All @@ -89,7 +89,7 @@
"type": "color"
},
"primary": {
"value": "#47ebd8",
"value": "#ff5100",
"type": "color"
},
"gray": {
Expand Down Expand Up @@ -228,7 +228,7 @@
"background": {
"primary": {
"default": {
"value": "#47ebd8",
"value": "#ff5100",
"type": "color"
}
},
Expand Down Expand Up @@ -327,4 +327,4 @@
"value": "https://raw.githubusercontent.com/brionmario/oxygen/main/examples/multi-brand-identity/public/assets/brands/oxygen/images/oxygen-logo-inverted.svg",
"type": "asset"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`Alert should match the snapshot 1`] = `
Movie
</label>
<div
class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root OxygenTextField-root css-wb57ya-MuiFormControl-root-MuiTextField-root"
class="MuiFormControl-root MuiFormControl-marginDense MuiFormControl-fullWidth MuiTextField-root OxygenTextField-root css-1z10yd4-MuiFormControl-root-MuiTextField-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd MuiAutocomplete-inputRoot css-115mmlx-MuiInputBase-root-MuiOutlinedInput-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports[`SignIn should match the snapshot 1`] = `
Username
</label>
<div
class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root OxygenTextField-root css-wb57ya-MuiFormControl-root-MuiTextField-root"
class="MuiFormControl-root MuiFormControl-marginDense MuiFormControl-fullWidth MuiTextField-root OxygenTextField-root css-1z10yd4-MuiFormControl-root-MuiTextField-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth Mui-focused MuiInputBase-formControl MuiInputBase-sizeSmall css-e1xd3c-MuiInputBase-root-MuiOutlinedInput-root"
Expand Down Expand Up @@ -76,7 +76,7 @@ exports[`SignIn should match the snapshot 1`] = `
Password
</label>
<div
class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root css-wb57ya-MuiFormControl-root-MuiTextField-root"
class="MuiFormControl-root MuiFormControl-marginDense MuiFormControl-fullWidth MuiTextField-root css-1z10yd4-MuiFormControl-root-MuiTextField-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-115mmlx-MuiInputBase-root-MuiOutlinedInput-root"
Expand Down
23 changes: 21 additions & 2 deletions packages/react/src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,17 @@ const PasswordFieldWithCriteria: ForwardRefExoticComponent<TextFieldProps> = for
*/
const TextField: OverridableComponent<FormControlTypeMap<TextFieldProps>> = forwardRef(
<C extends ElementType = ElementType>(
{className, id, label, type, InputLabelProps, variant, size = 'small', ...rest}: TextFieldProps<C>,
{
className,
id,
label,
type,
InputLabelProps,
variant,
size = 'small',
margin = 'dense',
...rest
}: TextFieldProps<C>,
ref: Ref<HTMLDivElement>,
): ReactElement => {
const classes: string = clsx('oxygen-text-field', className);
Expand All @@ -186,7 +196,15 @@ const TextField: OverridableComponent<FormControlTypeMap<TextFieldProps>> = forw
{label}
</InputLabel>
{type === TextFieldInputTypes.INPUT_PASSWORD ? (
<PasswordFieldWithCriteria ref={ref} id={id} variant={variant} type={type} size={size} {...rest} />
<PasswordFieldWithCriteria
ref={ref}
id={id}
variant={variant}
type={type}
size={size}
margin={margin}
{...rest}
/>
) : (
<MuiTextField
ref={ref}
Expand All @@ -195,6 +213,7 @@ const TextField: OverridableComponent<FormControlTypeMap<TextFieldProps>> = forw
className="OxygenTextField-root"
type={type}
size={size}
margin={margin}
{...rest}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`TextField should match the snapshot 1`] = `
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-animated MuiFormLabel-colorPrimary MuiInputLabel-root MuiInputLabel-animated oxygen-input-label css-f3834g-MuiFormLabel-root-MuiInputLabel-root"
/>
<div
class="MuiFormControl-root MuiTextField-root OxygenTextField-root css-1u3bzj6-MuiFormControl-root-MuiTextField-root"
class="MuiFormControl-root MuiFormControl-marginDense MuiTextField-root OxygenTextField-root css-4mzek5-MuiFormControl-root-MuiTextField-root"
>
<div
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-formControl MuiInputBase-sizeSmall css-9s98je-MuiInputBase-root-MuiOutlinedInput-root"
Expand Down
Loading