@hero-design/rn 8.99.4 → 8.100.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.
Files changed (121) hide show
  1. package/.turbo/turbo-build.log +8 -3
  2. package/CHANGELOG.md +17 -0
  3. package/es/index.js +5621 -690
  4. package/jest.config.js +1 -1
  5. package/lib/index.js +5545 -613
  6. package/package.json +4 -2
  7. package/src/components/Avatar/AvatarStack/utils.ts +6 -4
  8. package/src/components/Badge/Status.tsx +1 -1
  9. package/src/components/Badge/__tests__/Status.spec.tsx +20 -0
  10. package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -0
  11. package/src/components/Chart/ChartSelect/StyledChartSelect.tsx +9 -0
  12. package/src/components/Chart/ChartSelect/__tests__/StyledChartSelect.spec.tsx +15 -0
  13. package/src/components/Chart/ChartSelect/__tests__/__snapshots__/StyledChartSelect.spec.tsx.snap +20 -0
  14. package/src/components/Chart/ChartSelect/__tests__/index.spec.tsx +111 -0
  15. package/src/components/Chart/ChartSelect/index.tsx +137 -0
  16. package/src/components/Chart/ColumnChart/ColumnChartContent.tsx +84 -0
  17. package/src/components/Chart/ColumnChart/Segment.tsx +66 -0
  18. package/src/components/Chart/ColumnChart/StackedSegment.tsx +99 -0
  19. package/src/components/Chart/ColumnChart/StyledColumnChart.tsx +9 -0
  20. package/src/components/Chart/ColumnChart/__tests__/ColumnChartContent.spec.tsx +68 -0
  21. package/src/components/Chart/ColumnChart/__tests__/Segment.spec.tsx +99 -0
  22. package/src/components/Chart/ColumnChart/__tests__/StackedSegment.spec.tsx +115 -0
  23. package/src/components/Chart/ColumnChart/__tests__/__snapshots__/StackedSegment.spec.tsx.snap +120 -0
  24. package/src/components/Chart/ColumnChart/__tests__/__snapshots__/index.spec.tsx.snap +1405 -0
  25. package/src/components/Chart/ColumnChart/__tests__/index.spec.tsx +134 -0
  26. package/src/components/Chart/ColumnChart/index.tsx +216 -0
  27. package/src/components/Chart/Line/Line.tsx +81 -0
  28. package/src/components/Chart/Line/__tests__/Line.spec.tsx +148 -0
  29. package/src/components/Chart/Line/__tests__/__snapshots__/Line.spec.tsx.snap +56 -0
  30. package/src/components/Chart/Line/__tests__/__snapshots__/index.spec.tsx.snap +1461 -0
  31. package/src/components/Chart/Line/__tests__/index.spec.tsx +112 -0
  32. package/src/components/Chart/Line/index.tsx +143 -0
  33. package/src/components/Chart/StyledChart.tsx +16 -0
  34. package/src/components/Chart/index.tsx +13 -0
  35. package/src/components/Chart/shared/AxisLabel.tsx +25 -0
  36. package/src/components/Chart/shared/ChartFrame.tsx +131 -0
  37. package/src/components/Chart/shared/ChartHeader.tsx +19 -0
  38. package/src/components/Chart/shared/EmptyState.tsx +83 -0
  39. package/src/components/Chart/shared/XAxis.tsx +69 -0
  40. package/src/components/Chart/shared/XAxisGrid.tsx +42 -0
  41. package/src/components/Chart/shared/YAxis.tsx +104 -0
  42. package/src/components/Chart/shared/YAxisGrid.tsx +58 -0
  43. package/src/components/Chart/shared/__tests__/ChartFrame.spec.tsx +125 -0
  44. package/src/components/Chart/shared/__tests__/ChartHeader.spec.tsx +22 -0
  45. package/src/components/Chart/shared/__tests__/EmptyState.spec.tsx +29 -0
  46. package/src/components/Chart/shared/__tests__/XAXisGrid.spec.tsx +30 -0
  47. package/src/components/Chart/shared/__tests__/XAxis.spec.tsx +42 -0
  48. package/src/components/Chart/shared/__tests__/YAxis.spec.tsx +72 -0
  49. package/src/components/Chart/shared/__tests__/YAxisGrid.spec.tsx +35 -0
  50. package/src/components/Chart/shared/__tests__/__snapshots__/ChartFrame.spec.tsx.snap +3058 -0
  51. package/src/components/Chart/shared/__tests__/__snapshots__/ChartHeader.spec.tsx.snap +160 -0
  52. package/src/components/Chart/shared/__tests__/__snapshots__/EmptyState.spec.tsx.snap +155 -0
  53. package/src/components/Chart/shared/__tests__/__snapshots__/XAXisGrid.spec.tsx.snap +197 -0
  54. package/src/components/Chart/shared/__tests__/__snapshots__/XAxis.spec.tsx.snap +369 -0
  55. package/src/components/Chart/shared/__tests__/__snapshots__/YAxis.spec.tsx.snap +1013 -0
  56. package/src/components/Chart/shared/__tests__/__snapshots__/YAxisGrid.spec.tsx.snap +228 -0
  57. package/src/components/Chart/shared/__tests__/niceNumbers.spec.tsx +127 -0
  58. package/src/components/Chart/shared/constants.ts +2 -0
  59. package/src/components/Chart/shared/hooks/useColorScale.ts +25 -0
  60. package/src/components/Chart/shared/hooks/useGenerateTicks.ts +27 -0
  61. package/src/components/Chart/shared/hooks/useScaleBandX.ts +17 -0
  62. package/src/components/Chart/shared/hooks/useScaleLinearY.ts +30 -0
  63. package/src/components/Chart/shared/niceNumbers.ts +68 -0
  64. package/src/components/Chart/types.ts +100 -0
  65. package/src/components/Select/MultiSelect/OptionList.tsx +1 -1
  66. package/src/components/Select/MultiSelect/index.tsx +2 -6
  67. package/src/components/Select/MultiSelect/utils.ts +1 -1
  68. package/src/components/Select/SingleSelect/OptionList.tsx +1 -1
  69. package/src/components/Select/SingleSelect/index.tsx +2 -7
  70. package/src/components/Select/__tests__/helpers.spec.tsx +0 -36
  71. package/src/components/Select/helpers.tsx +0 -75
  72. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +3 -0
  73. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +1 -0
  74. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +3 -0
  75. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +2 -0
  76. package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +1 -0
  77. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
  78. package/src/index.ts +2 -0
  79. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +28 -0
  80. package/src/theme/components/chart.ts +28 -0
  81. package/src/theme/components/columnChart.ts +15 -0
  82. package/src/theme/getTheme.ts +6 -0
  83. package/src/types.ts +4 -0
  84. package/src/utils/__tests__/helpers.spec.ts +36 -1
  85. package/src/utils/helpers.ts +76 -1
  86. package/stats/8.100.0/rn-stats.html +4842 -0
  87. package/stats/8.99.4/rn-stats.html +1 -1
  88. package/types/components/Badge/Status.d.ts +0 -1
  89. package/types/components/Chart/ChartSelect/StyledChartSelect.d.ts +8 -0
  90. package/types/components/Chart/ChartSelect/index.d.ts +63 -0
  91. package/types/components/Chart/ColumnChart/ColumnChartContent.d.ts +25 -0
  92. package/types/components/Chart/ColumnChart/Segment.d.ts +14 -0
  93. package/types/components/Chart/ColumnChart/StackedSegment.d.ts +28 -0
  94. package/types/components/Chart/ColumnChart/StyledColumnChart.d.ts +8 -0
  95. package/types/components/Chart/ColumnChart/index.d.ts +80 -0
  96. package/types/components/Chart/Line/Line.d.ts +21 -0
  97. package/types/components/Chart/Line/index.d.ts +35 -0
  98. package/types/components/Chart/StyledChart.d.ts +9 -0
  99. package/types/components/Chart/index.d.ts +9 -0
  100. package/types/components/Chart/shared/AxisLabel.d.ts +7 -0
  101. package/types/components/Chart/shared/ChartFrame.d.ts +30 -0
  102. package/types/components/Chart/shared/ChartHeader.d.ts +8 -0
  103. package/types/components/Chart/shared/EmptyState.d.ts +8 -0
  104. package/types/components/Chart/shared/XAxis.d.ts +8 -0
  105. package/types/components/Chart/shared/XAxisGrid.d.ts +8 -0
  106. package/types/components/Chart/shared/YAxis.d.ts +10 -0
  107. package/types/components/Chart/shared/YAxisGrid.d.ts +10 -0
  108. package/types/components/Chart/shared/constants.d.ts +2 -0
  109. package/types/components/Chart/shared/hooks/useColorScale.d.ts +7 -0
  110. package/types/components/Chart/shared/hooks/useGenerateTicks.d.ts +6 -0
  111. package/types/components/Chart/shared/hooks/useScaleBandX.d.ts +8 -0
  112. package/types/components/Chart/shared/hooks/useScaleLinearY.d.ts +9 -0
  113. package/types/components/Chart/shared/niceNumbers.d.ts +12 -0
  114. package/types/components/Chart/types.d.ts +84 -0
  115. package/types/components/Select/helpers.d.ts +0 -5
  116. package/types/index.d.ts +2 -1
  117. package/types/theme/components/chart.d.ts +22 -0
  118. package/types/theme/components/columnChart.d.ts +10 -0
  119. package/types/theme/getTheme.d.ts +4 -0
  120. package/types/types.d.ts +3 -1
  121. package/types/utils/helpers.d.ts +5 -0
