tycho-components 0.38.3 → 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();
@@ -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.3",
4
+ "version": "0.38.4",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {