rich-react-component 0.3.2 → 0.4.1

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 (36) hide show
  1. package/README.md +178 -39
  2. package/dist/base/AreaChart.d.ts +4 -0
  3. package/dist/base/BarChart.d.ts +4 -0
  4. package/dist/base/Calendar.d.ts +54 -0
  5. package/dist/base/Chart.d.ts +26 -0
  6. package/dist/base/ChartLegend.d.ts +22 -0
  7. package/dist/base/DocumentViewer.d.ts +57 -0
  8. package/dist/base/DonutChart.d.ts +4 -0
  9. package/dist/base/LineChart.d.ts +9 -0
  10. package/dist/base/PieChart.d.ts +4 -0
  11. package/dist/base/StackedBarChart.d.ts +4 -0
  12. package/dist/base/chart/CartesianChart.d.ts +31 -0
  13. package/dist/base/chart/ChartSliceSummary.d.ts +13 -0
  14. package/dist/base/chart/ChartStatus.d.ts +16 -0
  15. package/dist/base/chart/ChartTooltip.d.ts +22 -0
  16. package/dist/base/chart/CircularChartBase.d.ts +18 -0
  17. package/dist/base/chart/chartColors.d.ts +4 -0
  18. package/dist/base/chart/chartScales.d.ts +15 -0
  19. package/dist/base/chart/chartTypes.d.ts +58 -0
  20. package/dist/base/chart/useChartDimensions.d.ts +13 -0
  21. package/dist/base/chart/useChartIndexNavigation.d.ts +23 -0
  22. package/dist/base/index.d.ts +28 -0
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.js +3270 -2136
  26. package/dist/index.js.map +1 -1
  27. package/dist/pdf-04d5ad63.js +14755 -0
  28. package/dist/pdf-04d5ad63.js.map +1 -0
  29. package/dist/pdf-c22cffd3.cjs +13 -0
  30. package/dist/pdf-c22cffd3.cjs.map +1 -0
  31. package/dist/pdf.worker.min-ab9f616e.cjs +2 -0
  32. package/dist/pdf.worker.min-ab9f616e.cjs.map +1 -0
  33. package/dist/pdf.worker.min-e6e7e836.js +5 -0
  34. package/dist/pdf.worker.min-e6e7e836.js.map +1 -0
  35. package/dist/style.css +1 -1
  36. package/package.json +75 -72
@@ -0,0 +1,58 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Small, semantic contracts shared by every chart in the family (doc section
4
+ * 13 — compose small parts rather than one "MassiveChartProps"). Every
5
+ * concrete chart (LineChart, BarChart, DonutChart, ...) extends the subset
6
+ * that applies to it.
7
+ */
8
+ export type ChartValue = string | number | Date;
9
+ export type ChartTone = "primary" | "success" | "warning" | "danger" | "info" | "secondary";
10
+ /** A row of chart data. Cartesian charts index it by `xKey` + each series' `key`; circular charts by `nameKey`/`valueKey`. */
11
+ export type ChartDatum = Record<string, ChartValue | null | undefined>;
12
+ export interface ChartSeries {
13
+ key: string;
14
+ label: string;
15
+ /** Explicit color — a CSS color or a `var(--rrc-*)` reference. Omitted: the chart's palette token assigns one by index. */
16
+ color?: string;
17
+ /** Series sharing a `stackId` stack on top of each other in BarChart/StackedBarChart. */
18
+ stackId?: string;
19
+ /** Initial visibility; the legend can still toggle it (uncontrolled unless `hiddenSeriesKeys` is passed). */
20
+ hidden?: boolean;
21
+ valueFormatter?: (value: number) => string;
22
+ }
23
+ export interface ChartInteraction {
24
+ seriesKey: string;
25
+ datum: ChartDatum;
26
+ value: number;
27
+ index: number;
28
+ }
29
+ export interface ChartSliceInteraction {
30
+ key: string;
31
+ label: string;
32
+ value: number;
33
+ index: number;
34
+ datum: ChartDatum;
35
+ }
36
+ /** Shared status/infrastructure props every chart composes via `Chart`/`ChartStatus` (doc: don't reimplement per chart type). */
37
+ export interface ChartStatusProps {
38
+ loading?: boolean;
39
+ /** Non-empty renders the error state instead of the chart. */
40
+ error?: ReactNode;
41
+ /** Shown when `data` (or every series in it) is empty. */
42
+ emptyMessage?: ReactNode;
43
+ disabled?: boolean;
44
+ }
45
+ export interface ChartCommonProps extends ChartStatusProps {
46
+ title?: string;
47
+ /** Fixed height; width is measured from the container (ResizeObserver, SSR-safe fallback). */
48
+ height?: number;
49
+ className?: string;
50
+ showLegend?: boolean;
51
+ showTooltip?: boolean;
52
+ /** Disables the CSS entrance animation; also forced off under `prefers-reduced-motion`. */
53
+ animate?: boolean;
54
+ /** Accessible name for the chart region; falls back to `title`. */
55
+ "aria-label"?: string;
56
+ /** Palette override, applied to series/slices in order before any per-item `color`. */
57
+ colors?: string[];
58
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Measures the chart's own container width (doc: responsive width, no global
3
+ * breakpoint). Reuses `useElementResize` (ResizeObserver with a window-resize
4
+ * fallback, already SSR-safe) instead of a second measurement strategy.
5
+ *
6
+ * Starts at 0 so the very first server/client render emits no SVG at all
7
+ * (avoids a divide-by-zero layout before the real width is known); the
8
+ * measured width lands on the next paint, which is invisible to the user.
9
+ */
10
+ export declare function useChartDimensions(): {
11
+ containerRef: React.RefObject<HTMLDivElement>;
12
+ width: number;
13
+ };
@@ -0,0 +1,23 @@
1
+ import { KeyboardEvent } from 'react';
2
+ export interface UseChartIndexNavigationOptions {
3
+ count: number;
4
+ disabled?: boolean;
5
+ onActivate?: (index: number) => void;
6
+ onSelect?: (index: number) => void;
7
+ }
8
+ export interface ChartIndexNavigation {
9
+ activeIndex: number;
10
+ setActiveIndex: (index: number) => void;
11
+ clearActive: () => void;
12
+ handleKeyDown: (event: KeyboardEvent) => void;
13
+ }
14
+ /**
15
+ * Roving index navigation shared by every chart shape: Left/Right (or the
16
+ * next/previous data point) moves the focused/hover point, Home/End jump to
17
+ * the ends, Enter/Space fires the same callback a mouse click on that point
18
+ * would (doc: "veri noktasına tıklama" and "klavye ile veri noktaları arasında
19
+ * hareket" are one interaction model, not two). Used for x-categories in the
20
+ * cartesian charts (Line/Area/Bar/StackedBar) and for slices in the circular
21
+ * ones (Donut/Pie) — the math is identical, only what "index" means differs.
22
+ */
23
+ export declare function useChartIndexNavigation({ count, disabled, onActivate, onSelect }: UseChartIndexNavigationOptions): ChartIndexNavigation;
@@ -59,6 +59,34 @@ export * from './IconButton';
59
59
  export * from './ListItem';
