diff --git a/src/components/SuperDrawer/components/SuperDrawerHeader.tsx b/src/components/SuperDrawer/components/SuperDrawerHeader.tsx index de38c7b69..ee03fea3e 100644 --- a/src/components/SuperDrawer/components/SuperDrawerHeader.tsx +++ b/src/components/SuperDrawer/components/SuperDrawerHeader.tsx @@ -12,7 +12,7 @@ interface SuperDrawerHeaderProps { } interface SuperDrawerHeaderStructuredProps { - title: string; + title: string | ReactNode; left?: ReactNode; right?: ReactNode; hideControls?: boolean; @@ -32,7 +32,7 @@ export function SuperDrawerHeader(props: SuperDrawerHeaderProps | SuperDrawerHea {isStructuredProps(props) ? (
-

{props.title}

+ {typeof props.title === "string" ?

{props.title}

: props.title} {props.left}
{props.right &&
{props.right}
} diff --git a/src/inputs/TextField.tsx b/src/inputs/TextField.tsx index 159981feb..a6e51a046 100644 --- a/src/inputs/TextField.tsx +++ b/src/inputs/TextField.tsx @@ -25,6 +25,8 @@ export interface TextFieldProps extends BeamTextFieldProps { endAdornment?: ReactNode; startAdornment?: ReactNode; hideErrorMessage?: boolean; + /** Allow focusing without selecting, i.e. to let the user keep typing after we've pre-filled text + called focus, like the Add New component. */ + selectOnFocus?: boolean; } export function TextField>(props: TextFieldProps) { diff --git a/src/inputs/TextFieldBase.tsx b/src/inputs/TextFieldBase.tsx index 9b66b79d5..98092e68f 100644 --- a/src/inputs/TextFieldBase.tsx +++ b/src/inputs/TextFieldBase.tsx @@ -61,6 +61,8 @@ export interface TextFieldBaseProps // Replaces empty input field and placeholder with node // IE: Multiselect renders list of selected items in the input field unfocusedPlaceholder?: ReactNode; + /** Allow focusing without selecting, i.e. to let the user keep typing after we've pre-filled text + called focus, like the Add New component. */ + selectOnFocus?: boolean; } // Used by both TextField and TextArea @@ -97,6 +99,7 @@ export function TextFieldBase>(props: TextFieldB alwaysShowHelperText = false, fullWidth = fieldProps?.fullWidth ?? false, unfocusedPlaceholder, + selectOnFocus = true, } = props; const typeScale = fieldProps?.typeScale ?? (inputProps.readOnly && labelStyle !== "hidden" ? "smMd" : "sm"); @@ -188,7 +191,7 @@ export function TextFieldBase>(props: TextFieldB } const onFocusChained = chain((e: FocusEvent | FocusEvent) => { - e.target.select(); + if (selectOnFocus) e.target.select(); }, onFocus); // Simulate clicking `ElementType` when using an unfocused placeholder