mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-12 15:55:03 -05:00
Compare commits
9 Commits
fix/claude
...
copilot/un
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a78ab9095 | ||
|
|
5681924fe4 | ||
|
|
a4c473ebbe | ||
|
|
89ce133e4e | ||
|
|
faccb78c6f | ||
|
|
9251424576 | ||
|
|
5e7b6b3da7 | ||
|
|
452fba179b | ||
|
|
5f3354230b |
@@ -20,12 +20,16 @@ export function Button(props: ButtonProps) {
|
|||||||
rightIcon,
|
rightIcon,
|
||||||
children,
|
children,
|
||||||
as = "button",
|
as = "button",
|
||||||
|
unmask = true,
|
||||||
...restProps
|
...restProps
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const disabled = "disabled" in props ? props.disabled : false;
|
const disabled = "disabled" in props ? props.disabled : false;
|
||||||
const isDisabled = disabled;
|
const isDisabled = disabled;
|
||||||
|
|
||||||
|
const applyUnmask = (...classes: Array<string | false | null | undefined>) =>
|
||||||
|
cn(...classes, unmask && "sentry-unmask");
|
||||||
|
|
||||||
// Extract aria-label for tooltip on icon variant
|
// Extract aria-label for tooltip on icon variant
|
||||||
const ariaLabel =
|
const ariaLabel =
|
||||||
"aria-label" in restProps ? restProps["aria-label"] : undefined;
|
"aria-label" in restProps ? restProps["aria-label"] : undefined;
|
||||||
@@ -84,11 +88,11 @@ export function Button(props: ButtonProps) {
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
const loadingClassName =
|
const loadingClassName =
|
||||||
variant === "ghost"
|
variant === "ghost"
|
||||||
? cn(
|
? applyUnmask(
|
||||||
extendedButtonVariants({ variant, size, className }),
|
extendedButtonVariants({ variant, size, className }),
|
||||||
"pointer-events-none",
|
"pointer-events-none",
|
||||||
)
|
)
|
||||||
: cn(
|
: applyUnmask(
|
||||||
extendedButtonVariants({ variant: "primary", size, className }),
|
extendedButtonVariants({ variant: "primary", size, className }),
|
||||||
"pointer-events-none border-zinc-500 bg-zinc-500 text-white",
|
"pointer-events-none border-zinc-500 bg-zinc-500 text-white",
|
||||||
);
|
);
|
||||||
@@ -120,7 +124,7 @@ export function Button(props: ButtonProps) {
|
|||||||
const nextLinkButton = (
|
const nextLinkButton = (
|
||||||
<NextLink
|
<NextLink
|
||||||
{...(restProps as LinkProps)}
|
{...(restProps as LinkProps)}
|
||||||
className={cn(
|
className={applyUnmask(
|
||||||
extendedButtonVariants({ variant, size, className }),
|
extendedButtonVariants({ variant, size, className }),
|
||||||
loading && "pointer-events-none",
|
loading && "pointer-events-none",
|
||||||
isDisabled && "pointer-events-none opacity-50",
|
isDisabled && "pointer-events-none opacity-50",
|
||||||
@@ -136,7 +140,7 @@ export function Button(props: ButtonProps) {
|
|||||||
|
|
||||||
const regularButton = (
|
const regularButton = (
|
||||||
<button
|
<button
|
||||||
className={cn(
|
className={applyUnmask(
|
||||||
extendedButtonVariants({ variant, size, className }),
|
extendedButtonVariants({ variant, size, className }),
|
||||||
loading && "pointer-events-none",
|
loading && "pointer-events-none",
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ type BaseButtonProps = {
|
|||||||
rightIcon?: React.ReactNode;
|
rightIcon?: React.ReactNode;
|
||||||
asChild?: boolean;
|
asChild?: boolean;
|
||||||
withTooltip?: boolean;
|
withTooltip?: boolean;
|
||||||
|
/**
|
||||||
|
* Adds the sentry-unmask class for static button labels.
|
||||||
|
* Disable for user-provided or dynamic strings.
|
||||||
|
*/
|
||||||
|
unmask?: boolean;
|
||||||
} & VariantProps<typeof extendedButtonVariants>;
|
} & VariantProps<typeof extendedButtonVariants>;
|
||||||
|
|
||||||
type ButtonAsButton = BaseButtonProps &
|
type ButtonAsButton = BaseButtonProps &
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ type CustomProps = {
|
|||||||
as?: As;
|
as?: As;
|
||||||
size?: Variant;
|
size?: Variant;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
/**
|
||||||
|
* Adds the sentry-unmask class for static text visibility in replays.
|
||||||
|
* Disable when rendering user-provided or dynamic content.
|
||||||
|
*/
|
||||||
|
unmask?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TextProps = React.PropsWithChildren<
|
export type TextProps = React.PropsWithChildren<
|
||||||
@@ -18,11 +23,14 @@ export function Text({
|
|||||||
as: outerAs,
|
as: outerAs,
|
||||||
size,
|
size,
|
||||||
className = "",
|
className = "",
|
||||||
|
unmask = true,
|
||||||
...rest
|
...rest
|
||||||
}: TextProps) {
|
}: TextProps) {
|
||||||
const variantClasses = variants[size || variant] || variants.body;
|
const variantClasses = variants[size || variant] || variants.body;
|
||||||
const Element = outerAs || variantElementMap[variant];
|
const Element = outerAs || variantElementMap[variant];
|
||||||
const combinedClassName = `${variantClasses} ${className}`.trim();
|
const combinedClassName = `${variantClasses} ${
|
||||||
|
unmask ? "sentry-unmask" : ""
|
||||||
|
} ${className}`.trim();
|
||||||
|
|
||||||
return React.createElement(
|
return React.createElement(
|
||||||
Element,
|
Element,
|
||||||
|
|||||||
Reference in New Issue
Block a user