@openwarelabs/ui 0.11.1 → 0.12.1

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.
Files changed (43) hide show
  1. package/dist/components/AppShell/AppShell.context.d.cts +21 -0
  2. package/dist/components/AppShell/AppShell.context.d.ts +21 -0
  3. package/dist/components/AppShell/AppShell.d.cts +17 -0
  4. package/dist/components/AppShell/AppShell.d.ts +17 -0
  5. package/dist/components/AppShell/AppShell.types.d.cts +46 -0
  6. package/dist/components/AppShell/AppShell.types.d.ts +46 -0
  7. package/dist/components/Chart/BarChart.d.cts +6 -0
  8. package/dist/components/Chart/BarChart.d.ts +6 -0
  9. package/dist/components/Chart/Cartesian.d.cts +8 -0
  10. package/dist/components/Chart/Cartesian.d.ts +8 -0
  11. package/dist/components/Chart/Chart.d.cts +5 -0
  12. package/dist/components/Chart/Chart.d.ts +5 -0
  13. package/dist/components/Chart/Chart.types.d.cts +83 -0
  14. package/dist/components/Chart/Chart.types.d.ts +83 -0
  15. package/dist/components/Chart/ChartParts.d.cts +16 -0
  16. package/dist/components/Chart/ChartParts.d.ts +16 -0
  17. package/dist/components/Chart/DonutChart.d.cts +6 -0
  18. package/dist/components/Chart/DonutChart.d.ts +6 -0
  19. package/dist/components/Chart/LineChart.d.cts +6 -0
  20. package/dist/components/Chart/LineChart.d.ts +6 -0
  21. package/dist/components/Chart/Sparkline.d.cts +6 -0
  22. package/dist/components/Chart/Sparkline.d.ts +6 -0
  23. package/dist/components/Chart/chartUtils.d.cts +13 -0
  24. package/dist/components/Chart/chartUtils.d.ts +13 -0
  25. package/dist/components/NavList/NavList.d.cts +6 -24
  26. package/dist/components/NavList/NavList.d.ts +6 -24
  27. package/dist/components/NavList/NavList.types.d.cts +23 -0
  28. package/dist/components/NavList/NavList.types.d.ts +23 -0
  29. package/dist/components.css +511 -0
  30. package/dist/icons.d.cts +3 -0
  31. package/dist/icons.d.ts +3 -0
  32. package/dist/index.cjs +1299 -729
  33. package/dist/index.cjs.map +4 -4
  34. package/dist/index.d.cts +4 -0
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.js +1281 -711
  37. package/dist/index.js.map +4 -4
  38. package/dist/openware-ui.iife.js +8 -8
  39. package/dist/styles.css +541 -0
  40. package/dist/tailwind.css +10 -0
  41. package/dist/tokens.css +30 -0
  42. package/dist/tokens.json +80 -0
  43. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ export interface AppShellState {
2
+ /** The sidebar is folded down to its icons (wide screens only; the phone drawer is never folded). */
3
+ collapsed: boolean;
4
+ setCollapsed(collapsed: boolean): void;
5
+ toggleCollapsed(): void;
6
+ /** Whether the sidebar can fold at all: AppShell's `collapsible`. */
7
+ collapsible: boolean;
8
+ /** True inside the phone drawer, false in the sidebar beside the page. */
9
+ inDrawer: boolean;
10
+ /** Opens and closes the phone drawer. Choosing a NavItem closes it by itself. */
11
+ openNavigation(): void;
12
+ closeNavigation(): void;
13
+ /** The sidebar's id, for aria-controls. */
14
+ sidebarId: string;
15
+ }
16
+ export declare const AppShellContext: import("react").Context<AppShellState | null>;
17
+ /**
18
+ * The shell around the component: whether the sidebar is folded, and ways to fold it or open and close the phone
19
+ * drawer. Null outside an AppShell.
20
+ */
21
+ export declare function useAppShell(): AppShellState | null;
@@ -0,0 +1,21 @@
1
+ export interface AppShellState {
2
+ /** The sidebar is folded down to its icons (wide screens only; the phone drawer is never folded). */
3
+ collapsed: boolean;
4
+ setCollapsed(collapsed: boolean): void;
5
+ toggleCollapsed(): void;
6
+ /** Whether the sidebar can fold at all: AppShell's `collapsible`. */
7
+ collapsible: boolean;
8
+ /** True inside the phone drawer, false in the sidebar beside the page. */
9
+ inDrawer: boolean;
10
+ /** Opens and closes the phone drawer. Choosing a NavItem closes it by itself. */
11
+ openNavigation(): void;
12
+ closeNavigation(): void;
13
+ /** The sidebar's id, for aria-controls. */
14
+ sidebarId: string;
15
+ }
16
+ export declare const AppShellContext: import("react").Context<AppShellState | null>;
17
+ /**
18
+ * The shell around the component: whether the sidebar is folded, and ways to fold it or open and close the phone
19
+ * drawer. Null outside an AppShell.
20
+ */
21
+ export declare function useAppShell(): AppShellState | null;
@@ -0,0 +1,17 @@
1
+ import type { AppShellProps, SidebarSectionProps, SidebarToggleProps } from "./AppShell.types.cjs";
2
+ export { useAppShell } from "./AppShell.context.cjs";
3
+ export type { AppShellState } from "./AppShell.context.cjs";
4
+ export type { AppShellProps, SidebarSectionProps, SidebarToggleProps } from "./AppShell.types.cjs";
5
+ /**
6
+ * An app's frame: a sidebar down the left and the page beside it. When the shell is narrower than its breakpoint
7
+ * (900px by default) the sidebar folds into a drawer behind a bar at the top. With `collapsible`, people can fold the sidebar to its icons.
8
+ */
9
+ export declare function AppShell({ sidebar, children, variant, collapsible, collapsed, defaultCollapsed, onCollapsedChange, breakpoint, topbar, topbarActions, labels, className, ...props }: AppShellProps): import("react").JSX.Element;
10
+ /** The top of the sidebar: the logo, a workspace switcher, a search button. It stays put while the content scrolls. */
11
+ export declare function SidebarHeader({ className, ...props }: SidebarSectionProps): import("react").JSX.Element;
12
+ /** The middle of the sidebar, usually NavLists. It scrolls when it's taller than the screen. */
13
+ export declare function SidebarContent({ className, children, ...props }: SidebarSectionProps): import("react").JSX.Element;
14
+ /** The bottom of the sidebar: the account, help, a SidebarToggle. */
15
+ export declare function SidebarFooter({ className, ...props }: SidebarSectionProps): import("react").JSX.Element;
16
+ /** Folds the sidebar to its icons and back. It shows only beside the page in a `collapsible` AppShell, not in the phone drawer. */
17
+ export declare function SidebarToggle({ labels, className }: SidebarToggleProps): import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import type { AppShellProps, SidebarSectionProps, SidebarToggleProps } from "./AppShell.types.js";
2
+ export { useAppShell } from "./AppShell.context.js";
3
+ export type { AppShellState } from "./AppShell.context.js";
4
+ export type { AppShellProps, SidebarSectionProps, SidebarToggleProps } from "./AppShell.types.js";
5
+ /**
6
+ * An app's frame: a sidebar down the left and the page beside it. When the shell is narrower than its breakpoint
7
+ * (900px by default) the sidebar folds into a drawer behind a bar at the top. With `collapsible`, people can fold the sidebar to its icons.
8
+ */
9
+ export declare function AppShell({ sidebar, children, variant, collapsible, collapsed, defaultCollapsed, onCollapsedChange, breakpoint, topbar, topbarActions, labels, className, ...props }: AppShellProps): import("react").JSX.Element;
10
+ /** The top of the sidebar: the logo, a workspace switcher, a search button. It stays put while the content scrolls. */
11
+ export declare function SidebarHeader({ className, ...props }: SidebarSectionProps): import("react").JSX.Element;
12
+ /** The middle of the sidebar, usually NavLists. It scrolls when it's taller than the screen. */
13
+ export declare function SidebarContent({ className, children, ...props }: SidebarSectionProps): import("react").JSX.Element;
14
+ /** The bottom of the sidebar: the account, help, a SidebarToggle. */
15
+ export declare function SidebarFooter({ className, ...props }: SidebarSectionProps): import("react").JSX.Element;
16
+ /** Folds the sidebar to its icons and back. It shows only beside the page in a `collapsible` AppShell, not in the phone drawer. */
17
+ export declare function SidebarToggle({ labels, className }: SidebarToggleProps): import("react").JSX.Element | null;
@@ -0,0 +1,46 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export interface AppShellProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
3
+ /** What goes down the left: a SidebarHeader, a SidebarContent with NavLists, a SidebarFooter. On narrow screens the same goes in a drawer. */
4
+ sidebar: ReactNode;
5
+ /** The page. It goes in a `main` landmark. */
6
+ children: ReactNode;
7
+ /** `inset` puts the page on a raised panel beside the sidebar, on the canvas; `flat` puts it straight on the surface, with a line between them.
8
+ * @default "inset" */
9
+ variant?: "inset" | "flat";
10
+ /** Lets people fold the sidebar down to its icons, with a SidebarToggle. Labels show as tooltips while it's folded. @default false */
11
+ collapsible?: boolean;
12
+ /** Folded, when you control it. */
13
+ collapsed?: boolean;
14
+ /** Folded at first, when it controls itself. @default false */
15
+ defaultCollapsed?: boolean;
16
+ /** Called when it folds or unfolds: keep `collapsed` here, or save the choice. */
17
+ onCollapsedChange?(collapsed: boolean): void;
18
+ /** How narrow the shell gets before the sidebar folds into a drawer: `sm` under 560px, `md` under 900px, `lg` under
19
+ * 1200px. It's the shell's own width, not the window's.
20
+ * @default "md" */
21
+ breakpoint?: "sm" | "md" | "lg";
22
+ /** The left of the bar on narrow screens, beside the menu button: usually the logo and the app's name. */
23
+ topbar?: ReactNode;
24
+ /** The right of the bar on narrow screens: a search or an account button. */
25
+ topbarActions?: ReactNode;
26
+ /** The words it uses, for other languages. */
27
+ labels?: {
28
+ /** Names the sidebar for screen readers. @default "Main navigation" */
29
+ navigation?: string;
30
+ /** The menu button on narrow screens. @default "Open navigation" */
31
+ openNavigation?: string;
32
+ /** The drawer's title. @default "Menu" */
33
+ menu?: string;
34
+ };
35
+ }
36
+ export interface SidebarSectionProps extends HTMLAttributes<HTMLDivElement> {
37
+ children: ReactNode;
38
+ }
39
+ export interface SidebarToggleProps {
40
+ /** @default { collapse: "Collapse sidebar", expand: "Expand sidebar" } */
41
+ labels?: {
42
+ collapse?: string;
43
+ expand?: string;
44
+ };
45
+ className?: string;
46
+ }
@@ -0,0 +1,46 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ export interface AppShellProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
3
+ /** What goes down the left: a SidebarHeader, a SidebarContent with NavLists, a SidebarFooter. On narrow screens the same goes in a drawer. */
4
+ sidebar: ReactNode;
5
+ /** The page. It goes in a `main` landmark. */
6
+ children: ReactNode;
7
+ /** `inset` puts the page on a raised panel beside the sidebar, on the canvas; `flat` puts it straight on the surface, with a line between them.
8
+ * @default "inset" */
9
+ variant?: "inset" | "flat";
10
+ /** Lets people fold the sidebar down to its icons, with a SidebarToggle. Labels show as tooltips while it's folded. @default false */
11
+ collapsible?: boolean;
12
+ /** Folded, when you control it. */
13
+ collapsed?: boolean;
14
+ /** Folded at first, when it controls itself. @default false */
15
+ defaultCollapsed?: boolean;
16
+ /** Called when it folds or unfolds: keep `collapsed` here, or save the choice. */
17
+ onCollapsedChange?(collapsed: boolean): void;
18
+ /** How narrow the shell gets before the sidebar folds into a drawer: `sm` under 560px, `md` under 900px, `lg` under
19
+ * 1200px. It's the shell's own width, not the window's.
20
+ * @default "md" */
21
+ breakpoint?: "sm" | "md" | "lg";
22
+ /** The left of the bar on narrow screens, beside the menu button: usually the logo and the app's name. */
23
+ topbar?: ReactNode;
24
+ /** The right of the bar on narrow screens: a search or an account button. */
25
+ topbarActions?: ReactNode;
26
+ /** The words it uses, for other languages. */
27
+ labels?: {
28
+ /** Names the sidebar for screen readers. @default "Main navigation" */
29
+ navigation?: string;
30
+ /** The menu button on narrow screens. @default "Open navigation" */
31
+ openNavigation?: string;
32
+ /** The drawer's title. @default "Menu" */
33
+ menu?: string;
34
+ };
35
+ }
36
+ export interface SidebarSectionProps extends HTMLAttributes<HTMLDivElement> {
37
+ children: ReactNode;
38
+ }
39
+ export interface SidebarToggleProps {
40
+ /** @default { collapse: "Collapse sidebar", expand: "Expand sidebar" } */
41
+ labels?: {
42
+ collapse?: string;
43
+ expand?: string;
44
+ };
45
+ className?: string;
46
+ }
@@ -0,0 +1,6 @@
1
+ import type { BarChartProps } from "./Chart.types.cjs";
2
+ /**
3
+ * Bars from a zero baseline, for comparing amounts: side by side, or stacked to show the parts of a whole. Hover,
4
+ * or focus it and use the arrow keys, to read each bar; screen readers get every number as a table.
5
+ */
6
+ export declare function BarChart(props: BarChartProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { BarChartProps } from "./Chart.types.js";
2
+ /**
3
+ * Bars from a zero baseline, for comparing amounts: side by side, or stacked to show the parts of a whole. Hover,
4
+ * or focus it and use the arrow keys, to read each bar; screen readers get every number as a table.
5
+ */
6
+ export declare function BarChart(props: BarChartProps): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { BarChartProps, LineChartProps } from "./Chart.types.cjs";
2
+ type Props = (LineChartProps & {
3
+ kind: "line";
4
+ }) | (BarChartProps & {
5
+ kind: "bar";
6
+ });
7
+ export declare function CartesianChart(props: Props): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { BarChartProps, LineChartProps } from "./Chart.types.js";
2
+ type Props = (LineChartProps & {
3
+ kind: "line";
4
+ }) | (BarChartProps & {
5
+ kind: "bar";
6
+ });
7
+ export declare function CartesianChart(props: Props): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ export { LineChart } from "./LineChart.cjs";
2
+ export { BarChart } from "./BarChart.cjs";
3
+ export { DonutChart } from "./DonutChart.cjs";
4
+ export { Sparkline } from "./Sparkline.cjs";
5
+ export type { BarChartProps, CartesianChartProps, ChartColor, ChartRow, ChartSeries, DonutChartProps, DonutChartSlice, LineChartProps, SparklineProps, } from "./Chart.types.cjs";
@@ -0,0 +1,5 @@
1
+ export { LineChart } from "./LineChart.js";
2
+ export { BarChart } from "./BarChart.js";
3
+ export { DonutChart } from "./DonutChart.js";
4
+ export { Sparkline } from "./Sparkline.js";
5
+ export type { BarChartProps, CartesianChartProps, ChartColor, ChartRow, ChartSeries, DonutChartProps, DonutChartSlice, LineChartProps, SparklineProps, } from "./Chart.types.js";
@@ -0,0 +1,83 @@
1
+ import type { ReactNode } from "react";
2
+ /** A chart series colour: 1 to 8 for the chart palette's slots, or any CSS colour. */
3
+ export type ChartColor = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | (string & {});
4
+ export interface ChartSeries {
5
+ /** The key in each row that holds this series' number. */
6
+ key: string;
7
+ /** Its name, in the legend, the readout and the table. */
8
+ label: string;
9
+ /**
10
+ * A palette slot (1–8) or a CSS colour. By default series take the slots in order. Give each one a fixed slot when
11
+ * a filter can hide some, so the rest keep their colours.
12
+ */
13
+ color?: ChartColor;
14
+ }
15
+ export type ChartRow = Record<string, unknown>;
16
+ export interface CartesianChartProps {
17
+ /** One row per point along the x axis, e.g. `{ month: "Jan", visits: 120, signups: 30 }`. */
18
+ data: ChartRow[];
19
+ /** The key in each row for the x axis: a label, a number or a Date. */
20
+ index: string;
21
+ /** The numbers to plot, one series each; at most eight. */
22
+ series: ChartSeries[];
23
+ /** What the chart shows, e.g. "Visits per month". Read out by screen readers and used as the table's caption. */
24
+ label: string;
25
+ /** Height of the plot in pixels, axes included. @default 240 */
26
+ height?: number;
27
+ /** Turns a number into the text in the readout and the table, e.g. (v) => `€${v}`. @default the locale's format */
28
+ formatValue?(value: number): string;
29
+ /** Turns a number into a y axis label. @default compact: 1.2K, 3M */
30
+ formatTick?(value: number): string;
31
+ /** Turns an x value into its label. @default dates as "12 Oct", anything else as text */
32
+ formatIndex?(value: unknown): string;
33
+ /** Shows the legend above the plot. @default true when there's more than one series */
34
+ legend?: boolean;
35
+ className?: string;
36
+ }
37
+ export interface LineChartProps extends CartesianChartProps {
38
+ /** Fills under each line with a light wash of its colour. @default false */
39
+ area?: boolean;
40
+ /** Joins the points with smooth curves instead of straight lines. @default false */
41
+ curved?: boolean;
42
+ }
43
+ export interface BarChartProps extends CartesianChartProps {
44
+ /** Stacks the series in one bar per row instead of side by side. @default false */
45
+ stacked?: boolean;
46
+ }
47
+ export interface DonutChartSlice {
48
+ label: string;
49
+ value: number;
50
+ color?: ChartColor;
51
+ }
52
+ export interface DonutChartProps {
53
+ /** One slice each, largest first reads best; at most eight. Fold the smallest into an "Other" slice past that. */
54
+ data: DonutChartSlice[];
55
+ /** What the chart shows, e.g. "Spend by category". Read out by screen readers and used as the table's caption. */
56
+ label: string;
57
+ /** @default the locale's format */
58
+ formatValue?(value: number): string;
59
+ /** In the middle: a total, or anything short. @default the total, formatted, over the word "Total" */
60
+ center?: ReactNode;
61
+ /** The word under the total in the middle. @default "Total" */
62
+ centerLabel?: ReactNode;
63
+ /** Diameter in pixels. @default 180 */
64
+ size?: number;
65
+ /** Shows the legend, with each slice's value and share, beside the ring. @default true */
66
+ legend?: boolean;
67
+ className?: string;
68
+ }
69
+ export interface SparklineProps {
70
+ /** The numbers, oldest first. */
71
+ data: number[];
72
+ /** Read out by screen readers, e.g. "Sign-ups over the last 30 days, rising from 12 to 48". */
73
+ "aria-label": string;
74
+ /** A palette slot (1–8) or a CSS colour. @default 1 */
75
+ color?: ChartColor;
76
+ /** Fills under the line with a light wash. @default true */
77
+ area?: boolean;
78
+ /** @default 120 */
79
+ width?: number | string;
80
+ /** @default 32 */
81
+ height?: number;
82
+ className?: string;
83
+ }
@@ -0,0 +1,83 @@
1
+ import type { ReactNode } from "react";
2
+ /** A chart series colour: 1 to 8 for the chart palette's slots, or any CSS colour. */
3
+ export type ChartColor = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | (string & {});
4
+ export interface ChartSeries {
5
+ /** The key in each row that holds this series' number. */
6
+ key: string;
7
+ /** Its name, in the legend, the readout and the table. */
8
+ label: string;
9
+ /**
10
+ * A palette slot (1–8) or a CSS colour. By default series take the slots in order. Give each one a fixed slot when
11
+ * a filter can hide some, so the rest keep their colours.
12
+ */
13
+ color?: ChartColor;
14
+ }
15
+ export type ChartRow = Record<string, unknown>;
16
+ export interface CartesianChartProps {
17
+ /** One row per point along the x axis, e.g. `{ month: "Jan", visits: 120, signups: 30 }`. */
18
+ data: ChartRow[];
19
+ /** The key in each row for the x axis: a label, a number or a Date. */
20
+ index: string;
21
+ /** The numbers to plot, one series each; at most eight. */
22
+ series: ChartSeries[];
23
+ /** What the chart shows, e.g. "Visits per month". Read out by screen readers and used as the table's caption. */
24
+ label: string;
25
+ /** Height of the plot in pixels, axes included. @default 240 */
26
+ height?: number;
27
+ /** Turns a number into the text in the readout and the table, e.g. (v) => `€${v}`. @default the locale's format */
28
+ formatValue?(value: number): string;
29
+ /** Turns a number into a y axis label. @default compact: 1.2K, 3M */
30
+ formatTick?(value: number): string;
31
+ /** Turns an x value into its label. @default dates as "12 Oct", anything else as text */
32
+ formatIndex?(value: unknown): string;
33
+ /** Shows the legend above the plot. @default true when there's more than one series */
34
+ legend?: boolean;
35
+ className?: string;
36
+ }
37
+ export interface LineChartProps extends CartesianChartProps {
38
+ /** Fills under each line with a light wash of its colour. @default false */
39
+ area?: boolean;
40
+ /** Joins the points with smooth curves instead of straight lines. @default false */
41
+ curved?: boolean;
42
+ }
43
+ export interface BarChartProps extends CartesianChartProps {
44
+ /** Stacks the series in one bar per row instead of side by side. @default false */
45
+ stacked?: boolean;
46
+ }
47
+ export interface DonutChartSlice {
48
+ label: string;
49
+ value: number;
50
+ color?: ChartColor;
51
+ }
52
+ export interface DonutChartProps {
53
+ /** One slice each, largest first reads best; at most eight. Fold the smallest into an "Other" slice past that. */
54
+ data: DonutChartSlice[];
55
+ /** What the chart shows, e.g. "Spend by category". Read out by screen readers and used as the table's caption. */
56
+ label: string;
57
+ /** @default the locale's format */
58
+ formatValue?(value: number): string;
59
+ /** In the middle: a total, or anything short. @default the total, formatted, over the word "Total" */
60
+ center?: ReactNode;
61
+ /** The word under the total in the middle. @default "Total" */
62
+ centerLabel?: ReactNode;
63
+ /** Diameter in pixels. @default 180 */
64
+ size?: number;
65
+ /** Shows the legend, with each slice's value and share, beside the ring. @default true */
66
+ legend?: boolean;
67
+ className?: string;
68
+ }
69
+ export interface SparklineProps {
70
+ /** The numbers, oldest first. */
71
+ data: number[];
72
+ /** Read out by screen readers, e.g. "Sign-ups over the last 30 days, rising from 12 to 48". */
73
+ "aria-label": string;
74
+ /** A palette slot (1–8) or a CSS colour. @default 1 */
75
+ color?: ChartColor;
76
+ /** Fills under the line with a light wash. @default true */
77
+ area?: boolean;
78
+ /** @default 120 */
79
+ width?: number | string;
80
+ /** @default 32 */
81
+ height?: number;
82
+ className?: string;
83
+ }
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from "react";
2
+ /** The series' names, each beside its colour, above the plot. */
3
+ export declare function ChartLegend({ items, shape }: {
4
+ items: Array<{
5
+ label: ReactNode;
6
+ color: string;
7
+ value?: ReactNode;
8
+ }>;
9
+ shape: "line" | "square";
10
+ }): import("react").JSX.Element;
11
+ /** Every number in the chart as a table, for screen readers: the chart's text alternative. */
12
+ export declare function ChartTable({ caption, head, rows }: {
13
+ caption: string;
14
+ head: string[];
15
+ rows: string[][];
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from "react";
2
+ /** The series' names, each beside its colour, above the plot. */
3
+ export declare function ChartLegend({ items, shape }: {
4
+ items: Array<{
5
+ label: ReactNode;
6
+ color: string;
7
+ value?: ReactNode;
8
+ }>;
9
+ shape: "line" | "square";
10
+ }): import("react").JSX.Element;
11
+ /** Every number in the chart as a table, for screen readers: the chart's text alternative. */
12
+ export declare function ChartTable({ caption, head, rows }: {
13
+ caption: string;
14
+ head: string[];
15
+ rows: string[][];
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { DonutChartProps } from "./Chart.types.cjs";
2
+ /**
3
+ * Parts of a whole as a ring, with the total in the middle and each part's value and share beside it. Best with two
4
+ * to six slices; hover a slice, or focus it and use the arrow keys, to read it.
5
+ */
6
+ export declare function DonutChart({ data, label, formatValue, center, centerLabel, size, legend, className }: DonutChartProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { DonutChartProps } from "./Chart.types.js";
2
+ /**
3
+ * Parts of a whole as a ring, with the total in the middle and each part's value and share beside it. Best with two
4
+ * to six slices; hover a slice, or focus it and use the arrow keys, to read it.
5
+ */
6
+ export declare function DonutChart({ data, label, formatValue, center, centerLabel, size, legend, className }: DonutChartProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { LineChartProps } from "./Chart.types.cjs";
2
+ /**
3
+ * Lines over time or another ordered x axis, for trends. Hover, or focus it and use the arrow keys, to read each
4
+ * point; screen readers get every number as a table.
5
+ */
6
+ export declare function LineChart(props: LineChartProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { LineChartProps } from "./Chart.types.js";
2
+ /**
3
+ * Lines over time or another ordered x axis, for trends. Hover, or focus it and use the arrow keys, to read each
4
+ * point; screen readers get every number as a table.
5
+ */
6
+ export declare function LineChart(props: LineChartProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { SparklineProps } from "./Chart.types.cjs";
2
+ /**
3
+ * A small line with no axes, for the shape of a trend beside a number or in a table cell. It's an image to screen
4
+ * readers: say what it shows in its aria-label.
5
+ */
6
+ export declare function Sparkline({ data, "aria-label": ariaLabel, color, area, width, height, className }: SparklineProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { SparklineProps } from "./Chart.types.js";
2
+ /**
3
+ * A small line with no axes, for the shape of a trend beside a number or in a table cell. It's an image to screen
4
+ * readers: say what it shows in its aria-label.
5
+ */
6
+ export declare function Sparkline({ data, "aria-label": ariaLabel, color, area, width, height, className }: SparklineProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import type { ChartColor, ChartRow, ChartSeries } from "./Chart.types.cjs";
2
+ export declare const colorOf: (color: ChartColor | undefined, index: number) => string;
3
+ export declare const seriesColors: (series: ChartSeries[]) => string[];
4
+ export declare const defaultValue: (value: number) => string;
5
+ export declare const defaultTick: (value: number) => string;
6
+ export declare const defaultIndex: (value: unknown) => string;
7
+ export declare const valueOf: (row: ChartRow | undefined, key: string) => number;
8
+ /** Round gridlines: steps of 1, 2 or 5 times a power of ten, about four of them, always including zero. */
9
+ export declare function niceTicks(min: number, max: number): number[];
10
+ /** The element's width, kept up to date. Zero until it's measured, so charts draw on the client only. */
11
+ export declare function useWidth<T extends HTMLElement>(): readonly [import("react").RefObject<T>, number];
12
+ /** Roughly how wide a label is at the axis' 11.5px, to keep labels from colliding without measuring each one. */
13
+ export declare const textWidth: (text: string) => number;
@@ -0,0 +1,13 @@
1
+ import type { ChartColor, ChartRow, ChartSeries } from "./Chart.types.js";
2
+ export declare const colorOf: (color: ChartColor | undefined, index: number) => string;
3
+ export declare const seriesColors: (series: ChartSeries[]) => string[];
4
+ export declare const defaultValue: (value: number) => string;
5
+ export declare const defaultTick: (value: number) => string;
6
+ export declare const defaultIndex: (value: unknown) => string;
7
+ export declare const valueOf: (row: ChartRow | undefined, key: string) => number;
8
+ /** Round gridlines: steps of 1, 2 or 5 times a power of ten, about four of them, always including zero. */
9
+ export declare function niceTicks(min: number, max: number): number[];
10
+ /** The element's width, kept up to date. Zero until it's measured, so charts draw on the client only. */
11
+ export declare function useWidth<T extends HTMLElement>(): readonly [import("react").RefObject<T>, number];
12
+ /** Roughly how wide a label is at the axis' 11.5px, to keep labels from colliding without measuring each one. */
13
+ export declare const textWidth: (text: string) => number;
@@ -1,27 +1,9 @@
1
- import { type ButtonHTMLAttributes, type ReactNode } from "react";
2
- export interface NavListProps {
3
- /** Names the navigation for screen readers, e.g. "Settings". */
4
- label: string;
5
- /** A muted heading above the items (vertical only). */
6
- heading?: ReactNode;
7
- /** `vertical` for a sidebar; `horizontal` scrolls sideways, for narrow screens.
8
- * @default "vertical" */
9
- orientation?: "vertical" | "horizontal";
10
- children: ReactNode;
11
- className?: string;
12
- }
1
+ import type { NavItemProps, NavListProps } from "./NavList.types.cjs";
2
+ export type { NavItemProps, NavListProps } from "./NavList.types.cjs";
13
3
  /** A list of places to go, the way a settings dialog's sidebar lists its sections. Place it on ow-canvas. */
14
4
  export declare function NavList({ label, heading, orientation, children, className }: NavListProps): import("react").JSX.Element;
15
- export interface NavItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
16
- /** A 15px lucide-react icon. */
17
- icon?: ReactNode;
18
- /** The current section: raised on a surface, its icon in the primary colour.
19
- * @default false */
20
- active?: boolean;
21
- /** Makes the item a link to this address instead of a button. */
22
- href?: string;
23
- /** Muted text at the right: a count, a badge. */
24
- end?: ReactNode;
25
- }
26
- /** One place in a NavList: a button, or a link when given an href. */
5
+ /**
6
+ * One place in a NavList: a button, or a link when given an href. In a folded AppShell sidebar it shows only its
7
+ * icon, with its label as a tooltip (and still read out by screen readers).
8
+ */
27
9
  export declare const NavItem: import("react").ForwardRefExoticComponent<NavItemProps & import("react").RefAttributes<HTMLElement>>;
@@ -1,27 +1,9 @@
1
- import { type ButtonHTMLAttributes, type ReactNode } from "react";
2
- export interface NavListProps {
3
- /** Names the navigation for screen readers, e.g. "Settings". */
4
- label: string;
5
- /** A muted heading above the items (vertical only). */
6
- heading?: ReactNode;
7
- /** `vertical` for a sidebar; `horizontal` scrolls sideways, for narrow screens.
8
- * @default "vertical" */
9
- orientation?: "vertical" | "horizontal";
10
- children: ReactNode;
11
- className?: string;
12
- }
1
+ import type { NavItemProps, NavListProps } from "./NavList.types.js";
2
+ export type { NavItemProps, NavListProps } from "./NavList.types.js";
13
3
  /** A list of places to go, the way a settings dialog's sidebar lists its sections. Place it on ow-canvas. */
14
4
  export declare function NavList({ label, heading, orientation, children, className }: NavListProps): import("react").JSX.Element;
15
- export interface NavItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
16
- /** A 15px lucide-react icon. */
17
- icon?: ReactNode;
18
- /** The current section: raised on a surface, its icon in the primary colour.
19
- * @default false */
20
- active?: boolean;
21
- /** Makes the item a link to this address instead of a button. */
22
- href?: string;
23
- /** Muted text at the right: a count, a badge. */
24
- end?: ReactNode;
25
- }
26
- /** One place in a NavList: a button, or a link when given an href. */
5
+ /**
6
+ * One place in a NavList: a button, or a link when given an href. In a folded AppShell sidebar it shows only its
7
+ * icon, with its label as a tooltip (and still read out by screen readers).
8
+ */
27
9
  export declare const NavItem: import("react").ForwardRefExoticComponent<NavItemProps & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,23 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from "react";
2
+ export interface NavListProps {
3
+ /** Names the navigation for screen readers, e.g. "Settings". */
4
+ label: string;
5
+ /** A muted heading above the items (vertical only). */
6
+ heading?: ReactNode;
7
+ /** `vertical` for a sidebar; `horizontal` scrolls sideways, for narrow screens.
8
+ * @default "vertical" */
9
+ orientation?: "vertical" | "horizontal";
10
+ children: ReactNode;
11
+ className?: string;
12
+ }
13
+ export interface NavItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
14
+ /** A 15px lucide-react icon. */
15
+ icon?: ReactNode;
16
+ /** The current section: raised on a surface, its icon in the primary colour.
17
+ * @default false */
18
+ active?: boolean;
19
+ /** Makes the item a link to this address instead of a button. */
20
+ href?: string;
21
+ /** Muted text at the right: a count, a badge. */
22
+ end?: ReactNode;
23
+ }
@@ -0,0 +1,23 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from "react";
2
+ export interface NavListProps {
3
+ /** Names the navigation for screen readers, e.g. "Settings". */
4
+ label: string;
5
+ /** A muted heading above the items (vertical only). */
6
+ heading?: ReactNode;
7
+ /** `vertical` for a sidebar; `horizontal` scrolls sideways, for narrow screens.
8
+ * @default "vertical" */
9
+ orientation?: "vertical" | "horizontal";
10
+ children: ReactNode;
11
+ className?: string;
12
+ }
13
+ export interface NavItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
14
+ /** A 15px lucide-react icon. */
15
+ icon?: ReactNode;
16
+ /** The current section: raised on a surface, its icon in the primary colour.
17
+ * @default false */
18
+ active?: boolean;
19
+ /** Makes the item a link to this address instead of a button. */
20
+ href?: string;
21
+ /** Muted text at the right: a count, a badge. */
22
+ end?: ReactNode;
23
+ }