mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
* feat(breakpoint): add Breakpoint * docs(breakpoint): update docs * refactor(breakpoint): add prop descriptions, type slot * docs: add missing semicolon to last typedef * docs: decrease margin bottom for inline snippet * docs: add Breakpoint to new components [ci skip] * docs(config): use "scripts-markup-styles" for svelteSortOrder [ci skip] * docs(breakpoint): label on:match event [ci skip]
37 lines
992 B
TypeScript
37 lines
992 B
TypeScript
/// <reference types="svelte" />
|
|
import { SvelteComponentTyped } from "svelte";
|
|
|
|
export type BreakpointSize = "sm" | "md" | "lg" | "xlg" | "max";
|
|
|
|
export type BreakpointValue = 320 | 672 | 1056 | 1312 | 1584;
|
|
|
|
export interface BreakpointProps {
|
|
/**
|
|
* Determine the current Carbon grid breakpoint size
|
|
*/
|
|
size?: BreakpointSize;
|
|
|
|
/**
|
|
* Carbon grid sizes as an object
|
|
* @default { sm: false, md: false, lg: false, xlg: false, max: false, }
|
|
*/
|
|
sizes?: Record<BreakpointSize, boolean>;
|
|
|
|
/**
|
|
* Reference the Carbon grid breakpoints
|
|
* @constant
|
|
* @default { sm: 320, md: 672, lg: 1056, xlg: 1312, max: 1584, }
|
|
*/
|
|
breakpoints?: { sm: 320; md: 672; lg: 1056; xlg: 1312; max: 1584 };
|
|
}
|
|
|
|
export default class Breakpoint extends SvelteComponentTyped<
|
|
BreakpointProps,
|
|
{
|
|
match: CustomEvent<{
|
|
size: BreakpointSize;
|
|
breakpointValue: BreakpointValue;
|
|
}>;
|
|
},
|
|
{ default: { size: BreakpointSize; sizes: Record<BreakpointSize, boolean> } }
|
|
> {}
|