@acronis-platform/ui-react 0.60.0 → 0.62.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 +5 -5
- package/dist/components/ui/app-shell/app-shell.js.map +1 -1
- package/dist/components/ui/area-chart/area-chart.js +209 -146
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +26 -23
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +595 -180
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/calendar-panel/calendar-panel-utils.js +63 -0
- package/dist/components/ui/calendar-panel/calendar-panel-utils.js.map +1 -0
- package/dist/components/ui/calendar-panel/calendar-panel.js +260 -0
- package/dist/components/ui/calendar-panel/calendar-panel.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +98 -77
- package/dist/components/ui/category-bar/category-bar.js.map +1 -1
- package/dist/components/ui/chart/chart-format.js +144 -14
- package/dist/components/ui/chart/chart-format.js.map +1 -1
- package/dist/components/ui/chart/chart.js +204 -150
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/composed-chart/composed-chart.js +422 -125
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +308 -202
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/filter-cards/filter-cards.js +25 -0
- package/dist/components/ui/filter-cards/filter-cards.js.map +1 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js +245 -51
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +85 -81
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +227 -184
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/metric/metric.js +88 -70
- package/dist/components/ui/metric/metric.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.js +234 -80
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +210 -57
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +358 -50
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js +23 -11
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/sankey-chart/sankey-chart.js +25 -18
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
- package/dist/components/ui/scatter-chart/scatter-chart.js +86 -78
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +206 -142
- package/dist/components/ui/timeline/timeline.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +183 -59
- package/dist/components/ui/treemap/treemap.js.map +1 -1
- package/dist/index.js +446 -420
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/react-day-picker@10.0.1_@types_react@19.2.15_react@19.2.6/node_modules/react-day-picker/dist/esm/useDayPicker.js +3 -3
- package/dist/react.js +446 -420
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +53 -3
- package/dist/src/components/ui/area-chart/index.d.ts +1 -1
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +154 -16
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/button/button.d.ts +1 -1
- package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
- package/dist/src/components/ui/calendar-panel/__tests__/calendar-panel-utils.test.d.ts +1 -0
- package/dist/src/components/ui/calendar-panel/calendar-panel-utils.d.ts +55 -0
- package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +112 -0
- package/dist/src/components/ui/calendar-panel/index.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-layout.d.ts +63 -0
- package/dist/src/components/ui/chart/__tests__/chart-layout.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-format.d.ts +415 -0
- package/dist/src/components/ui/chart/chart.d.ts +9 -3
- package/dist/src/components/ui/chart/index.d.ts +2 -2
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +156 -7
- package/dist/src/components/ui/composed-chart/index.d.ts +1 -1
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +138 -20
- package/dist/src/components/ui/confidence-cone/index.d.ts +1 -1
- package/dist/src/components/ui/filter-cards/filter-cards.d.ts +11 -0
- package/dist/src/components/ui/filter-cards/index.d.ts +1 -0
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +201 -3
- package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
- package/dist/src/components/ui/histogram/histogram.d.ts +2 -2
- package/dist/src/components/ui/line-chart/index.d.ts +1 -1
- package/dist/src/components/ui/line-chart/line-chart.d.ts +51 -3
- package/dist/src/components/ui/pie-chart/index.d.ts +1 -1
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +145 -4
- package/dist/src/components/ui/radar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +219 -6
- package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +215 -9
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +2 -2
- package/dist/src/components/ui/timeline/index.d.ts +1 -1
- package/dist/src/components/ui/timeline/timeline.d.ts +79 -20
- package/dist/src/components/ui/treemap/index.d.ts +1 -1
- package/dist/src/components/ui/treemap/treemap.d.ts +68 -8
- package/dist/src/index.d.ts +2 -1
- package/dist/ui-react.css +1 -1
- package/package.json +2 -2
- package/dist/components/ui/search-global/search-global.js +0 -60
- package/dist/components/ui/search-global/search-global.js.map +0 -1
- package/dist/src/components/ui/search-global/index.d.ts +0 -1
- package/dist/src/components/ui/search-global/search-global.d.ts +0 -7
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { ChartConfig, CartesianChartProps } from '../chart';
|
|
2
|
+
import { ChartConfig, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartCurveType, ChartDataLabelProps, ChartReferenceLine, CartesianLabelPosition } from '../chart';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const areaChartVariants: (props?: ({
|
|
5
5
|
layout?: "single" | "stacked" | null | undefined;
|
|
6
6
|
fill?: "solid" | "gradient" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Style override for one series, keyed by its `dataKeys` entry. Anything left
|
|
10
|
+
* unset falls back to the chart-wide prop, so an entry only states what differs
|
|
11
|
+
* — e.g. a projection band that reads fainter than the actuals beside it.
|
|
12
|
+
*/
|
|
13
|
+
export interface AreaChartAreaSettings {
|
|
14
|
+
/** Stroke and fill color. Defaults to the series' `config` color. */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Width of this series' top border. Defaults to the chart's `strokeWidth`. */
|
|
17
|
+
strokeWidth?: number;
|
|
18
|
+
/** Dash this series' top border. */
|
|
19
|
+
dashed?: boolean;
|
|
20
|
+
/** Interpolation for this series only. Defaults to the chart's `curve`. */
|
|
21
|
+
curveType?: ChartCurveType;
|
|
22
|
+
/**
|
|
23
|
+
* Fill opacity for this series. Under `fill="gradient"` it scales the
|
|
24
|
+
* gradient's own alpha rather than replacing it.
|
|
25
|
+
*/
|
|
26
|
+
fillOpacity?: number;
|
|
27
|
+
/** Render this series' per-point dots. Defaults to the chart's `showDots`. */
|
|
28
|
+
showDots?: boolean;
|
|
29
|
+
/** Dot radius for this series, in px. Defaults to the chart's `dotSize`. */
|
|
30
|
+
dotSize?: number;
|
|
31
|
+
/** Show/hide this series' value labels, overriding the chart's `showLabels`. */
|
|
32
|
+
showLabel?: boolean;
|
|
33
|
+
/** Position of this series' value labels. Defaults to the chart's `labelPosition`. */
|
|
34
|
+
labelPosition?: CartesianLabelPosition;
|
|
35
|
+
}
|
|
36
|
+
export interface AreaChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof areaChartVariants>, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartDataLabelProps {
|
|
9
37
|
/** Row-per-point data. Each object holds the category key + one numeric field per series (`null` breaks the area unless `connectNulls`). */
|
|
10
38
|
data: ReadonlyArray<Record<string, string | number | null>>;
|
|
11
39
|
/**
|
|
@@ -19,16 +47,38 @@ export interface AreaChartProps extends Omit<React.ComponentProps<'div'>, 'child
|
|
|
19
47
|
/** Category axis key (the shared dimension across rows, e.g. `"month"`). */
|
|
20
48
|
xKey: string;
|
|
21
49
|
/** Interpolation between points. */
|
|
22
|
-
curve?:
|
|
50
|
+
curve?: ChartCurveType;
|
|
23
51
|
/** Stroke width of each area's top border. */
|
|
24
52
|
strokeWidth?: number;
|
|
25
53
|
/** Flat-fill opacity — used only when `fill="solid"` (gradient controls its own stops). */
|
|
26
54
|
fillOpacity?: number;
|
|
27
55
|
/** Render a dot at each data point. */
|
|
28
56
|
showDots?: boolean;
|
|
57
|
+
/** Radius of each point's dot, in px. Its hover dot is 2px larger. */
|
|
58
|
+
dotSize?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Enlarge the hovered point's dot. Defaults to following `showDots`, so pass
|
|
61
|
+
* it explicitly to get hover dots on a dot-less area (`showDots={false}` with
|
|
62
|
+
* `showActiveDot`) or a static-only area (dots without the hover one).
|
|
63
|
+
*/
|
|
64
|
+
showActiveDot?: boolean;
|
|
29
65
|
/** Bridge `null` gaps in the data instead of breaking the area. */
|
|
30
66
|
connectNulls?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Per-series style overrides, keyed by `dataKeys` entry. Series with no entry
|
|
69
|
+
* render from the chart-wide props.
|
|
70
|
+
*/
|
|
71
|
+
areaSettings?: Record<string, AreaChartAreaSettings>;
|
|
72
|
+
/**
|
|
73
|
+
* One or more dashed reference/average lines on the value axis — a target, a
|
|
74
|
+
* threshold, or a series mean. Pass a single object or an array to draw
|
|
75
|
+
* several at once. On a stacked chart the value is read against the stack's
|
|
76
|
+
* axis, not one series.
|
|
77
|
+
*/
|
|
78
|
+
referenceLine?: ChartReferenceLine | ChartReferenceLine[];
|
|
31
79
|
showLegend?: boolean;
|
|
80
|
+
/** Position of the value labels when `showLabels` is on. Defaults to `top`. */
|
|
81
|
+
labelPosition?: CartesianLabelPosition;
|
|
32
82
|
}
|
|
33
83
|
declare const AreaChart: React.ForwardRefExoticComponent<Omit<AreaChartProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
84
|
export { AreaChart, areaChartVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AreaChart, areaChartVariants, type AreaChartProps } from './area-chart';
|
|
1
|
+
export { AreaChart, areaChartVariants, type AreaChartProps, type AreaChartAreaSettings, } from './area-chart';
|
|
@@ -2,7 +2,7 @@ import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const avatarVariants: (props?: ({
|
|
5
|
-
color?: "orange" | "red" | "teal" | "violet" | "yellow" | null | undefined;
|
|
5
|
+
color?: "blue" | "gray" | "green" | "orange" | "red" | "teal" | "violet" | "yellow" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface AvatarProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, VariantProps<typeof avatarVariants> {
|
|
8
8
|
}
|
|
@@ -1,30 +1,123 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import {
|
|
2
|
+
import { BarShapeProps } from 'recharts/types/cartesian/Bar';
|
|
3
|
+
import { ChartLegend, ChartTooltip, ChartConfig, ChartReferenceLine, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartCategoryRange, ChartDataLabelProps, CartesianLabelPosition } from '../chart';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
declare const barChartVariants: (props?: ({
|
|
5
6
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
7
|
layout?: "stacked" | "grouped" | null | undefined;
|
|
7
8
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* How a bar is painted. `rounded` rounds the growing end by `barRadius`; `pill`
|
|
11
|
+
* rounds every corner to a capsule; `gradient` fades the series color down the
|
|
12
|
+
* bar; `pattern` fills it with diagonal hatching in the series color (a
|
|
13
|
+
* colorblind-safe way to set a subset of bars apart).
|
|
14
|
+
*/
|
|
15
|
+
export type BarChartBarShape = 'rounded' | 'pill' | 'gradient' | 'pattern';
|
|
16
|
+
/**
|
|
17
|
+
* Style override for one series over a range of categories — e.g. "the forecast
|
|
18
|
+
* tail from September onward reads translucent and dashed". Anything left unset
|
|
19
|
+
* keeps the series' normal painting.
|
|
20
|
+
*/
|
|
21
|
+
export interface BarChartBarSettings extends ChartCategoryRange {
|
|
22
|
+
/** Fill for the matched bars. Defaults to the series color. */
|
|
23
|
+
fill?: string;
|
|
24
|
+
/** Fill opacity for the matched bars. */
|
|
25
|
+
opacity?: number;
|
|
26
|
+
/** Outline the matched bars with a dashed stroke in the series color. */
|
|
27
|
+
dashed?: boolean;
|
|
28
|
+
/** Shape for the matched bars, overriding the chart's `barShape`. */
|
|
29
|
+
shape?: BarChartBarShape;
|
|
11
30
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
31
|
+
* Track behind the matched bars: `true` fills the plot height, while a data
|
|
32
|
+
* field name caps it at that row's value — the headroom between a projection
|
|
33
|
+
* and its upper bound. A capped track stacks on its bar, so it needs the
|
|
34
|
+
* default `layout="grouped"`; under `layout="stacked"` it is ignored.
|
|
14
35
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
36
|
+
background?: boolean | string;
|
|
37
|
+
}
|
|
38
|
+
/** A shaded band behind a range of categories. */
|
|
39
|
+
export interface BarChartReferenceArea extends ChartCategoryRange {
|
|
40
|
+
/** Caption above the band. */
|
|
17
41
|
label?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Mark the category ticks under the band — accent color, italic — so the
|
|
44
|
+
* highlighted range reads on the axis too. On by default.
|
|
45
|
+
*/
|
|
46
|
+
highlightTicks?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Draw a dashed rule at the band's leading edge — the hand-off into a
|
|
49
|
+
* forecast. Off by default.
|
|
50
|
+
*/
|
|
51
|
+
divider?: boolean;
|
|
18
52
|
}
|
|
19
53
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
54
|
+
* Drop the synthetic headroom series from a recharts tooltip/legend payload,
|
|
55
|
+
* keeping the real series (and their order). `legendType`/`tooltipType="none"`
|
|
56
|
+
* are set on those bars too, but recharts still lists them, so this filter is
|
|
57
|
+
* what actually keeps them out — hence it's unit-tested.
|
|
58
|
+
*/
|
|
59
|
+
export declare function dropHeadroomSeries<T extends {
|
|
60
|
+
dataKey?: unknown;
|
|
61
|
+
}>(payload: readonly T[] | undefined, dataKeys?: string[]): T[] | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Swap a paint-server fill back to the series color for the chrome. A
|
|
64
|
+
* `gradient` / `pattern` bar fills from `url(#…)`, which paints SVG but means
|
|
65
|
+
* nothing as a CSS background — the legend swatch and the tooltip dot would
|
|
66
|
+
* render blank — so they fall back to the series' own `--color-<key>`.
|
|
25
67
|
*/
|
|
26
|
-
export declare function
|
|
27
|
-
|
|
68
|
+
export declare function withSeriesColor<T extends {
|
|
69
|
+
dataKey?: unknown;
|
|
70
|
+
color?: string;
|
|
71
|
+
}>(payload: readonly T[] | undefined): T[] | undefined;
|
|
72
|
+
type TooltipContentType = NonNullable<React.ComponentProps<typeof ChartTooltip>['content']>;
|
|
73
|
+
type TooltipContentFn = Extract<TooltipContentType, (...args: never[]) => unknown>;
|
|
74
|
+
type TooltipRenderProps = Parameters<TooltipContentFn>[0];
|
|
75
|
+
type LegendContentType = NonNullable<React.ComponentProps<typeof ChartLegend>['content']>;
|
|
76
|
+
type LegendContentFn = Extract<LegendContentType, (...args: never[]) => unknown>;
|
|
77
|
+
type LegendRenderProps = Parameters<LegendContentFn>[0];
|
|
78
|
+
/**
|
|
79
|
+
* Tooltip content that normalizes recharts' payload before anything renders it:
|
|
80
|
+
* the synthetic headroom series stripped, the rows put back in `dataKeys` order,
|
|
81
|
+
* and paint-server fills swapped back to the series color. Falls through to a
|
|
82
|
+
* caller-supplied `content`, preserving recharts' own mount semantics — a
|
|
83
|
+
* function via `createElement` (its own component identity + hook state), an
|
|
84
|
+
* element via `cloneElement`.
|
|
85
|
+
*
|
|
86
|
+
* This is a component rather than a per-render wrapper factory on purpose:
|
|
87
|
+
* recharts renders `content` by cloning the element it is given
|
|
88
|
+
* (`Tooltip.js:27-28`), so a stable module-level type here means the subtree is
|
|
89
|
+
* never remounted, whatever the caller passes.
|
|
90
|
+
*/
|
|
91
|
+
export declare function NormalizedTooltipContent({ content, dataKeys, ...props }: Partial<TooltipRenderProps> & {
|
|
92
|
+
content?: TooltipContentType;
|
|
93
|
+
dataKeys?: string[];
|
|
94
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
/**
|
|
96
|
+
* Legend content over the same normalization. Ordering is the reason this
|
|
97
|
+
* applies unconditionally: recharts sorts legend entries alphabetically by
|
|
98
|
+
* series name by default (`itemSorter: 'value'`), so without putting them back
|
|
99
|
+
* in `dataKeys` order the legend would silently reorder itself depending on
|
|
100
|
+
* which bar-styling props happen to be set.
|
|
101
|
+
*/
|
|
102
|
+
export declare function NormalizedLegendContent({ dataKeys, ...props }: Partial<LegendRenderProps> & {
|
|
103
|
+
dataKeys: string[];
|
|
104
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
/** Paint overrides recharts spreads over a bar to mark it as the active one. */
|
|
106
|
+
interface BarPaintOverride {
|
|
107
|
+
fill?: string;
|
|
108
|
+
fillOpacity?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build the `<Bar shape>` that draws a range-scoped track. recharts' own
|
|
112
|
+
* `background` is all-or-nothing per series, so the track is drawn per row and
|
|
113
|
+
* hidden where the range doesn't apply.
|
|
114
|
+
*/
|
|
115
|
+
export declare function createTrackShape({ inRange, trackFill, paint, }: {
|
|
116
|
+
inRange: (row: number) => boolean;
|
|
117
|
+
trackFill: string;
|
|
118
|
+
paint?: BarPaintOverride;
|
|
119
|
+
}): ({ background: track, index: row, ...bar }: BarShapeProps) => import("react/jsx-runtime").JSX.Element;
|
|
120
|
+
export interface BarChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof barChartVariants>, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartDataLabelProps {
|
|
28
121
|
/** Row-per-category data. Each object holds the category key + one numeric field per series. */
|
|
29
122
|
data: ReadonlyArray<Record<string, string | number>>;
|
|
30
123
|
/**
|
|
@@ -42,12 +135,57 @@ export interface BarChartProps extends Omit<React.ComponentProps<'div'>, 'childr
|
|
|
42
135
|
* bars, X for horizontal). Each is driven by a fixed `value` or a computed
|
|
43
136
|
* series `average`. Pass a single object or an array to draw several at once.
|
|
44
137
|
*/
|
|
45
|
-
referenceLine?:
|
|
138
|
+
referenceLine?: ChartReferenceLine | ChartReferenceLine[];
|
|
139
|
+
/**
|
|
140
|
+
* One or more shaded bands behind a range of categories — e.g. a forecast
|
|
141
|
+
* period. Pass a single object or an array to draw several.
|
|
142
|
+
*/
|
|
143
|
+
referenceArea?: BarChartReferenceArea | BarChartReferenceArea[];
|
|
144
|
+
/**
|
|
145
|
+
* Per-series style override for a range of categories, keyed by `dataKeys`
|
|
146
|
+
* entry. Bars outside a series' range — and series with no entry — render
|
|
147
|
+
* normally.
|
|
148
|
+
*/
|
|
149
|
+
barSettings?: Record<string, BarChartBarSettings>;
|
|
46
150
|
/** Unit suffix on X-axis tick values (recharts `unit`) — applies when the X axis is numeric (`orientation="horizontal"`). */
|
|
47
151
|
xUnit?: string;
|
|
48
152
|
/** Corner radius applied to the growing end of each bar. */
|
|
49
153
|
barRadius?: number;
|
|
154
|
+
/** How every bar is painted. Per-range overrides come from `barSettings`. */
|
|
155
|
+
barShape?: BarChartBarShape;
|
|
156
|
+
/** Fixed bar thickness, in px. Unset, recharts sizes bars from the available width. */
|
|
157
|
+
barSize?: number;
|
|
158
|
+
/** Upper bound on the computed bar thickness, in px. */
|
|
159
|
+
maxBarSize?: number;
|
|
160
|
+
/** Gap between bars of the same category, in px or a percentage string. */
|
|
161
|
+
barGap?: number | string;
|
|
162
|
+
/** Gap between category groups, in px or a percentage string. */
|
|
163
|
+
barCategoryGap?: number | string;
|
|
164
|
+
/**
|
|
165
|
+
* Minimum rendered length for a bar, in px, so a tiny value stays visible. A
|
|
166
|
+
* value of exactly `0` still renders nothing — a floor on it would read as a
|
|
167
|
+
* small positive.
|
|
168
|
+
*/
|
|
169
|
+
minPointSize?: number;
|
|
170
|
+
/** Draw a full-height track behind every bar. */
|
|
171
|
+
showBackground?: boolean;
|
|
172
|
+
/** Fill for the track background. Defaults to the secondary surface. */
|
|
173
|
+
backgroundFill?: string;
|
|
174
|
+
/** Highlight the hovered bar. */
|
|
175
|
+
showActiveBar?: boolean;
|
|
176
|
+
/** Painting of the hovered bar when `showActiveBar` is on. */
|
|
177
|
+
activeBar?: {
|
|
178
|
+
/** Fill for the hovered bar. Defaults to the series color. */
|
|
179
|
+
fill?: string;
|
|
180
|
+
/** Fill opacity for the hovered bar. */
|
|
181
|
+
opacity?: number;
|
|
182
|
+
};
|
|
50
183
|
showLegend?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Position of the value labels when `showLabels` is on. Defaults to the growing
|
|
186
|
+
* end — `top` for vertical bars, `right` for horizontal.
|
|
187
|
+
*/
|
|
188
|
+
labelPosition?: CartesianLabelPosition;
|
|
51
189
|
}
|
|
52
190
|
declare const BarChart: React.ForwardRefExoticComponent<Omit<BarChartProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
53
191
|
export { BarChart, barChartVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BarChart, barChartVariants, type BarChartProps, type
|
|
1
|
+
export { BarChart, barChartVariants, type BarChartProps, type BarChartReferenceArea, type BarChartBarSettings, type BarChartBarShape, } from './bar-chart';
|
|
@@ -2,7 +2,7 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "destructive" | "ai" | "
|
|
5
|
+
variant?: "destructive" | "ai" | "secondary" | "default" | "ghost" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const buttonMenuVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "primary" | "secondary" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonMenuProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>, VariantProps<typeof buttonMenuVariants> {
|
|
8
8
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CalendarPanelSelected, CalendarPanelVariant } from './calendar-panel';
|
|
2
|
+
import { DayPickerLocale, DayPickerProps } from 'react-day-picker';
|
|
3
|
+
/** Number of years offered on each side of the current year by default. */
|
|
4
|
+
export declare const DEFAULT_YEAR_SPAN = 50;
|
|
5
|
+
/** A `{value, label}` pair for one `InputSelect` option in the header dropdowns. */
|
|
6
|
+
export interface CalendarSelectItem<T> {
|
|
7
|
+
value: T;
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the year dropdown's bounds: an explicit `fromYear`/`toYear` wins,
|
|
12
|
+
* otherwise falls back to `currentYear` ± `span`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveYearRange(fromYear: number | undefined, toYear: number | undefined, currentYear: number, span?: number): {
|
|
15
|
+
fromYear: number;
|
|
16
|
+
toYear: number;
|
|
17
|
+
};
|
|
18
|
+
/** Day-of-week index DayPicker accepts for `weekStartsOn` (0 = Sunday). */
|
|
19
|
+
export type WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the week's first day: an explicit `weekStartsOn` wins, then the
|
|
22
|
+
* `locale`'s own week start, then Monday (per the design default).
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveWeekStartsOn(weekStartsOn: WeekStartsOn | undefined, locale: DayPickerLocale | undefined): WeekStartsOn;
|
|
25
|
+
/**
|
|
26
|
+
* Builds the 12 month dropdown items. Formats each from year 2000 (a leap
|
|
27
|
+
* year), so every month — including February 29 — formats from a valid date.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildMonthItems(formatMonthLabel: (date: Date) => string): CalendarSelectItem<number>[];
|
|
30
|
+
/**
|
|
31
|
+
* Builds the year dropdown items spanning `fromYear`..`toYear` inclusive.
|
|
32
|
+
* An inverted range (`toYear < fromYear`) clamps to a single `fromYear` item
|
|
33
|
+
* rather than producing an empty or negative-length list.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildYearItems(fromYear: number, toYear: number): CalendarSelectItem<number>[];
|
|
36
|
+
/**
|
|
37
|
+
* Backs a header-dropdown navigation target off so the last of `numberOfMonths`
|
|
38
|
+
* displayed months doesn't run past `endMonth`. Mirrors react-day-picker's own
|
|
39
|
+
* `getInitialMonth` back-off — its `goToMonth` only clamps the *first* displayed
|
|
40
|
+
* month to `endMonth`, so for a two-month `range` panel, requesting a first month
|
|
41
|
+
* within one month of `endMonth` (e.g. `endMonth` itself) leaves the second month
|
|
42
|
+
* past the bound, and `getDisplayMonths` silently drops it instead of the pair
|
|
43
|
+
* sliding back.
|
|
44
|
+
*/
|
|
45
|
+
export declare function clampNavigationTarget(target: Date, endMonth: Date, numberOfMonths: number): Date;
|
|
46
|
+
/**
|
|
47
|
+
* Assembles DayPicker's mode-specific selection props from `variant`. DayPicker's
|
|
48
|
+
* props are a discriminated union keyed by a literal `mode`, so each branch is
|
|
49
|
+
* built separately (rather than a single object with `mode: variant`) — a
|
|
50
|
+
* literal tag is what lets TypeScript pick the matching union member without
|
|
51
|
+
* an `as DayPickerProps` assertion. `selected`/`onSelect` are cast per branch
|
|
52
|
+
* to their branch-specific shape only, which the discriminated `CalendarPanelProps`
|
|
53
|
+
* union above guarantees is safe at the call site.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildModeProps(variant: CalendarPanelVariant, selected: CalendarPanelSelected, onSelect: ((selected: CalendarPanelSelected, triggerDate: Date) => void) | undefined, min: number | undefined, max: number | undefined): DayPickerProps;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { DateRange, DayButton, DayPickerLocale, Matcher, MonthCaptionProps } from 'react-day-picker';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type CalendarPanelVariant = 'single' | 'multiple' | 'range';
|
|
4
|
+
/** Selected value, shaped by the active `variant`. */
|
|
5
|
+
export type CalendarPanelSelected = Date | Date[] | DateRange | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The header of one month column: a month `InputSelect` and a year `InputSelect`.
|
|
8
|
+
* Replaces DayPicker's `MonthCaption`.
|
|
9
|
+
*/
|
|
10
|
+
declare function CalendarHeader({ calendarMonth, displayIndex, className, ...props }: MonthCaptionProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare namespace CalendarHeader {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One day cell (Figma's "CalendarItem") — a flat 32×32 square. `data-active`
|
|
16
|
+
* (a selected day or either range endpoint) and `data-range-middle` are mutually
|
|
17
|
+
* exclusive, so their backgrounds never compete.
|
|
18
|
+
*/
|
|
19
|
+
declare function CalendarItem({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare namespace CalendarItem {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
interface CalendarPanelSharedProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'defaultValue'> {
|
|
24
|
+
/**
|
|
25
|
+
* Text direction. Forwarded to `DayPicker` explicitly — an ancestor's `dir`
|
|
26
|
+
* mirrors the panel's CSS layout automatically (logical properties), but
|
|
27
|
+
* `react-day-picker` only flips its Arrow Left/Right keyboard roaming when
|
|
28
|
+
* `dir` is passed to it directly, so it must also be passed here.
|
|
29
|
+
*/
|
|
30
|
+
dir?: 'ltr' | 'rtl';
|
|
31
|
+
/** Uncontrolled initial month shown. */
|
|
32
|
+
defaultMonth?: Date;
|
|
33
|
+
/** Controlled month shown (the first month, for `range`). */
|
|
34
|
+
month?: Date;
|
|
35
|
+
/** Called when the displayed month changes (header dropdowns). */
|
|
36
|
+
onMonthChange?: (month: Date) => void;
|
|
37
|
+
/** Days that cannot be selected. */
|
|
38
|
+
disabled?: Matcher | Matcher[];
|
|
39
|
+
/** Minimum number of selectable days (`multiple` / `range`; ignored for `single`). */
|
|
40
|
+
min?: number;
|
|
41
|
+
/** Maximum number of selectable days (`multiple` / `range`; ignored for `single`). */
|
|
42
|
+
max?: number;
|
|
43
|
+
/** Render the leading/trailing days of the adjacent months. */
|
|
44
|
+
showOutsideDays?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* First day of the week (0 = Sunday). Defaults to `locale`'s own week start,
|
|
47
|
+
* falling back to Monday (per the design) when no `locale` is given.
|
|
48
|
+
*/
|
|
49
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
50
|
+
/**
|
|
51
|
+
* First year offered by the year dropdown and the earliest month the grid
|
|
52
|
+
* can navigate to. Defaults to 50 years back.
|
|
53
|
+
*/
|
|
54
|
+
fromYear?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Last year offered by the year dropdown and the latest month the grid can
|
|
57
|
+
* navigate to. Defaults to 50 years ahead.
|
|
58
|
+
*/
|
|
59
|
+
toYear?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Localizes weekday names and DayPicker's default day-cell/caption accessible
|
|
62
|
+
* labels (e.g. `import { es } from 'react-day-picker/locale'`). Defaults to
|
|
63
|
+
* date-fns `enUS`. Does not translate `monthLabel`/`yearLabel`/`cancelLabel`/
|
|
64
|
+
* `applyLabel`/`formatMonthLabel` — those are separate props the consumer
|
|
65
|
+
* must localize themselves.
|
|
66
|
+
*/
|
|
67
|
+
locale?: DayPickerLocale;
|
|
68
|
+
/** Accessible name of the month dropdown. */
|
|
69
|
+
monthLabel?: string;
|
|
70
|
+
/** Accessible name of the year dropdown. */
|
|
71
|
+
yearLabel?: string;
|
|
72
|
+
/** Formats a month's name for the month dropdown. Defaults to `locale`-aware `date-fns` formatting. */
|
|
73
|
+
formatMonthLabel?: (date: Date) => string;
|
|
74
|
+
/** Footer "Cancel" button label (`multiple` / `range`). */
|
|
75
|
+
cancelLabel?: string;
|
|
76
|
+
/** Footer "Apply" button label (`multiple` / `range`). */
|
|
77
|
+
applyLabel?: string;
|
|
78
|
+
/** Called when the footer's Cancel button is pressed. */
|
|
79
|
+
onCancel?: () => void;
|
|
80
|
+
/** Called when the footer's Apply button is pressed. */
|
|
81
|
+
onApply?: () => void;
|
|
82
|
+
}
|
|
83
|
+
/** `variant="single"` (the default) — `selected` is a single optional `Date`. */
|
|
84
|
+
export interface CalendarPanelSingleProps extends CalendarPanelSharedProps {
|
|
85
|
+
/** Selection mode + panel structure. `multiple`/`range` add the Cancel/Apply footer; `range` shows two months. */
|
|
86
|
+
variant?: 'single';
|
|
87
|
+
/** The selected date. Uncontrolled unless `onSelect` is provided. */
|
|
88
|
+
selected?: Date;
|
|
89
|
+
/** Called when the selection changes. Providing it makes `selected` controlled. */
|
|
90
|
+
onSelect?: (selected: Date | undefined, triggerDate: Date) => void;
|
|
91
|
+
}
|
|
92
|
+
/** `variant="multiple"` — `selected` is a `Date[]`, and the footer is shown. */
|
|
93
|
+
export interface CalendarPanelMultipleProps extends CalendarPanelSharedProps {
|
|
94
|
+
variant: 'multiple';
|
|
95
|
+
selected?: Date[];
|
|
96
|
+
onSelect?: (selected: Date[] | undefined, triggerDate: Date) => void;
|
|
97
|
+
}
|
|
98
|
+
/** `variant="range"` — `selected` is a `DateRange`, two months render, and the footer is shown. */
|
|
99
|
+
export interface CalendarPanelRangeProps extends CalendarPanelSharedProps {
|
|
100
|
+
variant: 'range';
|
|
101
|
+
selected?: DateRange;
|
|
102
|
+
onSelect?: (selected: DateRange | undefined, triggerDate: Date) => void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `CalendarPanel`'s props, discriminated by `variant` — a `single` panel only
|
|
106
|
+
* accepts a `Date`, `multiple` only a `Date[]`, `range` only a `DateRange`, so
|
|
107
|
+
* mismatched `selected`/`onSelect` shapes are caught at the call site instead
|
|
108
|
+
* of silently reaching `react-day-picker` with the wrong shape at runtime.
|
|
109
|
+
*/
|
|
110
|
+
export type CalendarPanelProps = CalendarPanelSingleProps | CalendarPanelMultipleProps | CalendarPanelRangeProps;
|
|
111
|
+
declare const CalendarPanel: React.ForwardRefExoticComponent<CalendarPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
112
|
+
export { CalendarPanel, CalendarItem, CalendarHeader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CalendarPanel, CalendarItem, CalendarHeader, type CalendarPanelProps, type CalendarPanelSingleProps, type CalendarPanelMultipleProps, type CalendarPanelRangeProps, type CalendarPanelSelected, type CalendarPanelVariant, } from './calendar-panel';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Width the faked layout reports to recharts. */
|
|
2
|
+
export declare const CHART_WIDTH = 600;
|
|
3
|
+
/** Height the faked layout reports to recharts. */
|
|
4
|
+
export declare const CHART_HEIGHT = 400;
|
|
5
|
+
/**
|
|
6
|
+
* Give recharts a laid-out container for the duration of the calling test.
|
|
7
|
+
*
|
|
8
|
+
* recharts' `ResponsiveContainer` measures its box through a `ResizeObserver`,
|
|
9
|
+
* which happy-dom never fires, and reads `getBoundingClientRect()` once in its
|
|
10
|
+
* effect — so by default the chart renders at 0×0 and every SVG child bails out.
|
|
11
|
+
* Feeding it a size is what makes the axes, grid and series observable in a unit
|
|
12
|
+
* test at all; without it the only honest assertion left is "the chart root
|
|
13
|
+
* exists", which passes whether or not the feature works.
|
|
14
|
+
*
|
|
15
|
+
* Only the responsive container may report the size. recharts also measures the
|
|
16
|
+
* legend wrapper; if that reported the full height too, it would claim the whole
|
|
17
|
+
* plot area and the series would again render at zero height.
|
|
18
|
+
*
|
|
19
|
+
* happy-dom defines the rect once, on `Element.prototype` — patching that one
|
|
20
|
+
* prototype covers every element type, and patching a subclass's prototype as
|
|
21
|
+
* well would capture this wrapper as its own "original" and leave it installed
|
|
22
|
+
* after the restore.
|
|
23
|
+
*
|
|
24
|
+
* Call it inside the test, before rendering. Cleanup is registered automatically,
|
|
25
|
+
* so no `afterEach` is needed at the call site. Calling it more than once in the
|
|
26
|
+
* same test (a loop that renders one chart per case) re-stubs nothing — that
|
|
27
|
+
* would capture this wrapper as its own "original" — though each call does queue
|
|
28
|
+
* its own teardown, and the second one finds the patches already lifted.
|
|
29
|
+
*/
|
|
30
|
+
export declare function giveTheChartASize(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Suite-level form of `giveTheChartASize`, for a file where every case renders a
|
|
33
|
+
* laid-out chart — including the ones that call `render()` directly instead of
|
|
34
|
+
* going through a shared `renderChart` helper. Call it once at the top of the
|
|
35
|
+
* file; it registers its own `beforeEach`/`afterEach`, so the size is in place
|
|
36
|
+
* whichever way a case renders and is torn down between cases either way.
|
|
37
|
+
*/
|
|
38
|
+
export declare function giveEveryChartASize(): void;
|
|
39
|
+
/**
|
|
40
|
+
* The tick elements recharts painted for one cartesian axis, in document order.
|
|
41
|
+
*
|
|
42
|
+
* Selected by recharts' own `orientation` attribute rather than by descending
|
|
43
|
+
* from `.recharts-xAxis` / `.recharts-yAxis`, because as of recharts 3.8 a tick
|
|
44
|
+
* is not inside its axis group at all: the labels are hoisted into a separate
|
|
45
|
+
* top-level `recharts-zIndex-layer_*` that is a *sibling* of the axis. So
|
|
46
|
+
* `.recharts-xAxis .recharts-text` matches nothing and `axis.contains(tick)` is
|
|
47
|
+
* false — and a test written the obvious way passes vacuously instead of
|
|
48
|
+
* asserting anything. (Descendant selectors themselves are fine here; `svg text`
|
|
49
|
+
* and `clipPath rect` both work.)
|
|
50
|
+
*
|
|
51
|
+
* `'x'` and `'y'` mean *both* axes of that dimension, so on a chart with a
|
|
52
|
+
* secondary scale they return the two axes' ticks concatenated. Pass a single
|
|
53
|
+
* side (`'left'`, `'right'`, `'top'`, `'bottom'`) to assert against one of them
|
|
54
|
+
* — the orientation attribute is the only thing separating them.
|
|
55
|
+
*
|
|
56
|
+
* An empty result means "no tick carried that orientation", which is also what
|
|
57
|
+
* you get if a recharts upgrade stops emitting the attribute. Assert a length
|
|
58
|
+
* before looping, or a broken selector reads as a chart with no ticks.
|
|
59
|
+
*/
|
|
60
|
+
export type ChartAxisSide = 'left' | 'right' | 'top' | 'bottom';
|
|
61
|
+
export declare function axisTicks(container: Element, axis: 'x' | 'y' | ChartAxisSide): Element[];
|
|
62
|
+
/** Text of every tick on one cartesian axis — see `axisTicks` for the caveats. */
|
|
63
|
+
export declare function axisTickLabels(container: Element, axis: 'x' | 'y' | ChartAxisSide): (string | null)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|