@esperanca-ui/componentes 2.13.6 → 2.14.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.
@@ -0,0 +1,7 @@
1
+ import { ChartBaseProps } from '../Charts/chartTypes';
2
+
3
+ export interface BarChartProps extends ChartBaseProps {
4
+ /** @deprecated Use `showValueLabels` instead. */
5
+ showValues?: boolean;
6
+ }
7
+ export declare const BarChart: import('react').ForwardRefExoticComponent<BarChartProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ import { ChartDisplayPreferences } from './chartTypes';
2
+
3
+ type ChartPreferenceAvailability = {
4
+ showTitle?: boolean;
5
+ showDescription?: boolean;
6
+ showLegend?: boolean;
7
+ showXAxisLabel?: boolean;
8
+ showYAxisLabel?: boolean;
9
+ showValueLabels?: boolean;
10
+ xTickRotation?: boolean;
11
+ };
12
+ type ChartPreferencesMenuProps = {
13
+ preferences: ChartDisplayPreferences;
14
+ availability: ChartPreferenceAvailability;
15
+ valueLabelsLabel: string;
16
+ onChange: (patch: Partial<ChartDisplayPreferences>) => void;
17
+ onReset: () => void;
18
+ };
19
+ export declare function ChartPreferencesMenu({ preferences, availability, valueLabelsLabel, onChange, onReset, }: ChartPreferencesMenuProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,53 @@
1
+ import { default as React } from 'react';
2
+ import { Card } from '../Card/Card';
3
+ import { ChartLegendPosition, ChartTickRotation } from './chartTypes';
4
+
5
+ type ChartShellLegendItem = {
6
+ label: React.ReactNode;
7
+ color: string;
8
+ };
9
+ type ChartShellTooltipData = {
10
+ xPercent: number;
11
+ yPercent: number;
12
+ label: React.ReactNode;
13
+ items: Array<{
14
+ key: string;
15
+ label: React.ReactNode;
16
+ value: React.ReactNode;
17
+ color: string;
18
+ }>;
19
+ };
20
+ type ChartShellYAxisTick = {
21
+ key: string;
22
+ label: React.ReactNode;
23
+ topPercent: number;
24
+ };
25
+ type ChartShellXAxisTick = {
26
+ key: string;
27
+ label: React.ReactNode;
28
+ leftPercent: number;
29
+ align?: 'start' | 'center' | 'end';
30
+ };
31
+ export interface ChartShellProps extends Omit<React.ComponentProps<typeof Card>, 'children' | 'title'> {
32
+ title?: React.ReactNode;
33
+ description?: React.ReactNode;
34
+ headerActions?: React.ReactNode;
35
+ legend?: ChartShellLegendItem[];
36
+ legendPosition?: ChartLegendPosition;
37
+ footer?: React.ReactNode;
38
+ empty?: boolean;
39
+ emptyMessage?: React.ReactNode;
40
+ ariaLabel?: string;
41
+ tooltip?: ChartShellTooltipData | null;
42
+ stageProps?: React.HTMLAttributes<HTMLDivElement>;
43
+ xAxisLabel?: React.ReactNode;
44
+ xAxisTicks?: ChartShellXAxisTick[];
45
+ xAxisTickRotation?: ChartTickRotation;
46
+ xAxisTickHeight?: number | string;
47
+ yAxisLabel?: React.ReactNode;
48
+ yAxisTicks?: ChartShellYAxisTick[];
49
+ yAxisTickWidth?: number | string;
50
+ children: React.ReactNode;
51
+ }
52
+ export declare const ChartShell: React.ForwardRefExoticComponent<Omit<ChartShellProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
53
+ export {};
@@ -0,0 +1,53 @@
1
+ import { ReactNode } from 'react';
2
+ import { CardProps } from '../Card/Card';
3
+
4
+ export type ChartTone = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
5
+ export type ChartCurve = 'linear' | 'smooth';
6
+ export type ChartLegendPosition = 'top' | 'bottom' | 'left' | 'right';
7
+ export type ChartTickRotation = 0 | -30 | -45 | -60 | -90;
8
+ export type ChartDatum = {
9
+ label: string;
10
+ [key: string]: string | number | null | undefined;
11
+ };
12
+ export interface ChartSeries {
13
+ key: string;
14
+ label: string;
15
+ color?: string;
16
+ tone?: ChartTone;
17
+ }
18
+ export interface ChartDisplayPreferences {
19
+ showTitle: boolean;
20
+ showDescription: boolean;
21
+ showLegend: boolean;
22
+ showXAxisLabel: boolean;
23
+ showYAxisLabel: boolean;
24
+ showValueLabels: boolean;
25
+ xTickRotation: ChartTickRotation;
26
+ }
27
+ export interface ChartBaseProps extends Omit<CardProps, 'children' | 'title'> {
28
+ data: ChartDatum[];
29
+ series: ChartSeries[];
30
+ title?: ReactNode;
31
+ description?: ReactNode;
32
+ footer?: ReactNode;
33
+ ariaLabel?: string;
34
+ height?: number;
35
+ showLegend?: boolean;
36
+ legendPosition?: ChartLegendPosition;
37
+ showGrid?: boolean;
38
+ showXAxis?: boolean;
39
+ showYAxis?: boolean;
40
+ xAxisLabel?: ReactNode;
41
+ yAxisLabel?: ReactNode;
42
+ yAxisTickWidth?: number | string;
43
+ showValueLabels?: boolean;
44
+ xTickRotation?: ChartTickRotation;
45
+ enableUserPreferences?: boolean;
46
+ preferencesStorageKey?: string;
47
+ onPreferencesChange?: (preferences: ChartDisplayPreferences) => void;
48
+ yTickCount?: number;
49
+ formatValue?: (value: number) => string;
50
+ formatTickValue?: (value: number) => string;
51
+ formatLabel?: (label: string) => string;
52
+ emptyMessage?: ReactNode;
53
+ }
@@ -0,0 +1,38 @@
1
+ import { ChartCurve, ChartDatum, ChartSeries, ChartTickRotation } from './chartTypes';
2
+
3
+ type ChartPoint = {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ export declare function resolveSeriesColor(series: ChartSeries, index: number): string;
8
+ export declare function getNumericValue(datum: ChartDatum, key: string): number;
9
+ export declare function formatChartValue(value: number, formatter?: (value: number) => string): string;
10
+ export declare function formatChartTickValue(value: number, formatter?: (value: number) => string): string;
11
+ export declare function formatChartLabel(label: string, formatter?: (label: string) => string): string;
12
+ export declare function getLineRange(data: ChartDatum[], series: ChartSeries[]): {
13
+ min: number;
14
+ max: number;
15
+ };
16
+ export declare function getBarRange(data: ChartDatum[], series: ChartSeries[]): {
17
+ min: number;
18
+ max: number;
19
+ };
20
+ export declare function getNiceTickScale(min: number, max: number, count: number): {
21
+ min: number;
22
+ max: number;
23
+ ticks: number[];
24
+ };
25
+ export declare function scaleY(value: number, min: number, max: number, top: number, height: number): number;
26
+ export declare function getXPosition(index: number, count: number, left: number, width: number): number;
27
+ export declare function getBandCenterPosition(index: number, count: number, left: number, width: number): number;
28
+ export declare function getSlotBounds(index: number, positions: number[], minX: number, maxX: number): {
29
+ x: number;
30
+ width: number;
31
+ };
32
+ export declare function getAxisLabelStep(length: number): 1 | 2 | 4;
33
+ export declare function isChartTickRotation(value: number): value is ChartTickRotation;
34
+ export declare function getXAxisTickBlockHeight(showXAxis: boolean, rotation: ChartTickRotation): 0 | 24 | 44 | 58 | 72 | 110;
35
+ export declare function getYAxisTickColumnWidth(labels: string[]): number;
36
+ export declare function createLinePath(points: ChartPoint[], curve: ChartCurve): string;
37
+ export declare function createAreaPath(points: ChartPoint[], baselineY: number, curve: ChartCurve): string;
38
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ChartDisplayPreferences } from './chartTypes';
2
+
3
+ type UseChartPreferencesOptions = {
4
+ enabled: boolean;
5
+ defaults: ChartDisplayPreferences;
6
+ storageKey?: string;
7
+ onChange?: (preferences: ChartDisplayPreferences) => void;
8
+ };
9
+ export declare function useChartPreferences({ enabled, defaults, storageKey, onChange, }: UseChartPreferencesOptions): {
10
+ preferences: ChartDisplayPreferences;
11
+ updatePreferences: (patch: Partial<ChartDisplayPreferences>) => void;
12
+ resetPreferences: () => void;
13
+ };
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ChartBaseProps, ChartCurve } from '../Charts/chartTypes';
2
+
3
+ export interface LineChartProps extends ChartBaseProps {
4
+ curve?: ChartCurve;
5
+ showArea?: boolean;
6
+ showDots?: boolean;
7
+ }
8
+ export declare const LineChart: import('react').ForwardRefExoticComponent<LineChartProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -19,6 +19,7 @@ export type SidebarItem = {
19
19
  iconName?: SidebarIconName;
20
20
  icon?: React.ReactNode;
21
21
  onClick?: () => void;
22
+ children?: SidebarItem[];
22
23
  };
