tycho-components 0.38.2 → 0.38.4

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.
@@ -2,8 +2,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { IconButton, } from 'tycho-storybook';
5
- import VirtualKeyboard from '../../shell/VirtualKeyboard';
6
5
  import { useCorpusUtils } from '../../configs/useCorpusUtils';
6
+ import VirtualKeyboard from '../../shell/VirtualKeyboard';
7
7
  export default function AppKeyboard({ mode, buttonMode = 'filled', size = 'medium', iconSize, tooltipPlacement, title, keyboardLayout, }) {
8
8
  const { t } = useTranslation('header');
9
9
  const { getCorpus } = useCorpusUtils();
@@ -18,7 +18,7 @@ export type { default as ProcessConfiguration, SentenceDelimiter, } from "./type
18
18
  export { DEFAULT_DELIMITERS, DELIMITERS, DelimiterNames, EMPTY_CONFIGURATION, } from "./types/ProcessConfiguration";
19
19
  export { SentenceStatusNames } from "./types/SentenceStatus";
20
20
  export type { SentenceStatus } from "./types/SentenceStatus";
21
- export type { Mark, Break, Format as SentenceFormat, SentenceTier, Translation, } from "./types/Sentence";
21
+ export type { Mark, Break, Format as SentenceFormat, SentenceTier, Translation, SentenceParticipant, } from "./types/Sentence";
22
22
  export type { default as Sentence } from "./types/Sentence";
23
23
  export { INFLECTIONS, EXTENSIONS } from "./types/Struct";
24
24
  export type { Chunk, Edition, Format, Morpheme, Split, Struct, Token, ConlluToken, } from "./types/Struct";
@@ -1,8 +1,8 @@
1
- import { Token } from './Struct';
2
- import { Edition } from './Struct';
3
- import { Struct } from './Struct';
4
- import { SentenceStatus } from './SentenceStatus';
5
- import { UploadedFile } from '../../common/AppDropzone/UploadedFile';
1
+ import { Token } from "./Struct";
2
+ import { Edition } from "./Struct";
3
+ import { Struct } from "./Struct";
4
+ import { SentenceStatus } from "./SentenceStatus";
5
+ import { UploadedFile } from "../../common/AppDropzone/UploadedFile";
6
6
  export type Mark = {
7
7
  id: string;
8
8
  tokens: Token[];
@@ -34,6 +34,13 @@ export type Translation = {
34
34
  uid: string;
35
35
  values: Record<string, string>;
36
36
  };
37
+ /** Nested speaker assignment on a sentence (code + cue metadata). */
38
+ export type SentenceParticipant = {
39
+ name: string;
40
+ cue?: string[];
41
+ lineCue?: boolean;
42
+ hideName?: boolean;
43
+ };
37
44
  type Sentence = {
38
45
  uid: string;
39
46
  value: string;
@@ -50,7 +57,7 @@ type Sentence = {
50
57
  start: number | null;
51
58
  end: number | null;
52
59
  normalized?: string;
53
- participant?: string;
60
+ participant?: SentenceParticipant;
54
61
  color?: string;
55
62
  tiers: SentenceTier[];
56
63
  canJoinSentence?: boolean;
@@ -38,7 +38,7 @@ export default function HeaderNotifications({ uid, mode, mobile }) {
38
38
  }, [uid, tab]);
39
39
  if (!visible)
40
40
  return null;
41
- return (_jsxs("div", { className: "ds-dropdown-container notifications-container", children: [_jsx(IconButton, { name: "notifications_active", className: comments && comments.length > 0 ? 'shake' : '', size: "medium", onClick: () => setOpen(!open), mode: mobile ? 'outlined' : 'filled' }), open && (_jsx("div", { className: "ds-dropdown-list", children: _jsxs("div", { className: "notifications-panel", children: [_jsxs("div", { className: "header", children: [_jsx("span", { children: t('notification.title') }), _jsx(IconButton, { name: "close", size: "small", mode: "ghost", onClick: () => setOpen(false) })] }), _jsxs("div", { className: "tabs", children: [_jsxs("button", { className: tab === 'unread' ? 'active-tab' : '', onClick: () => setTab('unread'), children: [t('notification.unread'), " (", comments?.length || 0, ")"] }), _jsx("button", { className: tab === 'read' ? 'active-tab' : '', onClick: () => setTab('read'), children: t('notification.all') })] }), _jsxs("div", { className: "content", children: [notifications &&
41
+ return (_jsxs("div", { className: "ds-dropdown-container notifications-container", children: [_jsx(IconButton, { name: "notifications_active", className: comments && comments.length > 0 ? 'shake' : '', size: "large", onClick: () => setOpen(!open), mode: mobile ? 'outlined' : 'filled' }), open && (_jsx("div", { className: "ds-dropdown-list", children: _jsxs("div", { className: "notifications-panel", children: [_jsxs("div", { className: "header", children: [_jsx("span", { children: t('notification.title') }), _jsx(IconButton, { name: "close", size: "small", mode: "ghost", onClick: () => setOpen(false) })] }), _jsxs("div", { className: "tabs", children: [_jsxs("button", { className: tab === 'unread' ? 'active-tab' : '', onClick: () => setTab('unread'), children: [t('notification.unread'), " (", comments?.length || 0, ")"] }), _jsx("button", { className: tab === 'read' ? 'active-tab' : '', onClick: () => setTab('read'), children: t('notification.all') })] }), _jsxs("div", { className: "content", children: [notifications &&
42
42
  notifications.map((not, idx) => (_jsxs("div", { className: "item", onClick: () => handleOpen(not), children: [_jsx(Avatar, { src: not.picture, size: "small" }), _jsxs("div", { className: "message", children: [_jsx("span", { className: "text", children: _jsx(Trans, { t: t, i18nKey: "notification.text", values: {
43
43
  user: not.name,
44
44
  } }) }), _jsx("span", { className: "date", children: DateUtils.formatDateTime(not.edited ? not.edited : not.date, 'MM/dd/yyyy - HH:mm') })] })] }, idx.valueOf()))), notifications && notifications.length === 0 && (_jsx("div", { className: "empty-notifications", children: t('notification.empty') }))] })] }) }))] }));
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { useEffect, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { Avatar, Button, Icon } from 'tycho-storybook';
5
5
  import { useLoggedUtils } from '../../../configs/useLoggedUtils';
6
+ import UsabilityUtils from '../../../functions/UsabilityUtils';
6
7
  import LanguageSelector from '../../LanguageSelector';
7
8
  import './style.scss';
8
9
  import HelpModal from '../HelpButton/HelpModal';
@@ -11,6 +12,11 @@ export default function HeaderUser({ navigateLogout, navigateNotLogged, helpActi
11
12
  const { isLogged, getLogged } = useLoggedUtils();
12
13
  const [open, setOpen] = useState(false);
13
14
  const [openHelp, setOpenHelp] = useState(false);
15
+ useEffect(() => {
16
+ if (!open)
17
+ return;
18
+ return UsabilityUtils.attachCloseToEscape(() => setOpen(false));
19
+ }, [open]);
14
20
  const handleProfile = () => {
15
21
  setOpen(false);
16
22
  window.open(import.meta.env.VITE_APP_RESERVED_URL, '_blank');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.38.2",
4
+ "version": "0.38.4",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {