// Copyright (c) Meta Platforms, Inc. and affiliates. 'use client'; /** * @file ChatLayoutScrollButton.tsx * @input Uses React, StyleX, Button, Icon, theme tokens * @output Exports ChatLayoutScrollButton component * @position Composable scroll-to-bottom button for use inside ChatLayout * * Renders inside the layout's dock container. Fades in when visible, * expands to show a label when provided (e.g. "New messages"). * * SYNC: When modified, update: * - /packages/core/src/Chat/index.ts (exports) * - /packages/cli/assets/templates/blocks/components/ChatLayoutScrollButton/ (block examples) */ import React from 'react'; import * as stylex from "../style-runtime.js"; import "../theme/tokens.stylex.js"; import { colorVars, spacingVars, radiusVars, shadowVars, durationVars, easeVars } from "../theme/tokens.stylex.js"; import { Icon } from "../Icon/index.js"; import { Button } from "../Button/index.js"; import type { BaseProps } from "../BaseProps.js"; import { mergeProps } from "../utils/index.js"; import { themeProps } from "../utils/themeProps.js"; import { useTranslator } from "../i18n/index.js"; // ============================================================================= // Types // ============================================================================= export interface ChatLayoutScrollButtonProps extends Omit, 'onClick'> { ref?: React.Ref; /** Whether the button is visible. */ isVisible: boolean; /** Optional label — expands the button (e.g. "New messages"). */ label?: string; /** Click handler. */ onClick: () => void; } // ============================================================================= // Styles // ============================================================================= const styles = { wrapper: { k1xSpc: "x78zum5", kjj79g: "xl56j7k", kGO01o: "xvmdzux", $$css: true as const }, button: { "--radius-element": "xnpej1e", khDVqt: "xuxw1ft", kg3NbH: "xf314gf", $$css: true as const }, buttonWithLabel: { kwRFfy: "x1t818jl", $$css: true as const } }; // ============================================================================= // Component // ============================================================================= /** * Floating scroll-to-bottom button for use inside ChatLayout. * * @example * ``` * * ``` */ export function ChatLayoutScrollButton({ ref, isVisible, label, onClick, xstyle, className, style, ...rest }: ChatLayoutScrollButtonProps) { const t = useTranslator(); return
; } ChatLayoutScrollButton.displayName = 'ChatLayoutScrollButton';