tycho-components 0.0.15-SNAPSHOT-8 → 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/AppAnalytics/AppAnalytics.d.ts +1 -0
- package/dist/AppAnalytics/AppAnalytics.js +25 -0
- package/dist/AppAnalytics/index.d.ts +2 -0
- package/dist/AppAnalytics/index.js +2 -0
- package/dist/Header/Header.d.ts +2 -1
- package/dist/Header/Header.js +3 -2
- package/dist/Header/HeaderCorpora/HeaderCorpora.js +1 -1
- package/dist/Header/HeaderCorpora/style.scss +9 -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 +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AppAnalytics(): null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export default function AppAnalytics() {
|
|
3
|
+
const GA_ID = import.meta.env.VITE_APP_GA_ID;
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (!GA_ID) {
|
|
6
|
+
console.warn('Google Analytics ID not set.');
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
// Inject the gtag.js script
|
|
10
|
+
const script = document.createElement('script');
|
|
11
|
+
script.src = `https://www.googletagmanager.com/gtag/js?id=${GA_ID}`;
|
|
12
|
+
script.async = true;
|
|
13
|
+
document.head.appendChild(script);
|
|
14
|
+
// Inject the inline gtag config script exactly like GA docs do
|
|
15
|
+
const inlineScript = document.createElement('script');
|
|
16
|
+
inlineScript.innerHTML = `
|
|
17
|
+
window.dataLayer = window.dataLayer || [];
|
|
18
|
+
function gtag(){dataLayer.push(arguments);}
|
|
19
|
+
gtag('js', new Date());
|
|
20
|
+
gtag('config', '${GA_ID}');
|
|
21
|
+
`;
|
|
22
|
+
document.head.appendChild(inlineScript);
|
|
23
|
+
}, []);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
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
|
}
|
|
@@ -56,5 +56,5 @@ export default function HeaderCorpora({ navigateCorpora, redirect, autoload, fre
|
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
autoload && loadAndApply();
|
|
58
58
|
}, [autoload]);
|
|
59
|
-
return (_jsxs("div", { className: "header-corpora-container", children: [hasCorpus() && (_jsxs("div", { className: "corpus-container", onClick: handleCorpusClick, children: [_jsx(AppPicture, { src: getCorpus().picture, title: getCorpus().name, className: "
|
|
59
|
+
return (_jsxs("div", { className: "header-corpora-container", children: [hasCorpus() && (_jsxs("div", { className: "header-corpus-container", onClick: handleCorpusClick, children: [_jsx(AppPicture, { src: getCorpus().picture, title: getCorpus().name, className: "header-corpus-image" }), _jsx("span", { children: getCorpus().name })] })), openCorpora && (_jsx(AppModal, { className: "modal-corpora", title: t('label.choose'), close: () => setOpenCorpora(false), children: corpora.map((corpus) => (_jsxs("div", { className: "item", onClick: () => handleChooseCorpus(corpus), children: [_jsx(AppPicture, { src: corpus.picture, title: corpus.name, className: "modal-corpus-image" }), _jsx("span", { children: corpus.name })] }, corpus.uid))) }))] }));
|
|
60
60
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
margin-left: auto;
|
|
4
4
|
margin-right: auto;
|
|
5
5
|
|
|
6
|
-
.corpus-container {
|
|
6
|
+
.header-corpus-container {
|
|
7
7
|
display: flex;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
align-items: center;
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
@include label-large-1;
|
|
16
16
|
color: var(--text-light-fixed);
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
.header-corpus-image {
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
width: 32px;
|
|
22
|
+
height: 32px;
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
|
|
@@ -39,7 +45,8 @@
|
|
|
39
45
|
background-color: var(--layer-hover-1);
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
.modal-corpus-image {
|
|
49
|
+
border-radius: 50%;
|
|
43
50
|
width: 48px;
|
|
44
51
|
height: 48px;
|
|
45
52
|
}
|
|
@@ -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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as AppAnalytics } from './AppAnalytics';
|
|
1
2
|
export { default as AppColorpicker } from './AppColorpicker';
|
|
2
3
|
export { default as AppEditable } from './AppEditable';
|
|
3
4
|
export { default as AppLoading } from './AppLoading';
|
|
@@ -23,6 +24,7 @@ export { commonResources } from './configs/Localization';
|
|
|
23
24
|
export { KeyboardCustomLayouts } from './VirtualKeyboard/KeyboardCustomLayout';
|
|
24
25
|
export { CorpusImageTypeNames } from './configs/CorpusImage';
|
|
25
26
|
export { UserStatusNames } from './configs/User';
|
|
27
|
+
export { default as CorpusUtils } from './functions/CorpusUtils';
|
|
26
28
|
export { default as DateUtils } from './functions/DateUtils';
|
|
27
29
|
export { default as FormUtils } from './functions/FormUtils';
|
|
28
30
|
export { default as ImageUtils } from './functions/ImageUtils';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as AppAnalytics } from './AppAnalytics';
|
|
1
2
|
export { default as AppColorpicker } from './AppColorpicker';
|
|
2
3
|
export { default as AppEditable } from './AppEditable';
|
|
3
4
|
export { default as AppLoading } from './AppLoading';
|
|
@@ -23,6 +24,7 @@ export { commonResources } from './configs/Localization';
|
|
|
23
24
|
export { KeyboardCustomLayouts } from './VirtualKeyboard/KeyboardCustomLayout';
|
|
24
25
|
export { CorpusImageTypeNames } from './configs/CorpusImage';
|
|
25
26
|
export { UserStatusNames } from './configs/User';
|
|
27
|
+
export { default as CorpusUtils } from './functions/CorpusUtils';
|
|
26
28
|
export { default as DateUtils } from './functions/DateUtils';
|
|
27
29
|
export { default as FormUtils } from './functions/FormUtils';
|
|
28
30
|
export { default as ImageUtils } from './functions/ImageUtils';
|