@playkit-js/moderation 3.2.16 → 3.2.17-canary.0-df449ae

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/moderation",
3
- "version": "3.2.16",
3
+ "version": "3.2.17-canary.0-df449ae",
4
4
  "main": "dist/playkit-moderation.js",
5
5
  "private": false,
6
6
  "bugs": {
@@ -39,6 +39,13 @@
39
39
  text-align: left;
40
40
  line-height: 32px;
41
41
  }
42
+ .selectTitle {
43
+ font-size: 14px;
44
+ line-height: 16px;
45
+ font-weight: 700;
46
+ text-align: left;
47
+ margin-top: 24px;
48
+ }
42
49
  .subtitle {
43
50
  margin-top: 16px;
44
51
  opacity: 0.7;
@@ -49,7 +56,7 @@
49
56
  display: flex;
50
57
  align-items: center;
51
58
  width: 100%;
52
- margin-top: 24px;
59
+ margin-top: 4px;
53
60
  margin-bottom: 16px;
54
61
  cursor: pointer;
55
62
  padding: 0;
@@ -30,6 +30,7 @@ interface ModerationProps {
30
30
  closeLabel?: string;
31
31
  reportPlaceholder?: string;
32
32
  defaultContentType?: string;
33
+ reportSelectTitle?: string;
33
34
  reportTitle?: string;
34
35
  }
35
36
 
@@ -68,8 +69,9 @@ const translates = ({moderateOptions}: ModerationProps) => {
68
69
  sendReportLabel: <Text id="moderation.report_button">Report</Text>,
69
70
  closeLabel: <Text id="moderation.close">Close</Text>,
70
71
  reportPlaceholder: <Text id="moderation.report_placeholder">Describe what you saw...</Text>,
71
- defaultContentType: <Text id="moderation.default_content_type">Choose a reason for reporting this content</Text>,
72
- reportTitle: <Text id="moderation.report_title">What’s wrong with this content?</Text>
72
+ defaultContentType: <Text id="moderation.default_content_type">Select</Text>,
73
+ reportSelectTitle: <Text id="moderation.report_select_title">Choose a reason for reporting this content (required)</Text>,
74
+ reportTitle: <Text id="moderation.report_title">What’s wrong with this content?</Text>,
73
75
  };
74
76
  };
75
77
 
