@recharts/devtools 0.0.16 → 0.0.18
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/annotations/AnnotationsController.js +21 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -30,21 +30,24 @@ const buttonStyle = {
|
|
|
30
30
|
padding: '4px 8px',
|
|
31
31
|
fontSize: '11px',
|
|
32
32
|
cursor: 'pointer',
|
|
33
|
-
border: '1px solid #ccc',
|
|
33
|
+
border: '1px solid var(--rd-border, #ccc)',
|
|
34
34
|
borderRadius: '3px',
|
|
35
|
-
background: '#fff',
|
|
35
|
+
background: 'var(--rd-surface, #fff)',
|
|
36
|
+
color: 'var(--rd-text, inherit)',
|
|
36
37
|
};
|
|
37
38
|
const activeButtonStyle = {
|
|
38
39
|
...buttonStyle,
|
|
39
|
-
background: '#e0e0e0',
|
|
40
|
-
borderColor: '#999',
|
|
40
|
+
background: 'var(--rd-surface-active, #e0e0e0)',
|
|
41
|
+
borderColor: 'var(--rd-border-strong, #999)',
|
|
41
42
|
};
|
|
42
43
|
const inputStyle = {
|
|
43
44
|
width: '50px',
|
|
44
45
|
fontSize: '11px',
|
|
45
46
|
padding: '2px 4px',
|
|
46
|
-
border: '1px solid #ccc',
|
|
47
|
+
border: '1px solid var(--rd-border, #ccc)',
|
|
47
48
|
borderRadius: '2px',
|
|
49
|
+
background: 'var(--rd-surface, #fff)',
|
|
50
|
+
color: 'var(--rd-text, inherit)',
|
|
48
51
|
};
|
|
49
52
|
const labelStyle = {
|
|
50
53
|
fontSize: '11px',
|
|
@@ -70,7 +73,11 @@ function SnapModeRadioGroup({ snapMode, onSnapModeChange, }) {
|
|
|
70
73
|
"Snap to axis ticks")));
|
|
71
74
|
}
|
|
72
75
|
function AnnotationEditForm({ annotation, handleStyleChange, onUpdateAnnotation, }) {
|
|
73
|
-
return (React.createElement("div", { style: {
|
|
76
|
+
return (React.createElement("div", { style: {
|
|
77
|
+
marginTop: '8px',
|
|
78
|
+
paddingTop: '8px',
|
|
79
|
+
borderTop: '1px solid var(--rd-border-subtle, #ddd)',
|
|
80
|
+
} },
|
|
74
81
|
React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap', gap: '8px', marginBottom: '8px' } },
|
|
75
82
|
(annotation.type === 'verticalLine' ||
|
|
76
83
|
annotation.type === 'circle' ||
|
|
@@ -208,7 +215,7 @@ export function AnnotationsController({ annotations, isAdding, selectedAnnotatio
|
|
|
208
215
|
React.createElement("div", { style: { marginBottom: '12px' } },
|
|
209
216
|
React.createElement("div", { style: { marginBottom: '6px', fontWeight: 'bold' } }, "Add Annotation:"),
|
|
210
217
|
React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap', gap: '4px' } }, ANNOTATION_TYPES.map(({ type, label }) => (React.createElement("button", { key: type, type: "button", onClick: () => (isAdding === type ? onCancelAdding() : onStartAdding(type)), style: isAdding === type ? activeButtonStyle : buttonStyle }, isAdding === type ? `Cancel ${label}` : label)))),
|
|
211
|
-
isAdding && (React.createElement("div", { style: { marginTop: '6px', fontSize: '11px', color: '#666' } },
|
|
218
|
+
isAdding && (React.createElement("div", { style: { marginTop: '6px', fontSize: '11px', color: 'var(--rd-text-muted, #666)' } },
|
|
212
219
|
"Click on the chart to place the annotation",
|
|
213
220
|
(isAdding === 'rectangle' || isAdding === 'freeformLine' || isAdding === 'circle') &&
|
|
214
221
|
' (click twice or drag to define dimensions)'))),
|
|
@@ -218,11 +225,14 @@ export function AnnotationsController({ annotations, isAdding, selectedAnnotatio
|
|
|
218
225
|
"Annotations (",
|
|
219
226
|
annotations.length,
|
|
220
227
|
"):"),
|
|
221
|
-
annotations.length === 0 ? (React.createElement("div", { style: { fontSize: '11px', color: '#666' } }, "No annotations yet")) : (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' } }, annotations.map((annotation) => (React.createElement("div", { key: annotation.id, style: {
|
|
228
|
+
annotations.length === 0 ? (React.createElement("div", { style: { fontSize: '11px', color: 'var(--rd-text-muted, #666)' } }, "No annotations yet")) : (React.createElement("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px' } }, annotations.map((annotation) => (React.createElement("div", { key: annotation.id, style: {
|
|
222
229
|
padding: '8px',
|
|
223
|
-
border: selectedAnnotationId === annotation.id
|
|
230
|
+
border: selectedAnnotationId === annotation.id
|
|
231
|
+
? '2px solid var(--rd-accent, #007bff)'
|
|
232
|
+
: '1px solid var(--rd-border-subtle, #ddd)',
|
|
224
233
|
borderRadius: '4px',
|
|
225
|
-
background: '#fafafa',
|
|
234
|
+
background: 'var(--rd-surface-raised, #fafafa)',
|
|
235
|
+
color: 'var(--rd-text, inherit)',
|
|
226
236
|
} },
|
|
227
237
|
React.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '4px' } },
|
|
228
238
|
React.createElement("input", { type: "color", value: annotation.style.color ?? '#ff0000', onChange: (e) => handleStyleChange(annotation, 'color', e.target.value), style: {
|
|
@@ -236,6 +246,6 @@ export function AnnotationsController({ annotations, isAdding, selectedAnnotatio
|
|
|
236
246
|
annotation.type),
|
|
237
247
|
React.createElement("button", { type: "button", onClick: () => toggleExpanded(annotation.id), style: buttonStyle }, expandedAnnotationId === annotation.id ? '▼' : '▶'),
|
|
238
248
|
React.createElement("button", { type: "button", onClick: () => onSelectAnnotation(selectedAnnotationId === annotation.id ? null : annotation.id), style: selectedAnnotationId === annotation.id ? activeButtonStyle : buttonStyle }, selectedAnnotationId === annotation.id ? 'Deselect' : 'Select'),
|
|
239
|
-
React.createElement("button", { type: "button", onClick: () => onDeleteAnnotation(annotation.id), style: { ...buttonStyle, color: '#d00' } }, "Delete")),
|
|
249
|
+
React.createElement("button", { type: "button", onClick: () => onDeleteAnnotation(annotation.id), style: { ...buttonStyle, color: 'var(--rd-danger, #d00)' } }, "Delete")),
|
|
240
250
|
expandedAnnotationId === annotation.id && (React.createElement(AnnotationEditForm, { annotation: annotation, handleStyleChange: handleStyleChange, onUpdateAnnotation: onUpdateAnnotation }))))))))));
|
|
241
251
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export { RechartsDevtoolsPortal, RechartsAnnotationsPortal, RechartsDevtoolsCont
|
|
|
8
8
|
export { RECHARTS_DEVTOOLS_PORTAL_ID, RECHARTS_ANNOTATIONS_PORTAL_ID } from './constants.js';
|
|
9
9
|
export type { Annotation, AnnotationType, AnnotationStyle } from './annotations/types.js';
|
|
10
10
|
export { useAnnotationsManager } from './annotations/useAnnotationsManager.js';
|
|
11
|
+
export { Blanket } from './annotations/Blanket.js';
|
|
11
12
|
export { useWhyDidYouRender } from './hooks/useWhyDidYouRender.js';
|
|
12
13
|
export { useSessionStorageState } from './hooks/useSessionStorageState.js';
|
package/dist/index.js
CHANGED
|
@@ -6,5 +6,6 @@ export { RechartsAnnotations } from './components/RechartsAnnotations.js';
|
|
|
6
6
|
export { RechartsDevtoolsPortal, RechartsAnnotationsPortal, RechartsDevtoolsContext, } from './context/RechartsDevtoolsContext.js';
|
|
7
7
|
export { RECHARTS_DEVTOOLS_PORTAL_ID, RECHARTS_ANNOTATIONS_PORTAL_ID } from './constants.js';
|
|
8
8
|
export { useAnnotationsManager } from './annotations/useAnnotationsManager.js';
|
|
9
|
+
export { Blanket } from './annotations/Blanket.js';
|
|
9
10
|
export { useWhyDidYouRender } from './hooks/useWhyDidYouRender.js';
|
|
10
11
|
export { useSessionStorageState } from './hooks/useSessionStorageState.js';
|