rich-react-component 0.3.1 → 0.4.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 (46) hide show
  1. package/README.md +164 -1
  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/ContextMenu.d.ts +87 -0
  8. package/dist/base/DataGrid.d.ts +27 -1
  9. package/dist/base/DocumentViewer.d.ts +57 -0
  10. package/dist/base/DonutChart.d.ts +4 -0
  11. package/dist/base/LineChart.d.ts +9 -0
  12. package/dist/base/PieChart.d.ts +4 -0
  13. package/dist/base/RichComponentBase.d.ts +12 -0
  14. package/dist/base/StackedBarChart.d.ts +4 -0
  15. package/dist/base/chart/CartesianChart.d.ts +31 -0
  16. package/dist/base/chart/ChartSliceSummary.d.ts +13 -0
  17. package/dist/base/chart/ChartStatus.d.ts +16 -0
  18. package/dist/base/chart/ChartTooltip.d.ts +22 -0
  19. package/dist/base/chart/CircularChartBase.d.ts +18 -0
  20. package/dist/base/chart/chartColors.d.ts +4 -0
  21. package/dist/base/chart/chartScales.d.ts +15 -0
  22. package/dist/base/chart/chartTypes.d.ts +58 -0
  23. package/dist/base/chart/useChartDimensions.d.ts +13 -0
  24. package/dist/base/chart/useChartIndexNavigation.d.ts +23 -0
  25. package/dist/base/contextMenuModel.d.ts +49 -0
  26. package/dist/base/contextMenuPosition.d.ts +41 -0
  27. package/dist/base/dataGridResponsive.d.ts +169 -0
  28. package/dist/base/index.d.ts +43 -0
  29. package/dist/base/shared/Portal.d.ts +20 -0
  30. package/dist/base/shared/composeRefs.d.ts +3 -0
  31. package/dist/base/shared/useElementResize.d.ts +16 -0
  32. package/dist/base/shared/useIsomorphicLayoutEffect.d.ts +12 -0
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.js +3686 -1906
  36. package/dist/index.js.map +1 -1
  37. package/dist/pdf-04d5ad63.js +14755 -0
  38. package/dist/pdf-04d5ad63.js.map +1 -0
  39. package/dist/pdf-c22cffd3.cjs +13 -0
  40. package/dist/pdf-c22cffd3.cjs.map +1 -0
  41. package/dist/pdf.worker.min-ab9f616e.cjs +2 -0
  42. package/dist/pdf.worker.min-ab9f616e.cjs.map +1 -0
  43. package/dist/pdf.worker.min-e6e7e836.js +5 -0
  44. package/dist/pdf.worker.min-e6e7e836.js.map +1 -0
  45. package/dist/style.css +1 -1
  46. package/package.json +75 -72
package/README.md CHANGED
@@ -83,7 +83,7 @@ import { RemoteComboBox } from "rich-react-component";
83
83
 
84
84
  ## What's in each layer
85
85
 
86
- **Base** (55 components) — form fields (`Input`, `NumberInput`, `PasswordInput`, `FileInput`, `CheckBox`, `Switch`, `RadioGroup`, `Select`, `MultiSelect`, `DatePicker`, `TimePicker`, `DateTimePicker`, `ComboBox`, `AutoComplete`, `FormField`), feedback (`Modal`, `Toast`, `Confirm`, `Alert`, `Spinner`, `Badge`, `Skeleton`), data display (`DataGrid`, `Pagination`, `Avatar`, `Tag`, `Rating`, `ProgressBar`, `ListItem`, `Sparkline`, `Statistic`), navigation (`Breadcrumb`, `Menu`, `Stepper`, `Tabs`, `Navbar`, `Sidebar`, `PageHeader`), layout (`Card`, `Divider`, `Stack`, `Flex`, `Container`, `Row`, `Col`), typography (`Text`), and more (`Button`, `IconButton`, `Tooltip`, `Popover`, `Accordion`, `Icon`).
86
+ **Base** (67 components) — form fields (`Input`, `NumberInput`, `PasswordInput`, `FileInput`, `CheckBox`, `Switch`, `RadioGroup`, `Select`, `MultiSelect`, `DatePicker`, `TimePicker`, `DateTimePicker`, `ComboBox`, `AutoComplete`, `FormField`), feedback (`Modal`, `Toast`, `Confirm`, `Alert`, `Spinner`, `Badge`, `Skeleton`), data display (`DataGrid`, `Pagination`, `Avatar`, `Tag`, `Rating`, `ProgressBar`, `ListItem`, `Sparkline`, `Statistic`), data visualization (`Chart`, `ChartLegend`, `LineChart`, `AreaChart`, `BarChart`, `StackedBarChart`, `DonutChart`, `PieChart`), scheduling (`Calendar`), documents (`DocumentViewer`), navigation (`Breadcrumb`, `Menu`, `Stepper`, `Tabs`, `Navbar`, `Sidebar`, `PageHeader`), layout (`Card`, `Divider`, `Stack`, `Flex`, `Container`, `Row`, `Col`), typography (`Text`), and more (`Button`, `IconButton`, `Tooltip`, `Popover`, `Accordion`, `Icon`, `RichComponentBase`, `ContextMenu`).
87
87
 
