canny-ui-react 6.6.2 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/Accordion/Accordion.d.ts +7 -0
- package/dist/components/Alert/Alert.types.d.ts +5 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +19 -1
- package/dist/components/Avatar/Avatar.d.ts +3 -1
- package/dist/components/Avatar/Avatar.types.d.ts +14 -0
- package/dist/components/Avatar/index.d.ts +2 -2
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/Button/Button.types.d.ts +16 -0
- package/dist/components/Button/IconButton.d.ts +11 -1
- package/dist/components/Charts/BarChart.d.ts +16 -2
- package/dist/components/Charts/ChartA11y.d.ts +3 -1
- package/dist/components/Charts/ChartParts.d.ts +19 -0
- package/dist/components/Charts/DonutChart.d.ts +15 -0
- package/dist/components/Charts/FunnelChart.d.ts +16 -0
- package/dist/components/Charts/GanttChart.d.ts +75 -0
- package/dist/components/Charts/GaugeChart.d.ts +25 -0
- package/dist/components/Charts/Heatmap.d.ts +37 -0
- package/dist/components/Charts/LineChart.d.ts +15 -1
- package/dist/components/Charts/PieChart.d.ts +25 -3
- package/dist/components/Charts/RadarChart.d.ts +25 -0
- package/dist/components/Charts/ScatterChart.d.ts +33 -0
- package/dist/components/Charts/Sparkline.d.ts +17 -0
- package/dist/components/Charts/StatCard.d.ts +23 -0
- package/dist/components/Charts/cartesian.d.ts +23 -0
- package/dist/components/Charts/chartExtra.d.ts +90 -0
- package/dist/components/Charts/chartScale.d.ts +94 -0
- package/dist/components/Charts/chartUtils.d.ts +6 -0
- package/dist/components/Charts/gantt/ganttUtils.d.ts +54 -0
- package/dist/components/Charts/index.d.ts +18 -0
- package/dist/components/Chip/Chip.d.ts +4 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +1 -1
- package/dist/components/CommandPalette/CommandPalette.types.d.ts +18 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +6 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +7 -2
- package/dist/components/DataTable/DataTable.d.ts +55 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +10 -0
- package/dist/components/DatePicker/dateUtils.d.ts +2 -0
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/Dialog/Dialog.d.ts +6 -0
- package/dist/components/Drawer/Drawer.d.ts +8 -0
- package/dist/components/FileUploader/FileUploader.d.ts +24 -0
- package/dist/components/FileUploader/index.d.ts +1 -1
- package/dist/components/FileUploader/useFileDrop.d.ts +1 -0
- package/dist/components/Input/Input.types.d.ts +2 -0
- package/dist/components/List/List.d.ts +17 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +10 -2
- package/dist/components/Navbar/Navbar.types.d.ts +12 -0
- package/dist/components/Pagination/Pagination.d.ts +34 -0
- package/dist/components/PanelGroup/PanelGroup.d.ts +1 -1
- package/dist/components/Popover/Popover.d.ts +11 -2
- package/dist/components/Progress/Progress.types.d.ts +5 -0
- package/dist/components/Scroll/Scroll.types.d.ts +0 -4
- package/dist/components/Scroll/index.d.ts +1 -1
- package/dist/components/Scroll/useScrollFocusable.d.ts +10 -0
- package/dist/components/Select/Select.d.ts +7 -1
- package/dist/components/Sidebar/Sidebar.types.d.ts +10 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +3 -1
- package/dist/components/Skeleton/SkeletonLayouts.d.ts +5 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +2 -0
- package/dist/components/Stepper/Stepper.d.ts +5 -1
- package/dist/components/Tabs/Tabs.d.ts +7 -0
- package/dist/components/Textarea/Textarea.d.ts +2 -0
- package/dist/components/Timeline/Timeline.d.ts +9 -0
- package/dist/components/Toast/Toast.d.ts +1 -5
- package/dist/components/Toast/Toast.types.d.ts +13 -3
- package/dist/components/Tooltip/Tooltip.d.ts +3 -11
- package/dist/components/TreeView/TreeView.d.ts +34 -0
- package/dist/index.cjs +80 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16459 -12433
- package/dist/index.js.map +1 -1
- package/dist/utils/overlayFocus.d.ts +13 -0
- package/dist/utils/useCloseGuard.d.ts +17 -0
- package/dist/utils/useVirtualWindow.d.ts +29 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ export function SignInCard() {
|
|
|
55
55
|
|
|
56
56
|
## Highlights
|
|
57
57
|
|
|
58
|
-
- **Buttons** — 7 variants × 5 colors × 3 sizes × 3 shapes, click-position ripple powered by `motion`, attached/spaced groups, FAB with spring entrance, Radix-powered toggles and segmented controls
|
|
58
|
+
- **Buttons** — 7 variants × 5 colors × 3 sizes × 3 shapes, click-position ripple powered by `motion`, `asChild` to render a router `<Link>` / `<a>` as a button, attached/spaced groups, FAB with spring entrance, Radix-powered toggles and segmented controls
|
|
59
59
|
- **Inputs** — prefix/suffix slots, clear button, password toggle, validation states wired through `<Field>`
|
|
60
60
|
- **Select / MultiSelect** — Radix Select + cmdk combobox with chip tokens, groups, descriptions, `maxItems` cap
|
|
61
61
|
- **Layout primitives** — `<Box>`, `<Stack>`, `<Row>`, `<Grid>`, `<Container>` map props to utility classes, polymorphic `as`
|
|
@@ -28,9 +28,16 @@ type RootMultiple = AccordionRootBase & {
|
|
|
28
28
|
defaultValue?: string[];
|
|
29
29
|
/** Fires when the open set changes. */
|
|
30
30
|
onValueChange?: (value: string[]) => void;
|
|
31
|
+
/** Start with every direct `AccordionItem` open (uncontrolled; ignored when `defaultValue`/`value` is set). */
|
|
32
|
+
expandAll?: boolean;
|
|
31
33
|
};
|
|
32
34
|
export type AccordionProps = (RootSingle | RootMultiple) & {
|
|
33
35
|
variant?: 'plain' | 'bordered' | 'separated';
|
|
36
|
+
/**
|
|
37
|
+
* Remember the open item(s) in localStorage under this key and restore them on
|
|
38
|
+
* mount (uncontrolled accordions only). Storage failures are ignored.
|
|
39
|
+
*/
|
|
40
|
+
persistKey?: string;
|
|
34
41
|
/**
|
|
35
42
|
* One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
|
|
36
43
|
* responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
|
|
@@ -18,6 +18,11 @@ export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'
|
|
|
18
18
|
action?: ReactNode;
|
|
19
19
|
/** When provided, renders a close button that invokes this callback. */
|
|
20
20
|
onDismiss?: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Play a short exit animation before `onDismiss` fires. Default `true`;
|
|
23
|
+
* skipped under `prefers-reduced-motion`. Set `false` for an immediate callback.
|
|
24
|
+
*/
|
|
25
|
+
exitAnimation?: boolean;
|
|
21
26
|
/** Accessible label for the dismiss button. */
|
|
22
27
|
dismissLabel?: string;
|
|
23
28
|
}
|
|
@@ -25,7 +25,7 @@ interface AutocompleteBase {
|
|
|
25
25
|
searchPlaceholder?: string;
|
|
26
26
|
/** Empty-state when no options match the search. */
|
|
27
27
|
emptyText?: ReactNode;
|
|
28
|
-
/** Show a loading spinner inside the dropdown. */
|
|
28
|
+
/** Show a loading spinner inside the dropdown (appears after 150ms to avoid flicker). */
|
|
29
29
|
loading?: boolean;
|
|
30
30
|
/** Loading-state text. */
|
|
31
31
|
loadingText?: ReactNode;
|
|
@@ -37,6 +37,24 @@ interface AutocompleteBase {
|
|
|
37
37
|
disabled?: boolean;
|
|
38
38
|
/** Show a clear button when something is selected. */
|
|
39
39
|
clearable?: boolean;
|
|
40
|
+
/** Highlight the part of each label matching the search text. Default: `true`. */
|
|
41
|
+
highlightMatch?: boolean;
|
|
42
|
+
/** Values shown as a "Recent" group while the search box is empty. */
|
|
43
|
+
recentItems?: string[];
|
|
44
|
+
/** Heading for the `recentItems` group. Default: `'Recent'`. */
|
|
45
|
+
recentLabel?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Controlled open state of the dropdown. Pair with `onOpenChange`; leave
|
|
48
|
+
* unset to let the component manage it.
|
|
49
|
+
*/
|
|
50
|
+
open?: boolean;
|
|
51
|
+
/** Uncontrolled initial open state. Default: `false`. */
|
|
52
|
+
defaultOpen?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Fires when the dropdown asks to open or close (trigger click, Esc, outside
|
|
55
|
+
* click, or a pick in single mode) — e.g. to load options on first open.
|
|
56
|
+
*/
|
|
57
|
+
onOpenChange?: (open: boolean) => void;
|
|
40
58
|
/** Field-threading: id forwarded to the trigger. */
|
|
41
59
|
id?: string;
|
|
42
60
|
/** Field-threading: forwarded ARIA. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import type { AvatarProps, AvatarStackProps } from './Avatar.types';
|
|
1
|
+
import type { AvatarGroupProps, AvatarProps, AvatarStackProps } from './Avatar.types';
|
|
2
2
|
export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
3
3
|
export declare const AvatarStack: import("react").ForwardRefExoticComponent<AvatarStackProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
/** Overlapping avatars that collapse past `max` into a "+N" avatar. */
|
|
5
|
+
export declare const AvatarGroup: import("react").ForwardRefExoticComponent<AvatarGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -7,6 +7,11 @@ export interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
7
7
|
status?: AvatarStatus;
|
|
8
8
|
src?: string;
|
|
9
9
|
alt?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Full name. When there is no `src` (or the image fails to load) and no
|
|
12
|
+
* `children`, its initials are shown.
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
10
15
|
/**
|
|
11
16
|
* One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
|
|
12
17
|
* responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
|
|
@@ -15,6 +20,15 @@ export interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
15
20
|
sx?: SxProp;
|
|
16
21
|
children?: ReactNode;
|
|
17
22
|
}
|
|
23
|
+
export interface AvatarGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
24
|
+
/** Avatars shown before collapsing the rest into "+N". Default 5. */
|
|
25
|
+
max?: number;
|
|
26
|
+
/** Real total when the children are only a page of a bigger set. Defaults to the child count. */
|
|
27
|
+
total?: number;
|
|
28
|
+
/** Size applied to the "+N" overflow avatar. Match your avatars. */
|
|
29
|
+
size?: AvatarSize;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}
|
|
18
32
|
export interface AvatarStackProps extends HTMLAttributes<HTMLDivElement> {
|
|
19
33
|
children: ReactNode;
|
|
20
34
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Avatar, AvatarStack } from './Avatar';
|
|
2
|
-
export type { AvatarProps, AvatarStackProps, AvatarSize, AvatarStatus } from './Avatar.types';
|
|
1
|
+
export { Avatar, AvatarStack, AvatarGroup } from './Avatar';
|
|
2
|
+
export type { AvatarProps, AvatarStackProps, AvatarGroupProps, AvatarSize, AvatarStatus } from './Avatar.types';
|
|
@@ -11,6 +11,12 @@ export interface BreadcrumbProps extends Omit<HTMLAttributes<HTMLElement>, 'chil
|
|
|
11
11
|
/** Separator node between items. Default: chevron. */
|
|
12
12
|
separator?: ReactNode;
|
|
13
13
|
size?: 'sm' | 'md';
|
|
14
|
+
/**
|
|
15
|
+
* Collapse long trails: when there are more items than this, show the first
|
|
16
|
+
* item and the last `maxItems - 1`, with the hidden ones in an ellipsis menu.
|
|
17
|
+
* Minimum 2. Default: show everything.
|
|
18
|
+
*/
|
|
19
|
+
maxItems?: number;
|
|
14
20
|
/**
|
|
15
21
|
* One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
|
|
16
22
|
* responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
|
|
@@ -24,6 +24,22 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
24
24
|
iconPosition?: ButtonIconPosition;
|
|
25
25
|
/** Disable the MUI-style click ripple. Default: `false`. */
|
|
26
26
|
disableRipple?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Render the single child element instead of a `<button>` — typically a
|
|
29
|
+
* router `<Link>` or an `<a href>` — so a button that navigates keeps link
|
|
30
|
+
* behaviour (middle-click, "open in new tab", link semantics). The child gets
|
|
31
|
+
* the button's classes, icon, spinner and ripple, and its own content goes
|
|
32
|
+
* in the button's content slot. `disabled` / `loading` set `aria-disabled`,
|
|
33
|
+
* drop it from the tab order and cancel the click (links have no `disabled`
|
|
34
|
+
* attribute). The child must accept a ref and spread its props onto the DOM
|
|
35
|
+
* element. Default: `false`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <Button asChild variant="outline" icon={<Pencil size={14} />}>
|
|
39
|
+
* <Link href={`/workflows/${id}/edit`}>Edit</Link>
|
|
40
|
+
* </Button>
|
|
41
|
+
*/
|
|
42
|
+
asChild?: boolean;
|
|
27
43
|
/**
|
|
28
44
|
* One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
|
|
29
45
|
* responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { ButtonProps } from './Button.types';
|
|
3
3
|
export interface IconButtonProps extends Omit<ButtonProps, 'children' | 'icon' | 'iconPosition'> {
|
|
4
4
|
/** Icon element. Required. */
|
|
5
5
|
icon: ReactNode;
|
|
6
6
|
/** Accessible label. Required — icon-only buttons must have one. */
|
|
7
7
|
'aria-label': string;
|
|
8
|
+
/**
|
|
9
|
+
* With `asChild`: the element to render as, e.g. `<Link href="/edit" />`.
|
|
10
|
+
* The icon is placed inside it.
|
|
11
|
+
*/
|
|
12
|
+
children?: ReactElement;
|
|
8
13
|
}
|
|
9
14
|
/**
|
|
10
15
|
* Convenience over `<Button shape="circle" icon={...} aria-label="…" />`.
|
|
11
16
|
* Enforces `aria-label` at the type level for icon-only accessibility.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <IconButton icon={<Pencil size={16} />} aria-label="Edit" asChild>
|
|
20
|
+
* <Link href={`/workflows/${id}/edit`} />
|
|
21
|
+
* </IconButton>
|
|
12
22
|
*/
|
|
13
23
|
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
3
|
import type { SxProp } from '../Layout/sx';
|
|
4
|
+
import type { Aggregate } from './chartScale';
|
|
4
5
|
export interface BarSeries {
|
|
5
6
|
/** Key into each datum for this series' value. */
|
|
6
7
|
key: string;
|
|
@@ -21,7 +22,20 @@ export interface BarChartProps<D extends Record<string, unknown> = Record<string
|
|
|
21
22
|
stacked?: boolean;
|
|
22
23
|
grid?: boolean;
|
|
23
24
|
legend?: boolean;
|
|
24
|
-
/**
|
|
25
|
+
/** Clicking a legend entry hides / shows that series. Default `true`. */
|
|
26
|
+
legendToggle?: boolean;
|
|
27
|
+
/** Content shown instead of the chart when there is no data. Default "No data". */
|
|
28
|
+
empty?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Max bars drawn. More categories than this are aggregated into contiguous buckets
|
|
31
|
+
* (labelled "first – last"). Default: as many as fit at ~6px each.
|
|
32
|
+
*/
|
|
33
|
+
maxBars?: number;
|
|
34
|
+
/** How bucketed categories combine when `maxBars` kicks in. Default `'sum'`. */
|
|
35
|
+
aggregate?: Aggregate;
|
|
36
|
+
/** Entrance animation (and smooth transitions when data changes). Default `true`; off under reduced motion and for very large charts. */
|
|
37
|
+
animate?: boolean;
|
|
38
|
+
/** Format y-axis tick values. Default compact (1.2K, 3M). */
|
|
25
39
|
yTickFormatter?: (value: number) => string;
|
|
26
40
|
/** Format x-axis category labels. */
|
|
27
41
|
xTickFormatter?: (value: string) => string;
|
|
@@ -40,4 +54,4 @@ export interface BarChartProps<D extends Record<string, unknown> = Record<string
|
|
|
40
54
|
*/
|
|
41
55
|
sx?: SxProp;
|
|
42
56
|
}
|
|
43
|
-
export declare function BarChart<D extends Record<string, unknown>>({ data, xKey, series, height, label, stacked, grid, legend, yTickFormatter, xTickFormatter, renderTooltip, className, style, sx, }: BarChartProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare function BarChart<D extends Record<string, unknown>>({ data: dataProp, xKey, series: allSeries, height, label, stacked, grid, legend, legendToggle, empty, maxBars, aggregate, animate, yTickFormatter, xTickFormatter, renderTooltip, className, style, sx, }: BarChartProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,8 +3,10 @@ import type { ReactNode } from 'react';
|
|
|
3
3
|
* Visually hidden data-table mirror of a chart. Screen readers get the exact
|
|
4
4
|
* values the SVG conveys visually; sighted users never see it.
|
|
5
5
|
*/
|
|
6
|
-
export declare function SrOnlyChartTable({ caption, head, rows, }: {
|
|
6
|
+
export declare function SrOnlyChartTable({ caption, head, rows, maxRows, }: {
|
|
7
7
|
caption: string;
|
|
8
8
|
head: string[];
|
|
9
9
|
rows: ReactNode[][];
|
|
10
|
+
/** Cap on rendered rows (evenly sampled, first/last kept) + a summary row. Default 200. */
|
|
11
|
+
maxRows?: number;
|
|
10
12
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Series keys hidden via the legend, plus a toggle. */
|
|
3
|
+
export declare function useHiddenKeys(): [Set<string>, (key: string) => void];
|
|
4
|
+
export interface LegendEntry {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
color: string;
|
|
8
|
+
}
|
|
9
|
+
/** Legend whose entries are toggle buttons (`aria-pressed`) unless `interactive` is off. */
|
|
10
|
+
export declare function ChartLegend({ entries, hidden, onToggle, interactive, }: {
|
|
11
|
+
entries: LegendEntry[];
|
|
12
|
+
hidden: Set<string>;
|
|
13
|
+
onToggle: (key: string) => void;
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/** No-data message centered over the (empty) plot, so layout does not jump. */
|
|
17
|
+
export declare function ChartEmpty({ children }: {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PieChartProps } from './PieChart';
|
|
3
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
4
|
+
export interface DonutChartProps extends Omit<PieChartProps, 'centerLabel' | 'innerRadius' | 'className' | 'style' | 'sx' | 'empty' | 'label'>, ChartBaseProps {
|
|
5
|
+
/** Hole size as a fraction of the outer radius. Default `0.62`. */
|
|
6
|
+
innerRadius?: number;
|
|
7
|
+
/** Custom center content. Defaults to the animated total (+ `centerCaption`). */
|
|
8
|
+
centerLabel?: ReactNode;
|
|
9
|
+
/** Small caption under the animated total, e.g. "workflows". */
|
|
10
|
+
centerCaption?: ReactNode;
|
|
11
|
+
/** Format the center total. */
|
|
12
|
+
valueFormatter?: (value: number) => string;
|
|
13
|
+
}
|
|
14
|
+
/** Donut chart: `PieChart` with a hole, a center-label slot, a sweep-in and a count-up total. */
|
|
15
|
+
export declare function DonutChart({ data, innerRadius, centerLabel, centerCaption, valueFormatter, label, animate, loading, empty, height, className, style, sx, ...rest }: DonutChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
2
|
+
export interface FunnelDatum {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FunnelChartProps extends ChartBaseProps {
|
|
8
|
+
/** Stages, top to bottom (usually descending). */
|
|
9
|
+
data: FunnelDatum[];
|
|
10
|
+
height?: number;
|
|
11
|
+
/** Show each stage's % of the first stage. Default `true`. */
|
|
12
|
+
showPercent?: boolean;
|
|
13
|
+
valueFormatter?: (value: number) => string;
|
|
14
|
+
}
|
|
15
|
+
/** Funnel: stage widths scale with value; hover shows step conversion. */
|
|
16
|
+
export declare function FunnelChart({ data: rawData, height, showPercent, valueFormatter, label, animate, loading, empty, className, style, sx, }: FunnelChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { SxProp } from '../Layout/sx';
|
|
3
|
+
import type { GanttScale } from './gantt/ganttUtils';
|
|
4
|
+
export type { GanttScale } from './gantt/ganttUtils';
|
|
5
|
+
export interface GanttTask {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
/** `Date` or ISO string. Date-only strings (`2026-03-01`) are read as local midnight. */
|
|
9
|
+
start: Date | string;
|
|
10
|
+
/**
|
|
11
|
+
* `Date` or ISO string. A date-only / midnight end is *inclusive* (the bar covers that whole
|
|
12
|
+
* day); an end with a time of day is exact. Ignored for milestones.
|
|
13
|
+
*/
|
|
14
|
+
end: Date | string;
|
|
15
|
+
/** 0–100. Draws a filled portion of the bar. */
|
|
16
|
+
progress?: number;
|
|
17
|
+
/** Bar color. Defaults to the group's palette color. */
|
|
18
|
+
color?: string;
|
|
19
|
+
/** Tasks sharing a `group` are listed together under a collapsible header. */
|
|
20
|
+
group?: string;
|
|
21
|
+
/** Ids of tasks that must finish before this one starts (draws arrows). */
|
|
22
|
+
dependsOn?: string[];
|
|
23
|
+
/** Render as a diamond at `start` instead of a bar. */
|
|
24
|
+
milestone?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface GanttChartProps {
|
|
27
|
+
tasks: GanttTask[];
|
|
28
|
+
/** Zoom level. Defaults to a scale chosen from the date range; a scale too fine for the range is coarsened automatically. */
|
|
29
|
+
scale?: GanttScale;
|
|
30
|
+
/** Max height of the chart in px; taller content scrolls vertically and only visible rows are rendered. Default 360. */
|
|
31
|
+
height?: number;
|
|
32
|
+
/** Height of each task row in px. Default 36. */
|
|
33
|
+
rowHeight?: number;
|
|
34
|
+
/** Width of the sticky task-name column in px. Default 200. Draggable at the header edge; narrow containers clamp it. */
|
|
35
|
+
nameWidth?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Pixels per day, overriding the scale's default. The timeline is capped at ~20,000px, so a
|
|
38
|
+
* value that would exceed it is reduced (coarser header scale) automatically.
|
|
39
|
+
*/
|
|
40
|
+
pxPerDay?: number;
|
|
41
|
+
/** Show zoom in / out buttons. Default `false`. */
|
|
42
|
+
zoomControls?: boolean;
|
|
43
|
+
/** Accessible label for the chart (group `aria-label` + hidden table caption). */
|
|
44
|
+
label?: string;
|
|
45
|
+
/** Reference date for the today marker. Defaults to now. */
|
|
46
|
+
today?: Date | string;
|
|
47
|
+
/** Draw the today marker. Default `true`. */
|
|
48
|
+
showToday?: boolean;
|
|
49
|
+
/** Allow dragging bars to move / resize and arrow keys to move the focused bar. */
|
|
50
|
+
editable?: boolean;
|
|
51
|
+
/** Called when an editable bar is moved or resized (snapped to whole days). Update `tasks` in response. */
|
|
52
|
+
onTaskChange?: (next: GanttTask, prev: GanttTask) => void;
|
|
53
|
+
/** Called when a bar is clicked, or activated with Enter / Space. */
|
|
54
|
+
onTaskClick?: (task: GanttTask) => void;
|
|
55
|
+
/** Group names that start collapsed. */
|
|
56
|
+
defaultCollapsed?: string[];
|
|
57
|
+
/** Animate bars, progress and dependency arrows. Default `true`; always off under `prefers-reduced-motion`. */
|
|
58
|
+
animate?: boolean;
|
|
59
|
+
/** Show a skeleton instead of the chart. */
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
/** Content shown instead of the chart when there are no tasks. Default "No tasks". */
|
|
62
|
+
empty?: ReactNode;
|
|
63
|
+
/** Custom tooltip body for a hovered task. */
|
|
64
|
+
renderTooltip?: (task: GanttTask) => ReactNode;
|
|
65
|
+
className?: string;
|
|
66
|
+
style?: CSSProperties;
|
|
67
|
+
/**
|
|
68
|
+
* One-off CSS, same as `Box`'s `sx`: each value may be a scalar or a
|
|
69
|
+
* responsive breakpoint map (`{ base, sm, md, lg, xl }`). Scalar-only sx
|
|
70
|
+
* merges into inline style; responsive sx injects a scoped class. Applied to
|
|
71
|
+
* the chart's outer container.
|
|
72
|
+
*/
|
|
73
|
+
sx?: SxProp;
|
|
74
|
+
}
|
|
75
|
+
export declare function GanttChart({ tasks, scale: scaleProp, height, rowHeight, nameWidth, pxPerDay, zoomControls, label, today, showToday, editable, onTaskChange, onTaskClick, defaultCollapsed, animate, loading, empty, renderTooltip, className, style, sx, }: GanttChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
2
|
+
export interface GaugeThreshold {
|
|
3
|
+
/** Value at (and above) which this color applies. */
|
|
4
|
+
from: number;
|
|
5
|
+
color: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GaugeChartProps extends Omit<ChartBaseProps, 'empty'> {
|
|
8
|
+
value: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Color steps, e.g. `[{ from: 0, color: 'var(--color-danger)' }, { from: 50, color: ... }]`. */
|
|
12
|
+
thresholds?: GaugeThreshold[];
|
|
13
|
+
/** Fixed arc color (ignored when `thresholds` match). */
|
|
14
|
+
color?: string;
|
|
15
|
+
/** `semi` = 180° dial, `radial` = 270° dial. */
|
|
16
|
+
variant?: 'semi' | 'radial';
|
|
17
|
+
/** Show a needle. Default `true` for `semi`. */
|
|
18
|
+
needle?: boolean;
|
|
19
|
+
height?: number;
|
|
20
|
+
/** Small caption under the value. */
|
|
21
|
+
caption?: string;
|
|
22
|
+
valueFormatter?: (value: number) => string;
|
|
23
|
+
}
|
|
24
|
+
/** Semi / radial gauge with an animated arc, needle and count-up value. */
|
|
25
|
+
export declare function GaugeChart({ value: valueIn, min: minIn, max: maxIn, thresholds, color, variant, needle, height, caption, valueFormatter: formatter, label, animate, loading, className, style, sx, }: GaugeChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
3
|
+
export interface HeatmapProps<D extends Record<string, unknown> = Record<string, unknown>> extends ChartBaseProps {
|
|
4
|
+
data: D[];
|
|
5
|
+
/** `matrix` = x by y grid; `calendar` = GitHub-style day grid. Default `matrix`. */
|
|
6
|
+
variant?: 'matrix' | 'calendar';
|
|
7
|
+
/** Matrix: key for the column category. Default `'x'`. */
|
|
8
|
+
xKey?: string;
|
|
9
|
+
/** Matrix: key for the row category. Default `'y'`. */
|
|
10
|
+
yKey?: string;
|
|
11
|
+
/** Key for the cell value. Default `'value'`. */
|
|
12
|
+
valueKey?: string;
|
|
13
|
+
/** Calendar: key holding a `yyyy-MM-dd` date. Default `'date'`. */
|
|
14
|
+
dateKey?: string;
|
|
15
|
+
/** Calendar: number of weeks shown, ending at `endDate`. Default `26`. */
|
|
16
|
+
weeks?: number;
|
|
17
|
+
/** Calendar: last day shown (`yyyy-MM-dd`). Defaults to the latest date in `data`. */
|
|
18
|
+
endDate?: string;
|
|
19
|
+
/** Matrix: explicit category order. */
|
|
20
|
+
xOrder?: string[];
|
|
21
|
+
yOrder?: string[];
|
|
22
|
+
/** Colors from lowest to highest value. Default: 5 steps of the primary token. */
|
|
23
|
+
colorScale?: string[];
|
|
24
|
+
/** Cell size in px. Default: up to 28 (matrix) / 13 (calendar), shrunk to fit the container (min 5). */
|
|
25
|
+
cellSize?: number;
|
|
26
|
+
/** Print the value inside matrix cells. */
|
|
27
|
+
showValues?: boolean;
|
|
28
|
+
/** Show the low-to-high legend. Default `true`. */
|
|
29
|
+
legend?: boolean;
|
|
30
|
+
valueFormatter?: (value: number) => string;
|
|
31
|
+
renderTooltip?: (params: {
|
|
32
|
+
title: string;
|
|
33
|
+
value: number | null;
|
|
34
|
+
}) => ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/** Matrix or calendar heatmap with a configurable color scale. */
|
|
37
|
+
export declare function Heatmap<D extends Record<string, unknown>>({ data: dataProp, variant, xKey, yKey, valueKey, dateKey, weeks: weeksProp, endDate, xOrder, yOrder, colorScale: colorProp, cellSize, showValues, legend, valueFormatter, renderTooltip, label, animate, loading, empty, className, style, sx, }: HeatmapProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,10 +13,24 @@ export interface LineChartProps<D extends Record<string, unknown> = Record<strin
|
|
|
13
13
|
area?: boolean;
|
|
14
14
|
/** Stack the series (area charts). */
|
|
15
15
|
stacked?: boolean;
|
|
16
|
-
/** Show point markers. */
|
|
16
|
+
/** Show point markers. Automatically skipped above ~100 visible points per series. */
|
|
17
17
|
dots?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Max points drawn per series. Longer series are reduced with LTTB (visual shape kept);
|
|
20
|
+
* the tooltip and keyboard navigation still use the full data. Default ~2 per plot pixel.
|
|
21
|
+
*/
|
|
22
|
+
maxPoints?: number;
|
|
23
|
+
/** Entrance animation (and smooth transitions when data changes). Default `true`; off under reduced motion and for very large charts. */
|
|
24
|
+
animate?: boolean;
|
|
18
25
|
grid?: boolean;
|
|
19
26
|
legend?: boolean;
|
|
27
|
+
/** Clicking a legend entry hides / shows that series. Default `true`. */
|
|
28
|
+
legendToggle?: boolean;
|
|
29
|
+
/** Vertical guide line (and enlarged points) at the hovered category. Default `true`. */
|
|
30
|
+
crosshair?: boolean;
|
|
31
|
+
/** Content shown instead of the chart when there is no data. Default "No data". */
|
|
32
|
+
empty?: ReactNode;
|
|
33
|
+
/** Format y-axis tick values. Default compact (1.2K, 3M). */
|
|
20
34
|
yTickFormatter?: (value: number) => string;
|
|
21
35
|
xTickFormatter?: (value: string) => string;
|
|
22
36
|
renderTooltip?: (params: {
|
|
@@ -14,13 +14,33 @@ export interface PieChartProps {
|
|
|
14
14
|
/** Inner radius as a fraction of the outer radius (0 = pie, 0.6 = donut). */
|
|
15
15
|
innerRadius?: number;
|
|
16
16
|
legend?: boolean;
|
|
17
|
+
/** Clicking a legend entry hides / shows that slice. Default `true`. */
|
|
18
|
+
legendToggle?: boolean;
|
|
19
|
+
/** Content shown instead of the chart when there is no data. Default "No data". */
|
|
20
|
+
empty?: ReactNode;
|
|
17
21
|
/** Custom tooltip body for a hovered slice. */
|
|
18
22
|
renderTooltip?: (params: {
|
|
19
23
|
datum: PieDatum;
|
|
20
24
|
percent: number;
|
|
21
25
|
}) => ReactNode;
|
|
22
|
-
/**
|
|
23
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Center label (e.g. a total) for donut charts. May be a function receiving the hole's
|
|
28
|
+
* pixel `diameter` so the content can size itself.
|
|
29
|
+
*/
|
|
30
|
+
centerLabel?: ReactNode | ((params: {
|
|
31
|
+
diameter: number;
|
|
32
|
+
}) => ReactNode);
|
|
33
|
+
/**
|
|
34
|
+
* Max slices drawn; the smallest are grouped into one "Other" slice (a toggle expands
|
|
35
|
+
* them). Default `10`; `0` or `Infinity` disables grouping.
|
|
36
|
+
*/
|
|
37
|
+
maxSlices?: number;
|
|
38
|
+
/** Label of the grouped slice. Default "Other". */
|
|
39
|
+
otherLabel?: string;
|
|
40
|
+
/** Format values in the tooltip. Default: grouped thousands, compact above a billion. */
|
|
41
|
+
valueFormatter?: (value: number) => string;
|
|
42
|
+
/** Entrance animation (and smooth transitions when data changes). Default `true`; off under reduced motion and for very large charts. */
|
|
43
|
+
animate?: boolean;
|
|
24
44
|
className?: string;
|
|
25
45
|
style?: CSSProperties;
|
|
26
46
|
/**
|
|
@@ -31,4 +51,6 @@ export interface PieChartProps {
|
|
|
31
51
|
*/
|
|
32
52
|
sx?: SxProp;
|
|
33
53
|
}
|
|
34
|
-
|
|
54
|
+
/** Share as text: "<0.1%" / "0.4%" for tiny slices, whole percent otherwise. */
|
|
55
|
+
export declare function formatShare(frac: number): string;
|
|
56
|
+
export declare function PieChart({ data, height, label, innerRadius, legend, legendToggle, empty, renderTooltip, centerLabel, maxSlices, otherLabel, valueFormatter, animate, className, style, sx, }: PieChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
2
|
+
import type { BarSeries } from './BarChart';
|
|
3
|
+
export interface RadarChartProps<D extends Record<string, unknown> = Record<string, unknown>> extends ChartBaseProps {
|
|
4
|
+
data: D[];
|
|
5
|
+
/** Key for each axis label. */
|
|
6
|
+
axisKey: string;
|
|
7
|
+
series: BarSeries[];
|
|
8
|
+
height?: number;
|
|
9
|
+
/** Outer ring value. Defaults to the data max. */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Number of concentric rings. Default `4`. */
|
|
12
|
+
levels?: number;
|
|
13
|
+
/** Fill the polygons. Default `true`. */
|
|
14
|
+
fill?: boolean;
|
|
15
|
+
legend?: boolean;
|
|
16
|
+
legendToggle?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Scale every axis to its own maximum (for axes on wildly different scales). `'auto'`
|
|
19
|
+
* (default) turns it on only when no `max` is set and axis maxima differ by over 20x.
|
|
20
|
+
* Tooltips always show the real values.
|
|
21
|
+
*/
|
|
22
|
+
normalize?: boolean | 'auto';
|
|
23
|
+
}
|
|
24
|
+
/** Spider / radar chart: one polygon per series across the axes. */
|
|
25
|
+
export declare function RadarChart<D extends Record<string, unknown>>({ data: rawData, axisKey, series: allSeriesIn, height, max, levels, fill, legend, legendToggle, normalize, label, animate, loading, empty, className, style, sx, }: RadarChartProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
3
|
+
export interface ScatterChartProps<D extends Record<string, unknown> = Record<string, unknown>> extends ChartBaseProps {
|
|
4
|
+
data: D[];
|
|
5
|
+
xKey: string;
|
|
6
|
+
yKey: string;
|
|
7
|
+
/** Key for bubble size; omit for uniform dots. */
|
|
8
|
+
sizeKey?: string;
|
|
9
|
+
/** Key whose value splits points into colored groups (and the legend). */
|
|
10
|
+
groupKey?: string;
|
|
11
|
+
/** Key for the point name shown in the tooltip. */
|
|
12
|
+
nameKey?: string;
|
|
13
|
+
/** Colors by group (in order of first appearance) or a single color. */
|
|
14
|
+
colors?: string[];
|
|
15
|
+
/** Bubble radius range in px. Default `[4, 22]`. */
|
|
16
|
+
sizeRange?: [number, number];
|
|
17
|
+
height?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Max dots drawn. Above this the plot is thinned to one dot per grid cell (per group) so the
|
|
20
|
+
* outline of the cloud is kept; hover and keyboard still see every point. Default 1500.
|
|
21
|
+
*/
|
|
22
|
+
maxPoints?: number;
|
|
23
|
+
grid?: boolean;
|
|
24
|
+
legend?: boolean;
|
|
25
|
+
legendToggle?: boolean;
|
|
26
|
+
xTickFormatter?: (v: number) => string;
|
|
27
|
+
yTickFormatter?: (v: number) => string;
|
|
28
|
+
renderTooltip?: (params: {
|
|
29
|
+
datum: D;
|
|
30
|
+
}) => ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/** Scatter plot with optional bubble size and color groups. */
|
|
33
|
+
export declare function ScatterChart<D extends Record<string, unknown>>({ data: dataProp, xKey, yKey, sizeKey, groupKey, nameKey, colors, sizeRange, height, maxPoints, grid, legend, legendToggle, xTickFormatter, yTickFormatter, renderTooltip, label, animate, loading, empty, className, style, sx, }: ScatterChartProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
2
|
+
export interface SparklineProps<D extends Record<string, unknown> = Record<string, unknown>> extends Omit<ChartBaseProps, 'empty'> {
|
|
3
|
+
/** Numbers, or objects read through `valueKey`. */
|
|
4
|
+
data: Array<number | D>;
|
|
5
|
+
/** Key to read from object data. Default `'value'`. */
|
|
6
|
+
valueKey?: string;
|
|
7
|
+
variant?: 'line' | 'area' | 'bar';
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
/** Dot on the last point (line / area). Default `true`. */
|
|
12
|
+
showLast?: boolean;
|
|
13
|
+
/** Message shown when there is no data. Default is a dash. */
|
|
14
|
+
emptyText?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Tiny inline chart with no axes. */
|
|
17
|
+
export declare function Sparkline<D extends Record<string, unknown> = Record<string, unknown>>({ data, valueKey, variant, width, height, color, showLast, label, emptyText, animate, loading, className, style, sx, }: SparklineProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartBaseProps } from './chartExtra';
|
|
3
|
+
export interface StatCardProps extends Omit<ChartBaseProps, 'empty' | 'label'> {
|
|
4
|
+
/** Metric name. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Number (counts up) or preformatted text. */
|
|
7
|
+
value: number | string;
|
|
8
|
+
/** Format a numeric `value`. */
|
|
9
|
+
valueFormatter?: (value: number) => string;
|
|
10
|
+
/** Change vs the previous period, in percent. Sign decides the arrow + color. */
|
|
11
|
+
delta?: number;
|
|
12
|
+
/** Text after the delta, e.g. "vs last week". */
|
|
13
|
+
deltaLabel?: string;
|
|
14
|
+
/** Treat a decrease as good (e.g. churn, latency). */
|
|
15
|
+
deltaInverse?: boolean;
|
|
16
|
+
/** Trend data for the inline sparkline. */
|
|
17
|
+
trend?: number[];
|
|
18
|
+
/** Sparkline color. */
|
|
19
|
+
color?: string;
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** KPI card: animated value, delta chip and sparkline. */
|
|
23
|
+
export declare function StatCard({ label, value, valueFormatter, delta, deltaLabel, deltaInverse, trend, color, icon, animate, loading, className, style, sx, }: StatCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { KeyboardEvent, ReactNode } from 'react';
|
|
2
|
+
/** Axis tick label: compact (1.2K / 3M), tiny values in exponent form, never NaN. */
|
|
3
|
+
export declare function axisFmt(n: number): string;
|
|
4
|
+
/** Tooltip value: exact up to 1e9 (grouped), compact beyond; `null` -> "no data". */
|
|
5
|
+
export declare function tipFmt(n: number | null | undefined): string;
|
|
6
|
+
/** Left gutter wide enough for the widest y label (clamped so tiny containers keep a plot). */
|
|
7
|
+
export declare function gutterFor(labels: readonly string[], width: number, min?: number): number;
|
|
8
|
+
/** Truncated x category label (full text stays in tooltip / aria). */
|
|
9
|
+
export declare const shortLabel: (s: string, max?: number) => string;
|
|
10
|
+
/** Evenly sampled rows for the sr-only table + a trailing "more" row (cap = SrOnlyChartTable default). */
|
|
11
|
+
export declare function sampleRows(n: number, build: (i: number) => ReactNode[], cap?: number): ReactNode[][];
|
|
12
|
+
/** Arrow/Home/End navigation over `count` ordered marks for a focusable svg. */
|
|
13
|
+
export declare function indexKeys(count: number, current: number | null, set: (i: number | null) => void, step?: number): (e: KeyboardEvent) => void;
|
|
14
|
+
/** Per-mark focusable/mouse handlers are only worth their cost below this many marks. */
|
|
15
|
+
export declare const MARK_CAP = 60;
|
|
16
|
+
/** `niceScale` that can never return a degenerate / non-finite domain. */
|
|
17
|
+
export declare function safeScale(min: number, max: number, count?: number): {
|
|
18
|
+
lo: number;
|
|
19
|
+
hi: number;
|
|
20
|
+
ticks: number[];
|
|
21
|
+
};
|
|
22
|
+
/** Plain-object view of a datum (null / primitives -> {}). */
|
|
23
|
+
export declare const rowOf: (d: unknown) => Record<string, unknown>;
|