@spider-analyzer/timeline 4.0.3 → 5.0.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 (76) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/README.md +275 -637
  3. package/dist/index.d.mts +132 -0
  4. package/dist/index.d.ts +132 -0
  5. package/dist/index.js +2913 -22
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +2906 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/dist/timeline-EX2XZ6IP.css +139 -0
  10. package/package.json +48 -15
  11. package/src/Cursor.jsx +5 -13
  12. package/src/TimeLine.tsx +994 -0
  13. package/src/TimeLineResizer.jsx +2 -8
  14. package/src/ToolTip.jsx +7 -7
  15. package/src/cursorElements/CursorIcon.jsx +6 -29
  16. package/src/cursorElements/CursorSelection.jsx +4 -19
  17. package/src/cursorElements/DragOverlay.jsx +2 -12
  18. package/src/cursorElements/LeftHandle.jsx +3 -19
  19. package/src/cursorElements/LeftToolTip.jsx +2 -7
  20. package/src/cursorElements/RightHandle.jsx +3 -19
  21. package/src/cursorElements/RightToolTip.jsx +4 -13
  22. package/src/cursorElements/ZoomIn.jsx +5 -25
  23. package/src/cursorElements/ZoomOut.jsx +4 -21
  24. package/src/cursorElements/utils.js +1 -1
  25. package/src/index.js +6 -0
  26. package/src/index.ts +158 -0
  27. package/src/moment-shim.ts +169 -0
  28. package/src/styles.ts +15 -0
  29. package/src/time.ts +52 -0
  30. package/src/timeLineElements/Button.jsx +5 -30
  31. package/src/timeLineElements/HistoToolTip.jsx +3 -17
  32. package/src/timeLineElements/Histogram.jsx +4 -16
  33. package/src/timeLineElements/Legend.jsx +2 -16
  34. package/src/timeLineElements/QualityLine.jsx +4 -11
  35. package/src/timeLineElements/Tools.jsx +1 -1
  36. package/src/timeLineElements/XAxis.jsx +5 -8
  37. package/src/timeLineElements/XGrid.jsx +3 -7
  38. package/src/timeLineElements/YAxis.jsx +4 -7
  39. package/src/timeLineElements/YGrid.jsx +2 -6
  40. package/src/timeLineElements/axesStyles.jsx +0 -49
  41. package/src/timeline.css +139 -0
  42. package/src/utils.ts +60 -0
  43. package/.babelrc +0 -8
  44. package/.gitlab-ci.yml +0 -27
  45. package/Makefile +0 -20
  46. package/dist/Cursor.js +0 -290
  47. package/dist/TimeLine.js +0 -1177
  48. package/dist/TimeLineResizer.js +0 -70
  49. package/dist/ToolTip.js +0 -43
  50. package/dist/cursorElements/CursorIcon.js +0 -98
  51. package/dist/cursorElements/CursorSelection.js +0 -179
  52. package/dist/cursorElements/DragOverlay.js +0 -168
  53. package/dist/cursorElements/LeftHandle.js +0 -95
  54. package/dist/cursorElements/LeftToolTip.js +0 -70
  55. package/dist/cursorElements/RightHandle.js +0 -95
  56. package/dist/cursorElements/RightToolTip.js +0 -75
  57. package/dist/cursorElements/ZoomIn.js +0 -93
  58. package/dist/cursorElements/ZoomOut.js +0 -67
  59. package/dist/cursorElements/commonStyles.js +0 -28
  60. package/dist/cursorElements/handleHistoHovering.js +0 -79
  61. package/dist/cursorElements/utils.js +0 -30
  62. package/dist/theme.js +0 -59
  63. package/dist/timeLineElements/Button.js +0 -101
  64. package/dist/timeLineElements/HistoToolTip.js +0 -78
  65. package/dist/timeLineElements/Histogram.js +0 -110
  66. package/dist/timeLineElements/Legend.js +0 -70
  67. package/dist/timeLineElements/QualityLine.js +0 -81
  68. package/dist/timeLineElements/Tools.js +0 -115
  69. package/dist/timeLineElements/XAxis.js +0 -76
  70. package/dist/timeLineElements/XGrid.js +0 -47
  71. package/dist/timeLineElements/YAxis.js +0 -60
  72. package/dist/timeLineElements/YGrid.js +0 -46
  73. package/dist/timeLineElements/axesStyles.js +0 -57
  74. package/src/TimeLine.jsx +0 -1163
  75. package/src/cursorElements/commonStyles.js +0 -21
  76. /package/dist/{tipDark.css → tipDark-BQEJ43KY.css} +0 -0