88
88
  `DataGrid` columns are declarative by default (`{ field: "conversion", header: "CONV.", align: "end" }`) — `render` stays available as the escape hatch for genuinely custom cells, and `format`/`formatter` cover the common presentation cases (`dataGridFormatters` exports the built-in `text`/`date`/`currency`/`boolean` set). `Card` accepts `title`/`subtitle`/`icon`/`avatar`/`actions`/`loading` directly, with `header` remaining as the raw escape hatch. `Tabs` supports `variant` (`default`/`underline`/`pill`/`card`/`button`), `orientation`, `size`, `stretch`, and per-item `icon`/`badge`, with roving-tabindex keyboard navigation.
89
89
 
@@ -97,6 +97,45 @@ import { RemoteComboBox } from "rich-react-component";
97
97
  - **Headless engine** — `useSmartField` / `useSmartAction` resolve one field/action's metadata (visibility, validation, localized label, resolved request params); `useSmartDependencies` tracks `dependsOn` and reports which field needs fresh metadata when a value it depends on changes.
98
98
  - **Components** — `SmartField` / `SmartAction` resolve one piece of metadata into UI; `SmartForm` / `SmartActions` are thin iteration helpers over a whole `SmartFormMetadata` — no field-value ownership, no business-rule evaluation, no layout decisions.
99
99
 
100
+ ## Context menu
101
+
102
+ `RichComponentBase` attaches a declarative context menu to any component in the
103
+ package. The menu is written as a child component — never as a prop, a metadata
104
+ array or a callback-returned object — and the behavior lives in that one place,
105
+ so no component carries a copy of it and none gained a `contextMenu` prop.
106
+
107
+ ```tsx
108
+ <RichComponentBase>
109
+ <ContextMenu>
110
+ <ContextMenu.Label>Actions</ContextMenu.Label>
111
+ <ContextMenu.Item icon={<Icon name="bi bi-pencil" />} onSelect={handleEdit}>Düzenle</ContextMenu.Item>
112
+ <ContextMenu.Separator />
113
+ <ContextMenu.SubMenu label="Export">
114
+ <ContextMenu.Item onSelect={exportPdf}>PDF</ContextMenu.Item>
115
+ <ContextMenu.Item onSelect={exportExcel}>Excel</ContextMenu.Item>
116
+ </ContextMenu.SubMenu>
117
+ <ContextMenu.Item danger onSelect={handleDelete}>Sil</ContextMenu.Item>
118
+ </ContextMenu>
119
+
120
+ <Button>İşlem</Button>
121
+ </RichComponentBase>
122
+ ```
123
+
124
+ - **No DOM tax.** With a single host-element child (`<div>`, `<table>`, …) the
125
+ trigger is attached to that element and nothing is added. Otherwise the content
126
+ is wrapped in a `display: contents` element, which generates no layout box, so
127
+ flex/grid placement, sizing and positioning are unchanged. `trigger="child"`
128
+ forces the no-DOM path; `as` picks the wrapper element (`as="tbody"`).
129
+ - **Transparent without a menu.** No `<ContextMenu>` child means no listeners and
130
+ no interception — the browser's own menu is untouched. The same holds for a
131
+ `disabled` or effectively empty declaration.
132
+ - **Composes, never replaces.** A consumer's own `onContextMenu` runs first; if it
133
+ calls `preventDefault()`, the base stands down. `className`, `style`, refs and
134
+ accessibility props are merged, not overwritten.
135
+ - **Real keyboard support.** Context Menu key and Shift + F10 open it; arrows,
136
+ Home/End, Enter/Space, Arrow Right/Left for submenus and Escape all work, with
137
+ focus moved on open and restored on close.
138
+
100
139
  ## Sidebar
101
140
 
102
141
  One recursive navigation tree with a single authoritative expansion state and a
@@ -256,6 +295,130 @@ nor Metronic ships a dark variant of those variables, and the light-mode shades
256
295
  measure about 2:1 on a dark neutral. An application with its own dark palette
257
296
  overrides the `--rrc-*` tokens, which are the documented integration point.
258
297
 
