@ldelia/react-media 0.2.7 → 0.3.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/.storybook/main.js +25 -2
- package/config/env.js +104 -0
- package/config/getHttpsConfig.js +66 -0
- package/config/jest/babelTransform.js +29 -0
- package/config/jest/cssTransform.js +14 -0
- package/config/jest/fileTransform.js +40 -0
- package/config/modules.js +134 -0
- package/config/paths.js +77 -0
- package/config/webpack/persistentCache/createEnvironmentHash.js +9 -0
- package/config/webpack.config.js +755 -0
- package/config/webpackDevServer.config.js +127 -0
- package/dist/components/timeline/{RangeSelectorCanvas.js → RangeSelectorCanvas/RangeSelectorCanvas.js} +30 -8
- package/dist/components/timeline/Timeline.d.ts +0 -5
- package/dist/components/timeline/Timeline.js +32 -27
- package/dist/components/timeline/{TickTimeCollectionDisplay.js → TimelineCanvas/TickTimeCollectionDisplay.js} +2 -2
- package/dist/components/timeline/TimelineCanvas/TimelineCanvas.d.ts +7 -0
- package/dist/components/timeline/TimelineCanvas/TimelineCanvas.js +72 -0
- package/dist/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.d.ts +2 -0
- package/dist/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.js +32 -0
- package/dist/components/timeline/TimelineValue/TimelineValue.d.ts +7 -0
- package/dist/components/timeline/{VaLueLineCanvas.js → TimelineValue/TimelineValue.js} +8 -39
- package/dist/components/timeline/ZoomContext/ZoomContext.d.ts +7 -0
- package/dist/components/timeline/ZoomContext/ZoomContext.js +8 -0
- package/dist/components/timeline/utils/utils.d.ts +3 -1
- package/dist/components/timeline/utils/utils.js +14 -1
- package/dist/stories/timeline.stories.d.ts +6 -6
- package/package.json +126 -18
- package/scripts/build.js +217 -0
- package/scripts/start.js +154 -0
- package/scripts/test.js +52 -0
- package/src/components/__tests__/timeline/timeline.test.js +22 -0
- package/src/components/index.js +1 -0
- package/src/components/timeline/RangeSelectorCanvas/RangeSelectorCanvas.js +127 -0
- package/src/components/timeline/{RangeSelectorCanvas.tsx → RangeSelectorCanvas/RangeSelectorCanvas.tsx} +9 -11
- package/src/components/timeline/Timeline.js +77 -0
- package/src/components/timeline/Timeline.tsx +47 -37
- package/src/components/timeline/TimelineCanvas/TickTime.js +26 -0
- package/src/components/timeline/TimelineCanvas/TickTimeCollectionDisplay.js +19 -0
- package/src/components/timeline/{TickTimeCollectionDisplay.tsx → TimelineCanvas/TickTimeCollectionDisplay.tsx} +5 -5
- package/src/components/timeline/TimelineCanvas/TimelineCanvas.js +44 -0
- package/src/components/timeline/TimelineCanvas/TimelineCanvas.tsx +79 -0
- package/src/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.js +28 -0
- package/src/components/timeline/TimelineCanvas/drawTimeBlocksOnCanvas.ts +43 -0
- package/src/components/timeline/TimelineValue/TimelineValue.js +50 -0
- package/src/components/timeline/{VaLueLineCanvas.tsx → TimelineValue/TimelineValue.tsx} +9 -64
- package/src/components/timeline/ZoomContext/ZoomContext.js +2 -0
- package/src/components/timeline/ZoomContext/ZoomContext.ts +10 -0
- package/src/components/timeline/constants.js +13 -0
- package/src/components/timeline/index.js +1 -0
- package/src/components/timeline/utils/utils.js +28 -0
- package/src/components/timeline/utils/utils.ts +22 -1
- package/src/index.js +1 -0
- package/src/react-app-env.d.ts +71 -1
- package/src/react-docgen-types.d.ts +37 -0
- package/src/setupTests.js +5 -0
- package/src/stories/timeline.stories.js +54 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/index.html +173 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +412 -0
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +995 -0
- package/storybook-static/sb-manager/globals-runtime.js +53527 -0
- package/storybook-static/sb-manager/globals.js +48 -0
- package/storybook-static/sb-manager/runtime.js +11885 -0
- package/storybook-static/sb-preview/globals.js +33 -0
- package/storybook-static/sb-preview/runtime.js +9483 -0
- package/tsconfig.json +8 -7
- package/.storybook/main.ts +0 -18
- package/.storybook/preview.ts +0 -14
- package/dist/components/timeline/VaLueLineCanvas.d.ts +0 -7
- package/dist/reportWebVitals.d.ts +0 -3
- package/dist/reportWebVitals.js +0 -37
- package/src/reportWebVitals.ts +0 -15
- /package/dist/components/timeline/{RangeSelectorCanvas.d.ts → RangeSelectorCanvas/RangeSelectorCanvas.d.ts} +0 -0
- /package/dist/components/timeline/{TickTime.d.ts → TimelineCanvas/TickTime.d.ts} +0 -0
- /package/dist/components/timeline/{TickTime.js → TimelineCanvas/TickTime.js} +0 -0
- /package/dist/components/timeline/{TickTimeCollectionDisplay.d.ts → TimelineCanvas/TickTimeCollectionDisplay.d.ts} +0 -0
- /package/src/components/timeline/{TickTime.tsx → TimelineCanvas/TickTime.tsx} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useCallback, useContext, useEffect, useRef } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { getComputedElementWidth, numberToPxString, secondsToPixel, } from '../utils/utils';
|
|
4
|
+
import { ZoomContext } from '../ZoomContext/ZoomContext';
|
|
5
|
+
const PreValueLine = styled.span `
|
|
6
|
+
position: absolute;
|
|
7
|
+
left: 0;
|
|
8
|
+
height: 100%;
|
|
9
|
+
`;
|
|
10
|
+
const ValueLine = styled.span `
|
|
11
|
+
position: absolute;
|
|
12
|
+
width: 1px;
|
|
13
|
+
height: 100%;
|
|
14
|
+
background-color: #575757;
|
|
15
|
+
`;
|
|
16
|
+
const PostValueLine = styled.span `
|
|
17
|
+
position: absolute;
|
|
18
|
+
height: 100%;
|
|
19
|
+
`;
|
|
20
|
+
export const TimelineValue = ({ canvasRef, value }) => {
|
|
21
|
+
const preValueLineRef = useRef(null);
|
|
22
|
+
const valueLineRef = useRef(null);
|
|
23
|
+
const postValueLineRef = useRef(null);
|
|
24
|
+
const zoomContextValue = useContext(ZoomContext);
|
|
25
|
+
const showValueLine = useCallback(() => {
|
|
26
|
+
const canvas = canvasRef.current;
|
|
27
|
+
const preValueLineElement = preValueLineRef.current;
|
|
28
|
+
const valueLineElement = valueLineRef.current;
|
|
29
|
+
const postValueLineElement = postValueLineRef.current;
|
|
30
|
+
const valueLineWidth = getComputedElementWidth(valueLineElement);
|
|
31
|
+
const linePosition = secondsToPixel(zoomContextValue, value);
|
|
32
|
+
const valueLinePositionBeginningConsideringWidth = linePosition - valueLineWidth / 2;
|
|
33
|
+
// configure preValueLineElement
|
|
34
|
+
preValueLineElement.style.width = numberToPxString(valueLinePositionBeginningConsideringWidth);
|
|
35
|
+
// configure valueLineElement
|
|
36
|
+
valueLineElement.style.left = numberToPxString(valueLinePositionBeginningConsideringWidth);
|
|
37
|
+
// configure postValueLineElement
|
|
38
|
+
const postValueLinePosition = valueLinePositionBeginningConsideringWidth + valueLineWidth;
|
|
39
|
+
const postValueLineWidth = canvas.width - postValueLinePosition;
|
|
40
|
+
postValueLineElement.style.left = numberToPxString(postValueLinePosition);
|
|
41
|
+
postValueLineElement.style.width = numberToPxString(postValueLineWidth);
|
|
42
|
+
}, [canvasRef, value, zoomContextValue]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
showValueLine();
|
|
45
|
+
}, [showValueLine]);
|
|
46
|
+
return (React.createElement(React.Fragment, null,
|
|
47
|
+
React.createElement(PreValueLine, { ref: preValueLineRef, className: 'media-timeline-pre-value-line' }),
|
|
48
|
+
React.createElement(ValueLine, { ref: valueLineRef, className: 'media-timeline-value-line' }),
|
|
49
|
+
React.createElement(PostValueLine, { ref: postValueLineRef, className: 'media-timeline-post-value-line' })));
|
|
50
|
+
};
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useEffect, useRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { ZoomContext, ZoomContextType } from './index';
|
|
5
3
|
import {
|
|
6
4
|
getComputedElementWidth,
|
|
7
5
|
numberToPxString,
|
|
8
6
|
secondsToPixel,
|
|
9
|
-
} from '
|
|
10
|
-
|
|
11
|
-
export interface VaLueLineCanvasProps {
|
|
12
|
-
blockStartingTimes: number[];
|
|
13
|
-
value: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const OverlayCanvas = styled.canvas`
|
|
17
|
-
position: absolute;
|
|
18
|
-
top: 0;
|
|
19
|
-
left: 0;
|
|
20
|
-
width: 100%;
|
|
21
|
-
height: 100%;
|
|
22
|
-
color: #c9c9c9;
|
|
23
|
-
`;
|
|
7
|
+
} from '../utils/utils';
|
|
8
|
+
import { ZoomContext, ZoomContextType } from '../ZoomContext/ZoomContext';
|
|
24
9
|
|
|
25
10
|
const PreValueLine = styled.span`
|
|
26
11
|
position: absolute;
|
|
@@ -40,45 +25,18 @@ const PostValueLine = styled.span`
|
|
|
40
25
|
height: 100%;
|
|
41
26
|
`;
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
value
|
|
46
|
-
}
|
|
47
|
-
const canvasRef = useRef(null);
|
|
28
|
+
interface Props {
|
|
29
|
+
canvasRef: React.RefObject<HTMLCanvasElement>;
|
|
30
|
+
value: number;
|
|
31
|
+
}
|
|
48
32
|
|
|
33
|
+
export const TimelineValue: React.FC<Props> = ({ canvasRef, value }) => {
|
|
49
34
|
const preValueLineRef = useRef(null);
|
|
50
35
|
const valueLineRef = useRef(null);
|
|
51
36
|
const postValueLineRef = useRef(null);
|
|
52
37
|
|
|
53
38
|
const zoomContextValue: ZoomContextType = useContext(ZoomContext);
|
|
54
39
|
|
|
55
|
-
const showBlocks = useCallback(
|
|
56
|
-
(canvas: HTMLCanvasElement) => {
|
|
57
|
-
const blockHeight = 20;
|
|
58
|
-
const context: CanvasRenderingContext2D = canvas.getContext('2d')!;
|
|
59
|
-
|
|
60
|
-
for (const blockStartingTime of blockStartingTimes) {
|
|
61
|
-
const x0Pixel = secondsToPixel(zoomContextValue, blockStartingTime);
|
|
62
|
-
const x1Pixel = secondsToPixel(
|
|
63
|
-
zoomContextValue,
|
|
64
|
-
blockStartingTime + zoomContextValue.blockOffset,
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
context.beginPath();
|
|
68
|
-
context.moveTo(x0Pixel, canvas.height);
|
|
69
|
-
context.lineTo(x0Pixel, canvas.height - blockHeight);
|
|
70
|
-
context.lineTo(x1Pixel, canvas.height - blockHeight);
|
|
71
|
-
context.lineTo(x1Pixel, canvas.height);
|
|
72
|
-
|
|
73
|
-
context.strokeStyle = window
|
|
74
|
-
.getComputedStyle(canvas)
|
|
75
|
-
.getPropertyValue('color');
|
|
76
|
-
context.stroke();
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
[blockStartingTimes, zoomContextValue],
|
|
80
|
-
);
|
|
81
|
-
|
|
82
40
|
const showValueLine = useCallback(() => {
|
|
83
41
|
const canvas: HTMLCanvasElement = canvasRef.current!;
|
|
84
42
|
|
|
@@ -107,26 +65,14 @@ const VaLueLineCanvas: React.FC<VaLueLineCanvasProps> = ({
|
|
|
107
65
|
const postValueLineWidth = canvas.width - postValueLinePosition;
|
|
108
66
|
postValueLineElement.style.left = numberToPxString(postValueLinePosition);
|
|
109
67
|
postValueLineElement.style.width = numberToPxString(postValueLineWidth);
|
|
110
|
-
}, [value, zoomContextValue]);
|
|
68
|
+
}, [canvasRef, value, zoomContextValue]);
|
|
111
69
|
|
|
112
70
|
useEffect(() => {
|
|
113
|
-
const canvas: HTMLCanvasElement = canvasRef.current!;
|
|
114
|
-
|
|
115
|
-
// https://stackoverflow.com/questions/8696631/canvas-drawings-like-lines-are-blurry
|
|
116
|
-
canvas.width = canvas.offsetWidth;
|
|
117
|
-
canvas.height = canvas.offsetHeight;
|
|
118
|
-
|
|
119
|
-
showBlocks(canvas);
|
|
120
71
|
showValueLine();
|
|
121
|
-
}, [
|
|
72
|
+
}, [showValueLine]);
|
|
122
73
|
|
|
123
74
|
return (
|
|
124
75
|
<>
|
|
125
|
-
<OverlayCanvas
|
|
126
|
-
ref={canvasRef}
|
|
127
|
-
className={'media-timeline-value-line-canvas'}
|
|
128
|
-
/>
|
|
129
|
-
|
|
130
76
|
<PreValueLine
|
|
131
77
|
ref={preValueLineRef}
|
|
132
78
|
className={'media-timeline-pre-value-line'}
|
|
@@ -139,4 +85,3 @@ const VaLueLineCanvas: React.FC<VaLueLineCanvasProps> = ({
|
|
|
139
85
|
</>
|
|
140
86
|
);
|
|
141
87
|
};
|
|
142
|
-
export default VaLueLineCanvas;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//[blockOffset, pixelsInSecond] when zoomLevel === 0, each block has an offset of 20 seconds, and each second has a width of 7px.
|
|
2
|
+
export const zoomLevelConfigurations = [
|
|
3
|
+
[20, 7],
|
|
4
|
+
[10, 10],
|
|
5
|
+
[10, 15],
|
|
6
|
+
[5, 20],
|
|
7
|
+
[5, 25],
|
|
8
|
+
[2, 35],
|
|
9
|
+
[2, 50],
|
|
10
|
+
[1, 60],
|
|
11
|
+
[1, 75],
|
|
12
|
+
[1, 90],
|
|
13
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Timeline';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const secondsToPixel = (zoomContextValue, seconds) => {
|
|
2
|
+
return zoomContextValue.pixelsInSecond * seconds;
|
|
3
|
+
};
|
|
4
|
+
export const pixelToSeconds = (zoomContextValue, pixel) => {
|
|
5
|
+
const seconds = pixel / zoomContextValue.pixelsInSecond;
|
|
6
|
+
return Math.round((seconds + Number.EPSILON) * 100) / 100;
|
|
7
|
+
};
|
|
8
|
+
export const getComputedElementWidth = (element) => {
|
|
9
|
+
const elementWidthCSSProperty = window
|
|
10
|
+
.getComputedStyle(element)
|
|
11
|
+
.getPropertyValue('width')
|
|
12
|
+
.replace(/[^-\d]/g, '');
|
|
13
|
+
return parseInt(elementWidthCSSProperty);
|
|
14
|
+
};
|
|
15
|
+
export const numberToPxString = (number) => {
|
|
16
|
+
return `${number}px`;
|
|
17
|
+
};
|
|
18
|
+
export const getTimelineWrapperWidth = (timeLineContainerWidth, zoomLevel) => {
|
|
19
|
+
return timeLineContainerWidth * Math.pow(1.25, zoomLevel) - 2; //-2px to account for the border
|
|
20
|
+
};
|
|
21
|
+
export function getBlockOffsetForZoomLevel(zoomLevel, duration, timelineWrapperWidth) {
|
|
22
|
+
const offsets = [10, 5, 5, 5, 2, 2, 2, 2, 2, 1];
|
|
23
|
+
let optimalOffset = offsets[zoomLevel];
|
|
24
|
+
while ((duration / optimalOffset) * 40 > timelineWrapperWidth) {
|
|
25
|
+
optimalOffset = optimalOffset * 1.25;
|
|
26
|
+
}
|
|
27
|
+
return Math.ceil(optimalOffset);
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZoomContextType } from '../
|
|
1
|
+
import { ZoomContextType } from '../ZoomContext/ZoomContext';
|
|
2
2
|
|
|
3
3
|
export const secondsToPixel = (
|
|
4
4
|
zoomContextValue: ZoomContextType,
|
|
@@ -26,3 +26,24 @@ export const getComputedElementWidth = (element: HTMLElement): number => {
|
|
|
26
26
|
export const numberToPxString = (number: number): string => {
|
|
27
27
|
return `${number}px`;
|
|
28
28
|
};
|
|
29
|
+
|
|
30
|
+
export const getTimelineWrapperWidth = (
|
|
31
|
+
timeLineContainerWidth: number,
|
|
32
|
+
zoomLevel: number,
|
|
33
|
+
): number => {
|
|
34
|
+
return timeLineContainerWidth * Math.pow(1.25, zoomLevel) - 2; //-2px to account for the border
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function getBlockOffsetForZoomLevel(
|
|
38
|
+
zoomLevel: number,
|
|
39
|
+
duration: number,
|
|
40
|
+
timelineWrapperWidth: number,
|
|
41
|
+
): number {
|
|
42
|
+
const offsets = [10, 5, 5, 5, 2, 2, 2, 2, 2, 1];
|
|
43
|
+
|
|
44
|
+
let optimalOffset = offsets[zoomLevel];
|
|
45
|
+
while ((duration / optimalOffset) * 40 > timelineWrapperWidth) {
|
|
46
|
+
optimalOffset = optimalOffset * 1.25;
|
|
47
|
+
}
|
|
48
|
+
return Math.ceil(optimalOffset);
|
|
49
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/src/react-app-env.d.ts
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
/// <reference types="react-dom" />
|
|
4
|
+
|
|
5
|
+
declare namespace NodeJS {
|
|
6
|
+
interface ProcessEnv {
|
|
7
|
+
readonly NODE_ENV: 'development' | 'production' | 'test';
|
|
8
|
+
readonly PUBLIC_URL: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '*.avif' {
|
|
13
|
+
const src: string;
|
|
14
|
+
export default src;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare module '*.bmp' {
|
|
18
|
+
const src: string;
|
|
19
|
+
export default src;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const src: string;
|
|
24
|
+
export default src;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare module '*.jpg' {
|
|
28
|
+
const src: string;
|
|
29
|
+
export default src;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare module '*.jpeg' {
|
|
33
|
+
const src: string;
|
|
34
|
+
export default src;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare module '*.png' {
|
|
38
|
+
const src: string;
|
|
39
|
+
export default src;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare module '*.webp' {
|
|
43
|
+
const src: string;
|
|
44
|
+
export default src;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare module '*.svg' {
|
|
48
|
+
import * as React from 'react';
|
|
49
|
+
|
|
50
|
+
export const ReactComponent: React.FunctionComponent<React.SVGProps<
|
|
51
|
+
SVGSVGElement
|
|
52
|
+
> & { title?: string }>;
|
|
53
|
+
|
|
54
|
+
const src: string;
|
|
55
|
+
export default src;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare module '*.module.css' {
|
|
59
|
+
const classes: { readonly [key: string]: string };
|
|
60
|
+
export default classes;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare module '*.module.scss' {
|
|
64
|
+
const classes: { readonly [key: string]: string };
|
|
65
|
+
export default classes;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare module '*.module.sass' {
|
|
69
|
+
const classes: { readonly [key: string]: string };
|
|
70
|
+
export default classes;
|
|
71
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
|
|
3
|
+
declare module 'react' {
|
|
4
|
+
interface FunctionComponent<P = {}> {
|
|
5
|
+
__docgenInfo?: {
|
|
6
|
+
description?: string;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
props?: {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
description?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
tsType?: {
|
|
13
|
+
name: string;
|
|
14
|
+
elements?: { name: string }[]; // Handle array types
|
|
15
|
+
raw?: string;
|
|
16
|
+
type?: string; // Handle various types
|
|
17
|
+
};
|
|
18
|
+
defaultValue?: {
|
|
19
|
+
value: string;
|
|
20
|
+
computed: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
methods?: {
|
|
25
|
+
name: string;
|
|
26
|
+
type?: string; // Handle method types
|
|
27
|
+
signature?: {
|
|
28
|
+
arguments: {
|
|
29
|
+
type: { name: string };
|
|
30
|
+
name: string;
|
|
31
|
+
}[];
|
|
32
|
+
return: { name: string };
|
|
33
|
+
}; // Handle method signatures
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Timeline } from '../components/timeline';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import './timeline.stories.custom.css';
|
|
5
|
+
const StyledTimeline = styled(Timeline) `
|
|
6
|
+
.media-timeline-value-line {
|
|
7
|
+
background-color: red;
|
|
8
|
+
width: 5px;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export default {
|
|
12
|
+
title: 'Timeline',
|
|
13
|
+
component: Timeline,
|
|
14
|
+
argTypes: {
|
|
15
|
+
onChange: { action: 'changed' },
|
|
16
|
+
onRangeChange: { action: 'range changed' },
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const Template = (args) => (React.createElement(StyledTimeline, Object.assign({}, args)));
|
|
20
|
+
export const Default = Template.bind({});
|
|
21
|
+
Default.args = {
|
|
22
|
+
duration: 305,
|
|
23
|
+
value: 301,
|
|
24
|
+
zoomLevel: 0,
|
|
25
|
+
};
|
|
26
|
+
export const WithSelectedRange = Template.bind({});
|
|
27
|
+
WithSelectedRange.args = {
|
|
28
|
+
duration: 305,
|
|
29
|
+
value: 31,
|
|
30
|
+
zoomLevel: 0,
|
|
31
|
+
selectedRange: [20, 30],
|
|
32
|
+
};
|
|
33
|
+
export const WithCustomClassName = Template.bind({});
|
|
34
|
+
WithCustomClassName.args = {
|
|
35
|
+
duration: 305,
|
|
36
|
+
value: 31,
|
|
37
|
+
zoomLevel: 0,
|
|
38
|
+
className: 'this-class-redefines-styles',
|
|
39
|
+
};
|
|
40
|
+
export const WithoutTimeBlocks = Template.bind({});
|
|
41
|
+
WithoutTimeBlocks.args = {
|
|
42
|
+
duration: 305,
|
|
43
|
+
value: 31,
|
|
44
|
+
zoomLevel: 0,
|
|
45
|
+
withTimeBlocks: false,
|
|
46
|
+
};
|
|
47
|
+
export const Minimalist = Template.bind({});
|
|
48
|
+
Minimalist.args = {
|
|
49
|
+
duration: 305,
|
|
50
|
+
value: 31,
|
|
51
|
+
zoomLevel: 0,
|
|
52
|
+
withTimeBlocks: false,
|
|
53
|
+
className: 'minimalist',
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svgjs="http://svgjs.com/svgjs" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="164" version="1.1"><svg xmlns="http://www.w3.org/2000/svg" width="164" height="164" fill="none" viewBox="0 0 164 164"><path fill="#FF4785" d="M22.467 147.762 17.5 15.402a8.062 8.062 0 0 1 7.553-8.35L137.637.016a8.061 8.061 0 0 1 8.565 8.047v144.23a8.063 8.063 0 0 1-8.424 8.054l-107.615-4.833a8.062 8.062 0 0 1-7.695-7.752Z"/><path fill="#fff" fill-rule="evenodd" d="m128.785.57-15.495.968-.755 18.172a1.203 1.203 0 0 0 1.928 1.008l7.06-5.354 5.962 4.697a1.202 1.202 0 0 0 1.946-.987L128.785.569Zm-12.059 60.856c-2.836 2.203-23.965 3.707-23.965.57.447-11.969-4.912-12.494-7.889-12.494-2.828 0-7.59.855-7.59 7.267 0 6.534 6.96 10.223 15.13 14.553 11.607 6.15 25.654 13.594 25.654 32.326 0 17.953-14.588 27.871-33.194 27.871-19.201 0-35.981-7.769-34.086-34.702.744-3.163 25.156-2.411 25.156 0-.298 11.114 2.232 14.383 8.633 14.383 4.912 0 7.144-2.708 7.144-7.267 0-6.9-7.252-10.973-15.595-15.657C64.827 81.933 51.53 74.468 51.53 57.34c0-17.098 11.76-28.497 32.747-28.497 20.988 0 32.449 11.224 32.449 32.584Z" clip-rule="evenodd"/></svg><style>@media (prefers-color-scheme:light){:root{filter:none}}</style></svg>
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
|
|
6
|
+
<title>storybook - Storybook</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: 'Nunito Sans';
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 400;
|
|
17
|
+
font-display: swap;
|
|
18
|
+
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@font-face {
|
|
22
|
+
font-family: 'Nunito Sans';
|
|
23
|
+
font-style: italic;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
font-display: swap;
|
|
26
|
+
src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@font-face {
|
|
30
|
+
font-family: 'Nunito Sans';
|
|
31
|
+
font-style: normal;
|
|
32
|
+
font-weight: 700;
|
|
33
|
+
font-display: swap;
|
|
34
|
+
src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@font-face {
|
|
38
|
+
font-family: 'Nunito Sans';
|
|
39
|
+
font-style: italic;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
font-display: swap;
|
|
42
|
+
src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
|
|
46
|
+
<link href="./sb-manager/runtime.js" rel="modulepreload" />
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<link href="./sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js" rel="modulepreload" />
|
|
50
|
+
|
|
51
|
+
<link href="./sb-addons/links-1/manager-bundle.js" rel="modulepreload" />
|
|
52
|
+
|
|
53
|
+
<link href="./sb-addons/essentials-controls-2/manager-bundle.js" rel="modulepreload" />
|
|
54
|
+
|
|
55
|
+
<link href="./sb-addons/essentials-actions-3/manager-bundle.js" rel="modulepreload" />
|
|
56
|
+
|
|
57
|
+
<link href="./sb-addons/essentials-backgrounds-4/manager-bundle.js" rel="modulepreload" />
|
|
58
|
+
|
|
59
|
+
<link href="./sb-addons/essentials-viewport-5/manager-bundle.js" rel="modulepreload" />
|
|
60
|
+
|
|
61
|
+
<link href="./sb-addons/essentials-toolbars-6/manager-bundle.js" rel="modulepreload" />
|
|
62
|
+
|
|
63
|
+
<link href="./sb-addons/essentials-measure-7/manager-bundle.js" rel="modulepreload" />
|
|
64
|
+
|
|
65
|
+
<link href="./sb-addons/essentials-outline-8/manager-bundle.js" rel="modulepreload" />
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
#storybook-root[hidden] {
|
|
70
|
+
display: none !important;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
</head>
|
|
76
|
+
<body>
|
|
77
|
+
<div id="root"></div>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
<script>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
window['FEATURES'] = {
|
|
84
|
+
"argTypeTargetsV7": true,
|
|
85
|
+
"legacyDecoratorFileOrder": false,
|
|
86
|
+
"disallowImplicitActionsInRenderV8": true
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
window['REFS'] = {};
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
window['LOGLEVEL'] = "info";
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
window['DOCS_OPTIONS'] = {
|
|
100
|
+
"defaultName": "Docs",
|
|
101
|
+
"autodocs": "tag"
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
window['CONFIG_TYPE'] = "PRODUCTION";
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
window['TAGS_OPTIONS'] = {
|
|
115
|
+
"dev-only": {
|
|
116
|
+
"excludeFromDocsStories": true
|
|
117
|
+
},
|
|
118
|
+
"docs-only": {
|
|
119
|
+
"excludeFromSidebar": true
|
|
120
|
+
},
|
|
121
|
+
"test-only": {
|
|
122
|
+
"excludeFromSidebar": true,
|
|
123
|
+
"excludeFromDocsStories": true
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
window['STORYBOOK_RENDERER'] = "react";
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
window['STORYBOOK_BUILDER'] = "@storybook/builder-webpack5";
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
window['STORYBOOK_FRAMEWORK'] = "@storybook/react-webpack5";
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
<script type="module">
|
|
144
|
+
import './sb-manager/globals-runtime.js';
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
import './sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js';
|
|
148
|
+
|
|
149
|
+
import './sb-addons/links-1/manager-bundle.js';
|
|
150
|
+
|
|
151
|
+
import './sb-addons/essentials-controls-2/manager-bundle.js';
|
|
152
|
+
|
|
153
|
+
import './sb-addons/essentials-actions-3/manager-bundle.js';
|
|
154
|
+
|
|
155
|
+
import './sb-addons/essentials-backgrounds-4/manager-bundle.js';
|
|
156
|
+
|
|
157
|
+
import './sb-addons/essentials-viewport-5/manager-bundle.js';
|
|
158
|
+
|
|
159
|
+
import './sb-addons/essentials-toolbars-6/manager-bundle.js';
|
|
160
|
+
|
|
161
|
+
import './sb-addons/essentials-measure-7/manager-bundle.js';
|
|
162
|
+
|
|
163
|
+
import './sb-addons/essentials-outline-8/manager-bundle.js';
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
import './sb-manager/runtime.js';
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<link href="./sb-preview/runtime.js" rel="prefetch" as="script" />
|
|
171
|
+
|
|
172
|
+
</body>
|
|
173
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":5,"entries":{"timeline--default":{"type":"story","id":"timeline--default","name":"Default","title":"Timeline","importPath":"./src/stories/timeline.stories.tsx","componentPath":"./src/components/timeline","tags":["dev","test"]},"timeline--with-selected-range":{"type":"story","id":"timeline--with-selected-range","name":"With Selected Range","title":"Timeline","importPath":"./src/stories/timeline.stories.tsx","componentPath":"./src/components/timeline","tags":["dev","test"]},"timeline--with-custom-class-name":{"type":"story","id":"timeline--with-custom-class-name","name":"With Custom Class Name","title":"Timeline","importPath":"./src/stories/timeline.stories.tsx","componentPath":"./src/components/timeline","tags":["dev","test"]},"timeline--without-time-blocks":{"type":"story","id":"timeline--without-time-blocks","name":"Without Time Blocks","title":"Timeline","importPath":"./src/stories/timeline.stories.tsx","componentPath":"./src/components/timeline","tags":["dev","test"]},"timeline--minimalist":{"type":"story","id":"timeline--minimalist","name":"Minimalist","title":"Timeline","importPath":"./src/stories/timeline.stories.tsx","componentPath":"./src/components/timeline","tags":["dev","test"]}}}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"generatedAt":1721473900035,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"babel-jest":"27.5.1","jest":"29.7.0","jest-resolve":"29.7.0","jest-watch-typeahead":"2.2.2","@testing-library/jest-dom":"6.4.6","@testing-library/react":"16.0.0","@testing-library/user-event":null,"@types/jest":"29.5.12"},"packageManager":{"type":"npm","version":"9.2.0"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-webpack5","options":{}},"builder":"@storybook/builder-webpack5","renderer":"@storybook/react","storybookVersion":"8.2.5","storybookVersionSpecifier":"^8.2.5","language":"typescript","storybookPackages":{"@chromatic-com/storybook":{"version":"1.5.0"},"@storybook/addon-actions":{"version":"8.2.5"},"@storybook/addon-interactions":{"version":"8.2.5"},"@storybook/addon-knobs":{"version":"8.0.1"},"@storybook/addon-onboarding":{"version":"8.2.5"},"@storybook/blocks":{"version":"8.2.5"},"@storybook/node-logger":{"version":"8.2.5"},"@storybook/react":{"version":"8.2.5"},"@storybook/react-webpack5":{"version":"8.2.5"},"@storybook/test":{"version":"8.2.5"},"eslint-plugin-storybook":{"version":"0.8.0"},"storybook":{"version":"8.2.5"}},"addons":{"@storybook/addon-links":{"version":"8.2.5"},"@storybook/addon-essentials":{"version":"8.2.5"},"@storybook/preset-create-react-app":{"version":null}}}
|