@@ -0,0 +1,169 @@
1
+ // Moment-compatible thin wrapper over Luxon.
2
+ //
3
+ // Exposes exactly the moment API surface that this library's internal code
4
+ // uses — not a general-purpose replacement. Swapping to this shim in place
5
+ // of `moment-timezone` drops ~300 KB from consumer bundles while keeping
6
+ // the component's internal .isBefore/.add/.diff/etc. call sites unchanged.
7
+
8
+ import { DateTime, Duration, type DurationLikeObject } from 'luxon';
9
+
10
+ const unitMap: Record<string, keyof DurationLikeObject> = {
11
+ ms: 'milliseconds',
12
+ milliseconds: 'milliseconds',
13
+ millisecond: 'milliseconds',
14
+ second: 'seconds',
15
+ seconds: 'seconds',
16
+ minute: 'minutes',
17
+ minutes: 'minutes',
18
+ hour: 'hours',
19
+ hours: 'hours',
20
+ day: 'days',
21
+ days: 'days',
22
+ month: 'months',
23
+ months: 'months',
24
+ year: 'years',
25
+ years: 'years',
26
+ };
27
+
28
+ function normalizeUnit(unit: string | undefined): keyof DurationLikeObject {
29
+ if (!unit) return 'milliseconds';
30
+ const norm = unit.toLowerCase();
31
+ return unitMap[norm] ?? (norm as keyof DurationLikeObject);
32
+ }
33
+
34
+ // A moment.duration-like handle. Internal code only uses `.asMilliseconds()`.
35
+ class DurationLike {
36
+ private d: Duration;
37
+ constructor(d: Duration) { this.d = d; }
38
+ asMilliseconds(): number { return this.d.as('milliseconds'); }
39
+ valueOf(): number { return this.d.as('milliseconds'); }
40
+ }
41
+
42
+ function toDurationLike(x: any): DurationLike {
43
+ if (x instanceof DurationLike) return x;
44
+ if (typeof x === 'number') return new DurationLike(Duration.fromMillis(x));
45
+ if (typeof x === 'string') return new DurationLike(Duration.fromISO(x));
46
+ if (x && typeof x.asMilliseconds === 'function') {
47
+ return new DurationLike(Duration.fromMillis(x.asMilliseconds()));
48
+ }
49
+ return new DurationLike(Duration.fromMillis(0));
50
+ }
51
+
52
+ // A moment-like handle over a single Luxon DateTime.
53
+ class MomentLike {
54
+ _dt: DateTime;
55
+
56
+ constructor(dt: DateTime) { this._dt = dt; }
57
+
58
+ _toDT(other: any): DateTime {
59
+ if (other instanceof MomentLike) return other._dt;
60
+ if (other instanceof Date) return DateTime.fromJSDate(other);
61
+ if (typeof other === 'number') return DateTime.fromMillis(other);
62
+ if (other instanceof DateTime) return other;
63
+ return DateTime.fromJSDate(new Date(other));
64
+ }
65
+
66
+ _addMillis(ms: number): number {
67
+ return this._dt.toMillis() + ms;
68
+ }
69
+
70
+ isBefore(other: any): boolean { return this._dt.toMillis() < this._toDT(other).toMillis(); }
71
+ isAfter(other: any): boolean { return this._dt.toMillis() > this._toDT(other).toMillis(); }
72
+ isSame(other: any): boolean { return this._dt.toMillis() === this._toDT(other).toMillis(); }
73
+ isSameOrBefore(other: any): boolean { return this._dt.toMillis() <= this._toDT(other).toMillis(); }
74
+ isSameOrAfter(other: any): boolean { return this._dt.toMillis() >= this._toDT(other).toMillis(); }
75
+
76
+ // moment returns duration by default; library internals always use the
77
+ // no-arg form and treat the result as a number via arithmetic. Return ms.
78
+ diff(other: any): number {
79
+ return this._dt.toMillis() - this._toDT(other).toMillis();
80
+ }
81
+
82
+ add(n: any, unit?: string): MomentLike {
83
+ const ms = normalizeToMillis(n, unit);
84
+ return new MomentLike(DateTime.fromMillis(this._addMillis(ms), { zone: this._dt.zone as any }));
85
+ }
86
+
87
+ subtract(n: any, unit?: string): MomentLike {
88
+ const ms = normalizeToMillis(n, unit);
89
+ return new MomentLike(DateTime.fromMillis(this._addMillis(-ms), { zone: this._dt.zone as any }));
90
+ }
91
+
92
+ toDate(): Date { return this._dt.toJSDate(); }
93
+ toISOString(): string { return this._dt.toUTC().toISO() ?? ''; }
94
+ valueOf(): number { return this._dt.toMillis(); }
95
+ format(fmt?: string): string {
96
+ if (!fmt) return this._dt.toISO() ?? '';
97
+ return this._dt.toFormat(momentFmtToLuxon(fmt));
98
+ }
99
+
100
+ // setter chain used in demo: .second(0).millisecond(0)
101
+ second(v: number): MomentLike { return new MomentLike(this._dt.set({ second: v })); }
102
+ millisecond(v: number): MomentLike { return new MomentLike(this._dt.set({ millisecond: v })); }
103
+
104
+ // Internal (escape hatch — prefer the wrapper API above).
105
+ toLuxon(): DateTime { return this._dt; }
106
+ }
107
+
108
+ function normalizeToMillis(n: any, unit?: string): number {
109
+ if (n instanceof DurationLike) return n.asMilliseconds();
110
+ if (n && typeof n.asMilliseconds === 'function') return n.asMilliseconds();
111
+ if (typeof n === 'number') {
112
+ if (!unit) return n;
113
+ const u = normalizeUnit(unit);
114
+ // Convert n<unit> to ms.
115
+ return Duration.fromObject({ [u]: n } as DurationLikeObject).as('milliseconds');
116
+ }
117
+ return 0;
118
+ }
119
+
120
+ function momentFmtToLuxon(fmt: string): string {
121
+ // Minimal mapping for the tokens used in the demo (TIME_FORMAT_TOOLTIP,
122
+ // locale.js). moment and Luxon agree on most of these already.
123
+ return fmt
124
+ .replace(/YYYY/g, 'yyyy')
125
+ .replace(/YY/g, 'yy')
126
+ .replace(/DD/g, 'dd')
127
+ .replace(/A/g, 'a');
128
+ }
129
+
130
+ // Public factory — matches `moment(x)` / `moment()`.
131
+ interface MomentFactory {
132
+ (x?: any): MomentLike;
133
+ isMoment(x: any): x is MomentLike;
134
+ isDuration(x: any): x is DurationLike;
135
+ duration(x?: any, unit?: string): DurationLike;
136
+ tz(x: any, zone: string): MomentLike;
137
+ }
138
+
139
+ function toDT(x: any): DateTime {
140
+ if (x === undefined || x === null) return DateTime.now();
141
+ if (x instanceof MomentLike) return x.toLuxon();
142
+ if (x instanceof Date) return DateTime.fromJSDate(x);
143
+ if (typeof x === 'number') return DateTime.fromMillis(x);
144
+ if (typeof x === 'string') return DateTime.fromISO(x);
145
+ return DateTime.fromJSDate(new Date(x));
146
+ }
147
+
148
+ const moment = function moment(x?: any): MomentLike {
149
+ return new MomentLike(toDT(x));
150
+ } as MomentFactory;
151
+
152
+ moment.isMoment = (x: any): x is MomentLike => x instanceof MomentLike;
153
+ moment.isDuration = (x: any): x is DurationLike => x instanceof DurationLike;
154
+
155
+ moment.duration = (x?: any, unit?: string): DurationLike => {
156
+ if (typeof x === 'number' && unit) {
157
+ const u = normalizeUnit(unit);
158
+ return new DurationLike(Duration.fromObject({ [u]: x } as DurationLikeObject));
159
+ }
160
+ return toDurationLike(x);
161
+ };
162
+
163
+ moment.tz = (x: any, zone: string): MomentLike => {
164
+ const base = toDT(x);
165
+ return new MomentLike(base.setZone(zone));
166
+ };
167
+
168
+ export default moment;
169
+ export type Moment = MomentLike;
package/src/styles.ts ADDED
@@ -0,0 +1,15 @@
1
+ import clsx from 'clsx';
2
+ import './timeline.css';
3
+
4
+ /**
5
+ * Resolves a built-in class name for a component slot, optionally merged with
6
+ * the consumer's override from the `classes` prop. Replaces the prior
7
+ * @material-ui/styles `useStyles()` + local clsx glue.
8
+ *
9
+ * Usage:
10
+ * const className = (name: string) => cn(name, classes);
11
+ * <rect className={className('histoItem')} />
12
+ */
13
+ export function cn(name: string, classes?: Record<string, string>): string {
14
+ return clsx(`tl-${name}`, classes?.[name]);
15
+ }
package/src/time.ts ADDED
@@ -0,0 +1,52 @@
1
+ import moment, { type Moment } from './moment-shim';
2
+ type Duration = { asMilliseconds(): number };
3
+
4
+ /**
5
+ * API-boundary funnel.
6
+ *
7
+ * External callers pass native `Date` (and millisecond numbers for
8
+ * durations) — the library is internally written against moment-timezone.
9
+ * These helpers normalize at the boundary so consumers don't need to take
10
+ * a moment peer-dep.
11
+ *
12
+ * For compat during migration, inputs may also be moment instances.
13
+ * In a future release (when moment is replaced by Luxon), this file is
14
+ * the only place that needs to change.
15
+ */
16
+
17
+ export type Instant = Date | Moment | number;
18
+ export type Millis = number | Duration;
19
+
20
+ export function toMoment(x: Instant, zone?: string): Moment {
21
+ if (moment.isMoment(x)) return x as Moment;
22
+ const m = zone ? moment.tz(x as any, zone) : moment(x as any);
23
+ return m;
24
+ }
25
+
26
+ export function toDuration(x: Millis): Duration {
27
+ if (moment.isDuration(x)) return x as Duration;
28
+ return moment.duration(x as number);
29
+ }
30
+
31
+ export function fromMoment(m: Moment | null | undefined): Date | null {
32
+ return m ? m.toDate() : null;
33
+ }
34
+
35
+ export interface DateDomain { min: Date; max: Date; }
36
+ export interface DateTimeSpan { start: Date; stop: Date; }
37
+
38
+ export function domainToMoments(d: { min: Instant; max: Instant }, zone?: string) {
39
+ return { min: toMoment(d.min, zone), max: toMoment(d.max, zone) };
40
+ }
41
+
42
+ export function timeSpanToMoments(t: { start: Instant; stop: Instant }, zone?: string) {
43
+ return { start: toMoment(t.start, zone), stop: toMoment(t.stop, zone) };
44
+ }
45
+
46
+ export function domainToDates(d: { min: Moment; max: Moment }): DateDomain {
47
+ return { min: d.min.toDate(), max: d.max.toDate() };
48
+ }
49
+
50
+ export function timeSpanToDates(t: { start: Moment; stop: Moment }): DateTimeSpan {
51
+ return { start: t.start.toDate(), stop: t.stop.toDate() };
52
+ }
@@ -1,37 +1,12 @@
1
1
  import React, {useState} from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import {makeStyles} from '@material-ui/styles';
