feat(stack): add Stack component (#1963)

This commit is contained in:
Eric Liu 2024-04-21 21:19:12 -07:00 committed by GitHub
commit 0f1a77a3fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 470 additions and 2 deletions

36
types/Stack/Stack.svelte.d.ts vendored Normal file
View file

@ -0,0 +1,36 @@
import type { SvelteComponentTyped } from "svelte";
import type { SvelteHTMLElements } from "svelte/elements";
export type StackScale = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
type RestProps = SvelteHTMLElements["svelte:element"];
export interface StackProps extends RestProps {
/**
* Specify the gap between items in the stack.
* The scale maps to Carbon layout values.
* Alternatively, specify a custom value (e.g., "200px").
* @default 1
*/
gap?: StackScale | string;
/**
* Specify the orientation of the stack.
* @default "vertical"
*/
orientation?: "vertical" | "horizontal";
/**
* Specify the tag name
* @default "div"
*/
tag?: keyof HTMLElementTagNameMap;
[key: `data-${string}`]: any;
}
export default class Stack extends SvelteComponentTyped<
StackProps,
Record<string, any>,
{ default: {} }
> {}