corpushub-design-system 0.1.0 → 0.1.1
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/common/AppDropzone/AppDropzoneBody.js +2 -1
- package/dist/common/AppDropzone/UploadedFile.d.ts +2 -0
- package/dist/common/AppDropzone/index.d.ts +2 -0
- package/dist/common/AppDropzone/index.js +1 -0
- package/dist/common/AppDropzone/toMediaDisplayUrl.d.ts +10 -0
- package/dist/common/AppDropzone/toMediaDisplayUrl.js +27 -0
- package/dist/common/AppPicture/AppPicture.js +1 -1
- package/dist/common/AppTable/styles.scss +6 -2
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -1
- package/dist/configs/Localization.js +4 -0
- package/dist/configs/api/applyAuthErrorHandling.js +5 -0
- package/dist/configs/api/index.js +2 -0
- package/dist/configs/auth/authApi.js +6 -0
- package/dist/configs/auth/installAuthRefreshInterceptor.js +5 -0
- package/dist/configs/auth/isPublicAuthRequest.d.ts +6 -0
- package/dist/configs/auth/isPublicAuthRequest.js +28 -0
- package/dist/configs/auth/session.js +8 -6
- package/dist/configs/brand.d.ts +6 -0
- package/dist/configs/brand.js +10 -3
- package/dist/configs/index.d.ts +3 -2
- package/dist/configs/index.js +2 -1
- package/dist/configs/localization/BackupTexts.d.ts +74 -0
- package/dist/configs/localization/BackupTexts.js +74 -0
- package/dist/configs/localization/CommentsTexts.d.ts +145 -145
- package/dist/configs/localization/CommentsTexts.js +145 -145
- package/dist/configs/localization/CommonTexts.d.ts +15 -0
- package/dist/configs/localization/CommonTexts.js +18 -3
- package/dist/configs/localization/HeaderTexts.js +3 -3
- package/dist/configs/localization/HelpTexts.d.ts +44 -2
- package/dist/configs/localization/HelpTexts.js +53 -11
- package/dist/configs/localization/HistoryTexts.d.ts +6 -0
- package/dist/configs/localization/HistoryTexts.js +6 -0
- package/dist/configs/localization/ParserRuleGroupsTexts.d.ts +53 -0
- package/dist/configs/localization/ParserRuleGroupsTexts.js +53 -0
- package/dist/configs/services/ProfileService.js +3 -3
- package/dist/configs/tour/index.d.ts +1 -1
- package/dist/configs/types/CorpusImage.d.ts +3 -0
- package/dist/features/AccessControl/AccessControlService.d.ts +9 -0
- package/dist/features/AccessControl/AccessControlService.js +22 -8
- package/dist/features/AccessControl/AccessGrant/AccessGrant.js +3 -1
- package/dist/features/AccessControl/AccessUser/AccessData.d.ts +2 -2
- package/dist/features/AccessControl/AccessUser/AccessData.js +21 -21
- package/dist/features/AccessControl/AccessUser/AccessUser.js +20 -3
- package/dist/features/AccessControl/AccessUser/AccessUserGroups.d.ts +8 -0
- package/dist/features/AccessControl/AccessUser/AccessUserGroups.js +77 -0
- package/dist/features/AccessControl/AccessUser/style.scss +41 -3
- package/dist/features/AccessControl/AccessUsers/AccessUsers.js +44 -29
- package/dist/features/AccessControl/AccessUsers/styles.scss +5 -0
- package/dist/features/AccessControl/index.d.ts +1 -0
- package/dist/features/AccessControl/types/CorpusGroup.d.ts +10 -0
- package/dist/features/AccessControl/types/CorpusGroup.js +1 -0
- package/dist/features/AccessControl/types/UserAccessResponse.d.ts +4 -0
- package/dist/features/Backup/BackupCreate/BackupCreate.d.ts +11 -0
- package/dist/features/Backup/BackupCreate/BackupCreate.js +89 -0
- package/dist/features/Backup/BackupCreate/index.d.ts +2 -0
- package/dist/features/Backup/BackupCreate/index.js +2 -0
- package/dist/features/Backup/BackupCreate/style.scss +5 -0
- package/dist/features/Backup/BackupInfo/BackupInfo.d.ts +8 -0
- package/dist/features/Backup/BackupInfo/BackupInfo.js +36 -0
- package/dist/features/Backup/BackupInfo/index.d.ts +2 -0
- package/dist/features/Backup/BackupInfo/index.js +2 -0
- package/dist/features/Backup/BackupInfo/style.scss +23 -0
- package/dist/features/Backup/BackupRestore/BackupRestore.d.ts +7 -0
- package/dist/features/Backup/BackupRestore/BackupRestore.js +52 -0
- package/dist/features/Backup/BackupRestore/index.d.ts +3 -0
- package/dist/features/Backup/BackupRestore/index.js +2 -0
- package/dist/features/Backup/BackupRestore/style.scss +17 -0
- package/dist/features/Backup/BackupService.d.ts +20 -0
- package/dist/features/Backup/BackupService.js +43 -0
- package/dist/features/Backup/BackupTable/BackupSearchFilter.d.ts +5 -0
- package/dist/features/Backup/BackupTable/BackupSearchFilter.js +4 -0
- package/dist/features/Backup/BackupTable/BackupTable.d.ts +8 -0
- package/dist/features/Backup/BackupTable/BackupTable.js +121 -0
- package/dist/features/Backup/BackupTable/index.d.ts +4 -0
- package/dist/features/Backup/BackupTable/index.js +3 -0
- package/dist/features/Backup/BackupTable/style.scss +19 -0
- package/dist/features/Backup/index.d.ts +7 -0
- package/dist/features/Backup/index.js +4 -0
- package/dist/features/Backup/types/Backup.d.ts +14 -0
- package/dist/features/Backup/types/Backup.js +1 -0
- package/dist/features/Comments/CommentService.js +2 -1
- package/dist/features/PageRender/PageRenderView.d.ts +1 -1
- package/dist/features/PageRender/PageRenderView.js +67 -9
- package/dist/features/PageRender/style.scss +27 -5
- package/dist/features/PageRender/types.d.ts +5 -1
- package/dist/features/ParserRuleGroups/ParserRuleGroupItem.d.ts +9 -0
- package/dist/features/ParserRuleGroups/ParserRuleGroupItem.js +18 -0
- package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.d.ts +17 -0
- package/dist/features/ParserRuleGroups/ParserRuleGroupsEditor.js +129 -0
- package/dist/features/ParserRuleGroups/index.d.ts +2 -0
- package/dist/features/ParserRuleGroups/index.js +2 -0
- package/dist/features/ParserRuleGroups/style.scss +81 -0
- package/dist/features/ServerErrorReport/ServerErrorReport.js +9 -48
- package/dist/features/ServerErrorReport/ServerErrorReportForm.d.ts +22 -0
- package/dist/features/ServerErrorReport/ServerErrorReportForm.js +85 -0
- package/dist/features/ServerErrorReport/captureTabScreenshot.d.ts +1 -1
- package/dist/features/ServerErrorReport/captureTabScreenshot.js +5 -20
- package/dist/features/ServerErrorReport/index.d.ts +2 -0
- package/dist/features/ServerErrorReport/index.js +1 -0
- package/dist/features/ServerErrorReport/styles.scss +22 -9
- package/dist/features/index.d.ts +5 -1
- package/dist/features/index.js +2 -0
- package/dist/primitives/AsyncSelectField/AsyncSelectField.js +2 -2
- package/dist/primitives/AsyncSelectField/styles.scss +31 -31
- package/dist/primitives/Button/Button.d.ts +5 -4
- package/dist/primitives/Button/Button.js +19 -19
- package/dist/primitives/DropdownButton/DropdownButton.d.ts +2 -1
- package/dist/primitives/DropdownButton/DropdownButton.js +2 -2
- package/dist/primitives/DropdownMenu/DropdownMenu.js +7 -1
- package/dist/primitives/Icon/Icon.d.ts +2 -1
- package/dist/primitives/Icon/Icon.js +2 -2
- package/dist/primitives/IconButton/IconButton.d.ts +2 -1
- package/dist/primitives/IconButton/IconButton.js +2 -2
- package/dist/primitives/Tag/Tag.d.ts +2 -1
- package/dist/primitives/Tag/Tag.js +3 -3
- package/dist/primitives/index.js +1 -1
- package/dist/shell/Header/HelpButton/HelpModal.js +3 -69
- package/dist/shell/Header/HelpButton/HelpModalMainColumn.d.ts +5 -0
- package/dist/shell/Header/HelpButton/HelpModalMainColumn.js +76 -0
- package/dist/shell/Header/HelpButton/HelpModalSideColumn.d.ts +7 -0
- package/dist/shell/Header/HelpButton/HelpModalSideColumn.js +18 -0
- package/dist/shell/Header/HelpButton/live-tour.png +0 -0
- package/dist/shell/Header/HelpButton/style.scss +330 -47
- package/dist/styles/base/_typographs.scss +376 -1
- package/dist/styles/main.scss +112 -1
- package/package.json +1 -1
- package/dist/primitives/styles/base/_typographs.scss +0 -376
- package/dist/primitives/styles/font-googleapis.scss +0 -222
- package/dist/primitives/styles/main.scss +0 -112
- /package/dist/{primitives/fonts → fonts}/material-symbols-outlined.woff2 +0 -0
- /package/dist/{primitives/fonts → fonts}/work-sans-latin-ext.woff2 +0 -0
- /package/dist/{primitives/fonts → fonts}/work-sans-latin.woff2 +0 -0
- /package/dist/{primitives/fonts → fonts}/work-sans-vietnamese.woff2 +0 -0
- /package/dist/{primitives/fonts.d.ts → fonts.d.ts} +0 -0
- /package/dist/{primitives/fonts.js → fonts.js} +0 -0
- /package/dist/{primitives/styles → styles}/base/_borders.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_colors.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_displays.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_margins.css +0 -0
- /package/dist/{primitives/styles → styles}/base/_spacing.scss +0 -0
- /package/dist/{primitives/styles → styles}/base/_tokens.scss +0 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import cx from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
export const ButtonModes = [
|
|
7
|
-
export const ButtonSizes = [
|
|
8
|
-
export const ButtonColors = [
|
|
9
|
-
export const ButtonIconPositions = [
|
|
10
|
-
export default function Button({ text, className =
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
import { iconSizeToPx } from '../Icon/IconSizes';
|
|
5
|
+
import './styles.scss';
|
|
6
|
+
export const ButtonModes = ['filled', 'tonal', 'outlined', 'ghost'];
|
|
7
|
+
export const ButtonSizes = ['large', 'medium', 'small', 'x-small'];
|
|
8
|
+
export const ButtonColors = ['accent', 'danger', 'white'];
|
|
9
|
+
export const ButtonIconPositions = ['left', 'right'];
|
|
10
|
+
export default function Button({ text, className = '', disabled = false, active = false, color = 'accent', size = 'large', mode = 'filled', icon, iconImage, iconPosition = 'right', iconSize, iconFilled = false, spin = false, onClick = () => { }, dataTour, ...buttonProps }) {
|
|
11
11
|
const hasIconSlot = Boolean(spin || iconImage || icon);
|
|
12
|
-
const getClassNames = cx(
|
|
12
|
+
const getClassNames = cx('ds-button', className, size, mode, color, {
|
|
13
13
|
active: !disabled && active,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
'icon-left': hasIconSlot && iconPosition === 'left',
|
|
15
|
+
'icon-right': hasIconSlot && iconPosition === 'right',
|
|
16
16
|
});
|
|
17
17
|
const getIconSize = () => {
|
|
18
18
|
if (iconSize)
|
|
19
19
|
return iconSize;
|
|
20
|
-
if (size ===
|
|
21
|
-
return
|
|
22
|
-
if (size ===
|
|
23
|
-
return
|
|
24
|
-
return
|
|
20
|
+
if (size === 'large')
|
|
21
|
+
return 'small';
|
|
22
|
+
if (size === 'medium' || size === 'small')
|
|
23
|
+
return 'x-small';
|
|
24
|
+
return 'x-small';
|
|
25
25
|
};
|
|
26
26
|
const resolvedIconSize = getIconSize();
|
|
27
27
|
const iconBoxPx = iconSizeToPx(resolvedIconSize);
|
|
@@ -33,10 +33,10 @@ export default function Button({ text, className = "", disabled = false, active
|
|
|
33
33
|
return (_jsx("img", { src: iconImage, alt: "", className: "ds-button-icon-image", width: iconBoxPx, height: iconBoxPx }));
|
|
34
34
|
}
|
|
35
35
|
if (icon) {
|
|
36
|
-
return
|
|
36
|
+
return _jsx(Icon, { name: icon, size: resolvedIconSize, filled: iconFilled });
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
39
|
};
|
|
40
40
|
const iconVisual = renderIconVisual();
|
|
41
|
-
return (_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: onClick, ...buttonProps, children: [hasIconSlot && iconPosition ===
|
|
41
|
+
return (_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: onClick, "data-tour": dataTour, ...buttonProps, children: [hasIconSlot && iconPosition === 'left' && iconVisual, _jsx("span", { className: "ds-button-text", children: text }), hasIconSlot && iconPosition === 'right' && iconVisual] }));
|
|
42
42
|
}
|
|
@@ -14,5 +14,6 @@ export type Props = JSX.IntrinsicElements['button'] & {
|
|
|
14
14
|
hideDivider?: boolean;
|
|
15
15
|
right?: boolean;
|
|
16
16
|
icon?: string;
|
|
17
|
+
dataTour?: string;
|
|
17
18
|
};
|
|
18
|
-
export default function DropdownButton({ text, list, className, disabled, active, color, size, onSelect, hideDivider, right, icon, }: Props): import("react").JSX.Element;
|
|
19
|
+
export default function DropdownButton({ text, list, className, disabled, active, color, size, onSelect, hideDivider, right, icon, dataTour, }: Props): import("react").JSX.Element;
|
|
@@ -15,7 +15,7 @@ export const DropdownButtonColors = [
|
|
|
15
15
|
'secondary',
|
|
16
16
|
'tertiary',
|
|
17
17
|
];
|
|
18
|
-
export default function DropdownButton({ text, list, className = '', disabled = false, active = false, color = 'primary', size = 'large', onSelect, hideDivider, right, icon, }) {
|
|
18
|
+
export default function DropdownButton({ text, list, className = '', disabled = false, active = false, color = 'primary', size = 'large', onSelect, hideDivider, right, icon, dataTour, }) {
|
|
19
19
|
const [show, setShow] = useState(false);
|
|
20
20
|
const containerRef = useRef(null);
|
|
21
21
|
useEffect(() => {
|
|
@@ -35,7 +35,7 @@ export default function DropdownButton({ text, list, className = '', disabled =
|
|
|
35
35
|
const getClassNames = cx('ds-dropdown-button', className, size, color, {
|
|
36
36
|
active: !disabled && active,
|
|
37
37
|
});
|
|
38
|
-
return (_jsxs("div", { className: "ds-dropdown-container", ref: containerRef, children: [_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: () => setShow(!show), children: [_jsxs("div", { className: "left-side", children: [icon && _jsx(Icon, { name: icon, className: "icon-custom" }), _jsx("span", { className: "text", children: text })] }), !hideDivider && _jsx("div", { className: "divider", children: "\u00A0" }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), show && (_jsx(DropdownList, { right: right, list: list, onSelect: (s) => {
|
|
38
|
+
return (_jsxs("div", { className: "ds-dropdown-container", ref: containerRef, children: [_jsxs("button", { type: "button", disabled: disabled, className: getClassNames, onClick: () => setShow(!show), "data-tour": dataTour, children: [_jsxs("div", { className: "left-side", children: [icon && _jsx(Icon, { name: icon, className: "icon-custom" }), _jsx("span", { className: "text", children: text })] }), !hideDivider && _jsx("div", { className: "divider", children: "\u00A0" }), _jsx(Icon, { name: "arrow_drop_down", className: "icon-arrow" })] }), show && (_jsx(DropdownList, { right: right, list: list, onSelect: (s) => {
|
|
39
39
|
onSelect && onSelect(s);
|
|
40
40
|
setTimeout(function () {
|
|
41
41
|
setShow(false);
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import UsabilityUtils from '../../functions/UsabilityUtils';
|
|
4
5
|
import Icon from '../Icon';
|
|
5
6
|
import IconButton from '../IconButton';
|
|
6
7
|
import './styles.scss';
|
|
7
8
|
export const DropdownMenuSizes = ['medium', 'small'];
|
|
8
9
|
export default function DropdownMenu({ list, className, size = 'medium', }) {
|
|
9
10
|
const [open, setOpen] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!open)
|
|
13
|
+
return;
|
|
14
|
+
return UsabilityUtils.attachCloseToEscape(() => setOpen(false));
|
|
15
|
+
}, [open]);
|
|
10
16
|
const getClassNames = cx('ds-dropdown-menu', className, size);
|
|
11
17
|
const getOptionClassNames = (optionClassName, disabled) => cx('option', optionClassName, { disabled });
|
|
12
18
|
const iconSize = size === 'small' ? 'x-small' : 'small';
|
|
@@ -10,6 +10,7 @@ export type Props = JSX.IntrinsicElements['span'] & {
|
|
|
10
10
|
weight?: IconWeights;
|
|
11
11
|
filled?: boolean;
|
|
12
12
|
disabled?: boolean;
|
|
13
|
+
dataTour?: string;
|
|
13
14
|
};
|
|
14
|
-
export default function Icon({ name, className, size, weight, filled, disabled, title, onClick, onMouseDown, onMouseUp, }: Props): import("react").JSX.Element;
|
|
15
|
+
export default function Icon({ name, className, size, weight, filled, disabled, title, onClick, onMouseDown, onMouseUp, dataTour, }: Props): import("react").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -9,12 +9,12 @@ export const IconSizes = [
|
|
|
9
9
|
'small',
|
|
10
10
|
'x-small',
|
|
11
11
|
];
|
|
12
|
-
export default function Icon({ name, className = '', size, weight = 'regular', filled = false, disabled = false, title, onClick, onMouseDown, onMouseUp, }) {
|
|
12
|
+
export default function Icon({ name, className = '', size, weight = 'regular', filled = false, disabled = false, title, onClick, onMouseDown, onMouseUp, dataTour, }) {
|
|
13
13
|
const getClassNames = cx('ds-icon material-symbols-outlined', className, size, weight, {
|
|
14
14
|
disabled: disabled,
|
|
15
15
|
});
|
|
16
16
|
const style = {
|
|
17
17
|
fontVariationSettings: `'FILL' ${filled ? 1 : 0}, 'wght' 400, 'GRAD' 0, 'opsz' 24`,
|
|
18
18
|
};
|
|
19
|
-
return (_jsx("span", { className: getClassNames, style: style, onClick: (e) => onClick && !disabled && onClick(e), onMouseDown: (e) => onMouseDown && onMouseDown(e), onMouseUp: (e) => onMouseUp && onMouseUp(e), title: title, translate: "no", children: name }));
|
|
19
|
+
return (_jsx("span", { className: getClassNames, style: style, onClick: (e) => onClick && !disabled && onClick(e), onMouseDown: (e) => onMouseDown && onMouseDown(e), onMouseUp: (e) => onMouseUp && onMouseUp(e), title: title, translate: "no", "data-tour": dataTour, children: name }));
|
|
20
20
|
}
|
|
@@ -19,6 +19,7 @@ export type Props = JSX.IntrinsicElements['button'] & {
|
|
|
19
19
|
tooltipPlacement?: TooltipPlacements;
|
|
20
20
|
iconSize?: IconSizes;
|
|
21
21
|
iconClassName?: string;
|
|
22
|
+
dataTour?: string;
|
|
22
23
|
};
|
|
23
|
-
export default function IconButton({ name, iconImage, className, disabled, active, color, size, mode, filledIcon, title, spin, iconSize, iconClassName, tooltipPlacement, onClick, type, ...buttonProps }: Props): import("react").JSX.Element;
|
|
24
|
+
export default function IconButton({ name, iconImage, className, disabled, active, color, size, mode, filledIcon, title, spin, iconSize, iconClassName, tooltipPlacement, onClick, type, dataTour, ...buttonProps }: Props): import("react").JSX.Element;
|
|
24
25
|
export {};
|
|
@@ -6,7 +6,7 @@ import { iconSizeToPx } from '../Icon/IconSizes';
|
|
|
6
6
|
import './styles.scss';
|
|
7
7
|
export const IconButtonSizes = ['large', 'medium', 'small', 'x-small'];
|
|
8
8
|
export const IconButtonColors = ['accent', 'danger', 'white'];
|
|
9
|
-
export default function IconButton({ name, iconImage, className, disabled = false, active = false, color = 'accent', size = 'large', mode = 'filled', filledIcon, title, spin = false, iconSize, iconClassName, tooltipPlacement = 'top', onClick = () => { }, type = 'button', ...buttonProps }) {
|
|
9
|
+
export default function IconButton({ name, iconImage, className, disabled = false, active = false, color = 'accent', size = 'large', mode = 'filled', filledIcon, title, spin = false, iconSize, iconClassName, tooltipPlacement = 'top', onClick = () => { }, type = 'button', dataTour, ...buttonProps }) {
|
|
10
10
|
const getClassNames = cx('ds-icon-button', className, size, mode, color, {
|
|
11
11
|
active: !disabled && active,
|
|
12
12
|
});
|
|
@@ -33,7 +33,7 @@ export default function IconButton({ name, iconImage, className, disabled = fals
|
|
|
33
33
|
}
|
|
34
34
|
return null;
|
|
35
35
|
};
|
|
36
|
-
const renderButton = () => (_jsx("button", { type: type, disabled: disabled, className: getClassNames, onClick: onClick, ...buttonProps, children: renderContent() }));
|
|
36
|
+
const renderButton = () => (_jsx("button", { type: type, disabled: disabled, className: getClassNames, onClick: onClick, "data-tour": dataTour, ...buttonProps, children: renderContent() }));
|
|
37
37
|
const button = renderButton();
|
|
38
38
|
// Disabled buttons do not fire pointer events; MUI Tooltip needs a wrapper.
|
|
39
39
|
if (!title) {
|
|
@@ -14,5 +14,6 @@ export type Props = {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
title?: string | React.ReactNode;
|
|
16
16
|
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
17
|
+
dataTour?: string;
|
|
17
18
|
};
|
|
18
|
-
export default function Tag({ text, title, className, disabled, color, size, type, onClick, }: Props): import("react").JSX.Element;
|
|
19
|
+
export default function Tag({ text, title, className, disabled, color, size, type, onClick, dataTour, }: Props): import("react").JSX.Element;
|
|
@@ -19,7 +19,7 @@ export const TagColorsValues = [
|
|
|
19
19
|
'pink',
|
|
20
20
|
'slate',
|
|
21
21
|
];
|
|
22
|
-
export default function Tag({ text = '', title = '', className = '', disabled = false, color = 'gray', size = 'large', type = 'low', onClick, }) {
|
|
22
|
+
export default function Tag({ text = '', title = '', className = '', disabled = false, color = 'gray', size = 'large', type = 'low', onClick, dataTour, }) {
|
|
23
23
|
const getClassNames = cx('ds-tag', className, type, size, color, {
|
|
24
24
|
disabled: disabled,
|
|
25
25
|
});
|
|
@@ -28,9 +28,9 @@ export default function Tag({ text = '', title = '', className = '', disabled =
|
|
|
28
28
|
dangerouslySetInnerHTML: { __html: title },
|
|
29
29
|
}), placement: "top", arrow: true, children: (_jsx("div", { className: getClassNames, style: {
|
|
30
30
|
cursor: title ? 'pointer' : '',
|
|
31
|
-
}, onClick: (e) => onClick && onClick(e), children: text })) }));
|
|
31
|
+
}, onClick: (e) => onClick && onClick(e), "data-tour": dataTour, children: text })) }));
|
|
32
32
|
}
|
|
33
33
|
return (_jsx("div", { className: getClassNames, style: {
|
|
34
34
|
cursor: title ? 'pointer' : '',
|
|
35
|
-
}, onClick: (e) => onClick && onClick(e), children: text }));
|
|
35
|
+
}, onClick: (e) => onClick && onClick(e), "data-tour": dataTour, children: text }));
|
|
36
36
|
}
|
package/dist/primitives/index.js
CHANGED
|
@@ -1,76 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
2
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Button } from '../../../primitives';
|
|
5
3
|
import AppModal from '../../../common/AppModal/AppModal';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useLoggedUtils } from '../../../configs/useLoggedUtils';
|
|
9
|
-
import { useTourUtils } from '../../../configs/useTourUtils';
|
|
10
|
-
import SecurityUtils from '../../../functions/SecurityUtils';
|
|
4
|
+
import HelpModalMainColumn from './HelpModalMainColumn';
|
|
5
|
+
import HelpModalSideColumn from './HelpModalSideColumn';
|
|
11
6
|
import './style.scss';
|
|
12
7
|
export default function HelpModal({ onClose, helpActions = [] }) {
|
|
13
8
|
const { t } = useTranslation('help');
|
|
14
|
-
|
|
15
|
-
const { getLogged, setLogged } = useLoggedUtils();
|
|
16
|
-
const [autoOpenEnabled, setAutoOpenEnabled] = useState(() => getLogged()?.liveTour ?? false);
|
|
17
|
-
const [updatingLiveTour, setUpdatingLiveTour] = useState(false);
|
|
18
|
-
const isTourActive = status();
|
|
19
|
-
const currentLiveTour = getLogged()?.liveTour ?? false;
|
|
20
|
-
const preferenceChanged = autoOpenEnabled !== currentLiveTour;
|
|
21
|
-
const isDisablingAutoOpen = preferenceChanged && !autoOpenEnabled;
|
|
22
|
-
const handleTutorials = () => {
|
|
23
|
-
const origin = (import.meta.env.VITE_APP_ORIGIN ?? '').replace(/\/+$/, '');
|
|
24
|
-
window.open(`${origin}/home/tutorials`, '_blank');
|
|
25
|
-
};
|
|
26
|
-
const handleTourToggle = () => {
|
|
27
|
-
const startTour = () => {
|
|
28
|
-
if (isTourActive) {
|
|
29
|
-
turnOff();
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
turnOn();
|
|
33
|
-
}
|
|
34
|
-
onClose();
|
|
35
|
-
};
|
|
36
|
-
if (!preferenceChanged) {
|
|
37
|
-
startTour();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
setUpdatingLiveTour(true);
|
|
41
|
-
ProfileService.updateLiveTour(autoOpenEnabled)
|
|
42
|
-
.then((response) => {
|
|
43
|
-
CookieStorage.setJwtToken(response.data);
|
|
44
|
-
setLogged(SecurityUtils.parseJwt(response.data));
|
|
45
|
-
})
|
|
46
|
-
.catch((error) => {
|
|
47
|
-
console.error(error);
|
|
48
|
-
})
|
|
49
|
-
.finally(() => {
|
|
50
|
-
setUpdatingLiveTour(false);
|
|
51
|
-
if (isDisablingAutoOpen) {
|
|
52
|
-
onClose();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
startTour();
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
const handleCustomAction = (item) => {
|
|
59
|
-
item.action();
|
|
60
|
-
onClose();
|
|
61
|
-
};
|
|
62
|
-
const handleAutoOpenChange = (event) => {
|
|
63
|
-
setAutoOpenEnabled(event.target.checked);
|
|
64
|
-
};
|
|
65
|
-
const actionItems = [
|
|
66
|
-
// {
|
|
67
|
-
// title: t('title.tutorials'),
|
|
68
|
-
// desc: t('description.tutorials'),
|
|
69
|
-
// action: handleTutorials,
|
|
70
|
-
// },
|
|
71
|
-
...helpActions,
|
|
72
|
-
];
|
|
73
|
-
return (_jsxs(AppModal, { title: t('modal.title'), close: onClose, hideFooter: true, className: "help-modal", children: [_jsxs("div", { className: "item item-tour", children: [_jsx("div", { className: "title", children: t('title.tour') }), _jsx("div", { className: "desc", children: t('description.tour') }), _jsxs("label", { className: "help-checkbox-label", children: [_jsx("input", { type: "checkbox", checked: autoOpenEnabled, onChange: handleAutoOpenChange, disabled: updatingLiveTour, className: "help-checkbox" }), _jsx("span", { children: t('checkbox.autoOpen') })] }), _jsx(Button, { text: isDisablingAutoOpen
|
|
74
|
-
? t('button.updateLiveTourPreference')
|
|
75
|
-
: t('button.tour'), size: "small", icon: isDisablingAutoOpen ? 'save' : 'keyboard_arrow_right', onClick: handleTourToggle, disabled: updatingLiveTour, "data-tour": "guided-tour-start" })] }), actionItems.map((item, idx) => (_jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: item.title }), _jsx("div", { className: "desc", children: item.desc }), _jsx(Button, { text: t('button.open'), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx)))] }));
|
|
9
|
+
return (_jsx(AppModal, { title: t('modal.title'), subtitle: t('modal.subtitle'), close: onClose, hideFooter: true, className: "help-modal", children: _jsxs("div", { className: "help-modal__layout", children: [_jsx(HelpModalMainColumn, { onClose: onClose }), _jsx(HelpModalSideColumn, { helpActions: helpActions, onClose: onClose })] }) }));
|
|
76
10
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import CookieStorage from '../../../configs/CookieStorage';
|
|
5
|
+
import ProfileService from '../../../configs/services/ProfileService';
|
|
6
|
+
import { useCorpusUtils } from '../../../configs/useCorpusUtils';
|
|
7
|
+
import { useLoggedUtils } from '../../../configs/useLoggedUtils';
|
|
8
|
+
import { useMessageUtils } from '../../../configs/useMessageUtils';
|
|
9
|
+
import { useTourUtils } from '../../../configs/useTourUtils';
|
|
10
|
+
import { ServerErrorReportForm } from '../../../features/ServerErrorReport';
|
|
11
|
+
import SecurityUtils from '../../../functions/SecurityUtils';
|
|
12
|
+
import { Button } from '../../../primitives';
|
|
13
|
+
import liveTourImg from './live-tour.png';
|
|
14
|
+
export default function HelpModalMainColumn({ onClose }) {
|
|
15
|
+
const { t } = useTranslation('help');
|
|
16
|
+
const { t: tCommon } = useTranslation('common');
|
|
17
|
+
const { turnOn, turnOff, status } = useTourUtils();
|
|
18
|
+
const { getLogged, setLogged } = useLoggedUtils();
|
|
19
|
+
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
20
|
+
const { dispatchMessageDirect } = useMessageUtils();
|
|
21
|
+
const [autoOpenEnabled, setAutoOpenEnabled] = useState(() => getLogged()?.liveTour ?? false);
|
|
22
|
+
const [updatingLiveTour, setUpdatingLiveTour] = useState(false);
|
|
23
|
+
const isTourActive = status();
|
|
24
|
+
const currentLiveTour = getLogged()?.liveTour ?? false;
|
|
25
|
+
const preferenceChanged = autoOpenEnabled !== currentLiveTour;
|
|
26
|
+
const isDisablingAutoOpen = preferenceChanged && !autoOpenEnabled;
|
|
27
|
+
const handleTourToggle = () => {
|
|
28
|
+
const startTour = () => {
|
|
29
|
+
if (isTourActive) {
|
|
30
|
+
turnOff();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
turnOn();
|
|
34
|
+
}
|
|
35
|
+
onClose();
|
|
36
|
+
};
|
|
37
|
+
if (!preferenceChanged) {
|
|
38
|
+
startTour();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
setUpdatingLiveTour(true);
|
|
42
|
+
ProfileService.updateLiveTour(autoOpenEnabled)
|
|
43
|
+
.then((response) => {
|
|
44
|
+
CookieStorage.setJwtToken(response.data);
|
|
45
|
+
setLogged(SecurityUtils.parseJwt(response.data));
|
|
46
|
+
})
|
|
47
|
+
.catch((error) => {
|
|
48
|
+
console.error(error);
|
|
49
|
+
})
|
|
50
|
+
.finally(() => {
|
|
51
|
+
setUpdatingLiveTour(false);
|
|
52
|
+
if (isDisablingAutoOpen) {
|
|
53
|
+
onClose();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
startTour();
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const handleAutoOpenChange = (event) => {
|
|
60
|
+
setAutoOpenEnabled(event.target.checked);
|
|
61
|
+
};
|
|
62
|
+
const handleFeedbackSent = () => {
|
|
63
|
+
dispatchMessageDirect(tCommon('server.error.report.feedback.sent'), 'success');
|
|
64
|
+
};
|
|
65
|
+
const tourButtonLabel = isDisablingAutoOpen
|
|
66
|
+
? t('button.updateLiveTourPreference')
|
|
67
|
+
: isTourActive
|
|
68
|
+
? t('button.tour.stop')
|
|
69
|
+
: t('button.tour');
|
|
70
|
+
const tourButtonIcon = isDisablingAutoOpen
|
|
71
|
+
? 'save'
|
|
72
|
+
: isTourActive
|
|
73
|
+
? 'stop_circle'
|
|
74
|
+
: 'play_circle';
|
|
75
|
+
return (_jsxs("div", { className: "help-modal__main", children: [_jsxs("section", { className: "help-modal__tour live-tour", "aria-labelledby": "help-tour-title", children: [_jsxs("div", { className: "help-modal__tour-header", children: [_jsx("h2", { id: "help-tour-title", className: "help-modal__tour-title", children: t('title.tour') }), _jsx("p", { className: "help-modal__tour-desc", children: t('description.tour') })] }), _jsxs("div", { className: "help-modal__tour-body", children: [_jsxs("div", { className: "help-modal__tour-content tour-content", children: [_jsxs("ol", { className: "help-modal__tour-steps", children: [_jsx("li", { children: t('tour.step.1') }), _jsx("li", { children: t('tour.step.2') }), _jsx("li", { children: t('tour.step.3') })] }), _jsxs("label", { className: "help-checkbox-label", children: [_jsx("input", { type: "checkbox", checked: autoOpenEnabled, onChange: handleAutoOpenChange, disabled: updatingLiveTour, className: "help-checkbox" }), _jsx("span", { children: t('checkbox.autoOpen') })] }), _jsx(Button, { text: tourButtonLabel, size: "small", icon: tourButtonIcon, onClick: handleTourToggle, disabled: updatingLiveTour, "data-tour": "guided-tour-start" })] }), _jsx("div", { className: "help-modal__tour-media", children: _jsx("img", { src: liveTourImg, alt: "", className: "help-modal__tour-image" }) })] })] }), _jsxs("section", { className: "help-modal__feedback", "aria-labelledby": "help-feedback-title", children: [_jsx("h2", { id: "help-feedback-title", className: "help-modal__section-title", children: t('title.feedback') }), _jsx("p", { className: "help-modal__section-desc", children: t('description.feedback') }), _jsx(ServerErrorReportForm, { intent: "feedback", showSendButton: true, corpus: hasCorpus() ? getCorpus() : undefined, onSent: handleFeedbackSent })] })] }));
|
|
76
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { resolveBrandYoutube } from '../../../configs/brand';
|
|
4
|
+
import { Button } from '../../../primitives';
|
|
5
|
+
import youtubeMark from '../HeaderApps/youtube.png';
|
|
6
|
+
export default function HelpModalSideColumn({ helpActions, onClose }) {
|
|
7
|
+
const { t } = useTranslation('help');
|
|
8
|
+
const youtubeUrl = resolveBrandYoutube();
|
|
9
|
+
const handleCustomAction = (item) => {
|
|
10
|
+
item.action();
|
|
11
|
+
onClose();
|
|
12
|
+
};
|
|
13
|
+
const handleYoutubeOpen = () => {
|
|
14
|
+
window.open(youtubeUrl, '_blank', 'noopener,noreferrer');
|
|
15
|
+
onClose();
|
|
16
|
+
};
|
|
17
|
+
return (_jsxs("div", { className: "help-modal__side", children: [helpActions.length > 0 ? (_jsxs("section", { className: "help-modal__resources", "aria-labelledby": "help-resources-title", children: [_jsx("h2", { id: "help-resources-title", className: "help-modal__section-title", children: t('title.resources') }), _jsx("ul", { className: "help-modal__action-list", children: helpActions.map((item, idx) => (_jsxs("li", { className: "help-modal__action-item", children: [_jsxs("div", { className: "help-modal__action-copy", children: [_jsx("div", { className: "help-modal__action-title", children: item.title }), _jsx("div", { className: "help-modal__action-desc", children: item.desc })] }), _jsx(Button, { text: t('button.open'), size: "x-small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx))) })] })) : (_jsxs("section", { className: "help-modal__resources help-modal__resources--empty", children: [_jsx("h2", { className: "help-modal__section-title", children: t('title.resources') }), _jsx("p", { className: "help-modal__section-desc", children: t('resources.empty') })] })), youtubeUrl && (_jsxs("section", { className: "help-modal__youtube", "aria-labelledby": "help-youtube-title", children: [_jsxs("div", { className: "help-modal__youtube-copy", children: [_jsx("h2", { id: "help-youtube-title", className: "help-modal__youtube-title", children: t('title.youtube') }), _jsx("p", { className: "help-modal__youtube-desc", children: t('description.youtube') }), _jsx(Button, { text: t('button.youtube'), size: "small", icon: "open_in_new", onClick: handleYoutubeOpen })] }), _jsx("div", { className: "help-modal__youtube-media", children: _jsx("img", { src: youtubeMark, alt: "", className: "help-modal__youtube-mark" }) })] }))] }));
|
|
18
|
+
}
|
|
Binary file
|