@zohodesk/dot 1.7.22 → 1.7.24
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 +10 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +10 -0
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +10 -0
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +10 -0
- package/es/AudioPlayer/AudioPlayer.js +580 -0
- package/es/AudioPlayer/AudioPlayer.module.css +146 -0
- package/es/AudioPlayer/Timer/Timer.js +67 -0
- package/es/AudioPlayer/Timer/Timer.module.css +5 -0
- package/es/AudioPlayer/Timer/__tests__/Timer.spec.js +20 -0
- package/es/AudioPlayer/Timer/__tests__/__snapshots__/Timer.spec.js.snap +14 -0
- package/es/AudioPlayer/Timer/propTypes/defaultProps.js +4 -0
- package/es/AudioPlayer/Timer/propTypes/propTypes.js +11 -0
- package/es/AudioPlayer/__tests__/AudioPlayer.spec.js +44 -0
- package/es/AudioPlayer/__tests__/__snapshots__/AudioPlayer.spec.js.snap +145 -0
- package/es/AudioPlayer/propTypes/defaultProps.js +14 -0
- package/es/AudioPlayer/propTypes/propTypes.js +33 -0
- package/es/AudioPlayer/utils/utils.js +24 -0
- package/lib/AudioPlayer/AudioPlayer.js +662 -0
- package/lib/AudioPlayer/AudioPlayer.module.css +146 -0
- package/lib/AudioPlayer/Timer/Timer.js +117 -0
- package/lib/AudioPlayer/Timer/Timer.module.css +5 -0
- package/lib/AudioPlayer/Timer/__tests__/Timer.spec.js +26 -0
- package/lib/AudioPlayer/Timer/__tests__/__snapshots__/Timer.spec.js.snap +14 -0
- package/lib/AudioPlayer/Timer/propTypes/defaultProps.js +11 -0
- package/lib/AudioPlayer/Timer/propTypes/propTypes.js +22 -0
- package/lib/AudioPlayer/__tests__/AudioPlayer.spec.js +50 -0
- package/lib/AudioPlayer/__tests__/__snapshots__/AudioPlayer.spec.js.snap +145 -0
- package/lib/AudioPlayer/propTypes/defaultProps.js +24 -0
- package/lib/AudioPlayer/propTypes/propTypes.js +44 -0
- package/lib/AudioPlayer/utils/utils.js +33 -0
- package/package.json +3 -3
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
height: var(--zd_size30) ;
|
|
3
|
+
background: var(--zdt_audioplayer_default_bg);
|
|
4
|
+
border-radius: 4px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dragtag {
|
|
8
|
+
margin: 0 var(--zd_size10) ;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.audioHid {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.pauseIcon {
|
|
16
|
+
font-size: var(--zd_font_size13) ;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.iconColor {
|
|
20
|
+
color: var(--zdt_audioplayer_line_text);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.downloadIcon {
|
|
24
|
+
font-size: var(--zd_font_size11) ;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[dir=ltr] .timerBox {
|
|
28
|
+
margin-left: var(--zd_size6) ;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[dir=rtl] .timerBox {
|
|
32
|
+
margin-right: var(--zd_size6) ;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.rightBox,
|
|
36
|
+
.closeBox {
|
|
37
|
+
height: 100% ;
|
|
38
|
+
width: var(--zd_size36) ;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[dir=ltr] .boxLeftRadius {
|
|
42
|
+
border-top-left-radius: 4px;
|
|
43
|
+
border-bottom-left-radius: 4px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[dir=rtl] .boxLeftRadius {
|
|
47
|
+
border-top-right-radius: 4px;
|
|
48
|
+
border-bottom-right-radius: 4px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[dir=ltr] .boxRightRadius {
|
|
52
|
+
border-top-right-radius: 4px;
|
|
53
|
+
border-bottom-right-radius: 4px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[dir=rtl] .boxRightRadius {
|
|
57
|
+
border-top-left-radius: 4px;
|
|
58
|
+
border-bottom-left-radius: 4px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.closeBox, .rightBox, .cursor {
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.downloadBox:hover, .downloadBox:focus, .closeBox:hover, .closeBox:focus {
|
|
66
|
+
background-color: var(--zdt_audioplayer_input_bg);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.downloadBox:hover .downloadIcon,
|
|
70
|
+
.closeBox:hover .pauseIcon {
|
|
71
|
+
color: var(--zdt_audioplayer_pauseicon_text);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.line {
|
|
75
|
+
color: var(--zdt_audioplayer_line_text);
|
|
76
|
+
font-size: var(--zd_font_size13) ;
|
|
77
|
+
font-family: var(--zd_semibold);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.disable {
|
|
81
|
+
pointer-events: none;
|
|
82
|
+
opacity: 0.4;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Audio Range styles */
|
|
86
|
+
|
|
87
|
+
input::-moz-focus-inner, input::-moz-focus-outer {
|
|
88
|
+
border: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.audioRangeContainer {
|
|
92
|
+
position: relative;
|
|
93
|
+
background-color: var(--zdt_audioplayer_input_bg);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.audioRangeContainer,
|
|
97
|
+
.input,
|
|
98
|
+
.loading {
|
|
99
|
+
height: var(--zd_size3) ;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.audioRangeContainer, .input, .loading {
|
|
103
|
+
border-radius: 4px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.loading {
|
|
107
|
+
width: 0% ;
|
|
108
|
+
height: 100% ;
|
|
109
|
+
position: absolute;
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
background-color: var(--zdt_audioplayer_loading_bg);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* CHROME */
|
|
115
|
+
.input {
|
|
116
|
+
-webkit-appearance: none;
|
|
117
|
+
outline: none;
|
|
118
|
+
background-color: var(--zdt_audioplayer_input_bg);
|
|
119
|
+
margin: 0 ;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.input::-webkit-slider-thumb {
|
|
123
|
+
-webkit-appearance: none;
|
|
124
|
+
width: var(--zd_size7) ;
|
|
125
|
+
height: var(--zd_size7) ;
|
|
126
|
+
border-radius: 50%;
|
|
127
|
+
background-color: var(--zdt_audioplayer_loading_bg);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* FIREFOX */
|
|
131
|
+
.input::-moz-range-thumb {
|
|
132
|
+
height: var(--zd_size7) ;
|
|
133
|
+
width: var(--zd_size7) ;
|
|
134
|
+
border: none;
|
|
135
|
+
border-radius: 50%;
|
|
136
|
+
background-color: var(--zdt_audioplayer_loading_bg);
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.input::-moz-range-track {
|
|
141
|
+
height: var(--zd_size3) ;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
border-radius: 4px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* End of audio range styles */
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Timer_propTypes } from "./propTypes/propTypes";
|
|
3
|
+
import { Timer_defaultProps } from "./propTypes/defaultProps";
|
|
4
|
+
import { Container } from '@zohodesk/components/lib/Layout';
|
|
5
|
+
import { addLeadingZeros } from "../utils/utils";
|
|
6
|
+
import style from "./Timer.module.css";
|
|
7
|
+
export default class Timer extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.constructTimer = this.constructTimer.bind(this);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
constructTimer() {
|
|
14
|
+
let {
|
|
15
|
+
hour,
|
|
16
|
+
minute,
|
|
17
|
+
second,
|
|
18
|
+
amPm,
|
|
19
|
+
separator,
|
|
20
|
+
timerFormat,
|
|
21
|
+
needCharacter
|
|
22
|
+
} = this.props;
|
|
23
|
+
const timeSeparator = separator == 'space' ? ' ' : ':';
|
|
24
|
+
let timerValue = '';
|
|
25
|
+
const format = timerFormat.toLowerCase().split(':');
|
|
26
|
+
hour = addLeadingZeros(hour);
|
|
27
|
+
minute = addLeadingZeros(minute);
|
|
28
|
+
second = addLeadingZeros(second);
|
|
29
|
+
|
|
30
|
+
if (needCharacter) {
|
|
31
|
+
hour = `${hour}h`;
|
|
32
|
+
minute = `${minute}m`;
|
|
33
|
+
second = `${second}s`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
format.map(type => {
|
|
37
|
+
if (type == 'hh') {
|
|
38
|
+
timerValue += hour;
|
|
39
|
+
} else if (type == 'mm') {
|
|
40
|
+
timerValue += minute;
|
|
41
|
+
} else if (type == 'ss') {
|
|
42
|
+
timerValue += second;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
timerValue += timeSeparator;
|
|
46
|
+
});
|
|
47
|
+
timerValue = timerValue.slice(0, -1);
|
|
48
|
+
amPm && (timerValue = `${timerValue} ${amPm}`);
|
|
49
|
+
return timerValue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
const {
|
|
54
|
+
dataId
|
|
55
|
+
} = this.props;
|
|
56
|
+
const timerValue = this.constructTimer();
|
|
57
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
58
|
+
dataId: dataId,
|
|
59
|
+
alignBox: "row",
|
|
60
|
+
className: style.container,
|
|
61
|
+
flexible: true
|
|
62
|
+
}, timerValue);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
Timer.defaultProps = Timer_defaultProps;
|
|
67
|
+
Timer.propTypes = Timer_propTypes;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import Timer from "../Timer";
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
dataId: 'CBTimer'
|
|
6
|
+
};
|
|
7
|
+
describe('Timer test Cases', () => {
|
|
8
|
+
// const {props,renderedDOM} = setup(Timer,Object.assign({},defaultProps))
|
|
9
|
+
// it('Should render Component',()=>{
|
|
10
|
+
// const component = TestUtils.scryRenderedComponentsWithTestid(renderedDOM,'CBTimer');
|
|
11
|
+
// expect(component.length).toBe(1);
|
|
12
|
+
// })
|
|
13
|
+
test('rendering the defult props', () => {
|
|
14
|
+
const {
|
|
15
|
+
asFragment
|
|
16
|
+
} = render( /*#__PURE__*/React.createElement(Timer, { ...defaultProps
|
|
17
|
+
}));
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Timer test Cases rendering the defult props 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="container flex cover rowdir"
|
|
7
|
+
data-id="CBTimer"
|
|
8
|
+
data-selector-id="container"
|
|
9
|
+
data-test-id="CBTimer"
|
|
10
|
+
>
|
|
11
|
+
undefined:undefined
|
|
12
|
+
</div>
|
|
13
|
+
</DocumentFragment>
|
|
14
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export const Timer_propTypes = {
|
|
3
|
+
dataId: PropTypes.string,
|
|
4
|
+
amPm: PropTypes.string,
|
|
5
|
+
hour: PropTypes.string,
|
|
6
|
+
minute: PropTypes.string,
|
|
7
|
+
needCharacter: PropTypes.bool,
|
|
8
|
+
second: PropTypes.string,
|
|
9
|
+
separator: PropTypes.oneOf(['space', 'colon']),
|
|
10
|
+
timerFormat: PropTypes.string
|
|
11
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import AudioPlayer from "../AudioPlayer"; // import TestUtils from 'react-dom/test-utils';
|
|
4
|
+
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
togglePlayer: jest.fn(),
|
|
7
|
+
downloadFile: jest.fn(),
|
|
8
|
+
minute: '02',
|
|
9
|
+
second: '03',
|
|
10
|
+
durationInSec: '203',
|
|
11
|
+
src: "https://ypvnxx00-a.akamaihd.net/downloads/ringtones/files/mp3/yuvanringtone-44640.mp3"
|
|
12
|
+
};
|
|
13
|
+
describe('AudioPlayer Test Cases', () => {
|
|
14
|
+
// const { props,renderedDOM } = setup(
|
|
15
|
+
// AudioPlayer,Object.assign({},defaultProps));
|
|
16
|
+
test('rendering the defult props', () => {
|
|
17
|
+
const {
|
|
18
|
+
asFragment
|
|
19
|
+
} = render( /*#__PURE__*/React.createElement(AudioPlayer, { ...defaultProps
|
|
20
|
+
}));
|
|
21
|
+
expect(asFragment()).toMatchSnapshot();
|
|
22
|
+
}); // it('should render component', () => {
|
|
23
|
+
// let component = TestUtils.scryRenderedComponentsWithTestid(
|
|
24
|
+
// renderedDOM,
|
|
25
|
+
// 'AudioPlayer');
|
|
26
|
+
// expect(component.length).toBe(1);
|
|
27
|
+
// })
|
|
28
|
+
// it('should close player onclicking close',()=>{
|
|
29
|
+
// let component = TestUtils.scryRenderedComponentsWithTestid(
|
|
30
|
+
// renderedDOM,
|
|
31
|
+
// 'audioPlayerClose'
|
|
32
|
+
// )[0];
|
|
33
|
+
// TestUtils.Simulate.click(component);
|
|
34
|
+
// expect(props.togglePlayer).toHaveBeenCalled();
|
|
35
|
+
// })
|
|
36
|
+
// it('should download audio onclicking download',()=>{
|
|
37
|
+
// let component = TestUtils.scryRenderedComponentsWithTestid(
|
|
38
|
+
// renderedDOM,
|
|
39
|
+
// 'audioDownload'
|
|
40
|
+
// )[0];
|
|
41
|
+
// TestUtils.Simulate.click(component);
|
|
42
|
+
// expect(props.downloadFile).toHaveBeenCalled();
|
|
43
|
+
// })
|
|
44
|
+
});
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`AudioPlayer Test Cases rendering the defult props 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="flex coldir"
|
|
7
|
+
data-id="AudioRange"
|
|
8
|
+
data-selector-id="container"
|
|
9
|
+
data-test-id="AudioRange"
|
|
10
|
+
tabindex="0"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
class="container flex rowdir vCenter"
|
|
14
|
+
data-id="containerComponent"
|
|
15
|
+
data-selector-id="container"
|
|
16
|
+
data-test-id="containerComponent"
|
|
17
|
+
>
|
|
18
|
+
<audio
|
|
19
|
+
class="audioHid"
|
|
20
|
+
controls=""
|
|
21
|
+
preload="auto"
|
|
22
|
+
>
|
|
23
|
+
<source
|
|
24
|
+
src="https://ypvnxx00-a.akamaihd.net/downloads/ringtones/files/mp3/yuvanringtone-44640.mp3"
|
|
25
|
+
type="audio/mpeg"
|
|
26
|
+
/>
|
|
27
|
+
</audio>
|
|
28
|
+
<div
|
|
29
|
+
class="rightBox downloadBox boxLeftRadius shrinkOff"
|
|
30
|
+
data-id="boxComponent"
|
|
31
|
+
data-selector-id="box"
|
|
32
|
+
data-test-id="boxComponent"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="disable flex cover coldir both"
|
|
36
|
+
data-id="AudioRange_playpause"
|
|
37
|
+
data-selector-id="container"
|
|
38
|
+
data-test-id="AudioRange_playpause"
|
|
39
|
+
data-title="Play"
|
|
40
|
+
>
|
|
41
|
+
<i
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
class="zd_font_icons basic icon-bcarr downloadIcon iconColor "
|
|
44
|
+
data-id="fontIcon"
|
|
45
|
+
data-selector-id="fontIcon"
|
|
46
|
+
data-test-id="fontIcon"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
class="timerBox shrinkOff"
|
|
52
|
+
data-id="boxComponent"
|
|
53
|
+
data-selector-id="box"
|
|
54
|
+
data-test-id="boxComponent"
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
class="flex cover rowdir vCenter"
|
|
58
|
+
data-id="containerComponent"
|
|
59
|
+
data-selector-id="container"
|
|
60
|
+
data-test-id="containerComponent"
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
class="container flex cover rowdir"
|
|
64
|
+
data-id="containerComponent"
|
|
65
|
+
data-selector-id="container"
|
|
66
|
+
data-test-id="containerComponent"
|
|
67
|
+
>
|
|
68
|
+
00:00:00
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
<div
|
|
73
|
+
class="dragtag disable grow basis shrinkOff"
|
|
74
|
+
data-id="boxComponent"
|
|
75
|
+
data-selector-id="box"
|
|
76
|
+
data-test-id="boxComponent"
|
|
77
|
+
>
|
|
78
|
+
<div
|
|
79
|
+
class="audioRangeContainer flex cover coldir"
|
|
80
|
+
data-id="containerComponent"
|
|
81
|
+
data-selector-id="container"
|
|
82
|
+
data-test-id="containerComponent"
|
|
83
|
+
>
|
|
84
|
+
<span
|
|
85
|
+
class="loading"
|
|
86
|
+
/>
|
|
87
|
+
<input
|
|
88
|
+
class="input"
|
|
89
|
+
data-id="AudioRange"
|
|
90
|
+
max="0"
|
|
91
|
+
min="0"
|
|
92
|
+
step="1"
|
|
93
|
+
type="range"
|
|
94
|
+
value="0"
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
<div
|
|
99
|
+
class="rightBox downloadBox shrinkOff"
|
|
100
|
+
data-id="boxComponent"
|
|
101
|
+
data-selector-id="box"
|
|
102
|
+
data-test-id="boxComponent"
|
|
103
|
+
>
|
|
104
|
+
<div
|
|
105
|
+
class="disable flex cover coldir both"
|
|
106
|
+
data-id="AudioRange_download"
|
|
107
|
+
data-selector-id="container"
|
|
108
|
+
data-test-id="AudioRange_download"
|
|
109
|
+
data-title="Download"
|
|
110
|
+
>
|
|
111
|
+
<i
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
class="zd_font_icons basic icon-download-new downloadIcon iconColor "
|
|
114
|
+
data-id="fontIcon"
|
|
115
|
+
data-selector-id="fontIcon"
|
|
116
|
+
data-test-id="fontIcon"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div
|
|
121
|
+
class="closeBox boxRightRadius shrinkOff"
|
|
122
|
+
data-id="boxComponent"
|
|
123
|
+
data-selector-id="box"
|
|
124
|
+
data-test-id="boxComponent"
|
|
125
|
+
>
|
|
126
|
+
<div
|
|
127
|
+
class="disable flex cover coldir both"
|
|
128
|
+
data-id="AudioRange_close"
|
|
129
|
+
data-selector-id="container"
|
|
130
|
+
data-test-id="AudioRange_close"
|
|
131
|
+
data-title="Close"
|
|
132
|
+
>
|
|
133
|
+
<i
|
|
134
|
+
aria-hidden="true"
|
|
135
|
+
class="zd_font_icons basic icon-cross pauseIcon iconColor "
|
|
136
|
+
data-id="fontIcon"
|
|
137
|
+
data-selector-id="fontIcon"
|
|
138
|
+
data-test-id="fontIcon"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</DocumentFragment>
|
|
145
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const AudioPlayer_defaultProps = {
|
|
2
|
+
isPlay: false,
|
|
3
|
+
timerFormat: 'mm:ss',
|
|
4
|
+
forwardStepInSec: 5,
|
|
5
|
+
backwardStepInSec: 5,
|
|
6
|
+
needClose: true,
|
|
7
|
+
needDownload: true,
|
|
8
|
+
needMuteIcon: false,
|
|
9
|
+
i18nKeys: {},
|
|
10
|
+
dataId: 'AudioPlayer',
|
|
11
|
+
customClass: '',
|
|
12
|
+
range: 0,
|
|
13
|
+
dataId: 'AudioRange'
|
|
14
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export const AudioPlayer_propTypes = {
|
|
3
|
+
backwardStepInSec: PropTypes.string,
|
|
4
|
+
forwardStepInSec: PropTypes.string,
|
|
5
|
+
getAudioDuration: PropTypes.func,
|
|
6
|
+
duration: PropTypes.string,
|
|
7
|
+
id: PropTypes.string,
|
|
8
|
+
isPlay: PropTypes.bool,
|
|
9
|
+
needClose: PropTypes.bool,
|
|
10
|
+
needDownload: PropTypes.bool,
|
|
11
|
+
needMuteIcon: PropTypes.bool,
|
|
12
|
+
onAudioLoading: PropTypes.func,
|
|
13
|
+
onAudioSeeking: PropTypes.func,
|
|
14
|
+
onClose: PropTypes.func,
|
|
15
|
+
onDownloading: PropTypes.func,
|
|
16
|
+
onError: PropTypes.func,
|
|
17
|
+
onMuteUnmute: PropTypes.func,
|
|
18
|
+
onPause: PropTypes.func,
|
|
19
|
+
onPlay: PropTypes.func,
|
|
20
|
+
src: PropTypes.string,
|
|
21
|
+
timerFormat: PropTypes.string,
|
|
22
|
+
i18nKeys: PropTypes.shape({
|
|
23
|
+
playTitle: PropTypes.string,
|
|
24
|
+
pauseTitle: PropTypes.string,
|
|
25
|
+
downloadTitle: PropTypes.string,
|
|
26
|
+
closeTitle: PropTypes.string,
|
|
27
|
+
muteTitle: PropTypes.string,
|
|
28
|
+
unmuteTitle: PropTypes.string
|
|
29
|
+
}),
|
|
30
|
+
dataId: PropTypes.string,
|
|
31
|
+
customClass: PropTypes.string,
|
|
32
|
+
range: PropTypes.number
|
|
33
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function openInNewTabWithNoopener(url) {
|
|
2
|
+
let targetnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_blank';
|
|
3
|
+
const aTag = document.createElement('a');
|
|
4
|
+
aTag.rel = 'noopener noreferrer';
|
|
5
|
+
aTag.target = targetnName;
|
|
6
|
+
aTag.href = url;
|
|
7
|
+
aTag.click();
|
|
8
|
+
}
|
|
9
|
+
export function addLeadingZeros(number) {
|
|
10
|
+
let desiredLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '2';
|
|
11
|
+
|
|
12
|
+
if (typeof number !== 'undefined') {
|
|
13
|
+
number = `${number}`;
|
|
14
|
+
desiredLength = Number(desiredLength);
|
|
15
|
+
|
|
16
|
+
if (number.length < desiredLength) {
|
|
17
|
+
for (let i = desiredLength - number.length; i > 0; i--) {
|
|
18
|
+
number = `0${number}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return number;
|
|
23
|
+
}
|
|
24
|
+
}
|