@ldelia/react-media 0.2.5 → 0.2.6

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.
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './Timeline.css';
3
2
  export interface TimelineProps {
4
3
  duration: number;
5
4
  value: number;
@@ -32,7 +32,21 @@ const TickTimeCollectionDisplay_1 = __importDefault(require("./TickTimeCollectio
32
32
  const VaLueLineCanvas_1 = __importDefault(require("./VaLueLineCanvas"));
33
33
  const RangeSelectorCanvas_1 = __importDefault(require("./RangeSelectorCanvas"));
34
34
  const constants_1 = require("./constants");
35
- require("./Timeline.css");
35
+ const styled_components_1 = __importDefault(require("styled-components"));
36
+ const TimelineContainer = styled_components_1.default.div `
37
+ background-color: #f0f0f0;
38
+ border: 1px solid #c9c9c9;
39
+ height: 80px;
40
+ width: 100%;
41
+ max-width: 100%;
42
+ overflow-x: auto;
43
+ position: relative;
44
+ display: flex;
45
+ `;
46
+ const TimelineWrapper = styled_components_1.default.div `
47
+ position: absolute;
48
+ height: 100%;
49
+ `;
36
50
  exports.ZoomContext = react_1.default.createContext({
37
51
  blockOffset: 0,
38
52
  pixelsInSecond: 0,
@@ -75,8 +89,8 @@ const Timeline = ({ duration, value, zoomLevel = 0, selectedRange = [], withTime
75
89
  const scrollPosition = value * zoomParams.pixelsInSecond - 300;
76
90
  timeLineWrapper.scrollLeft = Math.max(0, scrollPosition);
77
91
  }, [value, zoomParams]);
78
- return (react_1.default.createElement("div", { ref: timeLineContainerRef, className: `timeline-container ${className}` },
79
- react_1.default.createElement("div", { className: 'timeline-wrapper', style: { width: duration * zoomParams.pixelsInSecond + 'px' } },
92
+ return (react_1.default.createElement(TimelineContainer, { ref: timeLineContainerRef, className: className },
93
+ react_1.default.createElement(TimelineWrapper, { style: { width: duration * zoomParams.pixelsInSecond + 'px' } },
80
94
  react_1.default.createElement(exports.ZoomContext.Provider, { value: zoomParams },
81
95
  react_1.default.createElement(VaLueLineCanvas_1.default, { blockStartingTimes: withTimeBlocks ? blockStartingTimes : [], value: value }),
82
96
  react_1.default.createElement(RangeSelectorCanvas_1.default, { selectedRange: selectedRange, onChange: onChange, onRangeChange: onRangeChange }),
@@ -1,8 +1,9 @@
1
1
  import { TimelineProps } from '../components/timeline';
2
+ import { Meta } from '@storybook/react';
2
3
  import './timeline.stories.custom.css';
3
- declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-bf5e6555").R, import("@storybook/types").Args>;
4
+ declare const _default: Meta;
4
5
  export default _default;
5
- export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
6
- export declare const WithSelectedRange: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
7
- export declare const WithCustomClassName: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
8
- export declare const WithOutTimeBlocks: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-bf5e6555").R, TimelineProps>;
6
+ export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
7
+ export declare const WithSelectedRange: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
8
+ export declare const WithCustomClassName: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
9
+ export declare const WithOutTimeBlocks: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TimelineProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldelia/react-media",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "A React components collection for media-related features.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -3,8 +3,22 @@ import TickTimeCollectionDisplay from './TickTimeCollectionDisplay';
3
3
  import VaLueLineCanvas from './VaLueLineCanvas';
4
4
  import RangeSelectorCanvas from './RangeSelectorCanvas';
5
5
  import { zoomLevelConfigurations } from './constants';
6
+ import styled from 'styled-components';
6
7
 
7
- import './Timeline.css';
8
+ const TimelineContainer = styled.div`
9
+ background-color: #f0f0f0;
10
+ border: 1px solid #c9c9c9;
11
+ height: 80px;
12
+ width: 100%;
13
+ max-width: 100%;
14
+ overflow-x: auto;
15
+ position: relative;
16
+ display: flex;
17
+ `;
18
+ const TimelineWrapper = styled.div`
19
+ position: absolute;
20
+ height: 100%;
21
+ `;
8
22
 
9
23
  export interface TimelineProps {
10
24
  duration: number; // duration in seconds
@@ -88,12 +102,8 @@ export const Timeline: React.FC<TimelineProps> = ({
88
102
  }, [value, zoomParams]);
89
103
 
90
104
  return (
91
- <div
92
- ref={timeLineContainerRef}
93
- className={`timeline-container ${className}`}
94
- >
95
- <div
96
- className={'timeline-wrapper'}
105
+ <TimelineContainer ref={timeLineContainerRef} className={className}>
106
+ <TimelineWrapper
97
107
  style={{ width: duration * zoomParams.pixelsInSecond + 'px' }}
98
108
  >
99
109
  <ZoomContext.Provider value={zoomParams}>
@@ -110,7 +120,7 @@ export const Timeline: React.FC<TimelineProps> = ({
110
120
  <TickTimeCollectionDisplay tickTimes={blockStartingTimes} />
111
121
  )}
112
122
  </ZoomContext.Provider>
113
- </div>
114
- </div>
123
+ </TimelineWrapper>
124
+ </TimelineContainer>
115
125
  );
116
126
  };
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import './button.css';
3
- interface ButtonProps {
4
- /**
5
- * Is this the principal call to action on the page?
6
- */
7
- primary?: boolean;
8
- /**
9
- * What background color to use
10
- */
11
- backgroundColor?: string;
12
- /**
13
- * How large should the button be?
14
- */
15
- size?: 'small' | 'medium' | 'large';
16
- /**
17
- * Button contents
18
- */
19
- label: string;
20
- /**
21
- * Optional click handler
22
- */
23
- onClick?: () => void;
24
- }
25
- /**
26
- * Primary UI component for user interaction
27
- */
28
- export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => React.JSX.Element;
29
- export {};
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Button = void 0;
18
- const react_1 = __importDefault(require("react"));
19
- require("./button.css");
20
- /**
21
- * Primary UI component for user interaction
22
- */
23
- const Button = (_a) => {
24
- var { primary = false, size = 'medium', backgroundColor, label } = _a, props = __rest(_a, ["primary", "size", "backgroundColor", "label"]);
25
- const mode = primary
26
- ? 'storybook-button--primary'
27
- : 'storybook-button--secondary';
28
- return (react_1.default.createElement("button", Object.assign({ type: "button", className: ['storybook-button', `storybook-button--${size}`, mode].join(' '), style: { backgroundColor } }, props), label));
29
- };
30
- exports.Button = Button;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Small = exports.Large = exports.Secondary = exports.Primary = void 0;
4
- const test_1 = require("@storybook/test");
5
- const Button_1 = require("./Button");
6
- // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
7
- const meta = {
8
- title: 'Example/Button',
9
- component: Button_1.Button,
10
- parameters: {
11
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
12
- layout: 'centered',
13
- },
14
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
15
- tags: ['autodocs'],
16
- // More on argTypes: https://storybook.js.org/docs/api/argtypes
17
- argTypes: {
18
- backgroundColor: { control: 'color' },
19
- },
20
- // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
21
- args: { onClick: (0, test_1.fn)() },
22
- };
23
- exports.default = meta;
24
- // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
25
- exports.Primary = {
26
- args: {
27
- primary: true,
28
- label: 'Button',
29
- },
30
- };
31
- exports.Secondary = {
32
- args: {
33
- label: 'Button',
34
- },
35
- };
36
- exports.Large = {
37
- args: {
38
- size: 'large',
39
- label: 'Button',
40
- },
41
- };
42
- exports.Small = {
43
- args: {
44
- size: 'small',
45
- label: 'Button',
46
- },
47
- };
@@ -1,15 +0,0 @@
1
- .timeline-container {
2
- background-color: #f0f0f0;
3
- border: 1px solid #c9c9c9;
4
- height: 80px;
5
- width: 100%;
6
- max-width: 100%;
7
- overflow-x: auto;
8
- position: relative;
9
- display: flex;
10
- }
11
-
12
- .timeline-wrapper {
13
- position: absolute;
14
- height: 100%;
15
- }