298
+ ## Charts
299
+
300
+ Six full-size chart types share one responsive, accessible foundation — no SVG,
301
+ Canvas, ResizeObserver or tooltip portal in your own code:
302
+
303
+ ```tsx
304
+ import { LineChart } from "rich-react-component";
305
+
306
+ <LineChart
307
+ title="Monthly training completion"
308
+ data={data}
309
+ xKey="month"
310
+ series={[
311
+ { key: "completed", label: "Completed" },
312
+ { key: "missing", label: "Missing" },
313
+ ]}
314
+ />
315
+ ```
316
+
317
+ `LineChart`, `AreaChart`, `BarChart` (grouped, `orientation="vertical" |
318
+ "horizontal"`), `StackedBarChart`, `DonutChart` and `PieChart` all accept
319
+ `loading`/`error`/`isEmpty`, `showLegend`/`showTooltip`/`showDataLabels`,
320
+ per-series `color`/`hidden`/`valueFormatter`, and `animate` (also forced off
321
+ under `prefers-reduced-motion`). `Chart` is the shared responsive shell itself
322
+ — public for a custom SVG/Canvas visualization that still wants the same
323
+ sizing/status chrome — and `ChartLegend` is the shared, keyboard-operable
324
+ series legend both `LineChart`/`AreaChart`/`BarChart`/`StackedBarChart` compose.
325
+
326
+ Colors always come from theme tokens — `--rrc-chart-1` … `--rrc-chart-5` for
327
+ the categorical palette, `--rrc-chart-grid`/`--rrc-chart-axis` for the grid
328
+ and axis text, `--rrc-chart-tooltip-bg`/`--rrc-chart-tooltip-text` for the
329
+ tooltip — never hardcoded in a component, so a custom color scheme repaints
330
+ charts along with everything else.
331
+
332
+ **Accessibility.** Every data point/bar/slice is a real, individually
333
+ focusable, labelled target — arrow keys move between them, Enter/Space fires
334
+ `onDataPointClick`/`onSliceClick`, exactly like a mouse click on the same
335
+ point. A visually-hidden data table (or, for the circular charts, a
336
+ name/value list) carries the same numbers for a screen reader user, so the
337
+ chart's information is never conveyed by the drawing alone.
338
+
339
+ **Known limitation.** Very large series (tens of thousands of points) are not
340
+ virtualized or canvas-rendered — plain SVG, matching the same choice already
341
+ made for `Sparkline`, rather than a new charting dependency.
342
+
343
+ ## Calendar
344
+
345
+ A month-view event calendar — locale-aware, keyboard-operable, controlled or
346
+ uncontrolled:
347
+
348
+ ```tsx
349
+ <Calendar
350
+ locale="tr-TR"
351
+ weekStartsOn={1} // 0 = Sunday, 1 = Monday
352
+ value={selectedDate}
353
+ onDateChange={setSelectedDate}
354
+ events={events} // { id, title, start, end?, variant?, color?, disabled? }
355
+ onEventClick={handleEventClick}
356
+ onMonthChange={loadMonthEvents}
357
+ />
358
+ ```
359
+
360
+ Month/weekday names come from native `Intl.DateTimeFormat` — no date library
361
+ dependency. A day with more events than `maxEventsPerDay` (default 3) shows a
362
+ "+N more" control instead of overflowing the cell; below the `md` breakpoint
363
+ an agenda list of the selected day's events renders alongside the grid, via
364
+ plain Bootstrap responsive utility classes (no `matchMedia`, so it stays
365
+ SSR-safe).
366
+
367
+ **Timezone contract.** Every comparison uses the `Date` object's own local
368
+ getters (`getFullYear`/`getMonth`/`getDate`), never `Date.UTC` or ISO-string
369
+ parsing for day-bucketing — an event never silently shifts a day across a
370
+ timezone or DST boundary.
371
+
372
+ **Known limitation.** Only `view="month"` renders in this release. The `view`
373
+ prop and the `CalendarEvent` shape already accept `"week" | "day" | "agenda" |
374
+ "scheduler"` so a future release can add them without a breaking prop change;
375
+ passing one today falls back to month view with a development-mode warning.
376
+ Drag-and-drop event moving is not supported.
377
+
378
+ ## DocumentViewer
379
+
380
+ Previews a PDF or a common image format without your application touching
381
+ PDF.js, a `<canvas>`, or a blob URL:
382
+
383
+ ```tsx
384
+ <DocumentViewer
385
+ source={documentUrl} // string URL, or a Blob/ArrayBuffer already in hand
386
+ fileName="risk-assessment.pdf"
387
+ mimeType="application/pdf"
388
+ onDownload={handleDownload}
389
+ onError={handlePreviewError}
390
+ />
391
+ ```
392
+
393
+ Supports PDF, PNG, JPEG/JPG, WEBP and GIF. Page navigation, zoom, rotate,
394
+ fit-to-width/fit-to-view and fullscreen (which reuses the existing `Modal`,
395
+ escape-to-close included) are all built in. An unsupported file type never
396
+ renders a broken viewer — it shows the file's name/type and a download action
397
+ instead. Every built-in toolbar string can be overridden through the `labels`
398
+ prop, since no central i18n catalog lives in the Base layer.
399
+
400
+ **Dependency.** PDF rendering is powered by `pdfjs-dist`, this library's first
401
+ runtime dependency — but it is only ever `import()`-ed when a PDF is actually
402
+ previewed, so it lands in its own lazy chunk (verified via the real
403
+ `vite build` output: `pdf-*.js` and `pdf.worker.min-*.js` are separate from
404
+ `index.js`) and costs nothing for an application that only renders `Calendar`
405
+ or a chart. Its Web Worker is resolved through a bundler-native asset import,
406
+ so no manual worker configuration is needed in a Vite (or comparably
407
+ capable) consumer build.
408
+
409
+ **CORS/CSP.** A remote `source` URL is loaded the same way `<img src>` already
410
+ is elsewhere in this library — the browser (or, for a PDF, `pdfjs-dist`'s own
411
+ fetch/range-request handling) loads it directly, so the usual cross-origin
412
+ rules apply: the URL's own server must allow it, and a strict CSP needs
413
+ `worker-src` (for the PDF worker) and, for a cross-origin document, an
414
+ appropriate `connect-src`/`img-src` entry.
415
+
416
+ **Known limitations.** Fullscreen reuses `Modal` rather than the native
417
+ Fullscreen API (consistent with `Modal`'s own documented not-yet-portalled
418
+ limitation). No print action, text selection/search, or annotation layer
419
+ inside a previewed PDF — page rendering only. `FilePreview` was deliberately
420
+ not added as a second export; `DocumentViewer` is the only public name.
421
+
259
422
  ## Component showcase
