diff --git a/packages/odyssey-react-mui/src/components/TextField/TextField.tsx b/packages/odyssey-react-mui/src/components/TextField/TextField.tsx index 97e24c5c52..2e98d7ec1c 100644 --- a/packages/odyssey-react-mui/src/components/TextField/TextField.tsx +++ b/packages/odyssey-react-mui/src/components/TextField/TextField.tsx @@ -14,8 +14,8 @@ import { ChangeEventHandler, FocusEventHandler, forwardRef, - MouseEvent, ReactNode, + useCallback, useState, } from "react"; import { @@ -129,14 +129,12 @@ export const TextField = forwardRef( } = props; const [inputType, setInputType] = useState(inType); - const handleClickShowPassword = () => { + + const togglePasswordVisibility = useCallback(() => { setInputType((currentType) => currentType === "password" ? "text" : "password" ); - }; - const handleMouseDownPassword = (event: MouseEvent) => { - event.preventDefault(); - }; + }, []); const id = useUniqueId(idOverride); const hintId = hintText ? `${id}-hint` : undefined; @@ -160,8 +158,7 @@ export const TextField = forwardRef( {inputType === "password" ? : } diff --git a/packages/odyssey-react-mui/src/index.ts b/packages/odyssey-react-mui/src/index.ts index a5e0637b46..d6d0d305c3 100644 --- a/packages/odyssey-react-mui/src/index.ts +++ b/packages/odyssey-react-mui/src/index.ts @@ -107,6 +107,7 @@ export type { TableProps, TableRowProps, TableSortLabelProps, + ThemeOptions, TooltipProps, TypographyProps, useThemeProps, diff --git a/packages/odyssey-storybook/src/components/customization/CustomTheme.stories.tsx b/packages/odyssey-storybook/src/components/customization/CustomTheme.stories.tsx index ebb089a342..ae377f7cfd 100644 --- a/packages/odyssey-storybook/src/components/customization/CustomTheme.stories.tsx +++ b/packages/odyssey-storybook/src/components/customization/CustomTheme.stories.tsx @@ -13,17 +13,18 @@ import type { Story } from "@storybook/react"; import { Button, - InputBase, FormControlLabel, - RadioGroup, - Radio, OdysseyThemeProvider, + Radio, + RadioGroup, + TextField, + ThemeOptions, } from "@okta/odyssey-react-mui"; + import CustomThemeMdx from "./CustomTheme.mdx"; export default { - title: `Customization/components`, - component: Button, + title: "Customization/Components", parameters: { docs: { page: CustomThemeMdx, @@ -31,70 +32,60 @@ export default { }, }; -const Template: Story = (props) => { - const customTheme = { - palette: { - primary: { - main: "rgba(233, 0, 0, 1)", // THIS IS A SAMPLE. - }, +const customTheme: ThemeOptions = { + palette: { + primary: { + main: "rgba(233, 0, 0, 1)", // THIS IS A SAMPLE. DO NOT USE! }, - }; - - return ( - -
- {props.button && } - {props.input && ( - - )} - {props.radio && ( - - } - label="Lightspeed" - /> - } - label="Warp speed" - /> - } - label="Ludicrous speed" - /> - - )} -
-
- ); + }, }; -export const ButtonPrimary = Template.bind({}); -ButtonPrimary.args = { - button: true, -}; +export const ButtonStory: Story = () => ( + +
+ +
+
+); -export const InputDefault = Template.bind({}); -InputDefault.args = { - input: true, -}; +ButtonStory.name = "Button"; -export const RadioDefault = Template.bind({}); -RadioDefault.args = { - radio: true, -}; +export const TextFieldStory: Story = () => ( + +
+ +
+
+); + +TextFieldStory.name = "TextField"; + +export const RadioGroupStory: Story = () => ( + +
+ + } + label="Lightspeed" + /> + } + label="Warp speed" + /> + } + label="Ludicrous speed" + /> + +
+
+); + +RadioGroupStory.name = "RadioGroup";