tycho-components 0.8.4 → 0.8.6
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/dist/AppCard/AppCard.d.ts +2 -1
- package/dist/AppCard/AppCard.js +2 -2
- package/dist/AppSelect/AppSelect.d.ts +1 -1
- package/dist/AppSelect/AppSelect.js +4 -4
- package/dist/Header/HeaderReplaceAll/HeaderReplaceAll.js +19 -5
- package/dist/Header/HeaderReplaceAll/style.scss +1 -1
- package/dist/Participants/Participants.js +3 -3
- package/dist/configs/Localization.d.ts +3 -0
- package/dist/configs/localization/ParticipantsTexts.d.ts +3 -0
- package/dist/configs/localization/ParticipantsTexts.js +3 -0
- package/package.json +2 -4
|
@@ -7,6 +7,7 @@ type Props = {
|
|
|
7
7
|
footer?: React.ReactNode;
|
|
8
8
|
options?: DropdownMenuItem[];
|
|
9
9
|
className?: string;
|
|
10
|
+
onClick?: () => void;
|
|
10
11
|
};
|
|
11
|
-
export default function AppCard({ title, children, extraHeaderActions, footer, options, className, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function AppCard({ title, children, extraHeaderActions, footer, options, className, onClick, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
package/dist/AppCard/AppCard.js
CHANGED
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import { DropdownMenu } from 'tycho-storybook';
|
|
4
4
|
import './style.scss';
|
|
5
|
-
export default function AppCard({ title, children, extraHeaderActions, footer, options, className, }) {
|
|
6
|
-
return (_jsxs("div", { className: cx('ds-app-card', className), children: [title && (_jsxs("div", { className: "header", children: [_jsx("div", { className: "title", children: title }), extraHeaderActions && (_jsx("div", { className: "extra-header-actions", children: extraHeaderActions })), options && _jsx(DropdownMenu, { list: options })] })), _jsx("div", { className: "body", children: children }), footer && _jsx("div", { className: "footer", children: footer })] }));
|
|
5
|
+
export default function AppCard({ title, children, extraHeaderActions, footer, options, className, onClick, }) {
|
|
6
|
+
return (_jsxs("div", { className: cx('ds-app-card', className), onClick: onClick, children: [title && (_jsxs("div", { className: "header", children: [_jsx("div", { className: "title", children: title }), extraHeaderActions && (_jsx("div", { className: "extra-header-actions", children: extraHeaderActions })), options && _jsx(DropdownMenu, { list: options })] })), _jsx("div", { className: "body", children: children }), footer && _jsx("div", { className: "footer", children: footer })] }));
|
|
7
7
|
}
|
|
@@ -5,5 +5,5 @@ type Props = {
|
|
|
5
5
|
onChange: (value: any) => void;
|
|
6
6
|
emptyValue?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export default function AppSelect({ options, onChange, emptyValue, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default function AppSelect({ options, value, onChange, emptyValue, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import './style.scss';
|
|
2
|
+
import { MenuItem, Select } from '@mui/material';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
|
|
4
|
+
import './style.scss';
|
|
5
|
+
export default function AppSelect({ options, value, onChange, emptyValue = true, }) {
|
|
6
6
|
const { t } = useTranslation('common');
|
|
7
7
|
const getValues = () => {
|
|
8
8
|
if (Array.isArray(options))
|
|
@@ -16,5 +16,5 @@ export default function AppSelect({ options, onChange, emptyValue = true, }) {
|
|
|
16
16
|
});
|
|
17
17
|
return arr;
|
|
18
18
|
};
|
|
19
|
-
return (_jsxs(
|
|
19
|
+
return (_jsxs(Select, { onChange: (e) => onChange(e.target.value), value: value ?? '', fullWidth: true, children: [emptyValue && _jsx(MenuItem, { value: "", children: t('select.empty') }), getValues().map((option, idx) => (_jsx(MenuItem, { value: option.value, children: option.label }, idx.valueOf())))] }));
|
|
20
20
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Popover } from '@mui/material';
|
|
2
3
|
import { useState } from 'react';
|
|
3
|
-
import { Button, OverlayTrigger, Popover } from 'react-bootstrap';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { IconButton, getCurrentInput, getCurrentOnChange } from 'tycho-storybook';
|
|
5
|
+
import { IconButton, getCurrentInput, getCurrentOnChange, } from 'tycho-storybook';
|
|
6
6
|
import './style.scss';
|
|
7
7
|
export default function HeaderReplaceAll() {
|
|
8
8
|
const { t } = useTranslation('header');
|
|
9
9
|
const [findValue, setFindValue] = useState('');
|
|
10
10
|
const [replaceValue, setReplaceValue] = useState('');
|
|
11
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
12
|
const replaceAll = (str, find, replace) => {
|
|
12
13
|
// Escape special regex characters in 'find'
|
|
13
14
|
var escapedFind = find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
@@ -23,7 +24,20 @@ export default function HeaderReplaceAll() {
|
|
|
23
24
|
input.focus();
|
|
24
25
|
onChange({ target: input });
|
|
25
26
|
}
|
|
27
|
+
setAnchorEl(null);
|
|
26
28
|
};
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
+
const handleClick = (event) => {
|
|
30
|
+
setAnchorEl(event.currentTarget);
|
|
31
|
+
};
|
|
32
|
+
const handleClose = () => {
|
|
33
|
+
setAnchorEl(null);
|
|
34
|
+
};
|
|
35
|
+
const open = Boolean(anchorEl);
|
|
36
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { name: "autorenew", size: "small", title: t('replace.all.tooltip'), onClick: handleClick }), _jsx(Popover, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: {
|
|
37
|
+
vertical: 'bottom',
|
|
38
|
+
horizontal: 'left',
|
|
39
|
+
}, transformOrigin: {
|
|
40
|
+
vertical: 'top',
|
|
41
|
+
horizontal: 'left',
|
|
42
|
+
}, className: "popover-replace", children: _jsxs("div", { className: "popover-body", children: [_jsx("input", { type: "text", placeholder: t('replace.find.placeholder'), value: findValue, onChange: (e) => setFindValue(e.target.value) }), _jsx("input", { type: "text", placeholder: t('replace.placeholder'), value: replaceValue, onChange: (e) => setReplaceValue(e.target.value) }), _jsx(Button, { size: "small", onClick: handleReplaceAll, children: "confirm" })] }) })] }));
|
|
29
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { MenuItem, Select } from '@mui/material';
|
|
2
3
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { Form } from 'react-bootstrap';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Button } from 'tycho-storybook';
|
|
6
6
|
import AppEditable from '../AppEditable';
|
|
@@ -39,9 +39,9 @@ export default function Participants({ document, participants, onChange, useChat
|
|
|
39
39
|
if (participants.length > 0)
|
|
40
40
|
setParticipant(participants[0]);
|
|
41
41
|
}, []);
|
|
42
|
-
return (_jsxs("div", { className: "participants-container", children: [_jsxs("div", { className: "header", children: [_jsx("h3", { children: t('label.title') }), _jsx("div", { className: "actions", children: _jsx(Button, { icon: "add", text: t('button.label.add'), onClick: () => setOpenCreate(true), size: "small", mode: "outlined" }) })] }), _jsx("div", { className: "body", children: participant && (_jsxs(_Fragment, { children: [_jsx(
|
|
42
|
+
return (_jsxs("div", { className: "participants-container", children: [_jsxs("div", { className: "header", children: [_jsx("h3", { children: t('label.title') }), _jsx("div", { className: "actions", children: _jsx(Button, { icon: "add", text: t('button.label.add'), onClick: () => setOpenCreate(true), size: "small", mode: "outlined" }) })] }), _jsx("div", { className: "body", children: participant && (_jsxs(_Fragment, { children: [_jsx(Select, { onChange: (e) => setParticipant(participants[Number(e.target.value)]), value: participant
|
|
43
43
|
? participants.findIndex((p) => p.code === participant.code)
|
|
44
|
-
: 0, children: participants.map((el, idx) => (_jsx(
|
|
44
|
+
: 0, fullWidth: true, children: participants.map((el, idx) => (_jsx(MenuItem, { value: idx, children: `${el.code} - ${el.name}` }, idx))) }), _jsx(AppEditable, { translation: "participants", group: "participant", save: handleSave, item: { ...participant, uid: document }, fields: PARTICIPANT_FIELDS, className: "fields", reference: "code" }), useChat && (_jsx(AppEditable, { translation: "participants", group: "participant", save: handleSave, item: { ...participant, uid: document }, fields: CHAT_FIELDS, className: "fields", reference: "code" })), _jsx("div", { className: "footer", children: _jsx(Button, { icon: "delete", text: t('common:button.remove'), size: "small", className: "danger", onClick: () => {
|
|
45
45
|
setParticipant(participant);
|
|
46
46
|
setOpenRemove(true);
|
|
47
47
|
} }) })] })) }), participant && openRemove && (_jsx(ParticipantRemove, { document: document, onChange: (list) => {
|
|
@@ -158,6 +158,7 @@ export declare const commonResources: {
|
|
|
158
158
|
'participant.field.code': string;
|
|
159
159
|
'participant.field.name': string;
|
|
160
160
|
'participant.field.color': string;
|
|
161
|
+
'participant.field.select': string;
|
|
161
162
|
'participant.field.separator': string;
|
|
162
163
|
'participant.field.color.tooltip': string;
|
|
163
164
|
'participant.field.language': string;
|
|
@@ -424,6 +425,7 @@ export declare const commonResources: {
|
|
|
424
425
|
'participant.field.code': string;
|
|
425
426
|
'participant.field.name': string;
|
|
426
427
|
'participant.field.color': string;
|
|
428
|
+
'participant.field.select': string;
|
|
427
429
|
'participant.field.separator': string;
|
|
428
430
|
'participant.field.color.tooltip': string;
|
|
429
431
|
'participant.field.language': string;
|
|
@@ -689,6 +691,7 @@ export declare const commonResources: {
|
|
|
689
691
|
'participant.field.code': string;
|
|
690
692
|
'participant.field.name': string;
|
|
691
693
|
'participant.field.color': string;
|
|
694
|
+
'participant.field.select': string;
|
|
692
695
|
'participant.field.separator': string;
|
|
693
696
|
'participant.field.color.tooltip': string;
|
|
694
697
|
'participant.field.language': string;
|
|
@@ -6,6 +6,7 @@ export declare const ParticipantsTexts: {
|
|
|
6
6
|
'participant.field.code': string;
|
|
7
7
|
'participant.field.name': string;
|
|
8
8
|
'participant.field.color': string;
|
|
9
|
+
'participant.field.select': string;
|
|
9
10
|
'participant.field.separator': string;
|
|
10
11
|
'participant.field.color.tooltip': string;
|
|
11
12
|
'participant.field.language': string;
|
|
@@ -32,6 +33,7 @@ export declare const ParticipantsTexts: {
|
|
|
32
33
|
'participant.field.code': string;
|
|
33
34
|
'participant.field.name': string;
|
|
34
35
|
'participant.field.color': string;
|
|
36
|
+
'participant.field.select': string;
|
|
35
37
|
'participant.field.separator': string;
|
|
36
38
|
'participant.field.color.tooltip': string;
|
|
37
39
|
'participant.field.language': string;
|
|
@@ -57,6 +59,7 @@ export declare const ParticipantsTexts: {
|
|
|
57
59
|
'participant.field.code': string;
|
|
58
60
|
'participant.field.name': string;
|
|
59
61
|
'participant.field.color': string;
|
|
62
|
+
'participant.field.select': string;
|
|
60
63
|
'participant.field.separator': string;
|
|
61
64
|
'participant.field.color.tooltip': string;
|
|
62
65
|
'participant.field.language': string;
|
|
@@ -6,6 +6,7 @@ export const ParticipantsTexts = {
|
|
|
6
6
|
'participant.field.code': 'Code',
|
|
7
7
|
'participant.field.name': 'Name',
|
|
8
8
|
'participant.field.color': 'Color',
|
|
9
|
+
'participant.field.select': 'Select participant',
|
|
9
10
|
'participant.field.separator': 'Separator',
|
|
10
11
|
'participant.field.color.tooltip': 'A color for transcription visual identifier',
|
|
11
12
|
'participant.field.language': 'Language',
|
|
@@ -32,6 +33,7 @@ export const ParticipantsTexts = {
|
|
|
32
33
|
'participant.field.code': 'Código',
|
|
33
34
|
'participant.field.name': 'Nome',
|
|
34
35
|
'participant.field.color': 'Cor',
|
|
36
|
+
'participant.field.select': 'Selecionar participante',
|
|
35
37
|
'participant.field.separator': 'Separador',
|
|
36
38
|
'participant.field.color.tooltip': 'Cor para identificação visual da sentença na transcrição',
|
|
37
39
|
'participant.field.language': 'Língua',
|
|
@@ -57,6 +59,7 @@ export const ParticipantsTexts = {
|
|
|
57
59
|
'participant.field.code': 'Codice',
|
|
58
60
|
'participant.field.name': 'Nome',
|
|
59
61
|
'participant.field.color': 'Colore',
|
|
62
|
+
'participant.field.select': 'Seleziona partecipante',
|
|
60
63
|
'participant.field.separator': 'Separatore',
|
|
61
64
|
'participant.field.color.tooltip': "Un colore per l'identificatore visivo della trascrizione",
|
|
62
65
|
'participant.field.language': 'Lingua',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tycho-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.6",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -38,16 +38,14 @@
|
|
|
38
38
|
"@hookform/resolvers": "^3.1.1",
|
|
39
39
|
"@mui/icons-material": "7.3.0",
|
|
40
40
|
"@mui/material": "7.3.0",
|
|
41
|
-
"bootstrap": "^5.3.1",
|
|
42
41
|
"i18next": "^23.3.0",
|
|
43
42
|
"i18next-browser-languagedetector": "^7.1.0",
|
|
44
43
|
"react": ">=17 <19",
|
|
45
|
-
"react-bootstrap": "^2.8.0",
|
|
46
44
|
"react-dom": ">=17 <19",
|
|
47
45
|
"react-hook-form": "^7.45.2",
|
|
48
46
|
"react-i18next": "^13.0.2",
|
|
49
47
|
"react-router-dom": "^6.14.2",
|
|
50
|
-
"tycho-storybook": "0.5.
|
|
48
|
+
"tycho-storybook": "0.5.9",
|
|
51
49
|
"yup": "^1.2.0"
|
|
52
50
|
},
|
|
53
51
|
"devDependencies": {
|