tycho-components 0.7.6 → 0.7.7
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.
|
@@ -5,10 +5,18 @@ import { useTranslation } from "react-i18next";
|
|
|
5
5
|
import { Button, Icon } from "tycho-storybook";
|
|
6
6
|
import "./style.scss";
|
|
7
7
|
import { useEffect } from "react";
|
|
8
|
+
const stopEventPropagation = (event) => {
|
|
9
|
+
const e = event;
|
|
10
|
+
e.preventDefault?.();
|
|
11
|
+
e.stopPropagation?.();
|
|
12
|
+
e.stopImmediatePropagation?.();
|
|
13
|
+
};
|
|
8
14
|
const attachCloseToEscape = (handleClose) => {
|
|
9
15
|
const closeOnEscape = (e) => {
|
|
10
|
-
if (e.key === "Escape" || e.code === "Escape")
|
|
16
|
+
if (e.key === "Escape" || e.code === "Escape") {
|
|
17
|
+
stopEventPropagation(e);
|
|
11
18
|
handleClose();
|
|
19
|
+
}
|
|
12
20
|
};
|
|
13
21
|
// Capture phase makes this resilient if inner components stopPropagation() on Escape.
|
|
14
22
|
window.addEventListener("keydown", closeOnEscape, { capture: true });
|
|
@@ -22,10 +30,17 @@ export default function AppModal({ children, title, subtitle, className, close,
|
|
|
22
30
|
return;
|
|
23
31
|
return attachCloseToEscape(close);
|
|
24
32
|
}, [close, disableClose]);
|
|
25
|
-
return (_jsx(Modal, { open: true, disableEnforceFocus: true, disableAutoFocus: true, disableRestoreFocus: true, hideBackdrop: hideBackdrop, disableEscapeKeyDown: !!disableClose, onClose: () => {
|
|
33
|
+
return (_jsx(Modal, { open: true, disableEnforceFocus: true, disableAutoFocus: true, disableRestoreFocus: true, hideBackdrop: hideBackdrop, disableEscapeKeyDown: !!disableClose, onClose: (event) => {
|
|
34
|
+
stopEventPropagation(event);
|
|
26
35
|
if (!disableClose)
|
|
27
36
|
close();
|
|
28
|
-
}, children: _jsx(Fade, { in: true, onEntered: () => onEntered && onEntered(), children: _jsxs(Box, { className: getClassNames, sx: style, children: [_jsxs("div", { className: "header", children: [_jsxs("div", { className: "titles", children: [_jsx("span", { className: "title", children: title }), subtitle && _jsx("span", { className: "subtitle", children: subtitle })] }), !disableClose && (_jsx(Icon, { name: "close", onClick:
|
|
37
|
+
}, children: _jsx(Fade, { in: true, onEntered: () => onEntered && onEntered(), children: _jsxs(Box, { className: getClassNames, sx: style, children: [_jsxs("div", { className: "header", children: [_jsxs("div", { className: "titles", children: [_jsx("span", { className: "title", children: title }), subtitle && _jsx("span", { className: "subtitle", children: subtitle })] }), !disableClose && (_jsx(Icon, { name: "close", onClick: (e) => {
|
|
38
|
+
stopEventPropagation(e);
|
|
39
|
+
close();
|
|
40
|
+
}, className: "pointer" }))] }), _jsx("div", { className: "body", children: children }), !hideFooter ? (_jsxs("div", { className: "footer", children: [alternativeOptions && alternativeOptions, alternativeButton && (_jsx(Button, { className: "alternative", color: "white", onClick: alternativeButton.action, text: alternativeButton.title })), !disableCancel && (_jsx(Button, { onClick: (e) => {
|
|
41
|
+
stopEventPropagation(e);
|
|
42
|
+
(cancel || close)();
|
|
43
|
+
}, text: closeLabel || t("button.cancel"), color: "danger" })), confirm && (_jsx(Button, { onClick: confirm, disabled: disableConfirm, text: confirmLabel || t("button.confirm") }))] })) : null] }) }) }));
|
|
29
44
|
}
|
|
30
45
|
const style = {
|
|
31
46
|
position: "absolute",
|
|
@@ -99,6 +99,17 @@ export declare const commonResources: {
|
|
|
99
99
|
"sentence.status.review": string;
|
|
100
100
|
"sentence.status.error": string;
|
|
101
101
|
"sentence.status.auto": string;
|
|
102
|
+
'label.tier.original': string;
|
|
103
|
+
'label.tier.junction': string;
|
|
104
|
+
'label.tier.segmentation': string;
|
|
105
|
+
'label.tier.spelling': string;
|
|
106
|
+
'label.tier.expansion': string;
|
|
107
|
+
'label.tier.correction': string;
|
|
108
|
+
'label.tier.punctuation': string;
|
|
109
|
+
'label.tier.illegible': string;
|
|
110
|
+
'label.tier.modernization': string;
|
|
111
|
+
'label.tier.padronization': string;
|
|
112
|
+
'label.tier.inflection': string;
|
|
102
113
|
};
|
|
103
114
|
header: {
|
|
104
115
|
'label.platform': string;
|
|
@@ -365,6 +376,17 @@ export declare const commonResources: {
|
|
|
365
376
|
"sentence.status.review": string;
|
|
366
377
|
"sentence.status.error": string;
|
|
367
378
|
"sentence.status.auto": string;
|
|
379
|
+
'label.tier.original': string;
|
|
380
|
+
'label.tier.junction': string;
|
|
381
|
+
'label.tier.segmentation': string;
|
|
382
|
+
'label.tier.spelling': string;
|
|
383
|
+
'label.tier.expansion': string;
|
|
384
|
+
'label.tier.correction': string;
|
|
385
|
+
'label.tier.punctuation': string;
|
|
386
|
+
'label.tier.illegible': string;
|
|
387
|
+
'label.tier.modernization': string;
|
|
388
|
+
'label.tier.padronization': string;
|
|
389
|
+
'label.tier.inflection': string;
|
|
368
390
|
};
|
|
369
391
|
header: {
|
|
370
392
|
'label.platform': string;
|
|
@@ -630,6 +652,17 @@ export declare const commonResources: {
|
|
|
630
652
|
"sentence.status.review": string;
|
|
631
653
|
"sentence.status.error": string;
|
|
632
654
|
"sentence.status.auto": string;
|
|
655
|
+
'label.tier.original': string;
|
|
656
|
+
'label.tier.junction': string;
|
|
657
|
+
'label.tier.segmentation': string;
|
|
658
|
+
'label.tier.spelling': string;
|
|
659
|
+
'label.tier.expansion': string;
|
|
660
|
+
'label.tier.correction': string;
|
|
661
|
+
'label.tier.punctuation': string;
|
|
662
|
+
'label.tier.illegible': string;
|
|
663
|
+
'label.tier.modernization': string;
|
|
664
|
+
'label.tier.padronization': string;
|
|
665
|
+
'label.tier.inflection': string;
|
|
633
666
|
};
|
|
634
667
|
header: {
|
|
635
668
|
'label.platform': string;
|
|
@@ -53,6 +53,17 @@ export declare const CommonTexts: {
|
|
|
53
53
|
"sentence.status.review": string;
|
|
54
54
|
"sentence.status.error": string;
|
|
55
55
|
"sentence.status.auto": string;
|
|
56
|
+
'label.tier.original': string;
|
|
57
|
+
'label.tier.junction': string;
|
|
58
|
+
'label.tier.segmentation': string;
|
|
59
|
+
'label.tier.spelling': string;
|
|
60
|
+
'label.tier.expansion': string;
|
|
61
|
+
'label.tier.correction': string;
|
|
62
|
+
'label.tier.punctuation': string;
|
|
63
|
+
'label.tier.illegible': string;
|
|
64
|
+
'label.tier.modernization': string;
|
|
65
|
+
'label.tier.padronization': string;
|
|
66
|
+
'label.tier.inflection': string;
|
|
56
67
|
};
|
|
57
68
|
"pt-BR": {
|
|
58
69
|
"button.confirm": string;
|
|
@@ -108,6 +119,17 @@ export declare const CommonTexts: {
|
|
|
108
119
|
"sentence.status.review": string;
|
|
109
120
|
"sentence.status.error": string;
|
|
110
121
|
"sentence.status.auto": string;
|
|
122
|
+
'label.tier.original': string;
|
|
123
|
+
'label.tier.junction': string;
|
|
124
|
+
'label.tier.segmentation': string;
|
|
125
|
+
'label.tier.spelling': string;
|
|
126
|
+
'label.tier.expansion': string;
|
|
127
|
+
'label.tier.correction': string;
|
|
128
|
+
'label.tier.punctuation': string;
|
|
129
|
+
'label.tier.illegible': string;
|
|
130
|
+
'label.tier.modernization': string;
|
|
131
|
+
'label.tier.padronization': string;
|
|
132
|
+
'label.tier.inflection': string;
|
|
111
133
|
};
|
|
112
134
|
it: {
|
|
113
135
|
"button.confirm": string;
|
|
@@ -163,5 +185,16 @@ export declare const CommonTexts: {
|
|
|
163
185
|
"sentence.status.review": string;
|
|
164
186
|
"sentence.status.error": string;
|
|
165
187
|
"sentence.status.auto": string;
|
|
188
|
+
'label.tier.original': string;
|
|
189
|
+
'label.tier.junction': string;
|
|
190
|
+
'label.tier.segmentation': string;
|
|
191
|
+
'label.tier.spelling': string;
|
|
192
|
+
'label.tier.expansion': string;
|
|
193
|
+
'label.tier.correction': string;
|
|
194
|
+
'label.tier.punctuation': string;
|
|
195
|
+
'label.tier.illegible': string;
|
|
196
|
+
'label.tier.modernization': string;
|
|
197
|
+
'label.tier.padronization': string;
|
|
198
|
+
'label.tier.inflection': string;
|
|
166
199
|
};
|
|
167
200
|
};
|
|
@@ -53,6 +53,17 @@ export const CommonTexts = {
|
|
|
53
53
|
"sentence.status.review": "review",
|
|
54
54
|
"sentence.status.error": "error",
|
|
55
55
|
"sentence.status.auto": "automatic",
|
|
56
|
+
'label.tier.original': 'original',
|
|
57
|
+
'label.tier.junction': 'junction',
|
|
58
|
+
'label.tier.segmentation': 'segmentation',
|
|
59
|
+
'label.tier.spelling': 'spelling',
|
|
60
|
+
'label.tier.expansion': 'expansion',
|
|
61
|
+
'label.tier.correction': 'correction',
|
|
62
|
+
'label.tier.punctuation': 'punctuation',
|
|
63
|
+
'label.tier.illegible': 'illegible',
|
|
64
|
+
'label.tier.modernization': 'modernization',
|
|
65
|
+
'label.tier.padronization': 'padronization',
|
|
66
|
+
'label.tier.inflection': 'inflection',
|
|
56
67
|
},
|
|
57
68
|
"pt-BR": {
|
|
58
69
|
"button.confirm": "Confirmar",
|
|
@@ -108,6 +119,17 @@ export const CommonTexts = {
|
|
|
108
119
|
"sentence.status.review": "revisar",
|
|
109
120
|
"sentence.status.error": "erro",
|
|
110
121
|
"sentence.status.auto": "automático",
|
|
122
|
+
'label.tier.original': 'original',
|
|
123
|
+
'label.tier.junction': 'junção',
|
|
124
|
+
'label.tier.segmentation': 'segmentação',
|
|
125
|
+
'label.tier.spelling': 'grafia',
|
|
126
|
+
'label.tier.expansion': 'expansão',
|
|
127
|
+
'label.tier.correction': 'correção',
|
|
128
|
+
'label.tier.punctuation': 'pontuação',
|
|
129
|
+
'label.tier.illegible': 'ilegível',
|
|
130
|
+
'label.tier.modernization': 'modernização',
|
|
131
|
+
'label.tier.padronization': 'padronização',
|
|
132
|
+
'label.tier.inflection': 'flexão',
|
|
111
133
|
},
|
|
112
134
|
it: {
|
|
113
135
|
"button.confirm": "Conferma",
|
|
@@ -163,5 +185,16 @@ export const CommonTexts = {
|
|
|
163
185
|
"sentence.status.review": "revisione",
|
|
164
186
|
"sentence.status.error": "errore",
|
|
165
187
|
"sentence.status.auto": "automatico",
|
|
188
|
+
'label.tier.original': 'originale',
|
|
189
|
+
'label.tier.junction': 'giunzione',
|
|
190
|
+
'label.tier.segmentation': 'segmentazione',
|
|
191
|
+
'label.tier.spelling': 'grafia',
|
|
192
|
+
'label.tier.expansion': 'espansione',
|
|
193
|
+
'label.tier.correction': 'correzione',
|
|
194
|
+
'label.tier.punctuation': 'punteggiatura',
|
|
195
|
+
'label.tier.illegible': 'illeggibile',
|
|
196
|
+
'label.tier.modernization': 'modernizzazione',
|
|
197
|
+
'label.tier.padronization': 'standardizzazione',
|
|
198
|
+
'label.tier.inflection': 'flessione',
|
|
166
199
|
},
|
|
167
200
|
};
|