@playkit-js/transcript 3.2.0-canary.2-0254f9e → 3.2.0-canary.4-2b8a565
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/CHANGELOG.md +2 -1
- package/dist/playkit-transcript.js +1 -1
- package/dist/playkit-transcript.js.map +1 -1
- package/package.json +5 -4
- package/src/components/autoscroll-button/autoscroll-button.scss +20 -0
- package/src/components/autoscroll-button/autoscroll-button.tsx +46 -0
- package/src/components/autoscroll-button/index.ts +1 -0
- package/src/components/caption/caption.scss +14 -15
- package/src/components/close-button/close-button.scss +1 -1
- package/src/components/plugin-button/plugin-button.scss +1 -1
- package/src/components/plugin-button/plugin-button.tsx +6 -4
- package/src/components/search/search.tsx +25 -195
- package/src/components/spinner/spinner.scss +9 -49
- package/src/components/spinner/spinner.tsx +9 -52
- package/src/components/transcript/transcript.scss +9 -31
- package/src/components/transcript/transcript.tsx +16 -42
- package/src/variables.scss +5 -15
- package/src/components/search/search.scss +0 -94
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
.root {
|
|
8
8
|
display: flex;
|
|
9
9
|
justify-content: center;
|
|
10
|
-
padding:
|
|
11
|
-
color: $
|
|
10
|
+
padding: 16px 4px 0px 0px;
|
|
11
|
+
color: $tone-1-color;
|
|
12
12
|
height: 100%;
|
|
13
13
|
width: 100%;
|
|
14
14
|
position: absolute;
|
|
15
|
-
background-color: $root-background;
|
|
16
15
|
z-index: 1;
|
|
17
16
|
.skip-transcript-button {
|
|
18
17
|
position: absolute;
|
|
@@ -23,15 +22,15 @@
|
|
|
23
22
|
justify-content: center;
|
|
24
23
|
width: 120px;
|
|
25
24
|
height: 32px;
|
|
26
|
-
border-radius:
|
|
25
|
+
border-radius: $roundness-3;
|
|
27
26
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.3);
|
|
28
|
-
border: solid 1px $
|
|
29
|
-
background-color: $
|
|
27
|
+
border: solid 1px $primary-color;
|
|
28
|
+
background-color: $tone-7-color;
|
|
30
29
|
font-size: 15px;
|
|
31
30
|
line-height: 1.27;
|
|
32
|
-
color: $
|
|
31
|
+
color: $tone-1-color;
|
|
33
32
|
&:focus {
|
|
34
|
-
top:
|
|
33
|
+
top: 56px;
|
|
35
34
|
right: 12px;
|
|
36
35
|
outline: none !important; // prevent focus styles inherited from playkit-player.playkit-nav
|
|
37
36
|
}
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
align-items: center;
|
|
57
56
|
justify-content: space-between;
|
|
58
57
|
width: 100%;
|
|
59
|
-
margin-bottom:
|
|
58
|
+
margin-bottom: 8px;
|
|
60
59
|
padding-left: 16px;
|
|
61
60
|
font-size: 16px;
|
|
62
61
|
&.small-width {
|
|
@@ -78,7 +77,6 @@
|
|
|
78
77
|
@include plugin-scrollbar();
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
.loading-wrapper,
|
|
82
80
|
.error-wrapper {
|
|
83
81
|
height: 100%;
|
|
84
82
|
width: 100%;
|
|
@@ -86,7 +84,7 @@
|
|
|
86
84
|
align-items: center;
|
|
87
85
|
justify-content: center;
|
|
88
86
|
flex-direction: column;
|
|
89
|
-
color: $
|
|
87
|
+
color: $tone-3-color;
|
|
90
88
|
.error-icon {
|
|
91
89
|
width: 100%;
|
|
92
90
|
height: 100%;
|
|
@@ -115,23 +113,3 @@
|
|
|
115
113
|
cursor: pointer;
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
.autoscroll-button {
|
|
120
|
-
opacity: 0;
|
|
121
|
-
position: absolute;
|
|
122
|
-
right: 12px;
|
|
123
|
-
bottom: 25px;
|
|
124
|
-
width: 32px;
|
|
125
|
-
height: 32px;
|
|
126
|
-
padding: 0;
|
|
127
|
-
border: none;
|
|
128
|
-
border-radius: 50%;
|
|
129
|
-
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);
|
|
130
|
-
background-color: #01819a;
|
|
131
|
-
cursor: pointer;
|
|
132
|
-
z-index: 1;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.autoscroll-button-visible {
|
|
136
|
-
opacity: 1;
|
|
137
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {h, Component} from 'preact';
|
|
2
|
-
import {
|
|
2
|
+
import {OnClickEvent} from '@playkit-js/common';
|
|
3
3
|
import {debounce} from '../../utils';
|
|
4
4
|
import * as styles from './transcript.scss';
|
|
5
5
|
import {Spinner} from '../spinner';
|
|
@@ -8,15 +8,15 @@ import {CaptionList} from '../caption-list';
|
|
|
8
8
|
import {HighlightedMap, CuePointData} from '../../types';
|
|
9
9
|
import {CloseButton} from '../close-button';
|
|
10
10
|
import {ErrorIcon} from './error-icon';
|
|
11
|
+
import {AutoscrollButton} from '../autoscroll-button';
|
|
11
12
|
|
|
12
13
|
const {ENTER, SPACE, TAB, ESC} = KalturaPlayer.ui.utils.KeyMap;
|
|
13
14
|
const {withText, Text} = KalturaPlayer.ui.preacti18n;
|
|
14
15
|
|
|
15
16
|
const translates = {
|
|
16
|
-
|
|
17
|
+
skipTranscript: <Text id="transcript.skip_transcript">Skip transcript</Text>,
|
|
17
18
|
errorTitle: <Text id="transcript.whoops">Whoops!</Text>,
|
|
18
|
-
errorDescripton: <Text id="transcript.load_failed">Failed to load transcript</Text
|
|
19
|
-
skipTranscript: <Text id="transcript.skip_transcript">Skip transcript</Text>
|
|
19
|
+
errorDescripton: <Text id="transcript.load_failed">Failed to load transcript</Text>
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export interface TranscriptProps {
|
|
@@ -36,10 +36,9 @@ export interface TranscriptProps {
|
|
|
36
36
|
toggledWithEnter: boolean;
|
|
37
37
|
highlightedMap: HighlightedMap;
|
|
38
38
|
onItemClicked: (n: number) => void;
|
|
39
|
-
|
|
39
|
+
skipTranscript?: string;
|
|
40
40
|
errorTitle?: string;
|
|
41
41
|
errorDescripton?: string;
|
|
42
|
-
skipTranscript?: string;
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
interface TranscriptState {
|
|
@@ -62,7 +61,8 @@ const initialSearch = {
|
|
|
62
61
|
|
|
63
62
|
const SEARCHBAR_HEIGHT = 38; // height of search bar with margins
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
@withText(translates)
|
|
65
|
+
export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
66
66
|
private _transcriptListRef: HTMLElement | null = null;
|
|
67
67
|
private _captionListRef: any = null;
|
|
68
68
|
private _skipTranscriptButtonRef: HTMLDivElement | null = null;
|
|
@@ -113,32 +113,13 @@ export class TranscriptComponent extends Component<TranscriptProps, TranscriptSt
|
|
|
113
113
|
private _renderScrollToButton = () => {
|
|
114
114
|
const {isAutoScrollEnabled} = this.state;
|
|
115
115
|
return (
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this._autoscrollButtonRef = node;
|
|
124
|
-
}}>
|
|
125
|
-
<svg
|
|
126
|
-
width="32px"
|
|
127
|
-
height="32px"
|
|
128
|
-
viewBox="0 0 16 16"
|
|
129
|
-
version="1.1"
|
|
130
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
131
|
-
xmlnsXlink="http://www.w3.org/1999/xlink">
|
|
132
|
-
<g id="Icons/16/Arrowline/up" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
133
|
-
<path
|
|
134
|
-
d="M8.0000393,2 C8.55232405,2 9.0000393,2.44771525 9.0000393,3 L9.0000393,3 L9,10.17 L11.216782,7.37830235 C11.5337243,6.97899674 12.0940739,6.88664831 12.5186429,7.14486093 L12.6217369,7.21674268 C13.054318,7.56009681 13.1266507,8.18911658 12.7832966,8.62169765 L12.7832966,8.62169765 L8.78329662,13.6611718 C8.3829349,14.165575 7.61714369,14.165575 7.21678198,13.6611718 L7.21678198,13.6611718 L3.21678198,8.62169765 C2.87342784,8.18911658 2.94576057,7.56009681 3.37834164,7.21674268 C3.81092272,6.87338855 4.43994248,6.94572127 4.78329662,7.37830235 L4.78329662,7.37830235 L7,10.17 L7.0000393,3 C7.0000393,2.48716416 7.38607949,2.06449284 7.88341817,2.00672773 Z"
|
|
135
|
-
id="Combined-Shape"
|
|
136
|
-
fill="#ffffff"
|
|
137
|
-
transform="translate(8.000039, 8.019737) scale(1, -1) translate(-8.000039, -8.019737) "></path>
|
|
138
|
-
</g>
|
|
139
|
-
</svg>
|
|
140
|
-
</div>
|
|
141
|
-
</A11yWrapper>
|
|
116
|
+
<AutoscrollButton
|
|
117
|
+
setAutoscrollButtonRef={(node: HTMLDivElement) => {
|
|
118
|
+
this._autoscrollButtonRef = node;
|
|
119
|
+
}}
|
|
120
|
+
isAutoScrollEnabled={isAutoScrollEnabled}
|
|
121
|
+
onClick={this._enableAutoScroll}
|
|
122
|
+
/>
|
|
142
123
|
);
|
|
143
124
|
};
|
|
144
125
|
|
|
@@ -199,7 +180,7 @@ export class TranscriptComponent extends Component<TranscriptProps, TranscriptSt
|
|
|
199
180
|
const {toggledWithEnter, kitchenSinkActive} = this.props;
|
|
200
181
|
const {search, activeSearchIndex, totalSearchResults} = this.state;
|
|
201
182
|
return (
|
|
202
|
-
<div className={[styles.header, this._getHeaderStyles()].join(' ')}>
|
|
183
|
+
<div className={[styles.header, this._getHeaderStyles()].join(' ')} data-testid="transcript_header">
|
|
203
184
|
<Search
|
|
204
185
|
onChange={this._onSearch}
|
|
205
186
|
onSearchIndexChange={this._debounced.onActiveSearchIndexChange}
|
|
@@ -208,7 +189,6 @@ export class TranscriptComponent extends Component<TranscriptProps, TranscriptSt
|
|
|
208
189
|
totalSearchResults={totalSearchResults}
|
|
209
190
|
toggledWithEnter={toggledWithEnter}
|
|
210
191
|
kitchenSinkActive={kitchenSinkActive}
|
|
211
|
-
searchQuery={search}
|
|
212
192
|
/>
|
|
213
193
|
</div>
|
|
214
194
|
);
|
|
@@ -316,11 +296,7 @@ export class TranscriptComponent extends Component<TranscriptProps, TranscriptSt
|
|
|
316
296
|
};
|
|
317
297
|
|
|
318
298
|
private _renderLoading = () => {
|
|
319
|
-
return
|
|
320
|
-
<div className={styles.loadingWrapper}>
|
|
321
|
-
<Spinner />
|
|
322
|
-
</div>
|
|
323
|
-
);
|
|
299
|
+
return <Spinner />;
|
|
324
300
|
};
|
|
325
301
|
|
|
326
302
|
private _scrollTo = (el: HTMLElement) => {
|
|
@@ -402,5 +378,3 @@ export class TranscriptComponent extends Component<TranscriptProps, TranscriptSt
|
|
|
402
378
|
);
|
|
403
379
|
}
|
|
404
380
|
}
|
|
405
|
-
|
|
406
|
-
export const Transcript = withText(translates)(TranscriptComponent);
|
package/src/variables.scss
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
$
|
|
5
|
-
$
|
|
6
|
-
$semigray-color: #666666;
|
|
7
|
-
$lightgray-color: #999999;
|
|
8
|
-
$black-color: #000000;
|
|
9
|
-
$semiblack-color: #222222;
|
|
10
|
-
$text-match-color: #fdd304;
|
|
11
|
-
$text-current-match-color: #1687ff;
|
|
12
|
-
$text-selection-color: #5b80a7;
|
|
13
|
-
$main-color-darken: darken($main-color, 10%);
|
|
14
|
-
$root-background: #000000a1;
|
|
15
|
-
$focus-color: #00cbff;
|
|
1
|
+
@import '~@playkit-js/playkit-js-ui';
|
|
2
|
+
|
|
3
|
+
// border radius
|
|
4
|
+
$roundness-1: 4px;
|
|
5
|
+
$roundness-3: 16px;
|
|
16
6
|
|
|
17
7
|
@mixin plugin-scrollbar {
|
|
18
8
|
&::-webkit-scrollbar {
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
@import '../../variables.scss';
|
|
2
|
-
|
|
3
|
-
.search-wrapper {
|
|
4
|
-
::-moz-placeholder {
|
|
5
|
-
opacity: 1;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
flex-grow: 1;
|
|
11
|
-
width: 100%;
|
|
12
|
-
max-width: 599px;
|
|
13
|
-
height: 32px;
|
|
14
|
-
background-color: rgba(255, 255, 255, 0.24);
|
|
15
|
-
border: solid 1px rgba(255, 255, 255, 0.4);
|
|
16
|
-
border-radius: 4px;
|
|
17
|
-
.search-icon {
|
|
18
|
-
flex: 0 0 32px;
|
|
19
|
-
background-color: transparent;
|
|
20
|
-
width: 32px;
|
|
21
|
-
height: 32px;
|
|
22
|
-
margin: 0 2px;
|
|
23
|
-
}
|
|
24
|
-
.search-results {
|
|
25
|
-
display: flex;
|
|
26
|
-
justify-content: flex-end;
|
|
27
|
-
align-items: center;
|
|
28
|
-
flex-shrink: 0;
|
|
29
|
-
margin: 0 8px;
|
|
30
|
-
font-size: 12px;
|
|
31
|
-
text-overflow: ellipsis;
|
|
32
|
-
}
|
|
33
|
-
.prev-next-wrapper {
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
justify-content: space-around;
|
|
37
|
-
max-height: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
width: 14px;
|
|
40
|
-
margin-right: 8px;
|
|
41
|
-
.prev-next-button {
|
|
42
|
-
padding: 0;
|
|
43
|
-
background-color: transparent;
|
|
44
|
-
background-position: center;
|
|
45
|
-
background-size: cover;
|
|
46
|
-
border: none;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
&.disabled {
|
|
49
|
-
opacity: 0.4;
|
|
50
|
-
cursor: default;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
.search-input {
|
|
55
|
-
width: 100%;
|
|
56
|
-
flex-grow: 1;
|
|
57
|
-
flex-shrink: 1;
|
|
58
|
-
font-size: 15px;
|
|
59
|
-
padding: 0 6px 1px 0;
|
|
60
|
-
color: $gray-color;
|
|
61
|
-
background: transparent;
|
|
62
|
-
border: none;
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
text-overflow: ellipsis;
|
|
65
|
-
&:focus {
|
|
66
|
-
outline: none !important; // prevent focus styles inherited from playkit-player.playkit-nav
|
|
67
|
-
}
|
|
68
|
-
&::placeholder {
|
|
69
|
-
color: $gray-color;
|
|
70
|
-
}
|
|
71
|
-
&::selection {
|
|
72
|
-
background-color: $text-selection-color;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
.clear-icon {
|
|
76
|
-
padding: 0;
|
|
77
|
-
flex: 0 0 32px;
|
|
78
|
-
max-width: 32px;
|
|
79
|
-
max-height: 32px;
|
|
80
|
-
background-color: transparent;
|
|
81
|
-
width: 32px;
|
|
82
|
-
height: 32px;
|
|
83
|
-
border: none;
|
|
84
|
-
cursor: pointer;
|
|
85
|
-
}
|
|
86
|
-
&.active {
|
|
87
|
-
color: $gray-color;
|
|
88
|
-
background: $black-color;
|
|
89
|
-
}
|
|
90
|
-
&.focused {
|
|
91
|
-
box-shadow: 0 0 0 1px $focus-color;
|
|
92
|
-
border-radius: 4px;
|
|
93
|
-
}
|
|
94
|
-
}
|