Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+42
@@ -0,0 +1,42 @@
|
||||
import type { ButtonHTMLAttributes } from "react";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
|
||||
export type ChatSwitchProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "role"> &
|
||||
Readonly<{
|
||||
checked: boolean;
|
||||
onCheckedChange: (checked: boolean) => void;
|
||||
}>;
|
||||
|
||||
/** Chat-local accessible switch; avoids changing the generated Subframe primitive. */
|
||||
export function ChatSwitch({ checked, onCheckedChange, className, disabled, ...props }: ChatSwitchProps): React.JSX.Element {
|
||||
return (
|
||||
<button
|
||||
{...props}
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={checked}
|
||||
disabled={disabled}
|
||||
onClick={() => onCheckedChange(!checked)}
|
||||
className={cn(
|
||||
"focus-visible:shadow-focus inline-flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent outline-none disabled:cursor-default disabled:opacity-50",
|
||||
className
|
||||
)}
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
"rounded-round flex h-6 w-10 items-center border border-solid px-0.5 transition-colors",
|
||||
checked ? "border-brand-brand-border-solid-default bg-brand-brand-surface-solid-default" : "border-border-strong bg-surface-neutral-primary"
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-round h-4 w-4 transition-transform",
|
||||
checked ? "bg-icon-neutral-on-solid translate-x-4" : "bg-icon-neutral-tertiary translate-x-0"
|
||||
)}
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user