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