@redsift/charts 8.0.0-alpha.1 → 8.0.0-alpha.3
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/CONTRIBUTING.md +3 -3
- package/index.d.ts +94 -40
- package/index.js +405 -254
- package/index.js.map +1 -1
- package/package.json +3 -2
package/CONTRIBUTING.md
CHANGED
|
@@ -355,9 +355,9 @@ yarn dev:website
|
|
|
355
355
|
|
|
356
356
|
Then, open [http://localhost:3000](http://localhost:3000) in your browser.
|
|
357
357
|
|
|
358
|
-
To add documentation for a component, a MDX file should be created in the `
|
|
358
|
+
To add documentation for a component, a MDX file should be created in the `apps/website/pages/` folder and more precisely inside the subfolder corresponding to the section the page belongs to (i.e. `apps/website/pages/forms/checkbox.mdx` for the `Checkbox` component inside the `Forms` section).
|
|
359
359
|
|
|
360
|
-
To appear in the website's Side Panel, the page should be listed in `
|
|
360
|
+
To appear in the website's Side Panel, the page should be listed in `apps/website/components/CustomAppSidePanel/CustomAppSidePanel.tsx`) under the corresponding section.
|
|
361
361
|
|
|
362
362
|
A component page should be structured as following:
|
|
363
363
|
|
|
@@ -380,7 +380,7 @@ To display a prop table, use the `PropsTable` component as following:
|
|
|
380
380
|
<PropsTable component="Button" />
|
|
381
381
|
```
|
|
382
382
|
|
|
383
|
-
To display a demo, first create a demo (a simple `tsx` file) in the demo folder (`
|
|
383
|
+
To display a demo, first create a demo (a simple `tsx` file) in the demo folder (`apps/website/demo/`) inside a subfolder with the name of the component (i.e. `apps/website/demo/button/coloring` for a coloring demo of the `Button` component). Then use the `DemoBlock` as following:
|
|
384
384
|
|
|
385
385
|
```ts
|
|
386
386
|
<DemoBlock path="button/coloring" />
|
package/index.d.ts
CHANGED
|
@@ -55,6 +55,9 @@ type DotDatum = {
|
|
|
55
55
|
y: number;
|
|
56
56
|
r: number;
|
|
57
57
|
};
|
|
58
|
+
type LegendItemDatum = {
|
|
59
|
+
data: CategoryDatum;
|
|
60
|
+
};
|
|
58
61
|
|
|
59
62
|
/** TOOLTIP */
|
|
60
63
|
declare const TooltipVariant: {
|
|
@@ -247,6 +250,15 @@ type StyledDataPointProps = Omit<DataPointProps<any>, 'data'> & {
|
|
|
247
250
|
$clickable: boolean;
|
|
248
251
|
};
|
|
249
252
|
|
|
253
|
+
declare const DataPoint: Comp<DataPointProps<any>, SVGGElement>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Component style.
|
|
257
|
+
*/
|
|
258
|
+
declare const StyledDataPoint: styled_components.StyledComponent<_react_spring_web.AnimatedComponent<"g">, any, Omit<DataPointProps<any>, "data"> & {
|
|
259
|
+
$clickable: boolean;
|
|
260
|
+
}, never>;
|
|
261
|
+
|
|
250
262
|
/**
|
|
251
263
|
* Component props.
|
|
252
264
|
*/
|
|
@@ -292,6 +304,15 @@ declare const StyledArcs: styled_components.StyledComponent<"g", any, Omit<ArcsP
|
|
|
292
304
|
/**
|
|
293
305
|
* Component variant.
|
|
294
306
|
*/
|
|
307
|
+
declare const AxisVariant: {
|
|
308
|
+
readonly none: "none";
|
|
309
|
+
readonly line: "line";
|
|
310
|
+
readonly lineTick: "lineTick";
|
|
311
|
+
readonly tick: "tick";
|
|
312
|
+
readonly tickValue: "tickValue";
|
|
313
|
+
readonly default: "default";
|
|
314
|
+
};
|
|
315
|
+
type AxisVariant = ValueOf<typeof AxisVariant>;
|
|
295
316
|
declare const AxisPosition: {
|
|
296
317
|
top: string;
|
|
297
318
|
right: string;
|
|
@@ -318,6 +339,8 @@ interface AxisProps extends Omit<ComponentProps<'g'>, 'scale'> {
|
|
|
318
339
|
tickRotation?: number;
|
|
319
340
|
tickSize?: number;
|
|
320
341
|
tickValues?: TicksSpec;
|
|
342
|
+
/** Variant. */
|
|
343
|
+
variant?: AxisVariant;
|
|
321
344
|
/** X position. */
|
|
322
345
|
x?: number;
|
|
323
346
|
/** Y position. */
|
|
@@ -390,35 +413,6 @@ declare const StyledChartContainer: styled_components.StyledComponent<"div", any
|
|
|
390
413
|
declare const StyledChartContainerTitle: styled_components.StyledComponent<_redsift_design_system.Comp<_redsift_design_system.FlexboxProps, HTMLDivElement>, any, ChartContainerProps, never>;
|
|
391
414
|
declare const StyledChartContainerCaption: styled_components.StyledComponent<"p", any, ChartContainerProps, never>;
|
|
392
415
|
|
|
393
|
-
/**
|
|
394
|
-
* Component props.
|
|
395
|
-
*/
|
|
396
|
-
interface LegendProps extends ComponentProps<'ul'> {
|
|
397
|
-
/** Data. */
|
|
398
|
-
data: (CategoryDatum & {
|
|
399
|
-
color: string;
|
|
400
|
-
})[];
|
|
401
|
-
/** Variant. */
|
|
402
|
-
variant?: LabelVariant;
|
|
403
|
-
/** Width. */
|
|
404
|
-
width?: string;
|
|
405
|
-
}
|
|
406
|
-
type StyledLegendProps = Omit<LegendProps, 'data'> & {
|
|
407
|
-
$width?: LegendProps['width'];
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
declare const Legend: Comp<LegendProps, HTMLUListElement>;
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Component style.
|
|
414
|
-
*/
|
|
415
|
-
declare const StyledLegend: styled_components.StyledComponent<"ul", any, Omit<LegendProps, "data"> & {
|
|
416
|
-
$width?: string | undefined;
|
|
417
|
-
}, never>;
|
|
418
|
-
declare const StyledLabel: styled_components.StyledComponent<"li", any, {
|
|
419
|
-
$color: string;
|
|
420
|
-
}, never>;
|
|
421
|
-
|
|
422
416
|
interface LocaleText$2 {
|
|
423
417
|
emptyChartText: string;
|
|
424
418
|
}
|
|
@@ -469,6 +463,70 @@ declare const StyledBarChartEmptyText: styled_components.StyledComponent<"div",
|
|
|
469
463
|
$textSize: number;
|
|
470
464
|
}, never>;
|
|
471
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Component props.
|
|
468
|
+
*/
|
|
469
|
+
interface DotProps extends DataPointProps<DotDatum> {
|
|
470
|
+
/** A linear continuous scale defined over a numeric domain used to determine the x position based on the coordinates. */
|
|
471
|
+
scaleX: ScaleLinear$1<number, number, never>;
|
|
472
|
+
/** A linear continuous scale defined over a numeric domain used to determine the y position based on the coordinates. */
|
|
473
|
+
scaleY: ScaleLinear$1<number, number, never>;
|
|
474
|
+
}
|
|
475
|
+
type StyledDotProps = StyledDataPointProps & Omit<DotProps, 'scaleX' | 'scaleY'>;
|
|
476
|
+
|
|
477
|
+
declare const Dot: Comp<DotProps, SVGGElement>;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Component style.
|
|
481
|
+
*/
|
|
482
|
+
declare const StyledDot: styled_components.StyledComponent<_redsift_design_system.Comp<DataPointProps<any>, SVGGElement>, any, Omit<DataPointProps<any>, "data"> & {
|
|
483
|
+
$clickable: boolean;
|
|
484
|
+
} & Omit<DotProps, "scaleX" | "scaleY">, never>;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Component props.
|
|
488
|
+
*/
|
|
489
|
+
interface LegendItemProps extends Pick<DataPointProps<LegendItemDatum>, 'color' | 'data' | 'id' | 'index' | 'isSelected' | 'labelDecorator' | 'onClick' | 'previousData' | 'role' | 'tooltipVariant'>, Omit<ComponentProps<'li'>, 'onClick' | 'role'> {
|
|
490
|
+
/** Total used to compute percentage. */
|
|
491
|
+
total?: number;
|
|
492
|
+
/** Variant. */
|
|
493
|
+
variant?: LabelVariant;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Component props.
|
|
498
|
+
*/
|
|
499
|
+
interface LegendProps extends Omit<ComponentProps<'ul'>, 'onClick'> {
|
|
500
|
+
/** Data. */
|
|
501
|
+
data: (CategoryDatum & {
|
|
502
|
+
color: string;
|
|
503
|
+
})[];
|
|
504
|
+
/** Method to determine whether a slice is selected or not. */
|
|
505
|
+
isLegendItemSelected?: (datum: LegendItemDatum) => void;
|
|
506
|
+
/** Method to override the data labels. */
|
|
507
|
+
labelDecorator?: (datum: LegendItemDatum) => string;
|
|
508
|
+
/** Method to be called on a click on a legend item. */
|
|
509
|
+
onLegendItemClick?: (datum: LegendItemDatum) => void;
|
|
510
|
+
/** LegendItem role. Used to indicate that legend items are to be considered buttons or links. If an onClick is provided, the legend items will have the role `button` unless specifically set to `link` with this prop. */
|
|
511
|
+
legendItemRole?: LegendItemProps['role'];
|
|
512
|
+
/** Variant. */
|
|
513
|
+
variant?: LabelVariant;
|
|
514
|
+
/** Width. */
|
|
515
|
+
width?: string;
|
|
516
|
+
}
|
|
517
|
+
type StyledLegendProps = Omit<LegendProps, 'data'> & {
|
|
518
|
+
$width?: LegendProps['width'];
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
declare const Legend: Comp<LegendProps, HTMLUListElement>;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Component style.
|
|
525
|
+
*/
|
|
526
|
+
declare const StyledLegend: styled_components.StyledComponent<"ul", any, Omit<LegendProps, "data"> & {
|
|
527
|
+
$width?: string | undefined;
|
|
528
|
+
}, never>;
|
|
529
|
+
|
|
472
530
|
/**
|
|
473
531
|
* Component variant.
|
|
474
532
|
*/
|
|
@@ -556,16 +614,6 @@ declare const StyledPieChartEmptyText: styled_components.StyledComponent<"div",
|
|
|
556
614
|
$isDonut: boolean;
|
|
557
615
|
}, never>;
|
|
558
616
|
|
|
559
|
-
/**
|
|
560
|
-
* Component props.
|
|
561
|
-
*/
|
|
562
|
-
interface DotProps extends DataPointProps<DotDatum> {
|
|
563
|
-
/** A linear continuous scale defined over a numeric domain used to determine the x position based on the coordinates. */
|
|
564
|
-
scaleX: ScaleLinear$1<number, number, never>;
|
|
565
|
-
/** A linear continuous scale defined over a numeric domain used to determine the y position based on the coordinates. */
|
|
566
|
-
scaleY: ScaleLinear$1<number, number, never>;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
617
|
/**
|
|
570
618
|
* Component variant.
|
|
571
619
|
*/
|
|
@@ -608,6 +656,8 @@ interface ScatterPlotProps extends ChartContainerProps {
|
|
|
608
656
|
labelDecorator?: (datum: DotDatum) => string;
|
|
609
657
|
/** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. */
|
|
610
658
|
labelVariant?: ScatterPlotLabelVariant;
|
|
659
|
+
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
660
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'>;
|
|
611
661
|
/** Labels and texts. */
|
|
612
662
|
localeText?: LocaleText;
|
|
613
663
|
/** Method called on brush. */
|
|
@@ -626,6 +676,10 @@ interface ScatterPlotProps extends ChartContainerProps {
|
|
|
626
676
|
tooltipVariant?: TooltipVariant;
|
|
627
677
|
/** Variant. */
|
|
628
678
|
variant?: ScatterPlotVariant;
|
|
679
|
+
/** X axis variant. */
|
|
680
|
+
xAxisVariant?: AxisVariant;
|
|
681
|
+
/** Y axis variant. */
|
|
682
|
+
yAxisVariant?: AxisVariant;
|
|
629
683
|
}
|
|
630
684
|
type StyledScatterPlotProps = ScatterPlotProps & {};
|
|
631
685
|
|
|
@@ -640,4 +694,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
|
|
|
640
694
|
$textSize: number;
|
|
641
695
|
}, never>;
|
|
642
696
|
|
|
643
|
-
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, Bar, BarChart, BarChartDimensions, BarChartProps, BarDatum, BarOrientation, BarProps, CategoryData, CategoryDatum, CategoryDim, ChartContainer, ChartContainerProps, ChartDimensions, ChartSize, ChartTheme, ColorTheme, Coordinates, CoordinatesCategoryData, CoordinatesCategoryDatum, CoordinatesCategoryDim, CustomColorTheme, Datum, DotDatum, JSONArray, JSONObject, JSONValue, LabelVariant, Legend, LegendProps, NumericValue, PieChart, PieChartDimensions, PieChartLabelVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLabelVariant, ScatterPlotProps, ScatterPlotVariant, StringValue, StyledArc, StyledArcProps, StyledArcs, StyledArcsProps, StyledAxis, StyledAxisProps, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledBarChartProps, StyledBarProps, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerProps, StyledChartContainerTitle,
|
|
697
|
+
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartProps, BarDatum, BarOrientation, BarProps, CategoryData, CategoryDatum, CategoryDim, ChartContainer, ChartContainerProps, ChartDimensions, ChartSize, ChartTheme, ColorTheme, Coordinates, CoordinatesCategoryData, CoordinatesCategoryDatum, CoordinatesCategoryDim, CustomColorTheme, DataPoint, DataPointProps, Datum, Dot, DotDatum, DotProps, JSONArray, JSONObject, JSONValue, LabelVariant, Legend, LegendItemDatum, LegendProps, NumericValue, PieChart, PieChartDimensions, PieChartLabelVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLabelVariant, ScatterPlotProps, ScatterPlotVariant, StringValue, StyledArc, StyledArcProps, StyledArcs, StyledArcsProps, StyledAxis, StyledAxisProps, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledBarChartProps, StyledBarProps, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerProps, StyledChartContainerTitle, StyledDataPoint, StyledDataPointProps, StyledDot, StyledDotProps, StyledLegend, StyledLegendProps, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartProps, StyledScatterPlot, StyledScatterPlotEmptyText, StyledScatterPlotProps, SuccessDangerColorTheme, TicksSpec, TooltipVariant, UseBrushProps, UseColorProps, UseFormatCategoricalDataProps, UseZoomProps, empty, getColorScale, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|