60
60
  export * from './Sparkline';
61
61
  export * from './Statistic';
62
+ /**
63
+ * Chart family (doc: full-size Line/Area/Bar/StackedBar/Donut/Pie, distinct
64
+ * from the compact `Sparkline`). `Chart` is the shared responsive/status
65
+ * shell every concrete chart composes and is itself public for a consumer
66
+ * building a custom visualization; `ChartLegend` is the shared series legend.
67
+ * The per-chart-type render logic (`chart/*Base.tsx`) stays internal.
68
+ */
69
+ export { Chart } from './Chart';
70
+ export type { ChartProps } from './Chart';
71
+ export { ChartLegend, legendItemsFromSeries } from './ChartLegend';
72
+ export type { ChartLegendItem, ChartLegendProps } from './ChartLegend';
73
+ export { LineChart } from './LineChart';
74
+ export type { LineChartProps } from './LineChart';
75
+ export { AreaChart } from './AreaChart';
76
+ export type { AreaChartProps } from './AreaChart';
77
+ export { BarChart } from './BarChart';
78
+ export type { BarChartProps } from './BarChart';
79
+ export { StackedBarChart } from './StackedBarChart';
80
+ export type { StackedBarChartProps } from './StackedBarChart';
81
+ export { DonutChart } from './DonutChart';
82
+ export type { DonutChartProps } from './DonutChart';
83
+ export { PieChart } from './PieChart';
84
+ export type { PieChartProps } from './PieChart';
85
+ export type { ChartCommonProps, ChartDatum, ChartInteraction, ChartSeries, ChartSliceInteraction, ChartStatusProps, ChartTone, ChartValue, } from './chart/chartTypes';
86
+ export { Calendar } from './Calendar';
87
+ export type { CalendarEvent, CalendarEventVariant, CalendarProps, CalendarView } from './Calendar';
88
+ export { DocumentViewer } from './DocumentViewer';
89
+ export type { DocumentViewerError, DocumentViewerErrorKind, DocumentViewerLabels, DocumentViewerProps, DocumentViewerSource, } from './DocumentViewer';
62
90
  export { AppearanceProvider, useAppearance, createAppearanceInitScript, THEME_MODES, SIDEBAR_PRESENTATIONS, SIDEBAR_TONES } from './Appearance';
63
91
  export type { AppearanceContextValue, AppearanceInitScriptOptions, AppearanceProviderProps, AppearanceSettings, AppearanceStorage, ResolvedTheme, SidebarPresentation, SidebarTone, ThemeMode, } from './Appearance';
64
92
  export * from './appearanceSchemes';