@@ -6,7 +6,6 @@ export interface StatusProps extends ViewProps {
6
6
  * Whether the Status Badge is visible.
7
7
  */
8
8
  visible?: boolean;
9
- /**
10
9
  /**
11
10
  * Visual intent color to apply to Status Badge.
12
11
  */
@@ -0,0 +1,8 @@
1
+ import { View } from 'react-native';
2
+ declare const StyledHeaderContainer: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
3
+ theme?: import("@emotion/react").Theme;
4
+ as?: React.ElementType;
5
+ }, {}, {
6
+ ref?: import("react").Ref<View> | undefined;
7
+ }>;
8
+ export { StyledHeaderContainer };
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ import { BottomSheetProps } from '../../BottomSheet';
4
+ /**
5
+ * Represents a selectable option for ChartSelect.
6
+ * @template V The type of the option value.
7
+ * @property value The value of the option. Used for selection and comparison.
8
+ * @property text The display text for the option.
9
+ * @property key (Optional) A unique key for the option. If provided, used as the FlatList key for better performance and stability.
10
+ */
11
+ type OptionType<V> = {
12
+ value: V;
13
+ text: string;
14
+ key?: string;
15
+ };
16
+ export interface SingleSelectProps<V> {
17
+ /**
18
+ * The currently selected value. Should match one of the values in the options array.
19
+ */
20
+ value: V | null;
21
+ /**
22
+ * Callback fired when an option is selected.
23
+ * @param value The value of the selected option.
24
+ */
25
+ onConfirm: (value: V) => void;
26
+ /**
27
+ * Array of supported orientations for the Select modal (iOS only).
28
+ * Defaults to ['portrait'].
29
+ */
30
+ supportedOrientations?: ('portrait' | 'landscape')[];
31
+ /**
32
+ * The list of selectable options. Each option should have a value and display text.
33
+ */
34
+ options: OptionType<V>[];
35
+ /**
36
+ * Callback fired when the selection modal is dismissed without selecting an option.
37
+ */
38
+ onDismiss?: () => void;
39
+ /**
40
+ * Configuration for the bottom sheet modal.
41
+ * - variant: The visual variant of the bottom sheet.
42
+ * - header: Optional header text to display at the top of the bottom sheet.
43
+ */
44
+ bottomSheetConfig?: {
45
+ variant?: BottomSheetProps['variant'];
46
+ header?: BottomSheetProps['header'];
47
+ };
48
+ /**
49
+ * If true, the select is disabled and cannot be interacted with.
50
+ * @default false
51
+ */
52
+ disabled?: boolean;
53
+ /**
54
+ * Additional style to apply to the select container.
55
+ */
56
+ style?: StyleProp<ViewStyle>;
57
+ /**
58
+ * Optional test ID for testing purposes. Applied to the main touchable area.
59
+ */
60
+ testID?: string;
61
+ }
62
+ declare const SingleSelect: <V>({ onConfirm, onDismiss, options, disabled, style, testID, value, supportedOrientations, bottomSheetConfig, }: SingleSelectProps<V>) => React.JSX.Element;
63
+ export default SingleSelect;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { DataValue, Series, XAxisConfig, YAxisConfig } from '../types';
3
+ interface ColumnChartContentProps {
4
+ coordinates: {
5
+ yStart: number;
6
+ yEnd: number;
7
+ xStart: number;
8
+ xEnd: number;
9
+ };
10
+ data: Array<Series<Array<DataValue>>>;
11
+ yAxisConfig: Omit<YAxisConfig, 'minValue'>;
12
+ xAxisConfig: XAxisConfig;
13
+ /**
14
+ * Called when a bar (column segment) is pressed.
15
+ */
16
+ onBarPress?: (info: {
17
+ value: number | undefined;
18
+ xLabel: string;
19
+ seriesLabel: string;
20
+ seriesIndex: number;
21
+ xIndex: number;
22
+ }) => void;
23
+ }
24
+ declare const _default: React.MemoExoticComponent<({ coordinates, data, yAxisConfig, xAxisConfig, onBarPress, }: ColumnChartContentProps) => React.JSX.Element>;
25
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface SegmentProps {
3
+ xCenter: number;
4
+ y: number;
5
+ height: number;
6
+ color?: string;
7
+ value?: number;
8
+ xLabel: string;
9
+ seriesLabel: string;
10
+ testID: string;
11
+ onPress?: () => void;
12
+ }
13
+ declare const _default: React.MemoExoticComponent<({ xCenter, y, height, color, value, xLabel, seriesLabel, testID, onPress, }: SegmentProps) => React.JSX.Element>;
14
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { DataValue, YAxisConfig } from '../types';
3
+ interface StackedSegmentProps {
4
+ stackedData: Array<DataValue>;
5
+ seriesLabels: Array<string>;
6
+ xLabel: string;
7
+ yAxisConfig: YAxisConfig;
8
+ coordinates: {
9
+ yStart: number;
10
+ yEnd: number;
11
+ xStart: number;
12
+ xEnd: number;
13
+ };
14
+ xCenter: number;
15
+ xIndex: number;
16
+ /**
17
+ * Called when a bar (column segment) is pressed.
18
+ */
19
+ onBarPress?: (info: {
20
+ value: number | undefined;
21
+ xLabel: string;
22
+ seriesLabel: string;
23
+ seriesIndex: number;
24
+ xIndex: number;
25
+ }) => void;
26
+ }
27
+ declare const _default: React.NamedExoticComponent<StackedSegmentProps>;
28
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { View } from 'react-native';
2
+ declare const StyledColumnChartWrapper: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
3
+ theme?: import("@emotion/react").Theme;
4
+ as?: React.ElementType;
5
+ }, {}, {
6
+ ref?: import("react").Ref<View> | undefined;
7
+ }>;
8
+ export { StyledColumnChartWrapper };
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ import { DataValue, HeaderConfig, Series, XAxisConfig, YAxisConfig } from '../types';
4
+ /**
5
+ * Props for the ColumnChart component.
6
+ *
7
+ * @property data - The data to be displayed in the chart. Each item represents a series.
8
+ * @property yAxisConfig - Optional configuration for the Y axis.
9
+ * @property xAxisConfig - Optional configuration for the X axis.
10
+ * @property style - Additional style for the root View. Follows the same convention as other components (e.g., Button).
11
+ * @property testID - Testing id of the component. Passed to the root View and used as a suffix for inner elements.
12
+ * @property headerConfig - Optional header configuration (title, actions).
13
+ * @property emptyText - Optional text to display when data is empty.
14
+ * @property onBarPress - Called when a bar (column segment) is pressed. Receives info about the bar.
15
+ */
16
+ export interface ColumnChartProps {
17
+ /**
18
+ * The data to be displayed in the chart. Each item represents a series.
19
+ */
20
+ data: Array<Series<Array<DataValue>>>;
21
+ /**
22
+ * Optional configuration for the Y axis.
23
+ * Note: minValue is omitted and always set to zero internally by the component.
24
+ */
25
+ yAxisConfig?: Omit<YAxisConfig, 'minValue'>;
26
+ /**
27
+ * Optional configuration for the X axis.
28
+ */
29
+ xAxisConfig?: XAxisConfig;
30
+ /**
31
+ * Additional style for the root View.
32
+ */
33
+ style?: ViewStyle;
34
+ /**
35
+ * Testing id of the component.
36
+ */
37
+ testID?: string;
38
+ /**
39
+ * Header configuration for the chart.
40
+ */
41
+ headerConfig?: HeaderConfig;
42
+ /**
43
+ * Text to display when the chart has no data (empty state).
44
+ */
45
+ emptyText?: string;
46
+ /**
47
+ * Called when a bar (column segment) is pressed. Receives info about the bar.
48
+ */
49
+ onBarPress?: (info: {
50
+ value: number | undefined;
51
+ xLabel: string;
52
+ seriesLabel: string;
53
+ seriesIndex: number;
54
+ xIndex: number;
55
+ }) => void;
56
+ }
57
+ /**
58
+ * ColumnChart component for rendering grouped/stacked column charts.
59
+ * Handles layout, axis configuration, empty state, and data validation.
60
+ * Uses ChartFrame for layout and axes, and ColumnChartContent for rendering columns.
61
+ *
62
+ * @param data - Array of series, each with a label and array of values.
63
+ * @param yAxisConfig - Optional Y axis configuration.
64
+ * @param xAxisConfig - Optional X axis configuration.
65
+ * @param style - Optional style for the chart container.
66
+ * @param testID - Optional test ID for testing.
67
+ * @param headerConfig - Optional header configuration (title, actions).
68
+ * @param emptyText - Optional text to display when data is empty.
69
+ * @param onBarPress - Called when a bar (column segment) is pressed. Receives info about the bar.
70
+ *
71
+ * Example usage:
72
+ * <ColumnChart
73
+ * data={data}
74
+ * xAxisConfig={xAxisConfig}
75
+ * yAxisConfig={yAxisConfig}
76
+ * emptyText="No data available"
77
+ * />
78
+ */
79
+ declare const ColumnChart: ({ data, yAxisConfig, xAxisConfig, style, testID, headerConfig, emptyText, onBarPress, }: ColumnChartProps) => React.JSX.Element;
80
+ export default ColumnChart;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates, DataValue } from '../types';
3
+ /**
4
+ * Props for the Line chart component
5
+ */
6
+ type LineProps = {
7
+ /** Array of data points to be plotted on the line chart */
8
+ data: DataValue[];
9
+ /** Maximum value for the Y-axis scale */
10
+ maxValue: number;
11
+ /** Minimum value for the Y-axis scale */
12
+ minValue: number;
13
+ /** Array of labels for the X-axis points */
14
+ labels: string[];
15
+ /** Coordinates defining the chart's boundaries and scale */
16
+ coordinates: AxisCoordinates;
17
+ /** Color for the line */
18
+ color?: string;
19
+ };
20
+ declare const Line: ({ data, maxValue, minValue, labels, coordinates, color, }: LineProps) => React.JSX.Element | null;
21
+ export default Line;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { ViewStyle } from 'react-native';
3
+ import { DataValue, HeaderConfig, Series, XAxisConfig, YAxisConfig } from '../types';
4
+ export interface LineChartProps {
5
+ /**
6
+ * The data to be displayed in the chart. Each item represents a series.
7
+ */
8
+ data: Array<Series<Array<DataValue>>>;
9
+ /**
10
+ * Optional configuration for the Y axis.
11
+ */
12
+ yAxisConfig?: YAxisConfig;
13
+ /**
14
+ * Optional configuration for the X axis.
15
+ */
16
+ xAxisConfig?: XAxisConfig;
17
+ /**
18
+ * Additional style for the root View.
19
+ */
20
+ style?: ViewStyle;
21
+ /**
22
+ * Testing id of the component.
23
+ */
24
+ testID?: string;
25
+ /**
26
+ * Header configuration for the chart.
27
+ */
28
+ headerConfig?: HeaderConfig;
29
+ /**
30
+ * Text to display when the chart is empty.
31
+ */
32
+ emptyText?: string;
33
+ }
34
+ declare const LineChart: ({ data, yAxisConfig, xAxisConfig, style, testID, headerConfig, emptyText, }: LineChartProps) => React.JSX.Element;
35
+ export default LineChart;
@@ -0,0 +1,9 @@
1
+ declare const StyledChartHeader: import("@emotion/native").StyledComponent<import("../Box").BoxProps & {
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
4
+ }, {}, {}>;
5
+ declare const StyledLineChartWrapper: import("@emotion/native").StyledComponent<import("../Box").BoxProps & {
6
+ theme?: import("@emotion/react").Theme;
7
+ as?: React.ElementType;
8
+ }, {}, {}>;
9
+ export { StyledChartHeader, StyledLineChartWrapper };
@@ -0,0 +1,9 @@
1
+ import LineChart from './Line';
2
+ import ColumnChart from './ColumnChart';
3
+ declare const Chart: {
4
+ Column: ({ data, yAxisConfig, xAxisConfig, style, testID, headerConfig, emptyText, onBarPress, }: import("./ColumnChart").ColumnChartProps) => import("react").JSX.Element;
5
+ Line: ({ data, yAxisConfig, xAxisConfig, style, testID, headerConfig, emptyText, }: import("./Line").LineChartProps) => import("react").JSX.Element;
6
+ SelectAction: <V>({ onConfirm, onDismiss, options, disabled, style, testID, value, supportedOrientations, bottomSheetConfig, }: import("./ChartSelect").SingleSelectProps<V>) => import("react").JSX.Element;
7
+ };
8
+ export type { LineChart, ColumnChart };
9
+ export default Chart;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare const AxisLabel: ({ label, numberOfLines, textAlign, }: {
3
+ label: string;
4
+ numberOfLines?: number;
5
+ textAlign?: "right" | "center";
6
+ }) => React.JSX.Element;
7
+ export default AxisLabel;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates, HeaderConfig, XAxisConfig, YAxisConfig } from '../types';
3
+ export type ChartFrameProps = {
4
+ isEmpty?: boolean;
5
+ xAxisConfig: XAxisConfig;
6
+ yAxisConfig: YAxisConfig;
7
+ headerConfig?: HeaderConfig;
8
+ width: number;
9
+ height: number;
10
+ renderContent: (props: {
11
+ coordinates: AxisCoordinates;
12
+ }) => React.ReactNode;
13
+ /**
14
+ * Text to display when the chart has no data (empty state).
15
+ * If undefined, no empty label will appear even if the chart is empty.
16
+ */
17
+ emptyText?: string;
18
+ /**
19
+ * If true, hides the grid lines for the Y-axis.
20
+ * Defaults to false.
21
+ */
22
+ hideYAxisGrid?: boolean;
23
+ /**
24
+ * If true, hides the grid lines for the X-axis.
25
+ * Defaults to false.
26
+ */
27
+ hideXAxisGrid?: boolean;
28
+ };
29
+ declare const ChartFrame: ({ xAxisConfig, yAxisConfig, width, height, headerConfig, renderContent, isEmpty, emptyText, hideYAxisGrid, hideXAxisGrid, }: ChartFrameProps) => React.JSX.Element;
30
+ export default ChartFrame;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { LayoutChangeEvent } from 'react-native';
3
+ import { HeaderConfig } from '../types';
4
+ export type ChartHeaderProps = HeaderConfig & {
5
+ onLayout?: (event: LayoutChangeEvent) => void;
6
+ };
7
+ declare const ChartHeader: ({ title, actionsExtra, onLayout }: ChartHeaderProps) => React.JSX.Element;
8
+ export default ChartHeader;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates } from '../types';
3
+ type EmptyStateProps = {
4
+ coordinates: AxisCoordinates;
5
+ content: string;
6
+ };
7
+ declare const EmptyState: ({ content, coordinates }: EmptyStateProps) => React.JSX.Element;
8
+ export default EmptyState;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates, XAxisConfig } from '../types';
3
+ export type XAxisProps = {
4
+ xAxisConfig: XAxisConfig;
5
+ coordinates: AxisCoordinates;
6
+ };
7
+ declare const XAxis: ({ xAxisConfig, coordinates }: XAxisProps) => React.JSX.Element;
8
+ export default XAxis;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates, XAxisConfig } from '../types';
3
+ export type XAxisGridProps = {
4
+ xAxisConfig: XAxisConfig;
5
+ coordinates: AxisCoordinates;
6
+ };
7
+ declare const XAxisGrid: ({ xAxisConfig, coordinates }: XAxisGridProps) => React.JSX.Element;
8
+ export default XAxisGrid;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates, YAxisConfig } from '../types';
3
+ export type YAxisProps = {
4
+ yAxisConfig: YAxisConfig & {
5
+ minValue?: number;
6
+ };
7
+ coordinates: AxisCoordinates;
8
+ };
9
+ declare const YAxis: ({ yAxisConfig, coordinates }: YAxisProps) => React.JSX.Element;
10
+ export default YAxis;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { AxisCoordinates, YAxisConfig } from '../types';
3
+ export type YAxisGridProps = {
4
+ yAxisConfig: Omit<YAxisConfig, 'labels'> & {
5
+ minValue?: number;
6
+ };
7
+ coordinates: AxisCoordinates;
8
+ };
9
+ declare const YAxisGrid: ({ yAxisConfig, coordinates }: YAxisGridProps) => React.JSX.Element;
10
+ export default YAxisGrid;
@@ -0,0 +1,2 @@
1
+ export declare const DASH_ARRAY: number[];
2
+ export declare const DEFAULT_LINE_STROKE_WIDTH = 2;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * useColorScale - Returns a d3 ordinal scale for mapping labels to colors.
3
+ * @param labels Array of labels (series names or keys)
4
+ * @param customColors Optional custom color palette
5
+ * @returns Ordinal scale function: (label: string) => color
6
+ */
7
+ export default function useColorScale(labels: string[], customColors?: string[]): (label: string) => string | undefined;
@@ -0,0 +1,6 @@
1
+ declare const useGenerateTicks: ({ maxValue, minValue, step, }: {
2
+ maxValue?: number;
3
+ minValue?: number;
4
+ step?: number;
5
+ }) => number[];
6
+ export default useGenerateTicks;
@@ -0,0 +1,8 @@
1
+ import * as d3 from 'd3';
2
+ export type UseScaleBandXProps = {
3
+ labels: string[];
4
+ xStart: number;
5
+ xEnd: number;
6
+ };
7
+ declare const useScaleBandX: ({ labels, xStart, xEnd }: UseScaleBandXProps) => d3.ScaleBand<string>;
8
+ export default useScaleBandX;
@@ -0,0 +1,9 @@
1
+ import * as d3 from 'd3';
2
+ export type UseScaleLinearYProps = {
3
+ maxValue: number;
4
+ minValue: number;
5
+ yStart: number;
6
+ yEnd: number;
7
+ };
8
+ declare const useScaleLinearY: ({ maxValue, minValue, yStart, yEnd, }: UseScaleLinearYProps) => d3.ScaleLinear<number, number, never>;
9
+ export default useScaleLinearY;
@@ -0,0 +1,12 @@
1
+ import { DataValue } from '../types';
2
+ export declare const createNiceScale: (min: number, max: number, maxTicks?: number) => {
3
+ niceMin: number;
4
+ niceMax: number;
5
+ tickSpacing: number;
6
+ };
7
+ export declare const maxValueFromDataSet: (data: {
8
+ data: DataValue[];
9
+ }[]) => number;
10
+ export declare const minValueFromDataSet: (data: {
11
+ data: DataValue[];
12
+ }[]) => number;
@@ -0,0 +1,84 @@
1
+ export type AxisSizeConfig = {
2
+ xAxisTextHeight: number;
3
+ setXAxisTextHeight: (height: number) => void;
4
+ yAxisTextWidth: number;
5
+ setYAxisTextWidth: (width: number) => void;
6
+ };
7
+ /**
8
+ * Represents a data series for the chart.
9
+ * @template Data - The type of the data array for the series.
10
+ */
11
+ interface Series<Data> {
12
+ /**
13
+ * Label of the series (used for legends, etc.).
14
+ */
15
+ label: string;
16
+ /**
17
+ * Data values for the series.
18
+ */
19
+ data: Data;
20
+ }
21
+ /**
22
+ * Configuration for axis ticks.
23
+ */
24
+ interface TickConfig {
25
+ /**
26
+ * The interval between ticks on the axis.
27
+ */
28
+ interval: number;
29
+ }
30
+ /**
31
+ * Configuration for the Y axis of the chart.
32
+ */
33
+ interface YAxisConfig {
34
+ /**
35
+ * Maximum value for the Y axis.
36
+ */
37
+ maxValue?: number;
38
+ /**
39
+ * Minimum value for the Y axis.
40
+ */
41
+ minValue?: number;
42
+ /**
43
+ * Labels for the Y axis.
44
+ */
45
+ labels?: Array<string>;
46
+ /**
47
+ * Step size between ticks on the Y axis.
48
+ */
49
+ step?: number;
50
+ /**
51
+ * Tick configuration for the Y axis.
52
+ */
53
+ tick?: TickConfig;
54
+ }
55
+ /**
56
+ * Configuration for the X axis of the chart.
57
+ */
58
+ interface XAxisConfig {
59
+ /**
60
+ * Labels for the X axis.
61
+ */
62
+ labels?: Array<string>;
63
+ }
64
+ /**
65
+ * Represents a single data value in the chart (can be a number or undefined).
66
+ */
67
+ type DataValue = number | undefined;
68
+ /**
69
+ * Represents the position of an object in the chart.
70
+ */
71
+ type AxisCoordinates = {
72
+ xStart: number;
73
+ xEnd: number;
74
+ yStart: number;
75
+ yEnd: number;
76
+ };
77
+ /**
78
+ * Represents the configuration for the header of the chart.
79
+ */
80
+ type HeaderConfig = {
81
+ title?: string;
82
+ actionsExtra?: React.ReactNode;
83
+ };
84
+ export type { Series, TickConfig, XAxisConfig, YAxisConfig, DataValue, AxisCoordinates, HeaderConfig, };
@@ -8,8 +8,3 @@ export type ScrollParams = {
8
8
  sectionIndex: number;
9
9
  };