@@ -162,6 +164,7 @@ export class Moderation extends Component<MergedProps, ModerationState> {
162
164
  <div className={styles.mainWrapper}>
163
165
  <div className={styles.title}>{this.props.reportTitle}</div>
164
166
  {subtitle ? <div className={[styles.subtitle].join(' ')}>{subtitle}</div> : null}
167
+ <div className={styles.selectTitle}>{this.props.reportSelectTitle}</div>
165
168
  <Popover options={this._getPopoverMenuOptions()} setExpandedState={this._togglePopoverMenu} open={this.state.open}>
166
169
  <button
167
170
  className={styles.selectWrapper}
@@ -3,6 +3,7 @@ import {A11yWrapper, OnClickEvent} from '@playkit-js/common/dist/hoc/a11y-wrappe
3
3
  import * as styles from './popover.scss';
4
4
 
5
5
  const {ESC, TAB} = KalturaPlayer.ui.utils.KeyMap;
6
+ const {withEventManager} = KalturaPlayer.ui.Event;
6
7
 
7
8
  export interface PopoverMenuItem {
8
9
  label?: string;
@@ -14,9 +15,10 @@ interface PopoverProps {
14
15
  children: VNode;
15
16
  setExpandedState: (open: boolean, callback?: () => void) => void;
16
17
  open: boolean;
18
+ eventManager?: any;
17
19
  }
18
20
 
19
-
21
+ @withEventManager
20
22
  export class Popover extends Component<PopoverProps> {
21
23
  private _controlElementRef: HTMLDivElement | null = null;
22
24
  private _popoverElementRef: HTMLDivElement | null = null;
@@ -35,7 +37,9 @@ export class Popover extends Component<PopoverProps> {
35
37
  };
36
38
 
37
39
  private _handleKeyboardEvent = (event: KeyboardEvent) => {
38
- if (event.keyCode === ESC || !this._popoverElementRef?.contains(event.target as Node | null)) {
40
+ if (event.keyCode === ESC || (!this._popoverElementRef?.contains(event.target as Node | null)
41
+ && !this._controlElementRef?.contains(event.target as Node | null))) {
42
+
39
43
  this._closePopover();
40
44
  }
41
45
  };
@@ -60,7 +64,11 @@ export class Popover extends Component<PopoverProps> {
60
64
  this.props.setExpandedState(true, () => {
61
65
  this._addListeners();
62
66
  if (byKeyboard) {
63
- this._getOptionRef(0)?.focus();
67
+ this.props.eventManager?.listen(this._controlElementRef, 'keydown', (event: KeyboardEvent) => {
68
+ if (event.keyCode === TAB){
69
+ this._getOptionRef(-1)?.focus();
70
+ }
71
+ })
64
72
  }
65
73
  });
66
74
  };
@@ -98,7 +106,9 @@ export class Popover extends Component<PopoverProps> {
98
106
  <div
99
107
  className="popover-anchor-container"
100
108
  ref={node => {
101
- this._controlElementRef = node;
109
+ if (node){
110
+ this._controlElementRef = node;
111
+ }
102
112
  }}>
103
113
  <A11yWrapper onClick={this._togglePopover}>{props.children}</A11yWrapper>;
104
114
  </div>
@@ -4,7 +4,7 @@
4
4
  "report_button": "Bericht",
5
5
  "close": "Schließen",
6
6
  "report_placeholder": "Beschreiben Sie, was Sie gesehen haben...",
7
- "default_content_type": "Wählen Sie einen Grund, weswegen Sie diesen Inhalt melden",
7
+ "report_select_title": "Wählen Sie einen Grund, weswegen Sie diesen Inhalt melden",
8
8
  "report_title": "Was stimmt mit diesem Inhalt nicht?"
9
9
  }
10
10
  }
@@ -11,7 +11,8 @@
11
11
  "Spam / Commercials": "Spam / Commercials",
12
12
  "close": "Close",
13
13
  "report_placeholder": "Describe what you saw...",
14
- "default_content_type": "Choose a reason for reporting this content (required)",
14
+ "default_content_type": "Select",
15
+ "report_select_title": "Choose a reason for reporting this content (required)",
15
16
  "report_title": "What’s wrong with this content?"
16
17
  }
17
18
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Informe",
5
5
  "close": "Cerrar",
6
6
  "report_placeholder": "Describa lo que ha visto…",
7
- "default_content_type": "Elija una razón para denunciar este contenido",
7
+ "report_select_title": "Elija una razón para denunciar este contenido",
8
8
  "report_title": "¿Qué le ocurre a este contenido?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Raportoi",
5
5
  "close": "Sulje",
6
6
  "report_placeholder": "Kuvaile näkemäsi...",
7
- "default_content_type": "Valitse syy tämän sisällön raportointiin",
7
+ "report_select_title": "Valitse syy tämän sisällön raportointiin",
8
8
  "report_title": "Mitä vikaa tässä sisällössä on?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Rapport",
5
5
  "close": "Fermer",
6
6
  "report_placeholder": "Décrivez ce que vous avez vu...",
7
- "default_content_type": "Sélectionner une raison de signaler ce contenu",
7
+ "report_select_title": "Sélectionner une raison de signaler ce contenu",
8
8
  "report_title": "Quel est le problème avec ce contenu ?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Rapport",
5
5
  "close": "Fermer",
6
6
  "report_placeholder": "Décrivez ce que vous avez vu...",
7
- "default_content_type": "Choisissez un motif de signalement de ce contenu",
7
+ "report_select_title": "Choisissez un motif de signalement de ce contenu",
8
8
  "report_title": "Quel est le problème avec ce contenu?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Rapporto",
5
5
  "close": "Chiudi",
6
6
  "report_placeholder": "Descrivi ciò che hai visto...",
7
- "default_content_type": "Seleziona un motivo per segnalare questo contenuto",
7
+ "report_select_title": "Seleziona un motivo per segnalare questo contenuto",
8
8
  "report_title": "Cosa c’è di sbagliato in questo contenuto?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "レポート",
5
5
  "close": "閉じる",
6
6
  "report_placeholder": "あなたが見たものを記述する",
7
- "default_content_type": "このコンテンツを報告する理由を選択する",
7
+ "report_select_title": "このコンテンツを報告する理由を選択する",
8
8
  "report_title": "このコンテンツの何が悪いのですか?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "보고서",
5
5
  "close": "닫기",
6
6
  "report_placeholder": "관찰한 것을 설명하십시오.",
7
- "default_content_type": "해당 콘텐츠를 신고하는 이유를 선택하십시오.",
7
+ "report_select_title": "해당 콘텐츠를 신고하는 이유를 선택하십시오.",
8
8
  "report_title": "콘텐츠에 어떠한 문제가 있습니까?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Rapporteren",
5
5
  "close": "Sluiten",
6
6
  "report_placeholder": "Beschrijf wat je hebt gezien...",
7
- "default_content_type": "Kies een reden om deze inhoud te rapporteren",
7
+ "report_select_title": "Kies een reden om deze inhoud te rapporteren",
8
8
  "report_title": "Wat is er mis met de inhoud?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Relatório",
5
5
  "close": "Fechar",
6
6
  "report_placeholder": "Descreva o que você viu...",
7
- "default_content_type": "Escolha o motivo da denúncia deste conteúdo",
7
+ "report_select_title": "Escolha o motivo da denúncia deste conteúdo",
8
8
  "report_title": "O que há de errado com este conteúdo?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "Сообщить",
5
5
  "close": "Закрыть",
6
6
  "report_placeholder": "Опишите, что вы видели...",
7
- "default_content_type": "Выберите причину сообщения об этом контенте",
7
+ "report_select_title": "Выберите причину сообщения об этом контенте",
8
8
  "report_title": "Что не так с этим контентом?"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "报告",
5
5
  "close": "关闭",
6
6
  "report_placeholder": "描述您所看到的……",
7
- "default_content_type": "选择报告此内容的原因",
7
+ "report_select_title": "选择报告此内容的原因",
8
8
  "report_title": "此内容有什么问题"
9
9
  }
10
10
  }
@@ -4,7 +4,7 @@
4
4
  "report_button": "報告",
5
5
  "close": "關閉",
6
6
  "report_placeholder": "描述您所看到的...",
7
- "default_content_type": "選擇報告此內容的原因",
7
+ "report_select_title": "選擇報告此內容的原因",
8
8
  "report_title": "此內容有什麼問題?"
9
9
  }
10
10
  }