@ssa-ui-kit/core 1.0.11 → 1.0.12

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 (29) hide show
  1. package/dist/components/PieChart/types.d.ts +3 -3
  2. package/dist/components/SegmentedPieChart/SegmentedPieChart.d.ts +1 -1
  3. package/dist/components/SegmentedPieChart/components/ChartTitle.d.ts +4 -0
  4. package/dist/components/SegmentedPieChart/components/ChartTooltip.d.ts +5 -0
  5. package/dist/components/SegmentedPieChart/components/LegendItem.d.ts +2 -0
  6. package/dist/components/SegmentedPieChart/components/index.d.ts +3 -0
  7. package/dist/components/SegmentedPieChart/hooks/index.d.ts +1 -0
  8. package/dist/components/SegmentedPieChart/hooks/useData.d.ts +5 -0
  9. package/dist/components/SegmentedPieChart/stories/fixtures.d.ts +5 -3
  10. package/dist/components/SegmentedPieChart/types.d.ts +29 -16
  11. package/dist/components/SegmentedPieChart/utils.d.ts +1 -0
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/components/PieChart/PieChart.stories.tsx +2 -2
  16. package/src/components/PieChart/types.ts +3 -3
  17. package/src/components/SegmentedPieChart/SegmentedPieChart.spec.tsx +11 -9
  18. package/src/components/SegmentedPieChart/SegmentedPieChart.tsx +38 -103
  19. package/src/components/SegmentedPieChart/components/ChartTitle.tsx +34 -0
  20. package/src/components/SegmentedPieChart/components/ChartTooltip.tsx +85 -0
  21. package/src/components/SegmentedPieChart/components/LegendItem.tsx +36 -0
  22. package/src/components/SegmentedPieChart/components/index.ts +3 -0
  23. package/src/components/SegmentedPieChart/hooks/index.ts +1 -0
  24. package/src/components/SegmentedPieChart/hooks/useData.ts +71 -0
  25. package/src/components/SegmentedPieChart/stories/SegmentedPieChart.stories.tsx +44 -7
  26. package/src/components/SegmentedPieChart/stories/fixtures.ts +72 -45
  27. package/src/components/SegmentedPieChart/types.ts +37 -16
  28. package/src/components/SegmentedPieChart/utils.ts +2 -0
  29. package/tsbuildcache +1 -1
@@ -1,17 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import { SerializedStyles } from '@emotion/react';
3
- import { ResponsivePie } from '@nivo/pie';
3
+ import { ResponsivePie, MayHaveLabel } from '@nivo/pie';
4
4
  import { CommonProps } from '../..';
5
5
  export interface PieChartProps extends CommonProps, React.ComponentProps<typeof ResponsivePie> {
6
6
  title?: React.ReactNode;
7
7
  children?: React.ReactNode;
8
8
  }