10
10
  export declare const getScrollParams: <V, T extends OptionType<V>>(value: V, sections: SectionData<V, T>[]) => ScrollParams;
11
- export declare const useKeyboard: () => {
12
- isKeyboardVisible: boolean;
13
- keyboardHeight: number;
14
- };
15
- export declare const deepCompareValue: <V>(a: V, b: V) => boolean;
package/types/index.d.ts CHANGED
@@ -13,6 +13,7 @@ import Button from './components/Button';
13
13
  import Calendar from './components/Calendar';
14
14
  import Carousel from './components/Carousel';
15
15
  import Card from './components/Card';
16
+ import Chart from './components/Chart';
16
17
  import Chip from './components/Chip';
17
18
  import Collapse from './components/Collapse';
18
19
  import Checkbox from './components/Checkbox';
@@ -55,5 +56,5 @@ import { ScrollViewWithFAB, SectionListWithFAB, FlatListWithFAB } from './compon
55
56
  import Search from './components/Search';
56
57
  import FloatingIsland from './components/FloatingIsland';
57
58
  import LocaleProvider from './components/LocaleProvider';
58
- export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagLightSystemPalette, swagLightJobsSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, ehWorkDarkSystemPalette, ehWorkSystemPalette, ehJobsSystemPalette, Accordion, Alert, AppCue, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Carousel, Chip, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, FlatListWithFAB, Icon, Image, HeroDesignProvider, MapPin, List, PinInput, Progress, Portal, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, Search, ScrollViewWithFAB, SectionHeading, SectionListWithFAB, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, Rate, RefreshControl, RichTextEditor, FloatingIsland, LocaleProvider, };
59
+ export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagLightSystemPalette, swagLightJobsSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, ehWorkDarkSystemPalette, ehWorkSystemPalette, ehJobsSystemPalette, Accordion, Alert, AppCue, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Chart, Carousel, Chip, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, FlatListWithFAB, Icon, Image, HeroDesignProvider, MapPin, List, PinInput, Progress, Portal, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, Search, ScrollViewWithFAB, SectionHeading, SectionListWithFAB, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, Rate, RefreshControl, RichTextEditor, FloatingIsland, LocaleProvider, };
59
60
  export * from './types';
