@redsift/charts 8.0.0-alpha.2 → 8.0.0-alpha.4

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 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 `packages/website/pages/` folder and more precisely inside the subfolder corresponding to the section the page belongs to (i.e. `packages/website/pages/forms/checkbox.mdx` for the `Checkbox` component inside the `Forms` section).
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 `packages/website/components/CustomAppSidePanel/CustomAppSidePanel.tsx`) under the corresponding section.
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 (`packages/website/demo/`) inside a subfolder with the name of the component (i.e. `packages/website/demo/button/coloring` for a coloring demo of the `Button` component). Then use the `DemoBlock` as following:
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: {
@@ -483,11 +486,29 @@ declare const StyledDot: styled_components.StyledComponent<_redsift_design_syste
483
486
  /**
484
487
  * Component props.
485
488
  */
486
- interface LegendProps extends ComponentProps<'ul'> {
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'> {
487
500
  /** Data. */
488
501
  data: (CategoryDatum & {
489
502
  color: string;
490
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'];
491
512
  /** Variant. */
492
513
  variant?: LabelVariant;
493
514
  /** Width. */
@@ -505,9 +526,6 @@ declare const Legend: Comp<LegendProps, HTMLUListElement>;
505
526
  declare const StyledLegend: styled_components.StyledComponent<"ul", any, Omit<LegendProps, "data"> & {
506
527
  $width?: string | undefined;
507
528
  }, never>;
508
- declare const StyledLabel: styled_components.StyledComponent<"li", any, {
509
- $color: string;
510
- }, never>;
511
529
 
512
530
  /**
513
531
  * Component variant.
@@ -638,6 +656,8 @@ interface ScatterPlotProps extends ChartContainerProps {
638
656
  labelDecorator?: (datum: DotDatum) => string;
639
657
  /** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. */
640
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'>;
641
661
  /** Labels and texts. */
642
662
  localeText?: LocaleText;
643
663
  /** Method called on brush. */
@@ -674,4 +694,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
674
694
  $textSize: number;
675
695
  }, never>;
676
696
 
677
- 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, 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, StyledLabel, 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 };
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 };