tycho-components 0.0.15-SNAPSHOT-9 → 0.0.15-SNAPSHOT-10
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/Header/Header.d.ts +2 -1
- package/dist/Header/Header.js +3 -2
- package/dist/Header/HeaderReplaceAll/HeaderReplaceAll.d.ts +2 -0
- package/dist/Header/HeaderReplaceAll/HeaderReplaceAll.js +31 -0
- package/dist/Header/HeaderReplaceAll/index.d.ts +2 -0
- package/dist/Header/HeaderReplaceAll/index.js +2 -0
- package/dist/Header/HeaderReplaceAll/style.scss +24 -0
- package/dist/configs/Localization.d.ts +9 -0
- package/dist/configs/localization/HeaderTexts.d.ts +9 -0
- package/dist/configs/localization/HeaderTexts.js +9 -0
- package/dist/functions/CorpusUtils.d.ts +5 -0
- package/dist/functions/CorpusUtils.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/Header/Header.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ type Props = {
|
|
|
8
8
|
autoload?: boolean;
|
|
9
9
|
freeAccess?: boolean;
|
|
10
10
|
hideKeyboard?: boolean;
|
|
11
|
+
hideReplaceAll?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export default function Header({ tool, navigateHome, navigateCorpora, navigateLogout, redirect, autoload, freeAccess, hideKeyboard, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default function Header({ tool, navigateHome, navigateCorpora, navigateLogout, redirect, autoload, freeAccess, hideKeyboard, hideReplaceAll, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
package/dist/Header/Header.js
CHANGED
|
@@ -8,10 +8,11 @@ import LanguageSelector from '../LanguageSelector';
|
|
|
8
8
|
import VirtualKeyboard from '../VirtualKeyboard';
|
|
9
9
|
import HeaderApps from './HeaderApps';
|
|
10
10
|
import HeaderCorpora from './HeaderCorpora/HeaderCorpora';
|
|
11
|
+
import HeaderReplaceAll from './HeaderReplaceAll';
|
|
11
12
|
import HeaderUser from './HeaderUser';
|
|
12
13
|
import './styles.scss';
|
|
13
14
|
const linkTurorials = 'https://www.tycho.iel.unicamp.br/home/tutorials';
|
|
14
|
-
export default function Header({ tool, navigateHome, navigateCorpora, navigateLogout, redirect, autoload, freeAccess, hideKeyboard, }) {
|
|
15
|
+
export default function Header({ tool, navigateHome, navigateCorpora, navigateLogout, redirect, autoload, freeAccess, hideKeyboard, hideReplaceAll, }) {
|
|
15
16
|
const { t } = useTranslation('header');
|
|
16
17
|
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
17
18
|
const [openKeyboard, setOpenKeyboard] = useState(false);
|
|
@@ -21,5 +22,5 @@ export default function Header({ tool, navigateHome, navigateCorpora, navigateLo
|
|
|
21
22
|
const homeTextsClass = cx('texts', {
|
|
22
23
|
pointer: navigateHome !== undefined,
|
|
23
24
|
});
|
|
24
|
-
return (_jsxs("div", { className: "ds-header", children: [_jsx(HeaderApps, { freeAccess: freeAccess }), _jsxs("div", { className: homeTextsClass, onClick: () => navigateHome && navigateHome(), children: [_jsx("span", { className: "title", children: t('label.platform') }), _jsx("span", { className: "subtitle", children: tool })] }), _jsx(HeaderCorpora, { redirect: redirect, autoload: autoload, freeAccess: freeAccess, navigateCorpora: navigateCorpora }), _jsxs("div", { className: profileClass, children: [!hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "medium", title: t('tooltip.keyboard') })), _jsx(IconButton, { name: "live_help", size: "medium", title: t('tooltip.tutorials'), onClick: () => window.open(linkTurorials, '_blank') }), _jsx(LanguageSelector, {}), !freeAccess && _jsx(HeaderUser, { navigateLogout: navigateLogout })] }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('button.close'), defaultLayout: getCorpus().keyboardLayout || 'english' }))] }));
|
|
25
|
+
return (_jsxs("div", { className: "ds-header", children: [_jsx(HeaderApps, { freeAccess: freeAccess }), _jsxs("div", { className: homeTextsClass, onClick: () => navigateHome && navigateHome(), children: [_jsx("span", { className: "title", children: t('label.platform') }), _jsx("span", { className: "subtitle", children: tool })] }), _jsx(HeaderCorpora, { redirect: redirect, autoload: autoload, freeAccess: freeAccess, navigateCorpora: navigateCorpora }), _jsxs("div", { className: profileClass, children: [!hideReplaceAll && _jsx(HeaderReplaceAll, {}), !hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "medium", title: t('tooltip.keyboard') })), _jsx(IconButton, { name: "live_help", size: "medium", title: t('tooltip.tutorials'), onClick: () => window.open(linkTurorials, '_blank') }), _jsx(LanguageSelector, {}), !freeAccess && _jsx(HeaderUser, { navigateLogout: navigateLogout })] }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('button.close'), defaultLayout: getCorpus().keyboardLayout || 'english' }))] }));
|
|
25
26
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { faArrowsRotate } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Button, OverlayTrigger, Popover } from 'react-bootstrap';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { getCurrentInput, getCurrentOnChange } from 'tycho-storybook';
|
|
8
|
+
import './style.scss';
|
|
9
|
+
export default function HeaderReplaceAll() {
|
|
10
|
+
const { t } = useTranslation('header');
|
|
11
|
+
const [findValue, setFindValue] = useState('');
|
|
12
|
+
const [replaceValue, setReplaceValue] = useState('');
|
|
13
|
+
const replaceAll = (str, find, replace) => {
|
|
14
|
+
// Escape special regex characters in 'find'
|
|
15
|
+
var escapedFind = find.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
16
|
+
var regex = new RegExp(escapedFind, 'g');
|
|
17
|
+
return str.replace(regex, replace);
|
|
18
|
+
};
|
|
19
|
+
const handleReplaceAll = () => {
|
|
20
|
+
const input = getCurrentInput();
|
|
21
|
+
const onChange = getCurrentOnChange();
|
|
22
|
+
if (input && onChange) {
|
|
23
|
+
const value = input.value;
|
|
24
|
+
input.value = replaceAll(value, findValue, replaceValue);
|
|
25
|
+
input.focus();
|
|
26
|
+
onChange({ target: input });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const popoverReplace = (_jsx(Popover, { className: "popover-replace", children: _jsxs(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: "sm", onClick: handleReplaceAll, children: "confirm" })] }) }));
|
|
30
|
+
return (_jsx(OverlayTrigger, { placement: "bottom", trigger: "click", overlay: popoverReplace, rootClose: true, children: _jsx(Button, { className: "btn-replace-all", title: t('replace.all.tooltip'), children: _jsx(FontAwesomeIcon, { icon: faArrowsRotate }) }) }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.popover-replace {
|
|
2
|
+
max-width: 10vw;
|
|
3
|
+
|
|
4
|
+
> .popover-body {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 4px;
|
|
8
|
+
max-width: 10vw;
|
|
9
|
+
padding: 8px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.btn-replace-all {
|
|
14
|
+
width: 40px;
|
|
15
|
+
height: 40px;
|
|
16
|
+
background: var(--button-primary-default);
|
|
17
|
+
border-radius: 0;
|
|
18
|
+
border: 0;
|
|
19
|
+
margin-right: 4px;
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
background: var(--button-primary-hover);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -84,6 +84,9 @@ export declare const commonResources: {
|
|
|
84
84
|
'button.close': string;
|
|
85
85
|
'tooltip.keyboard': string;
|
|
86
86
|
'tooltip.tutorials': string;
|
|
87
|
+
'replace.all.tooltip': string;
|
|
88
|
+
'replace.find.placeholder': string;
|
|
89
|
+
'replace.placeholder': string;
|
|
87
90
|
'tag.public': string;
|
|
88
91
|
'tag.private': string;
|
|
89
92
|
'profile.label.hello': string;
|
|
@@ -201,6 +204,9 @@ export declare const commonResources: {
|
|
|
201
204
|
'button.close': string;
|
|
202
205
|
'tooltip.keyboard': string;
|
|
203
206
|
'tooltip.tutorials': string;
|
|
207
|
+
'replace.all.tooltip': string;
|
|
208
|
+
'replace.find.placeholder': string;
|
|
209
|
+
'replace.placeholder': string;
|
|
204
210
|
'tag.public': string;
|
|
205
211
|
'tag.private': string;
|
|
206
212
|
'profile.label.hello': string;
|
|
@@ -248,6 +254,9 @@ export declare const commonResources: {
|
|
|
248
254
|
'button.close': string;
|
|
249
255
|
'tooltip.keyboard': string;
|
|
250
256
|
'tooltip.tutorials': string;
|
|
257
|
+
'replace.all.tooltip': string;
|
|
258
|
+
'replace.find.placeholder': string;
|
|
259
|
+
'replace.placeholder': string;
|
|
251
260
|
'tag.public': string;
|
|
252
261
|
'tag.private': string;
|
|
253
262
|
'profile.label.hello': string;
|
|
@@ -10,6 +10,9 @@ export declare const HeaderTexts: {
|
|
|
10
10
|
'button.close': string;
|
|
11
11
|
'tooltip.keyboard': string;
|
|
12
12
|
'tooltip.tutorials': string;
|
|
13
|
+
'replace.all.tooltip': string;
|
|
14
|
+
'replace.find.placeholder': string;
|
|
15
|
+
'replace.placeholder': string;
|
|
13
16
|
'tag.public': string;
|
|
14
17
|
'tag.private': string;
|
|
15
18
|
'profile.label.hello': string;
|
|
@@ -54,6 +57,9 @@ export declare const HeaderTexts: {
|
|
|
54
57
|
'button.close': string;
|
|
55
58
|
'tooltip.keyboard': string;
|
|
56
59
|
'tooltip.tutorials': string;
|
|
60
|
+
'replace.all.tooltip': string;
|
|
61
|
+
'replace.find.placeholder': string;
|
|
62
|
+
'replace.placeholder': string;
|
|
57
63
|
'tag.public': string;
|
|
58
64
|
'tag.private': string;
|
|
59
65
|
'profile.label.hello': string;
|
|
@@ -99,6 +105,9 @@ export declare const HeaderTexts: {
|
|
|
99
105
|
'button.close': string;
|
|
100
106
|
'tooltip.keyboard': string;
|
|
101
107
|
'tooltip.tutorials': string;
|
|
108
|
+
'replace.all.tooltip': string;
|
|
109
|
+
'replace.find.placeholder': string;
|
|
110
|
+
'replace.placeholder': string;
|
|
102
111
|
'tag.public': string;
|
|
103
112
|
'tag.private': string;
|
|
104
113
|
'profile.label.hello': string;
|
|
@@ -10,6 +10,9 @@ export const HeaderTexts = {
|
|
|
10
10
|
'button.close': 'Close',
|
|
11
11
|
'tooltip.keyboard': 'Open Virtual Keyboard',
|
|
12
12
|
'tooltip.tutorials': 'Views Tutorials',
|
|
13
|
+
'replace.all.tooltip': 'Replace All',
|
|
14
|
+
'replace.find.placeholder': 'Find',
|
|
15
|
+
'replace.placeholder': 'Replace',
|
|
13
16
|
'tag.public': 'Public',
|
|
14
17
|
'tag.private': 'Private',
|
|
15
18
|
'profile.label.hello': 'Hello,',
|
|
@@ -54,6 +57,9 @@ export const HeaderTexts = {
|
|
|
54
57
|
'button.close': 'Fechar',
|
|
55
58
|
'tooltip.keyboard': 'Abrir Teclado Virtual',
|
|
56
59
|
'tooltip.tutorials': 'Ver tutoriais',
|
|
60
|
+
'replace.all.tooltip': 'Substituir Todos',
|
|
61
|
+
'replace.find.placeholder': 'Procurar',
|
|
62
|
+
'replace.placeholder': 'Substituir',
|
|
57
63
|
'tag.public': 'Público',
|
|
58
64
|
'tag.private': 'Privado',
|
|
59
65
|
'profile.label.hello': 'Olá,',
|
|
@@ -99,6 +105,9 @@ export const HeaderTexts = {
|
|
|
99
105
|
'button.close': 'Chiudi',
|
|
100
106
|
'tooltip.keyboard': 'Apri tastiera virtuale',
|
|
101
107
|
'tooltip.tutorials': 'Visualizza i tutorial',
|
|
108
|
+
'replace.all.tooltip': 'Sostituisci tutto',
|
|
109
|
+
'replace.find.placeholder': 'Trova',
|
|
110
|
+
'replace.placeholder': 'Sostituisci',
|
|
102
111
|
'tag.public': 'Pubblico',
|
|
103
112
|
'tag.private': 'Privato',
|
|
104
113
|
'profile.label.hello': 'Ciao,',
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { commonResources } from './configs/Localization';
|
|
|
24
24
|
export { KeyboardCustomLayouts } from './VirtualKeyboard/KeyboardCustomLayout';
|
|
25
25
|
export { CorpusImageTypeNames } from './configs/CorpusImage';
|
|
26
26
|
export { UserStatusNames } from './configs/User';
|
|
27
|
+
export { default as CorpusUtils } from './functions/CorpusUtils';
|
|
27
28
|
export { default as DateUtils } from './functions/DateUtils';
|
|
28
29
|
export { default as FormUtils } from './functions/FormUtils';
|
|
29
30
|
export { default as ImageUtils } from './functions/ImageUtils';
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export { commonResources } from './configs/Localization';
|
|
|
24
24
|
export { KeyboardCustomLayouts } from './VirtualKeyboard/KeyboardCustomLayout';
|
|
25
25
|
export { CorpusImageTypeNames } from './configs/CorpusImage';
|
|
26
26
|
export { UserStatusNames } from './configs/User';
|
|
27
|
+
export { default as CorpusUtils } from './functions/CorpusUtils';
|
|
27
28
|
export { default as DateUtils } from './functions/DateUtils';
|
|
28
29
|
export { default as FormUtils } from './functions/FormUtils';
|
|
29
30
|
export { default as ImageUtils } from './functions/ImageUtils';
|