@@ -0,0 +1,22 @@
1
+ import type { GlobalTheme } from '../global';
2
+ declare const getChartTheme: (theme: GlobalTheme) => {
3
+ space: {
4
+ xAxisMarginLeft: number;
5
+ xAxisGridTextMarginTop: number;
6
+ yAxisMarginBottom: number;
7
+ yAxisGridMarginTop: number;
8
+ yAxisGridTextMarginRight: number;
9
+ headerMarginBottom: number;
10
+ };
11
+ sizes: {
12
+ xAxisDefaultTextHeight: number;
13
+ yAxisDefaultTextHeight: number;
14
+ yAxisDefaultTextWidth: number;
15
+ defaultWebEmptyStateWidth: number;
16
+ defaultWebEmptyStateHeight: number;
17
+ };
18
+ colors: {
19
+ gridStroke: string;
20
+ };
21
+ };
22
+ export default getChartTheme;
@@ -0,0 +1,10 @@
1
+ import type { GlobalTheme } from '../global';
2
+ declare const getColumnChartTheme: (theme: GlobalTheme) => {
3
+ sizes: {
4
+ columnWidth: number;
5
+ };
6
+ space: {
7
+ segmentGap: number;
8
+ };
9
+ };
10
+ export default getColumnChartTheme;
@@ -12,6 +12,8 @@ import { CarouselThemeType } from './components/carousel';
12
12
  import getCardCarouselTheme from './components/cardCarousel';