260
423
 
261
424
  A dev-only application exercises the library live — not part of the published package:
@@ -0,0 +1,4 @@
1
+ import { CartesianChartCoreProps } from './chart/CartesianChart';
2
+ export type AreaChartProps = Omit<CartesianChartCoreProps, "kind" | "orientation" | "stacked">;
3
+ /** Same API and interaction model as `LineChart`, filled to its baseline. See `CartesianChart`. */
4
+ export declare function AreaChart(props: AreaChartProps): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { CartesianChartCoreProps } from './chart/CartesianChart';
2
+ export type BarChartProps = Omit<CartesianChartCoreProps, "kind" | "stacked">;
3
+ /** Grouped bars — each series in a category sits side by side. For stacked segments, use `StackedBarChart`. */
4
+ export declare function BarChart(props: BarChartProps): import("react").JSX.Element;
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from 'react';
2
+ export type CalendarView = "month" | "week" | "day" | "agenda" | "scheduler";
3
+ export type CalendarEventVariant = "primary" | "success" | "warning" | "danger" | "info" | "secondary";
4
+ export interface CalendarEvent {
5
+ id: string;
6
+ title: string;
7
+ start: Date | string;
8
+ end?: Date | string;
9
+ allDay?: boolean;
10
+ color?: string;
11
+ variant?: CalendarEventVariant;
12
+ description?: string;
13
+ disabled?: boolean;
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+ export interface CalendarProps {
17
+ value?: Date | null;
18
+ defaultValue?: Date | null;
19
+ onDateChange?: (date: Date) => void;
20
+ events?: CalendarEvent[];
21
+ /**
22
+ * Only `"month"` is implemented in this release. The type accepts the rest
23
+ * of the family so a future release can add them without a breaking prop
24
+ * change; passing one today falls back to `"month"` with a dev warning
25
+ * (known limitation — no week/day/agenda/scheduler view yet).
26
+ */
27
+ view?: CalendarView;
28
+ /** BCP 47 locale for month/weekday names via `Intl.DateTimeFormat`. */
29
+ locale?: string;
30
+ /** 0 = Sunday, 1 = Monday. */
31
+ weekStartsOn?: 0 | 1;
32
+ min?: Date;
33
+ max?: Date;
34
+ disabledDates?: (date: Date) => boolean;
35
+ maxEventsPerDay?: number;
36
+ loading?: boolean;
37
+ error?: ReactNode;
38
+ className?: string;
39
+ "aria-label"?: string;
40
+ todayLabel?: string;
41
+ moreLabel?: (count: number) => string;
42
+ noEventsLabel?: string;
43
+ onMonthChange?: (year: number, month: number) => void;
44
+ onEventClick?: (event: CalendarEvent) => void;
45
+ }
46
+ /**
47
+ * Month-view event calendar. Composes `Button`/`IconButton`/`Skeleton`/`Alert`
48
+ * for chrome rather than reimplementing them (doc: reuse, don't duplicate).
49
+ *
50
+ * Known limitations: only `view="month"` renders; no week/day/agenda/
51
+ * scheduler view and no drag-and-drop event moving yet — the `view` prop and
52
+ * `CalendarEvent` shape are deliberately future-proof for both.
53
+ */
54
+ export declare function Calendar({ value, defaultValue, onDateChange, events, view, locale, weekStartsOn, min, max, disabledDates, maxEventsPerDay, loading, error, className, "aria-label": ariaLabel, todayLabel, moreLabel, noEventsLabel, onMonthChange, onEventClick, }: CalendarProps): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChartCommonProps } from './chart/chartTypes';
3
+ export interface ChartProps extends ChartCommonProps {
4
+ /** Render prop — receives the measured surface size once a real width is known (never called at width 0). */
5
+ children: (size: {
6
+ width: number;
7
+ height: number;
8
+ }) => ReactNode;
9
+ /** No data to plot (distinct from `loading`/`error`) — renders `emptyMessage` instead of an empty SVG. */
10
+ isEmpty?: boolean;
11
+ legend?: ReactNode;
12
+ /** Visually-hidden textual/table fallback for screen reader and keyboard users who don't perceive the SVG (doc: chart data needs a non-visual summary). */
13
+ summary?: ReactNode;
14
+ }
15
+ /**
16
+ * Low-level responsive shell every concrete chart (LineChart, BarChart, ...)
17
+ * composes for sizing + loading/empty/error chrome (doc: "Chart" is part of
18
+ * the public surface in its own right, for a consumer building a custom
19
+ * visualization without reimplementing that infrastructure).
20
+ *
21
+ * Deliberately not `role="img"`: a chart's data points are individually
22
+ * focusable (keyboard navigation between them), and `img` tells assistive
23
+ * tech to ignore all descendants. `group` plus the visually-hidden `summary`
24
+ * is what stays correct for an interactive chart.
25
+ */
26
+ export declare function Chart({ title, height, loading, error, emptyMessage, disabled, className, animate, "aria-label": ariaLabel, isEmpty, legend, summary, children, }: ChartProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { ChartSeries } from './chart/chartTypes';
2
+ export interface ChartLegendItem {
3
+ key: string;
4
+ label: string;
5
+ color: string;
6
+ hidden?: boolean;
7
+ }
8
+ export interface ChartLegendProps {
9
+ items: readonly ChartLegendItem[];
10
+ /** Toggles one series' visibility. Omit to render a read-only legend. */
11
+ onToggle?: (key: string) => void;
12
+ className?: string;
13
+ }
14
+ /**
15
+ * Series swatches + labels, shared by every chart (doc section 5 — public,
16
+ * reused rather than reimplemented per chart type). Each item is a real
17
+ * `<button>` when `onToggle` is supplied, so toggling a series is keyboard-
18
+ * and screen-reader-accessible, not a `<div onClick>`.
19
+ */
20
+ export declare function ChartLegend({ items, onToggle, className }: ChartLegendProps): import("react").JSX.Element;
21
+ /** Convenience: builds legend items straight from a chart's series list + resolved colors — the shape every concrete chart needs. */
22
+ export declare function legendItemsFromSeries(series: readonly ChartSeries[], colorOverrides: string[] | undefined, hiddenKeys: ReadonlySet<string>): ChartLegendItem[];
@@ -0,0 +1,87 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { ContextMenuPoint } from './contextMenuPosition';
3
+ /**
4
+ * Declarative context menu.
5
+ *
6
+ * `<ContextMenu>` is a *declaration*, not page content: on its own it renders
7
+ * nothing at all. `RichComponentBase` lifts the declaration out of its
8
+ * children and re-renders it inside a surface context when the user invokes
9
+ * the menu, which is why a stray `<ContextMenu>` anywhere else in a tree can
10
+ * never leak markup into the page.
11
+ *
12
+ * Layer: Base. It performs no HTTP and knows nothing about metadata, so
13
+ * Remote and Smart can compose it without inverting the dependency direction.
14
+ */
15
+ export type ContextMenuCloseReason = "select" | "escape" | "dismiss";
16
+ export interface ContextMenuSurfaceValue {
17
+ /** Viewport coordinates the menu was invoked at. */
18
+ point: ContextMenuPoint;
19
+ /** Changes on every invocation, so a repeated right-click re-measures. */
20
+ openId: number;
21
+ close: (reason: ContextMenuCloseReason) => void;
22
+ }
23
+ /**
24
+ * Internal wiring between `RichComponentBase` and the surface. Deliberately
25
+ * not part of the package's public exports — open/close state and positioning
26
+ * are implementation details, not API.
27
+ */
28
+ export declare const ContextMenuSurfaceContext: import('react').Context<ContextMenuSurfaceValue | null>;
29
+ export interface ContextMenuProps {
30
+ children?: ReactNode;
31
+ /**
32
+ * Leaves the browser's own context menu intact without removing the
33
+ * declaration — the menu is switched off, not deleted.
34
+ */
35
+ disabled?: boolean;
36
+ /** Accessible name for the surface, when the rows alone are not enough. */
37
+ "aria-label"?: string;
38
+ className?: string;
39
+ }
40
+ export interface ContextMenuItemProps {
41
+ children?: ReactNode;
42
+ /** Optional stable identifier; emitted as the row's DOM id. */
43
+ id?: string;
44
+ disabled?: boolean;
45
+ /** Not rendered at all, and so skipped by keyboard navigation. */
46
+ hidden?: boolean;
47
+ /** Destructive emphasis — the same semantic name `Menu`'s item model uses. */
48
+ danger?: boolean;
49
+ /** Icon content, e.g. `<Icon name="bi bi-pencil" />`. No icon set is bundled. */
50
+ icon?: ReactNode;
51
+ /** Accessible name, for a row whose visible text is not sufficient. */
52
+ "aria-label"?: string;
53
+ className?: string;
54
+ onSelect?: () => void | Promise<void>;
55
+ }
56
+ export interface ContextMenuLabelProps {
57
+ children?: ReactNode;
58
+ className?: string;
59
+ }
60
+ export interface ContextMenuSeparatorProps {
61
+ className?: string;
62
+ }
63
+ export interface ContextMenuSubMenuProps {
64
+ /** Visible text of the row that opens the submenu. */
65
+ label: ReactNode;
66
+ children?: ReactNode;
67
+ id?: string;
68
+ disabled?: boolean;
69
+ hidden?: boolean;
70
+ icon?: ReactNode;
71
+ /** Accessible name, for a trigger whose visible text is not sufficient. */
72
+ "aria-label"?: string;
73
+ className?: string;
74
+ }
75
+ export interface ContextMenuComponent {
76
+ (props: ContextMenuProps): ReactElement | null;
77
+ Item: (props: ContextMenuItemProps) => ReactElement | null;
78
+ Separator: (props: ContextMenuSeparatorProps) => ReactElement;
79
+ Label: (props: ContextMenuLabelProps) => ReactElement;
80
+ SubMenu: (props: ContextMenuSubMenuProps) => ReactElement | null;
81
+ }
82
+ /**
83
+ * The compound is annotated explicitly rather than inferred from
84
+ * `Object.assign`, so the generated declaration file names only exported
85
+ * types and never a private local one.
86
+ */
87
+ export declare const ContextMenu: ContextMenuComponent;
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { GridResponsiveOptions } from './dataGridResponsive';
2
3
  export type DataGridAlign = "start" | "center" | "end";
3
4
  /**
4
5
  * Closed, finite formatter set — the same contract the Smart layer's
@@ -34,6 +35,17 @@ export type DataGridSort = {
34
35
  key: string;
35
36
  direction: "asc" | "desc";
36
37
  };
38
+ /**
39
+ * A column's identity as the grid resolves it: `key ?? field ?? header`.
40
+ *
41
+ * The row's own field names are offered as suggestions — they are what most
42
+ * columns are keyed by — while an explicit `key` (a `render`-only column, a
43
+ * command column) is still accepted. `string & {}` is what keeps the literal
44
+ * suggestions from collapsing into bare `string`.
45
+ */
46
+ export type DataGridColumnKey<TRow> = (keyof TRow & string) | (string & {});
47
+ /** Responsive options for one grid, keyed by that grid's column identities. */
48
+ export type DataGridResponsiveOptions<TRow> = GridResponsiveOptions<DataGridColumnKey<TRow>>;
37
49
  export interface DataGridProps<TRow> {
38
50
  columns: DataGridColumn<TRow>[];
39
51
  rows: TRow[];
@@ -57,6 +69,20 @@ export interface DataGridProps<TRow> {
57
69
  pageSize?: number;
58
70
  totalCount?: number;
59
71
  onPageChange?: (page: number) => void;
72
+ /**
73
+ * Progressive column reduction for narrow containers. Presence of this
74
+ * object is what enables the behavior — there is no second boolean to
75
+ * disagree with it. Omitted (the default), the grid is byte-for-byte what it
76
+ * was: every column stays in the row and a wide table scrolls horizontally
77
+ * inside its own container.
78
+ *
79
+ * Enabled, columns leave the tabular layout one at a time as the *grid's own
80
+ * container* gets too narrow for them, in the order of `columns`, and come
81
+ * back in the exact reverse order as it widens. `primaryColumn` always stays.
82
+ * With no `columns` list, every eligible data column is processed in declared
83
+ * order with `"Responsive"` behavior, so nothing is hidden by default.
84
+ */
85
+ responsive?: DataGridResponsiveOptions<TRow>;
60
86
  }
61
87
  /**
62
88
  * Intentionally focused first iteration (doc section 10/18): columns, rows,
@@ -64,4 +90,4 @@ export interface DataGridProps<TRow> {
64
90
  * No built-in filtering UI, column resize/reorder, or virtualization yet —
65
91
  * those are future extensions, not implemented speculatively.
66
92
  */
67
- export declare function DataGrid<TRow>({ columns, rows, rowKey, loading, error, emptyText, className, selectedRowKeys, onSelectionChange, sort, onSortChange, page, pageSize, totalCount, onPageChange, }: DataGridProps<TRow>): import("react").JSX.Element;
93
+ export declare function DataGrid<TRow>({ columns, rows, rowKey, loading, error, emptyText, className, selectedRowKeys, onSelectionChange, sort, onSortChange, page, pageSize, totalCount, onPageChange, responsive, }: DataGridProps<TRow>): import("react").JSX.Element;
@@ -0,0 +1,57 @@
1
+ export type DocumentViewerSource = string | Blob | ArrayBuffer;
2
+ export type DocumentViewerErrorKind = "unsupported" | "password-protected" | "corrupted" | "network" | "unknown";
3
+ export interface DocumentViewerError {
4
+ kind: DocumentViewerErrorKind;
5
+ message: string;
6
+ }
7
+ export interface DocumentViewerLabels {
8
+ loading?: string;
9
+ unsupported?: string;
10
+ passwordProtected?: string;
11
+ corrupted?: string;
12
+ networkError?: string;
13
+ download?: string;
14
+ zoomIn?: string;
15
+ zoomOut?: string;
16
+ fitToWidth?: string;
17
+ fitToView?: string;
18
+ rotate?: string;
19
+ fullscreen?: string;
20
+ exitFullscreen?: string;
21
+ previousPage?: string;
22
+ nextPage?: string;
23
+ page?: string;
24
+ of?: string;
25
+ openInNewTab?: string;
26
+ }
27
+ export interface DocumentViewerProps {
28
+ source: DocumentViewerSource;
29
+ fileName?: string;
30
+ /** MIME type, when known. Falls back to a safe guess from `fileName`'s extension when omitted. */
31
+ mimeType?: string;
32
+ className?: string;
33
+ /** Viewer surface height. Defaults to a fixed comfortable reading height rather than growing unbounded with page content. */
34
+ height?: number | string;
35
+ initialPage?: number;
36
+ toolbar?: boolean;
37
+ allowFullscreen?: boolean;
38
+ allowNewTab?: boolean;
39
+ /** No central i18n catalog lives in Base (doc: Smart owns the one exception) — override the visible strings here instead. */
40
+ labels?: DocumentViewerLabels;
41
+ /** Called instead of the built-in download behavior when supplied. */
42
+ onDownload?: () => void;
43
+ onError?: (error: DocumentViewerError) => void;
44
+ onPageChange?: (page: number, totalPages: number) => void;
45
+ }
46
+ /**
47
+ * Previews PDF and common image formats without leaking SVG/canvas/portal
48
+ * plumbing to the consumer — a document/file card, a native `<embed>`, a
49
+ * third-party viewer, or a bespoke zoom/rotate/pagination toolbar are never
50
+ * something a consumer of this library builds by hand.
51
+ *
52
+ * `pdfjs-dist` is imported lazily (only once a PDF `source` is actually
53
+ * rendered), so an app that only ever previews images never pays for it.
54
+ * SVG/HTML/script sources are never rendered directly — anything outside the
55
+ * five supported formats below falls back to a file-info + download panel.
56
+ */
57
+ export declare function DocumentViewer({ source, fileName, mimeType, className, height, initialPage, toolbar, allowFullscreen, allowNewTab, labels, onDownload, onError, onPageChange, }: DocumentViewerProps): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { CircularChartBaseProps } from './chart/CircularChartBase';
2
+ export type DonutChartProps = Omit<CircularChartBaseProps, "variant">;
3
+ /** A `PieChart` with a cutout center — `centerLabel`/`centerValue` render inside it. */
4
+ export declare function DonutChart(props: DonutChartProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { CartesianChartCoreProps } from './chart/CartesianChart';
2
+ export type LineChartProps = Omit<CartesianChartCoreProps, "kind" | "orientation" | "stacked">;
3
+ /**
4
+ * `<LineChart title="..." data={data} xKey="month" series={[...]} />` — a
5
+ * consumer never touches SVG, ResizeObserver or a tooltip portal (doc section
6
+ * 5). Composes the shared `CartesianChart` renderer with `AreaChart`,
7
+ * `BarChart` and `StackedBarChart`.
8
+ */
9
+ export declare function LineChart(props: LineChartProps): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { CircularChartBaseProps } from './chart/CircularChartBase';
2
+ export type PieChartProps = Omit<CircularChartBaseProps, "variant" | "innerRadiusRatio" | "centerLabel" | "centerValue">;
3
+ /** A single metric broken into categories (`nameKey`/`valueKey` over `data`). For a cutout center, use `DonutChart`. */
4
+ export declare function PieChart(props: PieChartProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { HTMLAttributes, ReactHTML, ReactNode } from 'react';
2
+ /** How the context-menu trigger is attached to the visible content. */
3
+ export type RichComponentBaseTrigger = "auto" | "child" | "wrapper";
4
+ export interface RichComponentBaseProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
5
+ /** A single optional `<ContextMenu>` declaration plus the visible content. */
6
+ children?: ReactNode;
7
+ /** See the component doc comment. Defaults to `"auto"`. */
8
+ trigger?: RichComponentBaseTrigger;
9
+ /** Wrapper element used by the wrapper path. Defaults to `"div"`. */
10
+ as?: keyof ReactHTML;
11
+ }
12
+ export declare const RichComponentBase: import('react').ForwardRefExoticComponent<RichComponentBaseProps & import('react').RefAttributes<HTMLElement>>;
@@ -0,0 +1,4 @@
1
+ import { CartesianChartCoreProps } from './chart/CartesianChart';
2
+ export type StackedBarChartProps = Omit<CartesianChartCoreProps, "kind" | "stacked">;
3
+ /** Every visible series stacks into one column per category. See `BarChart` for grouped bars. */
4
+ export declare function StackedBarChart(props: StackedBarChartProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { ChartCommonProps, ChartDatum, ChartInteraction, ChartSeries, ChartValue } from './chartTypes';
2
+ export interface CartesianChartCoreProps extends ChartCommonProps {
3
+ kind: "line" | "area" | "bar";
4
+ data: ChartDatum[];
5
+ xKey: string;
6
+ series: ChartSeries[];
7
+ xAxisLabel?: string;
8
+ yAxisLabel?: string;
9
+ showGrid?: boolean;
10
+ showDataLabels?: boolean;
11
+ xFormatter?: (value: ChartValue) => string;
12
+ yFormatter?: (value: number) => string;
13
+ /** Bar/StackedBar only. */
14
+ orientation?: "vertical" | "horizontal";
15
+ /** Bar only — StackedBarChart always passes `true` and hides the prop from its own public API. */
16
+ stacked?: boolean;
17
+ onDataPointClick?: (interaction: ChartInteraction) => void;
18
+ onLegendItemClick?: (seriesKey: string, hidden: boolean) => void;
19
+ locale?: string;
20
+ }
21
+ /**
22
+ * Shared renderer behind LineChart/AreaChart/BarChart/StackedBarChart (doc:
23
+ * compose, don't reimplement per chart type — the only real differences
24
+ * between them are the mark shape and, for bars, orientation/stacking).
25
+ *
26
+ * Plain SVG, no charting dependency (the same call already made for
27
+ * `Sparkline`): a public API shaped around `data`/`xKey`/`series` stays
28
+ * implementation-agnostic, and the repository's Base layer has zero runtime
29
+ * dependencies today.
30
+ */
31
+ export declare function CartesianChart({ kind, title, data, xKey, series, height, loading, error, emptyMessage, disabled, showLegend, showTooltip, showGrid, showDataLabels, animate, xAxisLabel, yAxisLabel, xFormatter, yFormatter, orientation, stacked, colors, className, onDataPointClick, onLegendItemClick, locale, "aria-label": ariaLabel, }: CartesianChartCoreProps): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ export interface ChartSliceSummaryProps {
2
+ items: readonly {
3
+ label: string;
4
+ value: number;
5
+ }[];
6
+ }
7
+ /**
8
+ * Visually-hidden textual/table fallback of a circular chart's data (doc:
9
+ * "ekran okuyucu için tablo veya metinsel veri özeti") — name/value pairs,
10
+ * the shape Donut/Pie slices actually have (`CartesianChart` builds its own
11
+ * equivalent table inline, since its shape — a series per column — differs).
12
+ */
13
+ export declare function ChartSliceSummary({ items }: ChartSliceSummaryProps): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChartStatusProps } from './chartTypes';
3
+ export interface ChartStatusOverlayProps extends ChartStatusProps {
4
+ height: number;
5
+ emptyMessage?: ReactNode;
6
+ }
7
+ /**
8
+ * Loading/error/empty presentation shared by every chart (doc: "Chart,
9
+ * ChartLegend, ChartTooltip, ChartEmptyState" common infrastructure — kept as
10
+ * one internal piece rather than three, since none of the three states is
11
+ * ever shown without the others in this family).
12
+ *
13
+ * Not part of the public surface: each concrete chart decides when to render
14
+ * it, so there is nothing here a consumer would use standalone.
15
+ */
16
+ export declare function ChartStatusOverlay({ loading, error, emptyMessage, height }: ChartStatusOverlayProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ export interface ChartTooltipPayloadItem {
2
+ key: string;
3
+ label: string;
4
+ value: string;
5
+ color: string;
6
+ }
7
+ export interface ChartTooltipPayload {
8
+ label: string;
9
+ items: ChartTooltipPayloadItem[];
10
+ }
11
+ export interface ChartTooltipProps {
12
+ payload: ChartTooltipPayload;
13
+ className?: string;
14
+ }
15
+ /**
16
+ * Summary of the currently focused/hovered data point (doc: tooltip).
17
+ * Deliberately not a cursor-following floating panel: that would need its own
18
+ * portal/collision-avoidance system duplicating `Popup`'s, for marginal gain —
19
+ * a fixed slot next to the chart (positioned by CSS, `.rrc-chart__tooltip`) is
20
+ * equally readable and stays keyboard- and touch-friendly without one.
21
+ */
22
+ export declare function ChartTooltip({ payload, className }: ChartTooltipProps): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChartCommonProps, ChartDatum, ChartSliceInteraction } from './chartTypes';
3
+ export interface CircularChartBaseProps extends ChartCommonProps {
4
+ variant: "donut" | "pie";
5
+ data: ChartDatum[];
6
+ nameKey: string;
7
+ valueKey: string;
8
+ /** Donut only — ratio of the inner cutout radius to the outer radius. Ignored (forced to 0) for `variant="pie"`. */
9
+ innerRadiusRatio?: number;
10
+ /** Donut only — rendered in the center cutout. */
11
+ centerLabel?: ReactNode;
12
+ centerValue?: ReactNode;
13
+ valueFormatter?: (value: number) => string;
14
+ showDataLabels?: boolean;
15
+ onSliceClick?: (interaction: ChartSliceInteraction) => void;
16
+ }
17
+ /** Shared renderer for DonutChart and PieChart. */
18
+ export declare function CircularChartBase({ variant, data, nameKey, valueKey, innerRadiusRatio, centerLabel, centerValue, valueFormatter, showDataLabels, showLegend, colors, onSliceClick, ...chartProps }: CircularChartBaseProps): import("react").JSX.Element;