Skip to content

Commit

Permalink
RTL fixes for field labels (#1836)
Browse files Browse the repository at this point in the history
* fix: respect RTL in FormControlLabel children

* fix: respect RTL in FormLabel optional text

* refactor: replace margins with gap

* refactor: remove vestigial display declaration
  • Loading branch information
jordankoschei-okta authored Jun 22, 2023
1 parent 8a00a14 commit 33eb556
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/odyssey-react-mui/src/theme/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ export const components = (
MuiFormControlLabel: {
styleOverrides: {
root: ({ theme, ownerState }) => ({
gap: odysseyTokens.Spacing2,
marginInlineStart: 0,
marginInlineEnd: 0, // used for row presentation of radio/checkbox
...(ownerState.labelPlacement === "start" && {
Expand Down Expand Up @@ -1241,9 +1242,7 @@ export const components = (
},
}),
label: {
"&:not(:first-child)": {
marginInlineStart: odysseyTokens.Spacing2,
},
gap: odysseyTokens.Spacing1,
},
asterisk: () => ({
display: "none",
Expand Down Expand Up @@ -1274,14 +1273,20 @@ export const components = (
MuiFormLabel: {
styleOverrides: {
root: {
alignItems: "center",
color: odysseyTokens.TypographyColorBody,
display: "inline-flex",
lineHeight: odysseyTokens.TypographyLineHeightUi,
fontSize: "1rem",
fontWeight: 600,
marginBottom: odysseyTokens.Spacing2,
"&.Mui-focused, &.Mui-error, &.Mui-disabled": {
color: odysseyTokens.TypographyColorBody,
},
"& > .MuiTypography-root": {
margin: "reset",
marginInlineStart: odysseyTokens.Spacing1,
},
},
},
},
Expand Down

0 comments on commit 33eb556

Please sign in to comment.