@playkit-js/transcript 3.0.1 → 3.1.0-canary.2-d22690c
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 +7 -0
- package/dist/playkit-transcript.js +1 -1
- package/dist/playkit-transcript.js.map +1 -1
- package/package.json +4 -3
- package/src/components/caption/caption.tsx +20 -24
- package/src/components/caption-list/captionList.tsx +5 -5
- package/src/components/close-button/index.tsx +9 -3
- package/src/components/icons/index.ts +4 -0
- package/src/components/plugin-button/plugin-button.scss +0 -19
- package/src/components/plugin-button/plugin-button.tsx +7 -9
- package/src/components/search/search.tsx +93 -57
- package/src/components/transcript/transcript.tsx +23 -9
- package/src/transcript-plugin.tsx +116 -83
- package/src/types/types-ui.ts +0 -7
- package/src/utils/index.ts +0 -1
- package/src/utils/utils.ts +34 -0
- package/src/components/download-print-menu/download-print-icons.tsx +0 -23
- package/src/components/download-print-menu/download-print-menu.scss +0 -44
- package/src/components/download-print-menu/download-print-menu.tsx +0 -164
- package/src/components/download-print-menu/index.ts +0 -1
- package/src/components/popover-menu/index.ts +0 -1
- package/src/components/popover-menu/popover-menu.scss +0 -6
- package/src/components/popover-menu/popover-menu.tsx +0 -52
- package/src/utils/popover/popover.scss +0 -30
- package/src/utils/popover/popover.tsx +0 -178
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.popover-container {
|
|
2
|
-
position: relative;
|
|
3
|
-
.popover-component {
|
|
4
|
-
background-color: #222222;
|
|
5
|
-
border-radius: 4px;
|
|
6
|
-
position: absolute;
|
|
7
|
-
right: 0px;
|
|
8
|
-
font-size: 15px;
|
|
9
|
-
display: block;
|
|
10
|
-
&.visible {
|
|
11
|
-
visibility: visible;
|
|
12
|
-
opacity: 1;
|
|
13
|
-
z-index: 10;
|
|
14
|
-
}
|
|
15
|
-
&.top {
|
|
16
|
-
bottom: 100%;
|
|
17
|
-
margin-bottom: 6px;
|
|
18
|
-
}
|
|
19
|
-
&.bottom {
|
|
20
|
-
top: 100%;
|
|
21
|
-
margin-top: 6px;
|
|
22
|
-
}
|
|
23
|
-
&.right {
|
|
24
|
-
left: 0px;
|
|
25
|
-
}
|
|
26
|
-
&.left {
|
|
27
|
-
right: 0px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import {h, Component, ComponentChild} from 'preact';
|
|
2
|
-
import * as styles from './popover.scss';
|
|
3
|
-
|
|
4
|
-
const {ENTER, Esc} = KalturaPlayer.ui.utils.KeyMap;
|
|
5
|
-
|
|
6
|
-
export enum PopoverVerticalPositions {
|
|
7
|
-
Top = 'top',
|
|
8
|
-
Bottom = 'bottom'
|
|
9
|
-
}
|
|
10
|
-
export enum PopoverHorizontalPositions {
|
|
11
|
-
Left = 'left',
|
|
12
|
-
Right = 'right'
|
|
13
|
-
}
|
|
14
|
-
export enum PopoverTriggerMode {
|
|
15
|
-
Click = 'click',
|
|
16
|
-
Hover = 'hover'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const CLOSE_ON_HOVER_DELAY = 500;
|
|
20
|
-
|
|
21
|
-
const defaultProps = {
|
|
22
|
-
verticalPosition: PopoverVerticalPositions.Top,
|
|
23
|
-
horizontalPosition: PopoverHorizontalPositions.Left,
|
|
24
|
-
triggerMode: PopoverTriggerMode.Click,
|
|
25
|
-
className: 'popover',
|
|
26
|
-
closeOnEsc: true,
|
|
27
|
-
closeOnClick: true
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
interface PopoverProps {
|
|
31
|
-
onClose?: () => void;
|
|
32
|
-
onOpen?: () => void;
|
|
33
|
-
closeOnClick: boolean;
|
|
34
|
-
closeOnEsc: boolean;
|
|
35
|
-
verticalPosition: PopoverVerticalPositions;
|
|
36
|
-
horizontalPosition: PopoverHorizontalPositions;
|
|
37
|
-
className: string;
|
|
38
|
-
triggerMode: PopoverTriggerMode;
|
|
39
|
-
content: ComponentChild;
|
|
40
|
-
children: ComponentChild;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface PopoverState {
|
|
44
|
-
open: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export class Popover extends Component<PopoverProps, PopoverState> {
|
|
48
|
-
private _closeTimeout: any = null;
|
|
49
|
-
private _controlElement: HTMLDivElement | null = null;
|
|
50
|
-
static defaultProps = {
|
|
51
|
-
...defaultProps
|
|
52
|
-
};
|
|
53
|
-
state = {
|
|
54
|
-
open: false
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
componentWillUnmount() {
|
|
58
|
-
this._removeListeners();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private _clearTimeout = () => {
|
|
62
|
-
clearTimeout(this._closeTimeout);
|
|
63
|
-
this._closeTimeout = null;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
private _handleMouseEvent = (event: MouseEvent) => {
|
|
67
|
-
if (!this._controlElement?.contains(event.target as Node | null) && this.props.closeOnClick) {
|
|
68
|
-
this._closePopover();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
private _handleKeyboardEvent = (event: KeyboardEvent) => {
|
|
73
|
-
if (this._controlElement?.contains(event.target as Node | null) && event.keyCode === ENTER) {
|
|
74
|
-
// handle Enter key pressed on Target icon to prevent triggering of _closePopover twice
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if ((this.props.closeOnEsc && event.keyCode === Esc) || event.keyCode === ENTER) {
|
|
78
|
-
// handle if ESC or Enter button presesd
|
|
79
|
-
this._closePopover();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
private _openPopover = () => {
|
|
84
|
-
const {onOpen} = this.props;
|
|
85
|
-
this._clearTimeout();
|
|
86
|
-
this.setState({open: true}, () => {
|
|
87
|
-
this._addListeners();
|
|
88
|
-
if (onOpen) {
|
|
89
|
-
onOpen();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
private _closePopover = () => {
|
|
95
|
-
const {onClose} = this.props;
|
|
96
|
-
this._clearTimeout();
|
|
97
|
-
this.setState({open: false}, () => {
|
|
98
|
-
this._removeListeners();
|
|
99
|
-
if (onClose) {
|
|
100
|
-
onClose();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
private _togglePopover = (e: MouseEvent | KeyboardEvent) => {
|
|
106
|
-
if (this.state.open) {
|
|
107
|
-
this._closePopover();
|
|
108
|
-
} else {
|
|
109
|
-
this._openPopover();
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
private _handleMouseEnter = () => {
|
|
113
|
-
if (!this.state.open) {
|
|
114
|
-
this._openPopover();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
private _handleMouseLeave = () => {
|
|
118
|
-
this._closeTimeout = setTimeout(this._closePopover, CLOSE_ON_HOVER_DELAY);
|
|
119
|
-
};
|
|
120
|
-
private _handleHoverOnPopover = () => {
|
|
121
|
-
if (this.state.open && this._closeTimeout) {
|
|
122
|
-
this._clearTimeout();
|
|
123
|
-
} else {
|
|
124
|
-
this._closePopover();
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
private _addListeners = () => {
|
|
128
|
-
document.addEventListener('click', this._handleMouseEvent);
|
|
129
|
-
document.addEventListener('keydown', this._handleKeyboardEvent);
|
|
130
|
-
};
|
|
131
|
-
private _removeListeners = () => {
|
|
132
|
-
document.removeEventListener('click', this._handleMouseEvent);
|
|
133
|
-
document.removeEventListener('keydown', this._handleKeyboardEvent);
|
|
134
|
-
};
|
|
135
|
-
private _getHoverEvents = () => {
|
|
136
|
-
if (this.props.triggerMode === PopoverTriggerMode.Hover) {
|
|
137
|
-
return {
|
|
138
|
-
targetEvents: {
|
|
139
|
-
onMouseEnter: this._handleMouseEnter,
|
|
140
|
-
onMouseLeave: this._handleMouseLeave
|
|
141
|
-
},
|
|
142
|
-
popoverEvents: {
|
|
143
|
-
onMouseEnter: this._handleHoverOnPopover,
|
|
144
|
-
onMouseLeave: this._handleHoverOnPopover
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return {targetEvents: {onClick: this._togglePopover}, popoverEvents: {}};
|
|
149
|
-
};
|
|
150
|
-
render(props: PopoverProps) {
|
|
151
|
-
if (!props.content || !props.children) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
const {targetEvents, popoverEvents} = this._getHoverEvents();
|
|
155
|
-
return (
|
|
156
|
-
<div className={styles.popoverContainer}>
|
|
157
|
-
<div
|
|
158
|
-
className="popover-anchor-container"
|
|
159
|
-
ref={node => {
|
|
160
|
-
this._controlElement = node;
|
|
161
|
-
}}
|
|
162
|
-
{...targetEvents}
|
|
163
|
-
>
|
|
164
|
-
{props.children}
|
|
165
|
-
</div>
|
|
166
|
-
{this.state.open && (
|
|
167
|
-
<div
|
|
168
|
-
aria-expanded="true"
|
|
169
|
-
className={[props.className, styles.popoverComponent, styles[props.verticalPosition], styles[props.horizontalPosition]].join(' ')}
|
|
170
|
-
{...popoverEvents}
|
|
171
|
-
>
|
|
172
|
-
{props.content}
|
|
173
|
-
</div>
|
|
174
|
-
)}
|
|
175
|
-
</div>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
}
|