feat: change collab trigger & add share dialog (#7647)

This commit is contained in:
David Luzar 2024-02-03 15:04:23 +01:00 committed by GitHub
parent a289c42830
commit 0513b647ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 440 additions and 136 deletions

View file

@ -13,8 +13,6 @@ import { Button } from "./Button";
import { eyeIcon, eyeClosedIcon } from "./icons";
type TextFieldProps = {
value?: string;
onChange?: (value: string) => void;
onClick?: () => void;
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
@ -26,12 +24,11 @@ type TextFieldProps = {
label?: string;
placeholder?: string;
isRedacted?: boolean;
};
} & ({ value: string } | { defaultValue: string });
export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
(
{
value,
onChange,
label,
fullWidth,
@ -40,6 +37,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
selectOnRender,
onKeyDown,
isRedacted = false,
...rest
},
ref,
) => {
@ -73,10 +71,17 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
>
<input
className={clsx({
"is-redacted": value && isRedacted && !isTemporarilyUnredacted,
"is-redacted":
"value" in rest &&
rest.value &&
isRedacted &&
!isTemporarilyUnredacted,
})}
readOnly={readonly}
value={value}
value={"value" in rest ? rest.value : undefined}
defaultValue={
"defaultValue" in rest ? rest.defaultValue : undefined
}
placeholder={placeholder}
ref={innerRef}
onChange={(event) => onChange?.(event.target.value)}