UNPKG

@opendatasoft/visualizations

Version:

Opendatasoft's components to easily build dashboards and visualizations.

92 lines (91 loc) 2.79 kB
import type { ExpressionInputType } from 'maplibre-gl'; export type DataFrame = Record<string, any>[]; export type Color = string; /** * Opens in a new tab when clicked (standard anchor behaviour). */ export interface LinkHref { href: string; label: string; /** Optional SVG string to display as an icon next to the label */ icon?: string; /** Optional side-effect callback invoked before the href is followed. Does not intercept or prevent navigation. */ onClick?: () => void; /** * Optional filename hint passed to the browser as the `download` attribute on the anchor. * Browsers honor this for same-origin URLs (cross-origin downloads ignore it and fall back * to the server-provided filename). */ download?: string; } /** * Runs a client-side callback. Renders as a menu button, not an anchor. */ export interface LinkAction { onClick: () => void; label: string; icon?: string; } /** * Menu item in LinksMenu: either a navigational link or an action. */ export type Link = LinkHref | LinkAction; export declare function isLinkHref(link: Link): link is LinkHref; /** * Root CSS class of the LinksMenu wrapper. Consumers can use this to filter the menu from DOM * clones (e.g. image export). LinksMenu.svelte applies it via `class={LINKS_MENU_CLASS}`, so the * single source of truth is this constant (scoped CSS still matches via the `.links-menu` rule in * the component's <style>). */ export declare const LINKS_MENU_CLASS = "links-menu"; /** * Props for the LinksMenu component. */ export interface LinksMenuProps extends Record<string, unknown> { /** Array of links to display in the menu */ links: Link[]; /** Optional inline styles for the menu container */ style?: string | null; } export interface CardProps extends Record<string, unknown> { title?: string; subtitle?: string; defaultStyle?: boolean; links?: Link[]; style?: string | null; className?: string | null; clientWidth?: number; tag?: 'div' | 'figure'; } export interface DataBounds { min: number; max: number; } export declare enum ColorScaleTypes { Gradient = "gradient", Palette = "palette" } export type GradientScale = { type: ColorScaleTypes.Gradient; colors: { start: Color; end: Color; }; }; export type PaletteScale = { type: ColorScaleTypes.Palette; colors: Color[]; }; export type ColorScale = GradientScale | PaletteScale; export declare function isGroupByForMatchExpression(value: ExpressionInputType[]): value is [ ExpressionInputType, ExpressionInputType, ExpressionInputType, ...ExpressionInputType[], ExpressionInputType ]; export interface Async<T> { value?: T; error?: any; loading?: boolean; }