9
- export type PieChartLegendItem = {
9
+ export interface PieChartLegendItem extends MayHaveLabel {
10
10
  id: string | number;
11
11
  value: string | number;
12
12
  label: string;
13
13
  [key: string | number | symbol]: unknown;
14
- };
14
+ }
15
15
  export interface PieChartLegendProps {
16
16
  data: Array<PieChartLegendItem>;
17
17
  colors?: Array<keyof MainColors>;
@@ -1,2 +1,2 @@
1
1
  import { SegmentedPieChartProps } from './types';
2
- export declare const SegmentedPieChart: ({ data, pieChartProps, pieChartLegendProps, legendBackgrounds, pieChartColors, currency, otherLabel, }: SegmentedPieChartProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
2
+ export declare const SegmentedPieChart: ({ data, pieChartProps, pieChartLegendProps, legendBackgrounds, pieChartColors, currency, otherLabel, totalAmount, totalDimension, legendValueRoundingDigits, legendPercentageRoundingDigits, showDimensions, showPercentage, }: SegmentedPieChartProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const ChartTitle: ({ totalAmount, totalDimension, }: {
2
+ totalAmount: number;
3
+ totalDimension: string;
4
+ }) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
@@ -0,0 +1,5 @@
1
+ import { MayHaveLabel, PieTooltipProps } from '@nivo/pie';
2
+ export declare const ChartTooltip: ({ point, legendPercentageRoundingDigits, }: {
3
+ point: PieTooltipProps<MayHaveLabel>;
4
+ legendPercentageRoundingDigits: number;
5
+ }) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
@@ -0,0 +1,2 @@
1
+ import { LegendItemProps } from '../types';
2
+ export declare const LegendItem: ({ label, legendLabel, percentage, legendValue, legendValueRoundingDigits, legendPercentageRoundingDigits, showDimensions, showPercentage, otherLabel, currency, }: LegendItemProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './ChartTooltip';
2
+ export * from './ChartTitle';
3
+ export * from './LegendItem';
@@ -0,0 +1 @@
1
+ export * from './useData';
@@ -0,0 +1,5 @@
1
+ import { BalanceDataForGraph, SegmentedPieChartProps } from '../types';
2
+ export declare const useData: ({ data, pieChartColors, legendValueRoundingDigits, }: Pick<SegmentedPieChartProps, 'data' | 'pieChartColors' | 'legendValueRoundingDigits'>) => {
3
+ balanceDataForTheGraph: BalanceDataForGraph[];
4
+ balanceDataForTheLegend: BalanceDataForGraph[];
5
+ };
@@ -1,3 +1,5 @@
1
- import { BalanceData } from '../types';
2
- export declare const balanceData: BalanceData;
3
- export declare const balanceMissedPartsData: BalanceData;
1
+ import { SegmentedDataSet } from '../types';
2
+ export declare const balanceData: SegmentedDataSet;
3
+ export declare const balanceTotalAmount: number;
4
+ export declare const balanceMissedPartsData: SegmentedDataSet;
5
+ export declare const balanceMissedPartsDataTotalAmount: number;
@@ -1,32 +1,38 @@
1
1
  /// <reference types="react" />
2
2
  import { CommonProps } from '../../types/emotion';
3
- import { MayHaveLabel } from '@nivo/pie';
4
- import { PieChartLegend, PieChartProps } from '../index';
5
- type BalanceDataPartsItem = {
3
+ import { PieChartLegend, PieChartLegendItem, PieChartProps } from '../index';
4
+ type SegmentedDataMainInfo = {
6
5
  label: string;
7
- percentage: number;
8
- value: number;
9
- };
10
- type BalanceDataItem = {
11
- id: number;
12
6
  value: number;
13
- label: string;
14
- percentage: number;
15
- parts?: BalanceDataPartsItem[];
7
+ legendValue: number;
16
8
  };
17
- export type BalanceData = Array<BalanceDataItem>;
9
+ export interface SegmentedDataItem extends PieChartLegendItem {
10
+ legendValue: number;
11
+ legendLabel?: string;
12
+ parts?: SegmentedDataMainInfo[];
13
+ }
14
+ export type SegmentedDataSet = Array<SegmentedDataItem>;
18
15
  export interface SegmentedPieChartProps extends CommonProps {
19
- data: BalanceData;
16
+ data: SegmentedDataSet;
17
+ totalAmount: number;
18
+ totalDimension: string;
20
19
  pieChartProps?: Partial<PieChartProps>;
21
20
  pieChartLegendProps?: Partial<React.ComponentProps<typeof PieChartLegend>>;
22
21
  legendBackgrounds?: string[];
23
22
  pieChartColors?: string[][];
24
23
  currency?: string;
25
24
  otherLabel?: string;
25
+ legendValueRoundingDigits?: number;
26
+ legendPercentageRoundingDigits?: number;
27
+ showDimensions?: boolean;
28
+ showPercentage?: boolean;
26
29
  }
27
- export interface BalanceDataForGraph extends MayHaveLabel {
28
- mainLabel: string;
29
- mainPercentage: number;
30
+ export interface BalanceDataForGraph extends PieChartLegendItem {
31
+ label: string;
32
+ legendLabel?: string;
33
+ legendValueRoundingDigits: number;
34
+ percentage: number;
35
+ partIndex?: number;
30
36
  partLabel?: string;
31
37
  partPercentage?: number;
32
38
  id: number | string;
@@ -34,4 +40,11 @@ export interface BalanceDataForGraph extends MayHaveLabel {
34
40
  value: number | string;
35
41
  color: string;
36
42
  }
43
+ export type LegendItemProps = {
44
+ label: string;
45
+ legendLabel?: string;
46
+ percentage?: number;
47
+ legendValue?: number;
48
+ legendValueRoundingDigits: number;
49
+ } & Pick<SegmentedPieChartProps, 'showDimensions' | 'legendPercentageRoundingDigits' | 'otherLabel' | 'currency' | 'showPercentage'>;
37
50
  export {};
@@ -0,0 +1 @@
1
+ export declare const getRoundedNumber: (number: unknown, roundingDigits: number) => number;