4
3
  import ToolTip from '../ToolTip';
5
4
  import clsx from 'clsx';
6
5
 
7
- import theme from '../theme';
8
6
 
9
- const useStyles = makeStyles({
10
- buttonGroup: {
11
- cursor: 'pointer'
12
- },
13
- buttonGroupInactive: {
14
- cursor: 'not-allowed'
15
- },
16
- buttonOverShape: {
17
- fill: 'transparent'
18
- },
19
- buttonIcon: {
20
- fill: theme.colors.medium,
21
- fillOpacity: 1,
22
- stroke: theme.colors.medium,
23
- strokeWidth: 1,
24
- strokeOpacity: 1
25
- },
26
- buttonIconOver: {
27
- fill: theme.colors.buttonOver,
28
- stroke: theme.colors.buttonOver,
29
- }
30
- });
31
7
 
32
8
  export default function Button({tipPlacement, tipOverlay, path, origin, scale, iconSize, onClick, classes, rcToolTipPrefixCls, isActive}){
33
9
  const [isOver, setOver] = useState(false);
34
- const defaultClasses = useStyles();
35
10
 
36
11
  return (
37
12
  <ToolTip
@@ -40,9 +15,9 @@ export default function Button({tipPlacement, tipOverlay, path, origin, scale, i
40
15
  >
41
16
  <g
42
17
  className={clsx(
43
- defaultClasses.buttonGroup,
18
+ "tl-buttonGroup",
44
19
  classes.buttonGroup,
45
- !isActive && defaultClasses.buttonGroupInactive,
20
+ !isActive && "tl-buttonGroupInactive",
46
21
  !isActive && classes.buttonGroupInactive,
47
22
  )}
48
23
  transform={`translate(${origin.x},${origin.y}) scale(${scale})`}
@@ -58,7 +33,7 @@ export default function Button({tipPlacement, tipOverlay, path, origin, scale, i
58
33
  >
59
34
  <rect
60
35
  className={clsx(
61
- defaultClasses.buttonOverShape,
36
+ "tl-buttonOverShape",
62
37
  classes.buttonOverShape
63
38
  )}
64
39
  x ='0'
@@ -68,9 +43,9 @@ export default function Button({tipPlacement, tipOverlay, path, origin, scale, i
68
43
  />
69
44
  <path
70
45
  className={clsx(
71
- defaultClasses.buttonIcon,
46
+ "tl-buttonIcon",
72
47
  classes.buttonIcon,
73
- isOver && defaultClasses.buttonIconOver,
48
+ isOver && "tl-buttonIconOver",
74
49
  isOver && classes.buttonIconOver
75
50
  )}
76
51
  d={path}
@@ -1,27 +1,13 @@
1
- import {makeStyles} from '@material-ui/styles';
1
+ import { cn } from "../styles";
2
2
  import clsx from 'clsx';
3
3
  import PropTypes from 'prop-types';
4
- import moment from 'moment-timezone';
4
+ import moment from '../moment-shim';
5
5
  import React from 'react';
6
6
 
7
- const useStyles = makeStyles({
8
- innerTipMetrics:{
9
- marginTop: 4
10
- },
11
- innerTipLeft:{
12
- marginRight: 4,
13
- display: 'inline-block'
14
- },
15
- innerTipRight:{
16
- display: 'inline-block',
17
- float: 'right'
18
- }
19
- });
20
7
 
21
8
  export default function HistoTooltip({metricsDefinition, item, onFormatTimeToolTips, onFormatMetricLegend, classes}){
22
9
 
23
- const defaultClasses = useStyles();
24
- const className = (className) => clsx(defaultClasses[className], classes[className]);
10
+ const className = (n) => cn(n, classes);
25
11
 
26
12
  return (
27
13
  <>
@@ -1,22 +1,11 @@
1
+ import { cn } from "../styles";
1
2
  import React from 'react';
2
- import moment from 'moment-timezone';
3
- import _sum from 'lodash-es/sum';
3
+ import moment from '../moment-shim';
4
+ import { sum as _sum } from '../utils';
4
5
  import PropTypes from 'prop-types';
5
6
  import clsx from 'clsx';
6
- import {makeStyles} from '@material-ui/styles';
7
7
  import ToolTip from '../ToolTip';
8
8
 
9
- const useStyles = makeStyles({
10
- histoItem: {
11
- fillOpacity: 1,
12
- strokeWidth: 1,
13
- },
14
- histoHovered: {
15
- strokeWidth: 0,
16
- fill: '#000000',
17
- fillOpacity: 0.3
18
- },
19
- });
20
9
 
21
10
  export default function Histogram({
22
11
  classes, items, metricsDefinition, origin,
@@ -28,8 +17,7 @@ export default function Histogram({
28
17
  return null;
29
18
  }
30
19
 
31
- const defaultClasses= useStyles();
32
- const className = (className) => clsx(defaultClasses[className], classes[className]);
20
+ const className = (n) => cn(n, classes);
33
21
 
34
22
  return <g transform={`translate(${origin.x}, ${origin.y})`}>
35
23
  {
@@ -1,30 +1,16 @@
1
+ import { cn } from "../styles";
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import clsx from 'clsx';
4
5
 
5
- import theme from '../theme';
6
- import {makeStyles} from '@material-ui/styles';
7
6
 
8
- const useStyles = makeStyles({
9
- legend: {
10
- fontSize: theme.font.legendSize,
11
- lineHeight: '125%',
12
- fontFamily: theme.font.family,
13
- fillOpacity: 1,
14
- stroke:'none',
15
- textAlign:'end',
16
- textAnchor:'end',
17
- userSelect: 'none'
18
- }
19
- });
20
7
 
21
8
  export default function Legend({classes, metricsDefinition, origin}){
22
9
 
23
10
  const fill = [...metricsDefinition.colors].reverse();
24
11
  const legends = [...metricsDefinition.legends].reverse();
25
12
 
26
- const defaultClasses = useStyles();
27
- const className = (className) => clsx(defaultClasses[className], classes[className]);
13
+ const className = (n) => cn(n, classes);
28
14
 
29
15
  return (
30
16
  <g
@@ -1,24 +1,17 @@
1
+ import { cn } from "../styles";
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import clsx from 'clsx';
4
5
 
5
- import theme from '../theme';
6
- import {makeStyles} from '@material-ui/styles';
7
- import moment from 'moment-timezone';
6
+ import moment from '../moment-shim';
8
7
  import ToolTip from '../ToolTip';
9
8
 
10
9
  const qualityHeight = 3;
11
10
 
12
- const useStyles = makeStyles({
13
- qualityCell: {
14
- strokeWidth: 0,
15
- }
16
- });
17
11
 
18
12
  export default function QualityLine({classes, rcToolTipPrefixCls, origin, quality, xAxis, qualityScale}){
19
13
 
20
- const defaultClasses = useStyles();
21
- const className = (className) => clsx(defaultClasses[className], classes[className]);
14
+ const className = (n) => cn(n, classes);
22
15
 
23
16
  return (
24
17
  <g transform={`translate(${origin.x}, ${origin.y})`}>
@@ -33,7 +26,7 @@ export default function QualityLine({classes, rcToolTipPrefixCls, origin, qualit
33
26
  style={{
34
27
  fill: qualityScale(item.quality),
35
28
  }}
36
- onMouseOver={(event) => { event.target.style.fill = theme.colors.qualityFillSelected; }}
29
+ onMouseOver={(event) => { event.target.style.fill = '#00ebeb'; }}
37
30
  onMouseOut={(event) => { event.target.style.fill = qualityScale(item.quality); }}
38
31
  x={x1}
39
32
  y={1}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import moment from 'moment-timezone';
3
+ import moment from '../moment-shim';
4
4
  import Button from './Button';
5
5
 
6
6
  const doubleArrowIcon = 'm 0,0 5,5 0,-5 5,5 -5,5 0,-5 -5,5 Z';
@@ -1,17 +1,17 @@
1
1
  import React from 'react';
2
- import moment from 'moment-timezone';
2
+ import moment from '../moment-shim';
3
3
  import PropTypes from 'prop-types';
4
4
  import {timeDay} from 'd3-time';
5
5
  import clsx from 'clsx';
6
6
 
7
- import {useStyles, arrow} from './axesStyles';
7
+ import { arrow } from "./axesStyles";
8
+ import { cn } from "../styles";
8
9
 
9
- export default function XAxis({min, max, origin, axisWidth, marks, xAxis, classes, arrowPath, onFormatTimeLegend}){
10
+ export default function XAxis({min, max, origin, axisWidth, marks, xAxis, classes, arrowPath = arrow, onFormatTimeLegend}){
10
11
 
11
12
  const now = moment();
12
- const defaultClasses = useStyles();
13
13
 
14
- const className = (className) => clsx(defaultClasses[className], classes[className]);
14
+ const className = (n) => cn(n, classes);
15
15
 
16
16
  return (
17
17
  <g transform={`translate(${origin.x}, ${origin.y})`}
@@ -81,6 +81,3 @@ XAxis.propTypes = {
81
81
  onFormatTimeLegend: PropTypes.func.isRequired,
82
82
  };
83
83
 
84
- XAxis.defaultProps = {
85
- arrowPath: arrow,
86
- }
@@ -1,15 +1,14 @@
1
1
  import React from 'react';
2
- import moment from 'moment-timezone';
2
+ import moment from '../moment-shim';
3
3
  import PropTypes from 'prop-types';
4
4
  import clsx from 'clsx';
5
5
 
6
- import {useStyles, arrow} from './axesStyles';
6
+ import { cn } from "../styles";
7
7
 
8
8
  export default function XAxis({origin, marks, xAxis, classes, yAxisHeight}){
9
9
 
10
- const defaultClasses = useStyles();
11
10
 
12
- const className = (className) => clsx(defaultClasses[className], classes[className]);
11
+ const className = (n) => cn(n, classes);
13
12
 
14
13
  return (
15
14
  <g transform={`translate(${origin.x}, ${origin.y})`}>
@@ -43,6 +42,3 @@ XAxis.propTypes = {
43
42
  yAxisHeight: PropTypes.number,
44
43
  };
45
44
 
46
- XAxis.defaultProps = {
47
- arrowPath: arrow,
48
- }
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- import {useStyles, arrow} from './axesStyles';
4
+ import { arrow } from "./axesStyles";
5
+ import { cn } from "../styles";
5
6
  import clsx from 'clsx';
6
7
 
7
- export default function YAxis({classes, marks, yAxis, onFormatMetricLegend, maxHeight, origin, arrowPath}){
8
+ export default function YAxis({classes, marks, yAxis, onFormatMetricLegend, maxHeight, origin, arrowPath = arrow}){
8
9
 
9
- const defaultClasses = useStyles();
10
- const className = (className) => clsx(defaultClasses[className], classes[className]);
10
+ const className = (n) => cn(n, classes);
11
11
 
12
12
  return (
13
13
  <g transform={`translate(${origin.x}, ${origin.y})`}
@@ -59,6 +59,3 @@ YAxis.propTypes = {
59
59
  onFormatMetricLegend: PropTypes.func.isRequired,
60
60
  };
61
61
 
62
- YAxis.defaultProps = {
63
- arrowPath: arrow,
64
- }
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- import {useStyles, arrow} from './axesStyles';
4
+ import { cn } from "../styles";
5
5
  import clsx from 'clsx';
6
6
 
7
7
  export default function YAxis({classes, marks, yAxis, origin, xAxisWidth}){
8
8
 
9
- const defaultClasses = useStyles();
10
- const className = (className) => clsx(defaultClasses[className], classes[className]);
9
+ const className = (n) => cn(n, classes);
11
10
 
12
11
  return (
13
12
  <g transform={`translate(${origin.x}, ${origin.y})`}
@@ -40,6 +39,3 @@ YAxis.propTypes = {
40
39
  xAxisWidth: PropTypes.number,
41
40
  };
42
41
 
43
- YAxis.defaultProps = {
44
- arrowPath: arrow,
45
- }
@@ -1,50 +1 @@
1
- import {makeStyles} from '@material-ui/styles';
2
- import theme from '../theme';
3
-
4
1
  export const arrow = `m 0,-5 5,5 -5,5`;
5
-
6
- export const useStyles = makeStyles({
7
- axis: {
8
- fill: 'none',
9
- stroke: theme.colors.medium,
10
- strokeWidth: 1,
11
- },
12
- now: {
13
- fill: theme.colors.mediumDark,
14
- stroke: theme.colors.mediumDark,
15
- strokeWidth: 1,
16
- },
17
- arrow: {
18
- fill: theme.colors.medium,
19
- fillOpacity: 1,
20
- stroke: theme.colors.medium,
21
- strokeWidth: 1,
22
- },
23
- grid: {
24
- stroke: theme.colors.light,
25
- strokeWidth: 1,
26
- },
27
- limitMarker: {
28
- stroke: theme.colors.medium,
29
- strokeWidth: 1,
30
- },
31
- timeAxisText: {
32
- fontSize: theme.font.axisTextSize,
33
- fontFamily: theme.font.family,
34
- fill: theme.colors.medium,
35
- textAlign: 'center',
36
- textAnchor: 'middle',
37
- userSelect: 'none'
38
- },
39
- timeAxisDaysText: {
40
- fill: theme.colors.mediumDark,
41
- },
42
- verticalAxisText: {
43
- fontSize: theme.font.axisTextSize,
44
- fontFamily: theme.font.family,
45
- fill: theme.font.family,
46
- textAlign: 'end',
47
- textAnchor: 'end',
48
- userSelect: 'none'
49
- }
50
- });