import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import { onMount } from 'solid-js'; import './register'; // side effect: registers the custom elements import { argTypesFor, specDescription } from '../stories/docs/element-controls'; // The web components are custom DOM elements, so declare the tags for JSX. declare module 'solid-js' { // eslint-disable-next-line @typescript-eslint/no-namespace namespace JSX { interface IntrinsicElements { 'kc-scroll-button': JSX.HTMLAttributes & { for?: string; variant?: string; size?: string; 'on:kc-scroll'?: (e: CustomEvent) => void; }; } } } const HTML_SNIPPET = `
`; const meta = { title: 'Components/ScrollButton', tags: ['autodocs'], argTypes: argTypesFor('kc-scroll-button'), parameters: { layout: 'fullscreen', docs: { description: specDescription('kc-scroll-button', [ '`` is the framework-agnostic **web component** for a floating "scroll to bottom" button — visible when the target container is scrolled up, hidden when already at the bottom. Isolated in **Shadow DOM**.', '**When to use:** placing a scroll-to-bottom affordance next to any long scrollable list or chat thread outside SolidJS. In SolidJS, use the `ScrollButton` primitive inside a `ChatContainerRoot`.', '**Wiring the scroll target:** set the `for` attribute to the `id` of the scrollable container (mirrors the `