@recharts/devtools 0.0.10 → 0.0.12
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/dist/components/RechartsDevtools.js +7 -2
- package/dist/hooks/useSessionStorageState.d.ts +1 -1
- package/dist/inspectors/XAxisTicksInspector.d.ts +2 -0
- package/dist/inspectors/XAxisTicksInspector.js +12 -0
- package/dist/inspectors/YAxisTicksInspector.d.ts +2 -0
- package/dist/inspectors/YAxisTicksInspector.js +12 -0
- package/package.json +1 -1
|
@@ -12,6 +12,8 @@ import { ActiveTooltipLabelInspector } from '../inspectors/ActiveTooltipLabelIns
|
|
|
12
12
|
import { useSessionStorageState } from '../hooks/useSessionStorageState.js';
|
|
13
13
|
import { useRechartsDevtoolsContext } from '../context/RechartsDevtoolsContext.js';
|
|
14
14
|
import { RechartsAnnotations } from './RechartsAnnotations.js';
|
|
15
|
+
import { YAxisTicksInspector } from '../inspectors/YAxisTicksInspector.js';
|
|
16
|
+
import { XAxisTicksInspector } from '../inspectors/XAxisTicksInspector.js';
|
|
15
17
|
const INSPECTORS = {
|
|
16
18
|
'useChartWidth | useChartHeight': ChartDimensionInspector,
|
|
17
19
|
useMargin: MarginInspector,
|
|
@@ -21,6 +23,8 @@ const INSPECTORS = {
|
|
|
21
23
|
useXAxisDomain: XAxisDomainInspector,
|
|
22
24
|
useYAxisDomain: YAxisDomainInspector,
|
|
23
25
|
useActiveTooltipLabel: ActiveTooltipLabelInspector,
|
|
26
|
+
useXAxisTicks: XAxisTicksInspector,
|
|
27
|
+
useYAxisTicks: YAxisTicksInspector,
|
|
24
28
|
};
|
|
25
29
|
const isValidInspectorKey = (key) => {
|
|
26
30
|
return key != null && key in INSPECTORS;
|
|
@@ -38,6 +42,7 @@ export const RechartsDevtools = () => {
|
|
|
38
42
|
const portalId = contextId ?? RECHARTS_DEVTOOLS_PORTAL_ID;
|
|
39
43
|
const { selectedInspectorId, setSelectedInspectorId, selectedInspector } = useSelectedInspector();
|
|
40
44
|
const [container, setContainer] = React.useState(null);
|
|
45
|
+
const selectId = React.useId();
|
|
41
46
|
React.useEffect(() => {
|
|
42
47
|
const el = document.getElementById(portalId);
|
|
43
48
|
setContainer(el);
|
|
@@ -62,8 +67,8 @@ export const RechartsDevtools = () => {
|
|
|
62
67
|
borderBottom: '1px solid #ccc',
|
|
63
68
|
} },
|
|
64
69
|
React.createElement("div", { style: { display: 'flex', alignItems: 'center', marginBottom: '4px', gap: '8px' } },
|
|
65
|
-
React.createElement("label",
|
|
66
|
-
React.createElement("select", { value: selectedInspectorId, onChange: (e) => setSelectedInspectorId(e.target.value), style: { padding: '4px' } }, Object.keys(INSPECTORS).map((key) => (React.createElement("option", { key: key, value: key }, key)))),
|
|
70
|
+
React.createElement("label", { htmlFor: selectId }, "Inspect Hook:"),
|
|
71
|
+
React.createElement("select", { id: selectId, value: selectedInspectorId, onChange: (e) => setSelectedInspectorId(e.target.value), style: { padding: '4px' } }, Object.keys(INSPECTORS).map((key) => (React.createElement("option", { key: key, value: key }, key)))),
|
|
67
72
|
Overlay && (React.createElement("div", { style: { marginTop: '4px' } },
|
|
68
73
|
React.createElement("label", { style: { cursor: 'pointer', display: 'flex', alignItems: 'center' } },
|
|
69
74
|
React.createElement("input", { type: "checkbox", checked: isOverlayEnabled, onChange: (e) => setIsOverlayEnabled(e.target.checked), style: { marginRight: '4px' } }),
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* In browsers without session storage support, it will fallback to `useState`.
|
|
5
5
|
*/
|
|
6
|
-
export declare const useSessionStorageState: <T>(id: string, initialState: T) =>
|
|
6
|
+
export declare const useSessionStorageState: <T>(id: string, initialState: T) => [state: T, setState: (newState: T) => void];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useXAxisTicks } from 'recharts';
|
|
3
|
+
import { ArrayInspector } from './generic/ArrayInspector.js';
|
|
4
|
+
import { useEventDispatch } from '../components/useEventDispatch.js';
|
|
5
|
+
const Inspector = () => {
|
|
6
|
+
const xAxisTicks = useXAxisTicks();
|
|
7
|
+
useEventDispatch(xAxisTicks);
|
|
8
|
+
return React.createElement(ArrayInspector, { arr: xAxisTicks });
|
|
9
|
+
};
|
|
10
|
+
export const XAxisTicksInspector = {
|
|
11
|
+
Inspector,
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useYAxisTicks } from 'recharts';
|
|
3
|
+
import { ArrayInspector } from './generic/ArrayInspector.js';
|
|
4
|
+
import { useEventDispatch } from '../components/useEventDispatch.js';
|
|
5
|
+
const Inspector = () => {
|
|
6
|
+
const yAxisTicks = useYAxisTicks();
|
|
7
|
+
useEventDispatch(yAxisTicks);
|
|
8
|
+
return React.createElement(ArrayInspector, { arr: yAxisTicks });
|
|
9
|
+
};
|
|
10
|
+
export const YAxisTicksInspector = {
|
|
11
|
+
Inspector,
|
|
12
|
+
};
|