23
24
  export type SidebarSection = {
24
25
  heading?: string;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ export { PageHeader } from './components/PageHeader/PageHeader';
12
12
  export { Tabs } from './components/Tabs/Tabs';
13
13
  export { Card, CardHeader, CardTitle, CardDescription, CardBody, CardFooter } from './components/Card/Card';
14
14
  export { MetricCard } from './components/MetricCard/MetricCard';
15
+ export { LineChart } from './components/LineChart/LineChart';
16
+ export { BarChart } from './components/BarChart/BarChart';
15
17
  export { TaskStatusBadge } from './components/TaskStatusBadge/TaskStatusBadge';
16
18
  export { TaskPriorityBadge } from './components/TaskPriorityBadge/TaskPriorityBadge';
17
19
  export { TaskCard } from './components/TaskCard/TaskCard';
@@ -42,6 +44,9 @@ export type { PageHeaderProps } from './components/PageHeader/PageHeader';
42
44
  export type { TabsProps, TabsItem, TabsVariant, TabsSize } from './components/Tabs/Tabs';
43
45
  export type { CardProps } from './components/Card/Card';
44
46
  export type { MetricCardProps } from './components/MetricCard/MetricCard';
47
+ export type { LineChartProps } from './components/LineChart/LineChart';
48
+ export type { BarChartProps } from './components/BarChart/BarChart';
49
+ export type { ChartBaseProps, ChartCurve, ChartDatum, ChartDisplayPreferences, ChartLegendPosition, ChartSeries, ChartTickRotation, ChartTone, } from './components/Charts/chartTypes';
45
50
  export type { TaskStatusBadgeProps, TaskStatus } from './components/TaskStatusBadge/TaskStatusBadge';
46
51
  export type { TaskPriorityBadgeProps, TaskPriority } from './components/TaskPriorityBadge/TaskPriorityBadge';
47
52
  export type { TaskCardProps } from './components/TaskCard/TaskCard';