@osrd-project/ui-charts 0.0.76 → 0.0.78
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 +22 -19
- package/dist/index.esm.js +194 -66
- package/dist/index.esm.js.map +1 -1
- package/dist/manchette/components/Manchette.d.ts +1 -1
- package/dist/manchette/components/Waypoint.d.ts +5 -3
- package/dist/manchette/hooks/useManchetteWithSpaceTimeChart.d.ts +2 -2
- package/dist/manchette/index.d.ts +2 -2
- package/dist/spaceTimeChart/index.d.ts +1 -0
- package/dist/spaceTimeChart/utils/__tests__/scales.spec.d.ts +1 -0
- package/dist/spaceTimeChart/utils/scales.d.ts +24 -0
- package/dist/speedSpaceChart/components/common/InteractionButtons.d.ts +2 -1
- package/dist/speedSpaceChart/components/common/SettingsPanel.d.ts +2 -1
- package/dist/speedSpaceChart/components/hooks.d.ts +1 -1
- package/dist/theme.css +7 -5
- package/dist/theme.css.map +1 -1
- package/dist/trackOccupancyDiagram/components/layers/OccupancyZonesLayer.d.ts +3 -1
- package/dist/trackOccupancyDiagram/components/types.d.ts +12 -11
- package/dist/trackOccupancyDiagram/index.d.ts +1 -0
- package/package.json +8 -8
|
@@ -3,7 +3,7 @@ import type { InteractiveWaypoint } from '../types';
|
|
|
3
3
|
export type ManchetteProps = {
|
|
4
4
|
contents: (InteractiveWaypoint | React.ReactNode)[];
|
|
5
5
|
activeWaypointId?: string;
|
|
6
|
-
activeWaypointRef?: React.RefObject<HTMLDivElement>;
|
|
6
|
+
activeWaypointRef?: React.RefObject<HTMLDivElement | null>;
|
|
7
7
|
zoomYIn: () => void;
|
|
8
8
|
zoomYOut: () => void;
|
|
9
9
|
resetZoom: () => void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
2
|
import { type InteractiveWaypoint } from '../types';
|
|
3
3
|
type WaypointProps = {
|
|
4
|
-
waypoint: InteractiveWaypoint
|
|
5
|
-
|
|
4
|
+
waypoint: Omit<InteractiveWaypoint, 'name'> & {
|
|
5
|
+
name?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
waypointRef?: React.RefObject<HTMLDivElement | null>;
|
|
6
8
|
isActive: boolean;
|
|
7
9
|
isMenuActive?: boolean;
|
|
8
10
|
};
|
|
@@ -57,9 +57,9 @@ export type ManchetteWithSpaceTimeChartOptions = {
|
|
|
57
57
|
export declare const DEFAULT_MANCHETTE_WITH_SPACE_TIME_CHART_OPTIONS: ManchetteWithSpaceTimeChartOptions;
|
|
58
58
|
declare const useManchetteWithSpaceTimeChart: ({ waypoints, manchetteWithSpaceTimeChartRef, height, spaceTimeChartRef, defaultTimeOrigin, defaultSpaceOrigin, defaultXOffset, verticalPadding, splitPoints, options, }: {
|
|
59
59
|
waypoints: Waypoint[];
|
|
60
|
-
manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement>;
|
|
60
|
+
manchetteWithSpaceTimeChartRef: React.RefObject<HTMLDivElement | null>;
|
|
61
61
|
height?: number;
|
|
62
|
-
spaceTimeChartRef?: React.RefObject<HTMLDivElement>;
|
|
62
|
+
spaceTimeChartRef?: React.RefObject<HTMLDivElement | null>;
|
|
63
63
|
defaultTimeOrigin?: number;
|
|
64
64
|
defaultSpaceOrigin?: number;
|
|
65
65
|
defaultXOffset?: number;
|
|
@@ -4,8 +4,8 @@ import './consts';
|
|
|
4
4
|
export { default as WaypointComponent } from './components/Waypoint';
|
|
5
5
|
export { default as Manchette, type ManchetteProps } from './components/Manchette';
|
|
6
6
|
export { default as ManchetteWithSpaceTimeChart, type ManchetteWithSpaceTimeChartProps, } from './components/ManchetteWithSpaceTimeChart';
|
|
7
|
-
export { DEFAULT_ZOOM_MS_PER_PX } from './consts';
|
|
8
|
-
export { default as useManchetteWithSpaceTimeChart } from './hooks/useManchetteWithSpaceTimeChart';
|
|
7
|
+
export { DEFAULT_ZOOM_MS_PER_PX, BASE_WAYPOINT_HEIGHT } from './consts';
|
|
8
|
+
export { default as useManchetteWithSpaceTimeChart, type SplitPoint, } from './hooks/useManchetteWithSpaceTimeChart';
|
|
9
9
|
export { default as usePaths } from './hooks/usePaths';
|
|
10
10
|
export type { Waypoint, ProjectPathTrainResult, InteractiveWaypoint } from './types';
|
|
11
11
|
export { positionMmToKm, positionKmToMm } from './utils';
|
|
@@ -17,3 +17,4 @@ export type { HoveredItem, SpaceTimeChartProps, SpaceScale, OperationalPoint, Sp
|
|
|
17
17
|
export { isPathOnScreen } from './utils/geometry';
|
|
18
18
|
export { getSpaceAtTime } from './utils/scales';
|
|
19
19
|
export { getCrispLineCoordinate } from './utils/canvas';
|
|
20
|
+
export { computeRectZoomOffsets } from './utils/scales';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -48,3 +48,27 @@ export declare function getSpaceAtTime(path: PathData, time: number): number;
|
|
|
48
48
|
* positions between these the two input positions (the array can be empty).
|
|
49
49
|
*/
|
|
50
50
|
export declare function getSpaceBreakpoints(from: number, to: number, tree: NormalizedScaleTree): number[];
|
|
51
|
+
/**
|
|
52
|
+
* in most cases, after the rectangle zoom, the screen will be centered
|
|
53
|
+
* on the center of the rectangle the user drew.
|
|
54
|
+
* In case we reach max zoom, not to break this expectation we need a different offset calculation
|
|
55
|
+
*/
|
|
56
|
+
export declare function computeRectZoomOffsets({ rect, timeOrigin, spaceOrigin, newTimeScale, newSpaceScale, swapAxes, chartWidth, chartHeight, }: {
|
|
57
|
+
rect: {
|
|
58
|
+
timeStart: Date;
|
|
59
|
+
timeEnd: Date;
|
|
60
|
+
spaceStart: number;
|
|
61
|
+
spaceEnd: number;
|
|
62
|
+
};
|
|
63
|
+
timeOrigin: number;
|
|
64
|
+
spaceOrigin: number;
|
|
65
|
+
newTimeScale: number;
|
|
66
|
+
newSpaceScale: number;
|
|
67
|
+
swapAxes: boolean;
|
|
68
|
+
chartWidth: number;
|
|
69
|
+
chartHeight: number;
|
|
70
|
+
}): {
|
|
71
|
+
xOffset: number;
|
|
72
|
+
yOffset: number;
|
|
73
|
+
};
|
|
74
|
+
export declare function sideOffset(origin: number, newScale: number, rectStart: number | Date, rectEnd: number | Date, chartSideSizePx: number, axisPadding?: number): number;
|
|
@@ -4,6 +4,7 @@ type InteractionButtonsProps = {
|
|
|
4
4
|
reset: () => void;
|
|
5
5
|
openSettingsPanel: () => void;
|
|
6
6
|
store: Store;
|
|
7
|
+
testIdPrefix?: string;
|
|
7
8
|
};
|
|
8
|
-
declare const InteractionButtons: ({ reset, openSettingsPanel, store }: InteractionButtonsProps) => React.JSX.Element;
|
|
9
|
+
declare const InteractionButtons: ({ reset, openSettingsPanel, store, testIdPrefix, }: InteractionButtonsProps) => React.JSX.Element;
|
|
9
10
|
export default InteractionButtons;
|
|
@@ -8,6 +8,7 @@ type SettingsPanelProps = {
|
|
|
8
8
|
setStore: React.Dispatch<React.SetStateAction<Store>>;
|
|
9
9
|
setIsMouseHoveringSettingsPanel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
10
|
translations?: SpeedSpaceChartProps['translations'];
|
|
11
|
+
testIdPrefix?: string;
|
|
11
12
|
};
|
|
12
|
-
declare const SettingsPanel: ({ globalHeight, color, store, setStore, setIsMouseHoveringSettingsPanel, translations, }: SettingsPanelProps) => React.JSX.Element;
|
|
13
|
+
declare const SettingsPanel: ({ globalHeight, color, store, setStore, setIsMouseHoveringSettingsPanel, translations, testIdPrefix, }: SettingsPanelProps) => React.JSX.Element;
|
|
13
14
|
export default SettingsPanel;
|
|
@@ -6,6 +6,6 @@ type UseCanvasParams = {
|
|
|
6
6
|
store: Store;
|
|
7
7
|
setStore?: React.Dispatch<React.SetStateAction<Store>>;
|
|
8
8
|
};
|
|
9
|
-
type UseCanvas = (draw: DrawFunction, params: UseCanvasParams) => React.RefObject<HTMLCanvasElement>;
|
|
9
|
+
type UseCanvas = (draw: DrawFunction, params: UseCanvasParams) => React.RefObject<HTMLCanvasElement | null>;
|
|
10
10
|
export declare const useCanvas: UseCanvas;
|
|
11
11
|
export {};
|
package/dist/theme.css
CHANGED
|
@@ -377,7 +377,7 @@ video {
|
|
|
377
377
|
}.button {
|
|
378
378
|
height: 2.5rem;
|
|
379
379
|
font-size: 1.125rem;
|
|
380
|
-
font-weight:
|
|
380
|
+
font-weight: 500;
|
|
381
381
|
--tw-text-opacity: 1;
|
|
382
382
|
color: rgb(245 245 245 / var(--tw-text-opacity));
|
|
383
383
|
padding: 0.5rem 0.875rem 0.688rem 0.875rem;
|
|
@@ -946,13 +946,14 @@ video {
|
|
|
946
946
|
}.date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.inside-selectable-slot:not(.within-selected-slot):not(.past):active .current-date-highlight {
|
|
947
947
|
--tw-bg-opacity: 1;
|
|
948
948
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
949
|
-
}.date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.past,
|
|
950
|
-
|
|
951
|
-
|
|
949
|
+
}.date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.past .current-date-highlight, .date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.outside-selectable-slot .current-date-highlight {
|
|
950
|
+
--tw-bg-opacity: 1;
|
|
951
|
+
background-color: rgb(211 209 207 / var(--tw-bg-opacity));
|
|
952
|
+
}.date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.inside-selectable-slot.past {
|
|
952
953
|
opacity: 0.5;
|
|
953
954
|
--tw-bg-opacity: 1;
|
|
954
955
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity));
|
|
955
|
-
}.date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.
|
|
956
|
+
}.date-picker .calendar-picker .calendar-list .calendar-wrapper .calendar-anatomy .calendar-grid-wrapper .calendar-days-grid .day-background .day-wrapper.inside-selectable-slot.past .day {
|
|
956
957
|
font-weight: 400;
|
|
957
958
|
--tw-text-opacity: 1;
|
|
958
959
|
color: rgb(211 209 207 / var(--tw-text-opacity));
|
|
@@ -3628,6 +3629,7 @@ video {
|
|
|
3628
3629
|
.manchette-container .manchette-actions .toggle-mode {
|
|
3629
3630
|
font-size: 0.875rem;
|
|
3630
3631
|
line-height: 14px;
|
|
3632
|
+
outline: none;
|
|
3631
3633
|
}
|
|
3632
3634
|
.manchette-container .waypoints-list {
|
|
3633
3635
|
width: 349px;
|