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.
- package/README.md +164 -1
- package/dist/base/AreaChart.d.ts +4 -0
- package/dist/base/BarChart.d.ts +4 -0
- package/dist/base/Calendar.d.ts +54 -0
- package/dist/base/Chart.d.ts +26 -0
- package/dist/base/ChartLegend.d.ts +22 -0
- package/dist/base/ContextMenu.d.ts +87 -0
- package/dist/base/DataGrid.d.ts +27 -1
- package/dist/base/DocumentViewer.d.ts +57 -0
- package/dist/base/DonutChart.d.ts +4 -0
- package/dist/base/LineChart.d.ts +9 -0
- package/dist/base/PieChart.d.ts +4 -0
- package/dist/base/RichComponentBase.d.ts +12 -0
- package/dist/base/StackedBarChart.d.ts +4 -0
- package/dist/base/chart/CartesianChart.d.ts +31 -0
- package/dist/base/chart/ChartSliceSummary.d.ts +13 -0
- package/dist/base/chart/ChartStatus.d.ts +16 -0
- package/dist/base/chart/ChartTooltip.d.ts +22 -0
- package/dist/base/chart/CircularChartBase.d.ts +18 -0
- package/dist/base/chart/chartColors.d.ts +4 -0
- package/dist/base/chart/chartScales.d.ts +15 -0
- package/dist/base/chart/chartTypes.d.ts +58 -0
- package/dist/base/chart/useChartDimensions.d.ts +13 -0
- package/dist/base/chart/useChartIndexNavigation.d.ts +23 -0
- package/dist/base/contextMenuModel.d.ts +49 -0
- package/dist/base/contextMenuPosition.d.ts +41 -0
- package/dist/base/dataGridResponsive.d.ts +169 -0
- package/dist/base/index.d.ts +43 -0
- package/dist/base/shared/Portal.d.ts +20 -0
- package/dist/base/shared/composeRefs.d.ts +3 -0
- package/dist/base/shared/useElementResize.d.ts +16 -0
- package/dist/base/shared/useIsomorphicLayoutEffect.d.ts +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3686 -1906
- package/dist/index.js.map +1 -1
- package/dist/pdf-04d5ad63.js +14755 -0
- package/dist/pdf-04d5ad63.js.map +1 -0
- package/dist/pdf-c22cffd3.cjs +13 -0
- package/dist/pdf-c22cffd3.cjs.map +1 -0
- package/dist/pdf.worker.min-ab9f616e.cjs +2 -0
- package/dist/pdf.worker.min-ab9f616e.cjs.map +1 -0
- package/dist/pdf.worker.min-e6e7e836.js +5 -0
- package/dist/pdf.worker.min-e6e7e836.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +75 -72
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChartSeries } from './chartTypes';
|
|
2
|
+
export declare function resolveChartColor(index: number, explicit: string | undefined, overrides: string[] | undefined): string;
|
|
3
|
+
/** Resolves a color for every series in order — the shape `ChartLegend` and every concrete chart need. */
|
|
4
|
+
export declare function chartSeriesColorList(series: readonly ChartSeries[], overrides: string[] | undefined): string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal scale/tick math, written in-house rather than adding a dependency
|
|
3
|
+
* (d3-scale et al.) — the same call this repo already made for `Sparkline`.
|
|
4
|
+
* A handful of pure functions is enough for a band + linear axis and stays
|
|
5
|
+
* inside the library's zero-runtime-dependency footprint for the Base layer.
|
|
6
|
+
*/
|
|
7
|
+
export declare function linearScale(domain: [number, number], range: [number, number]): (value: number) => number;
|
|
8
|
+
/** "Nice" round tick values spanning at least [min, max] — the standard d3-style rounding step. */
|
|
9
|
+
export declare function niceTicks(min: number, max: number, count?: number): number[];
|
|
10
|
+
/** Evenly divides `size` into `count` bands, returning each band's start offset and width. */
|
|
11
|
+
export declare function bandScale(count: number, size: number, paddingRatio?: number): {
|
|
12
|
+
bandWidth: number;
|
|
13
|
+
offset: (index: number) => number;
|
|
14
|
+
};
|
|
15
|
+
export declare function defaultNumberFormatter(locale?: string): (value: number) => string;
|
|
@@ -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;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Identification of the declarative context-menu nodes.
|
|
4
|
+
*
|
|
5
|
+
* Recognition is by component *identity*, recorded in a module-private
|
|
6
|
+
* WeakMap that is written once while this module initializes and never
|
|
7
|
+
* mutated afterwards. Deliberately not `displayName`, not `Component.name`
|
|
8
|
+
* and not a string on `props`: those are all rewritten or dropped by a
|
|
9
|
+
* minifier, which would make the whole feature fail only in a production
|
|
10
|
+
* bundle. A WeakMap keyed on the component reference survives minification
|
|
11
|
+
* for exactly the same reason `type === Component` does, and needs no type
|
|
12
|
+
* assertion to read back.
|
|
13
|
+
*/
|
|
14
|
+
export type ContextMenuNodeKind = "menu" | "item" | "label" | "separator" | "submenu";
|
|
15
|
+
/** Records what a component is. Called once per component at module scope. */
|
|
16
|
+
export declare function markContextMenuNode<TComponent extends object>(component: TComponent, kind: ContextMenuNodeKind): TComponent;
|
|
17
|
+
/** The kind of a rendered node, or `undefined` for anything this module did not mark. */
|
|
18
|
+
export declare function contextMenuNodeKind(node: ReactNode): ContextMenuNodeKind | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Flattens the direct children of a node one fragment level at a time.
|
|
21
|
+
*
|
|
22
|
+
* Fragments are handled deliberately rather than by accident: a
|
|
23
|
+
* `<>{menu}{content}</>` child must not hide the menu declaration from the
|
|
24
|
+
* partition below, and its visible children must not be dropped either.
|
|
25
|
+
*/
|
|
26
|
+
export declare function flattenMenuChildren(children: ReactNode): ReactNode[];
|
|
27
|
+
export interface RichComponentBaseChildren {
|
|
28
|
+
/** The single `<ContextMenu>` declaration, if one was supplied. */
|
|
29
|
+
menu?: ReactElement;
|
|
30
|
+
/** Everything else, rendered as ordinary page content. */
|
|
31
|
+
content: ReactNode[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Splits `RichComponentBase`'s children into the menu declaration and the
|
|
35
|
+
* visible content. A second `<ContextMenu>` is ignored rather than rendered,
|
|
36
|
+
* so a stray declaration can never leak into the page as content.
|
|
37
|
+
*/
|
|
38
|
+
export declare function partitionRichComponentBaseChildren(children: ReactNode): RichComponentBaseChildren;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a declaration would put at least one selectable row on screen.
|
|
41
|
+
*
|
|
42
|
+
* This is what decides if the browser's own context menu is suppressed, so it
|
|
43
|
+
* is answered from the declaration *before* anything is rendered. Labels and
|
|
44
|
+
* separators do not count — a surface made only of those is "effectively
|
|
45
|
+
* empty" and must leave native behavior alone. Anything this module did not
|
|
46
|
+
* mark (a consumer's own wrapper component, arbitrary markup) counts as
|
|
47
|
+
* content: guessing it away would silently disable a menu that does render.
|
|
48
|
+
*/
|
|
49
|
+
export declare function contextMenuHasContent(children: ReactNode): boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure viewport placement math for the context menu surface.
|
|
3
|
+
*
|
|
4
|
+
* Kept free of React and of the DOM (the caller measures and passes plain
|
|
5
|
+
* numbers) so the flip/clamp rules are unit-testable on their own, the same
|
|
6
|
+
* split `sidebarModel.ts` uses for the Sidebar's navigation model.
|
|
7
|
+
*/
|
|
8
|
+
export interface ContextMenuPoint {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ContextMenuSize {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ContextMenuViewport {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
/** Rect of a submenu's trigger row, in viewport coordinates. */
|
|
21
|
+
export interface ContextMenuTriggerBox {
|
|
22
|
+
left: number;
|
|
23
|
+
right: number;
|
|
24
|
+
top: number;
|
|
25
|
+
bottom: number;
|
|
26
|
+
}
|
|
27
|
+
/** Breathing room kept between the surface and the viewport edge. */
|
|
28
|
+
export declare const CONTEXT_MENU_VIEWPORT_MARGIN = 8;
|
|
29
|
+
/**
|
|
30
|
+
* Places the root surface at the pointer. Flips to the opposite side of the
|
|
31
|
+
* pointer when the preferred side would overflow, then clamps, so a menu that
|
|
32
|
+
* is simply larger than the viewport still starts inside it rather than
|
|
33
|
+
* scrolling the page.
|
|
34
|
+
*/
|
|
35
|
+
export declare function placeContextMenuAtPoint(point: ContextMenuPoint, size: ContextMenuSize, viewport: ContextMenuViewport, margin?: number): ContextMenuPoint;
|
|
36
|
+
/**
|
|
37
|
+
* Places a submenu beside its trigger row: flush to the trigger's right edge
|
|
38
|
+
* by default so the pointer can travel into it without crossing a gap, and
|
|
39
|
+
* mirrored to the left when that would overflow.
|
|
40
|
+
*/
|
|
41
|
+
export declare function placeSubMenuBeside(trigger: ContextMenuTriggerBox, size: ContextMenuSize, viewport: ContextMenuViewport, margin?: number): ContextMenuPoint;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Responsive column model for grid-like components.
|
|
4
|
+
*
|
|
5
|
+
* The problem: when a grid's *actual available width* is too small for its
|
|
6
|
+
* visible columns, rows stop being readable. The answer here is an ordered
|
|
7
|
+
* list of rules that progressively take columns out of the tabular layout —
|
|
8
|
+
* either relocating them into the row's own label/value detail area
|
|
9
|
+
* (`"Responsive"`) or dropping them entirely (`"Hide"`) — while one primary
|
|
10
|
+
* column always stays in the normal row.
|
|
11
|
+
*
|
|
12
|
+
* This module owns the whole algorithm: column classification, primary-column
|
|
13
|
+
* resolution, rule normalization, development-time validation and the
|
|
14
|
+
* width-driven fit loop. `DataGrid` is its only consumer, and `RemoteDataGrid`
|
|
15
|
+
* and the Smart `dataGridResolver` inherit the behavior by composing
|
|
16
|
+
* `DataGrid` — the algorithm exists exactly once.
|
|
17
|
+
*
|
|
18
|
+
* It is deliberately React-only-at-the-edges: everything above
|
|
19
|
+
* `useResponsiveColumnFit` is a pure function of a structural column model,
|
|
20
|
+
* so it is unit-testable without rendering a grid, and it never imports the
|
|
21
|
+
* grid itself (no cycle, and the grid stays the sole owner of its column type).
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* What happens to a column when the grid runs out of room for it.
|
|
25
|
+
*
|
|
26
|
+
* - `"Responsive"` — leaves the tabular row and is shown as a label/value pair
|
|
27
|
+
* in that same row's detail area.
|
|
28
|
+
* - `"Hide"` — leaves the tabular row and is not shown anywhere.
|
|
29
|
+
*
|
|
30
|
+
* Capitalized, unlike this library's other string unions (`"asc"`, `"text"`,
|
|
31
|
+
* `"auto"`, …), because these two are a specified external contract. One
|
|
32
|
+
* representation only: the lower-case spellings are deliberately *not*
|
|
33
|
+
* accepted, so there is never a second competing form of the same concept.
|
|
34
|
+
*/
|
|
35
|
+
export type ResponsiveColumnBehavior = "Responsive" | "Hide";
|
|
36
|
+
/**
|
|
37
|
+
* One entry of the ordered rule list. Position in the array is the priority —
|
|
38
|
+
* there is no separate priority number to keep in sync with it.
|
|
39
|
+
*/
|
|
40
|
+
export interface ResponsiveColumnRule<TField> {
|
|
41
|
+
field: TField;
|
|
42
|
+
behavior: ResponsiveColumnBehavior;
|
|
43
|
+
}
|
|
44
|
+
export interface GridResponsiveOptions<TField> {
|
|
45
|
+
/**
|
|
46
|
+
* The column that carries the row's identity in a narrow layout. It always
|
|
47
|
+
* stays in the tabular row: it is never relocated to the detail area and
|
|
48
|
+
* never removed by a `"Hide"` rule.
|
|
49
|
+
*/
|
|
50
|
+
primaryColumn?: TField;
|
|
51
|
+
/**
|
|
52
|
+
* Ordered rules. The first is processed first as width shrinks, and the last
|
|
53
|
+
* processed is the first restored as width grows. Columns not listed here
|
|
54
|
+
* are still handled — see `buildResponsiveColumnPlan`.
|
|
55
|
+
*/
|
|
56
|
+
columns?: readonly ResponsiveColumnRule<TField>[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The parts of a grid column this model needs, as a structural shape.
|
|
60
|
+
*
|
|
61
|
+
* `isData` / `isUtility` / `isTextual` are classifications the grid derives
|
|
62
|
+
* from its own column type, so this module never has to know what a
|
|
63
|
+
* `DataGridColumn` is.
|
|
64
|
+
*/
|
|
65
|
+
export interface ResponsiveColumnModel {
|
|
66
|
+
/** The grid's own column identity. */
|
|
67
|
+
key: string;
|
|
68
|
+
/** Reads a value out of the row (as opposed to a command/action column). */
|
|
69
|
+
isData: boolean;
|
|
70
|
+
/** A command/action/control column: renders arbitrary content, reads no value. */
|
|
71
|
+
isUtility: boolean;
|
|
72
|
+
/** A data column whose value is textual, so it reads well as a row title. */
|
|
73
|
+
isTextual: boolean;
|
|
74
|
+
}
|
|
75
|
+
export type ResponsiveProblemKind = "unknown-column" | "duplicate-rule" | "primary-column-rule" | "invalid-behavior" | "utility-column-responsive" | "invalid-primary-column";
|
|
76
|
+
/** One development-time diagnostic, in the same shape the demo registry uses. */
|
|
77
|
+
export interface ResponsiveProblem {
|
|
78
|
+
kind: ResponsiveProblemKind;
|
|
79
|
+
detail: string;
|
|
80
|
+
}
|
|
81
|
+
/** A rule after validation, addressed by the grid's resolved column key. */
|
|
82
|
+
export interface NormalizedResponsiveRule {
|
|
83
|
+
key: string;
|
|
84
|
+
behavior: ResponsiveColumnBehavior;
|
|
85
|
+
}
|
|
86
|
+
export interface ResponsiveColumnPlan {
|
|
87
|
+
/** Resolved primary column, or `undefined` when no column is eligible. */
|
|
88
|
+
primaryKey: string | undefined;
|
|
89
|
+
/** The single ordered list the fit loop walks. */
|
|
90
|
+
rules: readonly NormalizedResponsiveRule[];
|
|
91
|
+
problems: readonly ResponsiveProblem[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Deterministic resolution, in order:
|
|
95
|
+
*
|
|
96
|
+
* 1. the configured `primaryColumn`, when it names an eligible column;
|
|
97
|
+
* 2. otherwise the first textual data column in declared column order;
|
|
98
|
+
* 3. otherwise the first data column in declared column order;
|
|
99
|
+
* 4. otherwise `undefined` — the grid keeps its existing behavior.
|
|
100
|
+
*
|
|
101
|
+
* Utility columns (selection, row number, expanders, actions, command and
|
|
102
|
+
* drag-handle columns) are never chosen automatically, and a configured one is
|
|
103
|
+
* rejected: a checkbox or a button is not a row's identity.
|
|
104
|
+
*
|
|
105
|
+
* A configured column that is absent from the current column set — because it
|
|
106
|
+
* was filtered out upstream by a column chooser, by a permission check or by
|
|
107
|
+
* Smart metadata — cannot be the *visible* primary column, so resolution falls
|
|
108
|
+
* through to the automatic rules. Nothing about the upstream decision is
|
|
109
|
+
* touched or written back.
|
|
110
|
+
*/
|
|
111
|
+
export declare function resolvePrimaryColumnKey(columns: readonly ResponsiveColumnModel[], configured: string | undefined): string | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Turns the configured options into one ordered, validated rule list.
|
|
114
|
+
*
|
|
115
|
+
* Configured rules come first, in their declared order. Every remaining
|
|
116
|
+
* eligible data column is then appended in *declared column order* with the
|
|
117
|
+
* default `"Responsive"` behavior, so responsive layout works without asking
|
|
118
|
+
* a consumer to describe every column — and nothing is hidden by default.
|
|
119
|
+
*
|
|
120
|
+
* Skipped, each with a diagnostic: a rule for an unknown column, a duplicate
|
|
121
|
+
* rule, a rule for the primary column, a rule with an invalid behavior, and a
|
|
122
|
+
* `"Responsive"` rule for a utility column (an action cell has no meaningful
|
|
123
|
+
* label/value form). A `"Hide"` rule for a utility column is honored — that is
|
|
124
|
+
* an explicit instruction to drop a control when space runs out, not a silent
|
|
125
|
+
* loss of data. Utility columns are never added by default.
|
|
126
|
+
*/
|
|
127
|
+
export declare function buildResponsiveColumnPlan(columns: readonly ResponsiveColumnModel[], options: GridResponsiveOptions<string> | undefined): ResponsiveColumnPlan;
|
|
128
|
+
/**
|
|
129
|
+
* A stable string identity for one plan. Used to reset the fit loop and to
|
|
130
|
+
* report diagnostics once per configuration rather than once per render or —
|
|
131
|
+
* far worse — once per resize.
|
|
132
|
+
*/
|
|
133
|
+
export declare function responsivePlanSignature(plan: ResponsiveColumnPlan): string;
|
|
134
|
+
export interface ResponsiveColumnFitOptions {
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
/** The grid's own scroll container — the element whose width actually matters. */
|
|
137
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
138
|
+
ruleCount: number;
|
|
139
|
+
/** Resets the loop when the columns or the rules themselves change. */
|
|
140
|
+
signature: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* How many rules are currently applied.
|
|
144
|
+
*
|
|
145
|
+
* Overflow is read from the grid's existing scroll container
|
|
146
|
+
* (`scrollWidth` vs `clientWidth`) rather than from a re-implementation of
|
|
147
|
+
* column sizing, so the browser's own table layout — fixed, minimum and
|
|
148
|
+
* maximum column widths, measured content, `white-space` — remains the single
|
|
149
|
+
* sizing authority. Two DOM reads per pass, independent of row count: the
|
|
150
|
+
* algorithm is O(1) in rows and never scans cells.
|
|
151
|
+
*
|
|
152
|
+
* Shrinking applies one more rule per pass and records the width at which the
|
|
153
|
+
* previous count did not fit. Growing releases one rule per pass, but only
|
|
154
|
+
* once the container is wider than that recorded width plus the hysteresis, so
|
|
155
|
+
* a restore that would immediately overflow again is not attempted. Passes are
|
|
156
|
+
* capped per width, so a pathological layout cannot loop forever.
|
|
157
|
+
*/
|
|
158
|
+
export declare function useResponsiveColumnFit({ enabled, containerRef, ruleCount, signature, }: ResponsiveColumnFitOptions): number;
|
|
159
|
+
/**
|
|
160
|
+
* Reports configuration problems once per configuration.
|
|
161
|
+
*
|
|
162
|
+
* Follows the library's existing development-time validation convention
|
|
163
|
+
* (`useControllableState`, `Sidebar`): `NODE_ENV`-guarded, `console.error`
|
|
164
|
+
* with the `[react-components]` prefix, from an effect keyed on a stable
|
|
165
|
+
* signature — so it never throws during render and never logs on resize.
|
|
166
|
+
* Production fails safe: the malformed rule is skipped, and no data is hidden
|
|
167
|
+
* because of it.
|
|
168
|
+
*/
|
|
169
|
+
export declare function useResponsivePlanDiagnostics(plan: ResponsiveColumnPlan, signature: string): void;
|
package/dist/base/index.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ export * from './AutoComplete';
|
|
|
17
17
|
export * from './FormField';
|
|
18
18
|
export * from './Modal';
|
|
19
19
|
export * from './DataGrid';
|
|
20
|
+
/**
|
|
21
|
+
* Responsive column model shared by every grid-like component. Exported from
|
|
22
|
+
* the Base layer so Remote and Smart grids inherit it by composition rather
|
|
23
|
+
* than by a second implementation.
|
|
24
|
+
*/
|
|
25
|
+
export type { GridResponsiveOptions, ResponsiveColumnBehavior, ResponsiveColumnRule, } from './dataGridResponsive';
|
|
20
26
|
export * from './Pagination';
|
|
21
27
|
export * from './Button';
|
|
22
28
|
export * from './Spinner';
|
|
@@ -53,10 +59,47 @@ export * from './IconButton';
|
|
|
53
59
|
export * from './ListItem';
|
|
54
60
|
export * from './Sparkline';
|
|
55
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';
|
|
56
90
|
export { AppearanceProvider, useAppearance, createAppearanceInitScript, THEME_MODES, SIDEBAR_PRESENTATIONS, SIDEBAR_TONES } from './Appearance';
|
|
57
91
|
export type { AppearanceContextValue, AppearanceInitScriptOptions, AppearanceProviderProps, AppearanceSettings, AppearanceStorage, ResolvedTheme, SidebarPresentation, SidebarTone, ThemeMode, } from './Appearance';
|
|
58
92
|
export * from './appearanceSchemes';
|
|
59
93
|
export * from './AppearanceMenu';
|
|
94
|
+
/**
|
|
95
|
+
* Context menu system. `RichComponentBase` and the `ContextMenu` compound are
|
|
96
|
+
* the whole public surface — the surface context, the positioning helpers and
|
|
97
|
+
* the node-kind model behind them stay internal.
|
|
98
|
+
*/
|
|
99
|
+
export { RichComponentBase } from './RichComponentBase';
|
|
100
|
+
export type { RichComponentBaseProps, RichComponentBaseTrigger } from './RichComponentBase';
|
|
101
|
+
export { ContextMenu } from './ContextMenu';
|
|
102
|
+
export type { ContextMenuComponent, ContextMenuItemProps, ContextMenuLabelProps, ContextMenuProps, ContextMenuSeparatorProps, ContextMenuSubMenuProps, } from './ContextMenu';
|
|
60
103
|
export { Popup } from './shared/Popup';
|
|
61
104
|
export type { PopupProps } from './shared/Popup';
|
|
62
105
|
export { Label } from './shared/Label';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PortalProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** Defaults to `document.body` once mounted on the client. */
|
|
5
|
+
container?: Element | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Minimal SSR-safe portal.
|
|
9
|
+
*
|
|
10
|
+
* The repository had no portal infrastructure before this (Popup positions
|
|
11
|
+
* itself with plain CSS and Modal renders in place, both of which say so in
|
|
12
|
+
* their own doc comments), so this is the smallest primitive that lets an
|
|
13
|
+
* overlay escape an ancestor's `overflow`/`transform` clipping.
|
|
14
|
+
*
|
|
15
|
+
* `document` is never touched during module initialization or during render:
|
|
16
|
+
* the host is resolved in an effect, so a server render produces nothing and
|
|
17
|
+
* the first client render is identical to it. Intentionally internal — it is
|
|
18
|
+
* plumbing for the context menu surface, not a second public overlay API.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Portal({ children, container }: PortalProps): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Calls `onResize` whenever the observed element's box changes.
|
|
4
|
+
*
|
|
5
|
+
* The element's *own* box, not the viewport: a grid can sit in a narrow
|
|
6
|
+
* dashboard panel, a modal, a split view or a resizable container, and a
|
|
7
|
+
* global breakpoint knows nothing about any of those.
|
|
8
|
+
*
|
|
9
|
+
* `ResizeObserver` is used when the environment has it, and only then; the
|
|
10
|
+
* window-resize listener is a fallback for environments without it, so a
|
|
11
|
+
* modern browser never gets a permanent global listener per grid. Nothing is
|
|
12
|
+
* touched during module initialization or during render, so importing this on
|
|
13
|
+
* a server is inert, and the observer is disconnected on cleanup — which is
|
|
14
|
+
* also what makes it safe under React Strict Mode's double mount.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useElementResize(ref: RefObject<Element | null>, enabled: boolean, onResize: () => void): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `useLayoutEffect` in the browser, `useEffect` on the server.
|
|
4
|
+
*
|
|
5
|
+
* Measurement has to happen after layout but before paint, which is what
|
|
6
|
+
* `useLayoutEffect` is for — but React warns when it runs during server
|
|
7
|
+
* rendering, where there is no layout to read. The `typeof window` test never
|
|
8
|
+
* touches a browser global (it cannot throw) and is evaluated once, so the
|
|
9
|
+
* choice is constant for the lifetime of the module and the rules of hooks
|
|
10
|
+
* still hold.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|