@redsift/charts 10.3.0-alpha.4 → 10.3.0-alpha.6
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 +0 -4
- package/index.d.ts +33 -4
- package/index.js +411 -267
- package/index.js.map +1 -1
- package/package.json +2 -2
package/CONTRIBUTING.md
CHANGED
|
@@ -137,9 +137,6 @@ import { BadgeProps } from './types';
|
|
|
137
137
|
|
|
138
138
|
const COMPONENT_NAME = 'Badge';
|
|
139
139
|
const CLASSNAME = 'redsift-badge';
|
|
140
|
-
const DEFAULT_PROPS: Partial<BadgeProps> = {
|
|
141
|
-
// default values
|
|
142
|
-
};
|
|
143
140
|
|
|
144
141
|
/**
|
|
145
142
|
* The Badge component.
|
|
@@ -162,7 +159,6 @@ export const Badge: Comp<BadgeProps, HTMLDivElement> = forwardRef((props, ref) =
|
|
|
162
159
|
);
|
|
163
160
|
});
|
|
164
161
|
Badge.className = CLASSNAME;
|
|
165
|
-
Badge.defaultProps = DEFAULT_PROPS;
|
|
166
162
|
Badge.displayName = COMPONENT_NAME;
|
|
167
163
|
```
|
|
168
164
|
|
package/index.d.ts
CHANGED
|
@@ -394,6 +394,8 @@ interface DataPointProps<T> extends Omit<ComponentProps<'g'>, 'onClick' | 'scale
|
|
|
394
394
|
color?: string;
|
|
395
395
|
/** Data. Also state to which the component should end the animation, if any. */
|
|
396
396
|
data: T;
|
|
397
|
+
/** Href when the component is a navigation link. */
|
|
398
|
+
href?: string;
|
|
397
399
|
/** Id. Used for accessibility. */
|
|
398
400
|
id?: string;
|
|
399
401
|
/** Position in the list of siblings. Used for placement and selection. */
|
|
@@ -411,7 +413,7 @@ interface DataPointProps<T> extends Omit<ComponentProps<'g'>, 'onClick' | 'scale
|
|
|
411
413
|
/** State from which the component should start the animation, if any. */
|
|
412
414
|
previousData?: T;
|
|
413
415
|
/** Role. Will be set to 'button' if onClick is provided. If 'option', then the component becomes selectable. */
|
|
414
|
-
role?: 'button' | 'link' | 'option';
|
|
416
|
+
role?: 'img' | 'button' | 'link' | 'option';
|
|
415
417
|
/** Theme. */
|
|
416
418
|
theme?: Theme;
|
|
417
419
|
/** Tooltip variant. */
|
|
@@ -542,6 +544,23 @@ interface ChartContainerProps extends Omit<ComponentProps<'div'>, 'title'>, Cont
|
|
|
542
544
|
title?: string | ReactElement;
|
|
543
545
|
/** Theme. */
|
|
544
546
|
theme?: Theme;
|
|
547
|
+
/** Description that won't be visually displayed but will be used for assistive technology. If you want to display the description, use `description` instead. */
|
|
548
|
+
descriptionForAssistiveTechnology?: string;
|
|
549
|
+
/** Whether the chart is static or interactive. */
|
|
550
|
+
mode?: 'static' | 'interactive';
|
|
551
|
+
/** Small text explaining which kind of chart is presenting and what's its basic composition. */
|
|
552
|
+
definition?: string;
|
|
553
|
+
/** Small text explaining the basic composition of the x-axis, if any. */
|
|
554
|
+
xAxisDefinition?: string;
|
|
555
|
+
/** Small text explaining the basic composition of the y-axis, if any. */
|
|
556
|
+
yAxisDefinition?: string;
|
|
557
|
+
/** Small text explaining how the chart is interactive, if any. */
|
|
558
|
+
interactionExplanation?: string;
|
|
559
|
+
/** Table representation of the chart. */
|
|
560
|
+
dataTableRepresentation?: {
|
|
561
|
+
header: ReactElement;
|
|
562
|
+
body: ReactElement;
|
|
563
|
+
};
|
|
545
564
|
}
|
|
546
565
|
type StyledChartContainerProps = Omit<ChartContainerProps, 'theme'> & {
|
|
547
566
|
$theme: Theme;
|
|
@@ -643,7 +662,7 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
643
662
|
/** @deprecated: Use xAxisTickRotation instead. Whether the x axis labels are rotated or not. */
|
|
644
663
|
areXLabelsRotated?: boolean;
|
|
645
664
|
/** Native HTML props to forward to each bar. */
|
|
646
|
-
barProps?: Omit<ComponentProps<'g'>, 'onClick' | 'orientation' | 'ref' | 'scale'
|
|
665
|
+
barProps?: Omit<ComponentProps<'g'>, 'onClick' | 'orientation' | 'ref' | 'scale'>;
|
|
647
666
|
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
648
667
|
caping?: number;
|
|
649
668
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
@@ -652,6 +671,11 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
652
671
|
dataType?: 'TwoCategoryData' | 'LinearData' | 'CategoryData';
|
|
653
672
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
654
673
|
emptyComponent?: ReactNode;
|
|
674
|
+
/** Method used to define the href on a bar used as a navigation link. */
|
|
675
|
+
getBarAnchorProps?: (datum: BarDatum) => {
|
|
676
|
+
href: string;
|
|
677
|
+
target?: string;
|
|
678
|
+
};
|
|
655
679
|
/** Method to determine whether a slice is selected or not. */
|
|
656
680
|
isBarSelected?: (datum: BarDatum) => void;
|
|
657
681
|
/** Method to override the data labels. */
|
|
@@ -674,7 +698,7 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
674
698
|
localeText?: LocaleText$3;
|
|
675
699
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
676
700
|
margins?: MarginProps;
|
|
677
|
-
/** Method to be called on a click on a bar. */
|
|
701
|
+
/** Method to be called on a click on a bar. For a navigation link, please use `getBarAnchorProps` instead. */
|
|
678
702
|
onBarClick?: (datum: BarDatum) => void;
|
|
679
703
|
/** Orientation of the bar. */
|
|
680
704
|
orientation?: BarOrientation;
|
|
@@ -895,6 +919,11 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
895
919
|
data?: CategoryData;
|
|
896
920
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
897
921
|
emptyComponent?: ReactNode;
|
|
922
|
+
/** Method used to define the href on a bar used as a navigation link. */
|
|
923
|
+
getSliceAnchorProps?: (datum: ArcDatum) => {
|
|
924
|
+
href: string;
|
|
925
|
+
target?: string;
|
|
926
|
+
};
|
|
898
927
|
/** Whether the pie or donut is cut in half or not. */
|
|
899
928
|
isHalf?: boolean;
|
|
900
929
|
/** Method to determine whether a slice is selected or not. */
|
|
@@ -917,7 +946,7 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
917
946
|
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant'>;
|
|
918
947
|
/** Labels and texts. */
|
|
919
948
|
localeText?: LocaleText$1;
|
|
920
|
-
/** Method to be called on a click on a slice. */
|
|
949
|
+
/** Method to be called on a click on a slice. For a navigation link, please use `getSliceAnchorProps` instead. */
|
|
921
950
|
onSliceClick?: (datum: ArcDatum) => void;
|
|
922
951
|
/** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */
|
|
923
952
|
others?: boolean | string;
|