Skip to content

Commit

Permalink
Merge pull request #1843 from okta/ee/form
Browse files Browse the repository at this point in the history
Rebrand: Form & Fieldset
  • Loading branch information
edburyenegren-okta authored Jun 21, 2023
2 parents 0da693e + 83602de commit 8a00a14
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 18 deletions.
3 changes: 2 additions & 1 deletion packages/odyssey-design-tokens/src/border.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
}
},
"radius": {
"main": { "value": "4px" },
"tight": { "value": "4px" },
"main": { "value": "6px" },
"outer": { "value": "12px" },
"round": { "value": "1.5em" }
},
Expand Down
8 changes: 6 additions & 2 deletions packages/odyssey-react-mui/src/Fieldset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ FieldsetProps) => {
sx={{
maxWidth: (theme) => theme.mixins.maxWidth,
margin: (theme) => theme.spacing(0),
marginBlockEnd: (theme) => theme.spacing(4),
marginBlockEnd: (theme) => theme.spacing(6),
padding: (theme) => theme.spacing(0),
border: "0",

Expand All @@ -82,7 +82,11 @@ FieldsetProps) => {
<Typography variant="legend" component="legend">
{legend}
</Typography>
{description && <Typography paragraph>{description}</Typography>}
{description && (
<Typography component="p" variant="subtitle2">
{description}
</Typography>
)}
{alert}
{children}
</Box>
Expand Down
6 changes: 5 additions & 1 deletion packages/odyssey-react-mui/src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ const Form = ({
{title}
</Typography>
)}
{description && <Typography paragraph>{description}</Typography>}
{description && (
<Typography component="p" variant="subtitle2">
{description}
</Typography>
)}
{alert}
{children}
{formActions && (
Expand Down
8 changes: 4 additions & 4 deletions packages/odyssey-react-mui/src/theme/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ export const components = (
borderRadius: 0,
}),
...(ownerState.variant === "infobox" && {
borderRadius: odysseyTokens.BorderRadiusOuter,
borderRadius: odysseyTokens.BorderRadiusMain,
"&:not(:last-child)": {
marginBottom: odysseyTokens.Spacing4,
marginBottom: odysseyTokens.Spacing6,
},
}),
...(ownerState.variant === "toast" && {
Expand Down Expand Up @@ -500,7 +500,7 @@ export const components = (
root: ({ theme }) => ({
width: `${odysseyTokens.TypographyLineHeightUi}em`,
height: `${odysseyTokens.TypographyLineHeightUi}em`,
borderRadius: theme.mixins.borderRadius,
borderRadius: odysseyTokens.BorderRadiusTight,
borderWidth: theme.mixins.borderWidth,
borderStyle: theme.mixins.borderStyle,
borderColor: theme.palette.grey[500],
Expand Down Expand Up @@ -1182,7 +1182,7 @@ export const components = (
maxWidth: odysseyTokens.TypographyLineLengthMax,
...(ownerState.margin === "normal" && {
marginTop: 0,
marginBottom: theme.spacing(5),
marginBottom: theme.spacing(4),
"&:last-child": {
marginBottom: 0,
},
Expand Down
16 changes: 13 additions & 3 deletions packages/odyssey-react-mui/src/theme/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ export const typography = (
fontSize: odysseyTokens.TypographyScale0,
lineHeight: odysseyTokens.TypographyLineHeightBody,
},
subtitle2: undefined,
subtitle2: {
color: odysseyTokens.HueNeutral700,
fontFamily: odysseyTokens.TypographyFamilyBody,
fontWeight: Number(odysseyTokens.TypographyWeightBody),
fontSize: odysseyTokens.TypographyScale1,
fontFeatureSettings: "'lnum', 'pnum'",
fontVariant: "normal",
lineHeight: odysseyTokens.TypographyLineHeightBody,
letterSpacing: "initial",
marginBlockEnd: odysseyTokens.Spacing5,
},
body1: {
color: odysseyTokens.TypographyColorBody,
fontFamily: odysseyTokens.TypographyFamilyBody,
Expand All @@ -103,8 +113,8 @@ export const typography = (
legend: {
padding: 0,
fontWeight: Number(odysseyTokens.TypographyWeightHeading),
fontSize: odysseyTokens.TypographyScale2,
lineHeight: odysseyTokens.TypographyLineHeightHeading6,
fontSize: odysseyTokens.TypographySizeHeading5,
lineHeight: odysseyTokens.TypographyLineHeightHeading5,
marginBottom: odysseyTokens.Spacing2,
},
ui: {
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/theme/typography.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ declare module "@mui/material/Typography" {
legend: true;
overline: true;
subtitle1: true; // Design may refer to this as "caption"
subtitle2: false;
subtitle2: true;
ui: true;
default: true; // used by <Link>
monochrome: true; // used by <Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
import { Meta, StoryObj } from "@storybook/react";
import {
Button,
Checkbox,
CheckboxGroup,
Fieldset,
Form,
FormProps,
Infobox,
Link,
TextField,
Typography,
} from "@okta/odyssey-react-mui";
import { MuiThemeDecorator } from "../../../../.storybook/components";

Expand Down Expand Up @@ -168,23 +172,51 @@ export const KitchenSink: StoryObj<FormProps> = {
<Fieldset
legend="Vessel information"
name="vessel"
description="This information helps us verify vessel ownership and origination."
description="Taylor sat back in his chair reading the morning newspaper. The warm kitchen and the smell of coffee blended with the comfort of not having to go to work. This was his Rest Period, the first for a long time, and he was glad of it. He folded the second section back, sighing with contentment."
>
<TextField label="Name of vessel" />
<TextField isMultiline label="Nature of visit" />
<TextField
label="Name of vessel"
errorMessage="This field is required."
/>
<CheckboxGroup label="Systems check" isRequired>
<Checkbox
label="Life support"
name="life-support"
value="life-support"
/>
<Checkbox
label="Warp core containment"
name="warp-core"
value="warp-core"
/>
<Checkbox
label="Cetacean ops"
name="cetacean-ops"
value="cetacean-ops"
/>
</CheckboxGroup>
</Fieldset>
<Fieldset
legend="Passenger information"
name="passengers"
description="This information will be used to track your passengers' whereabouts."
alert={
<Infobox severity="error" role="alert" title="Standby for boarding">
Your captain is a known space pirate. Your location has been
reported to Station Control.
<Typography paragraph>
There is an issue with the fuel mixture ratios. Reconfigure the
fuel mixture and perform the safety checks again.
</Typography>

<Link href="#" variant="monochrome">
Visit fueling console
</Link>
</Infobox>
}
>
<TextField label="Number of passengers" />
<TextField
label="Number of passengers"
hint="Specify your destination within the Sol system."
/>
<TextField label="Captain's name" />
</Fieldset>
</>
Expand Down

0 comments on commit 8a00a14

Please sign in to comment.