13
13
  import getCheckboxTheme from './components/checkbox';
14
14
  import getChipTheme from './components/chip';
15
+ import getChartTheme from './components/chart';
16
+ import getColumnChartTheme from './components/columnChart';
15
17
  import getContentNavigatorTheme from './components/contentNavigator';
16
18
  import getDatePickerTheme from './components/datePicker';
17
19
  import getDividerTheme from './components/divider';
@@ -69,6 +71,8 @@ type Theme = GlobalTheme & {
69
71
  cardCarousel: ReturnType<typeof getCardCarouselTheme>;
70
72
  checkbox: ReturnType<typeof getCheckboxTheme>;
71
73
  chip: ReturnType<typeof getChipTheme>;
74
+ chart: ReturnType<typeof getChartTheme>;
75
+ columnChart: ReturnType<typeof getColumnChartTheme>;
72
76
  contentNavigator: ReturnType<typeof getContentNavigatorTheme>;
73
77
  datePicker: ReturnType<typeof getDatePickerTheme>;
74
78
  divider: ReturnType<typeof getDividerTheme>;
package/types/types.d.ts CHANGED
@@ -14,4 +14,6 @@ import { ActionGroupHandles } from './components/FAB/ActionGroup';
14
14
  import type { SliderRangeValue } from './components/Slider/RangeSlider';
15
15
  import type { CalendarDateRange } from './components/Calendar/CalendarRange';
16
16
  import { LocaleCode, LocaleValues, DateTimeFormats } from './locales/types';
17
- export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, SwipeableProps, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, TextProps, TextInputHandles, Theme, CardCarouselHandles, FABHandles, ActionGroupHandles, SliderRangeValue, CalendarDateRange, LocaleCode, LocaleValues, DateTimeFormats, };
17
+ import type { ColumnChartProps } from './components/Chart/ColumnChart';
18
+ import { LineChartProps } from './components/Chart/Line';
19
+ export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, SwipeableProps, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, TextProps, TextInputHandles, Theme, CardCarouselHandles, FABHandles, ActionGroupHandles, SliderRangeValue, CalendarDateRange, LocaleCode, LocaleValues, DateTimeFormats, ColumnChartProps, LineChartProps, };