@topconsultnpm/sdkui-react 6.20.0-dev1.13 → 6.20.0-dev1.131
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/lib/assets/Toppy-help-center.png +0 -0
- package/lib/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +322 -30
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +8 -1
- package/lib/components/NewComponents/ContextMenu/hooks.js +80 -8
- package/lib/components/NewComponents/ContextMenu/index.d.ts +3 -0
- package/lib/components/NewComponents/ContextMenu/index.js +2 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +9 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +146 -47
- package/lib/components/NewComponents/ContextMenu/types.d.ts +22 -3
- package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +620 -125
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +25 -5
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +215 -59
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +12 -3
- package/lib/components/base/TMAccordionNew.js +35 -14
- package/lib/components/base/TMButton.js +6 -0
- package/lib/components/base/TMClosableList.js +4 -0
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +153 -11
- package/lib/components/base/TMDropDownMenu.js +21 -18
- package/lib/components/base/TMFileManager.d.ts +4 -3
- package/lib/components/base/TMFileManager.js +32 -24
- package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
- package/lib/components/base/TMFileManagerDataGridView.js +1 -11
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
- package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
- package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
- package/lib/components/base/TMListView.js +33 -15
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +4 -2
- package/lib/components/base/TMPopUp.js +6 -0
- package/lib/components/base/TMToolbarCard.js +2 -0
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +33 -26
- package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
- package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
- package/lib/components/choosers/TMMetadataChooser.js +19 -4
- package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +2 -5
- package/lib/components/choosers/TMUserChooser.js +33 -47
- package/lib/components/editors/TMCheckBox.js +2 -0
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMEditorStyled.js +7 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
- package/lib/components/editors/TMMetadataEditor.js +4 -4
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.d.ts +2 -0
- package/lib/components/editors/TMMetadataValues.js +26 -8
- package/lib/components/editors/TMRadioButton.js +2 -0
- package/lib/components/editors/TMTextArea.js +18 -30
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +29 -4
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +462 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
- package/lib/components/features/documents/TMDcmtForm.js +576 -292
- package/lib/components/features/documents/TMDcmtPreview.js +42 -155
- package/lib/components/features/documents/TMDcmtTasks.js +9 -9
- package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
- package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +2 -2
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
- package/lib/components/features/search/TMSearch.d.ts +3 -0
- package/lib/components/features/search/TMSearch.js +50 -11
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +40 -25
- package/lib/components/features/search/TMSearchResult.d.ts +3 -0
- package/lib/components/features/search/TMSearchResult.js +370 -252
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +227 -171
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +47 -52
- package/lib/components/features/tasks/TMTaskForm.js +75 -25
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +57 -37
- package/lib/components/features/tasks/TMTasksView.js +28 -19
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +140 -34
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +14 -7
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +35 -7
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/grids/TMBlogsPost.js +56 -31
- package/lib/components/grids/TMRecentsManager.js +20 -10
- package/lib/components/grids/TMValidationItemsList.js +6 -0
- package/lib/components/index.d.ts +6 -3
- package/lib/components/index.js +6 -3
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/components/query/TMQueryEditor.d.ts +6 -1
- package/lib/components/query/TMQueryEditor.js +105 -101
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/settings/SettingsAppearance.js +99 -30
- package/lib/components/sidebar/TMHeader.js +11 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +36 -17
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +35 -71
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
- package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +22 -0
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +21 -3
- package/lib/helper/SDKUI_Localizator.js +196 -10
- package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
- package/lib/helper/TMCommandsContextMenu.js +15 -4
- package/lib/helper/TMIcons.d.ts +4 -0
- package/lib/helper/TMIcons.js +13 -3
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +373 -0
- package/lib/helper/TMToppyMessage.js +4 -0
- package/lib/helper/checkinCheckoutManager.d.ts +31 -1
- package/lib/helper/checkinCheckoutManager.js +112 -30
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +30 -2
- package/lib/helper/helpers.js +132 -4
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +2 -2
- package/lib/helper/queryHelper.js +80 -24
- package/lib/helper/workItemsHelper.d.ts +6 -0
- package/lib/helper/workItemsHelper.js +230 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useDataListItem.d.ts +12 -0
- package/lib/hooks/useDataListItem.js +132 -0
- package/lib/hooks/useDataUserIdItem.d.ts +10 -0
- package/lib/hooks/useDataUserIdItem.js +96 -0
- package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
- package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/lib/hooks/useSettingsFeedback.d.ts +11 -0
- package/lib/hooks/useSettingsFeedback.js +38 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/services/platform_services.d.ts +3 -3
- package/lib/ts/types.d.ts +61 -1
- package/lib/utils/theme.d.ts +1 -1
- package/lib/utils/theme.js +1 -1
- package/package.json +8 -6
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/base/TMContextMenu.d.ts +0 -25
- package/lib/components/base/TMContextMenu.js +0 -109
- package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
- package/lib/components/base/TMContextMenuOLD.js +0 -56
- package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
- package/lib/components/base/TMFloatingToolbar.js +0 -101
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
- package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
const Container = styled.div `
|
|
4
|
-
position: fixed;
|
|
5
|
-
z-index: 10002;
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
gap: 12px;
|
|
9
|
-
pointer-events: none;
|
|
10
|
-
|
|
11
|
-
${props => {
|
|
12
|
-
const isTop = props.$position.startsWith('top');
|
|
13
|
-
const isBottom = props.$position.startsWith('bottom');
|
|
14
|
-
const isLeft = props.$position.endsWith('left');
|
|
15
|
-
const isRight = props.$position.endsWith('right');
|
|
16
|
-
const isCenter = props.$position.endsWith('center');
|
|
17
|
-
return `
|
|
18
|
-
${isTop ? 'top: 24px;' : ''}
|
|
19
|
-
${isBottom ? 'bottom: 24px;' : ''}
|
|
20
|
-
${isLeft ? 'left: 24px;' : ''}
|
|
21
|
-
${isRight ? 'right: 24px;' : ''}
|
|
22
|
-
${isCenter ? 'left: 50%; transform: translateX(-50%);' : ''}
|
|
23
|
-
`;
|
|
24
|
-
}}
|
|
25
|
-
|
|
26
|
-
& > * {
|
|
27
|
-
pointer-events: auto;
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
const NotificationContainer = ({ position, children }) => {
|
|
31
|
-
return _jsx(Container, { "$position": position, children: children });
|
|
32
|
-
};
|
|
33
|
-
export default NotificationContainer;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { NotificationMode, NotificationPosition } from './types';
|
|
2
|
-
export declare const NotificationContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
-
$position: NotificationPosition;
|
|
4
|
-
$mode: NotificationMode;
|
|
5
|
-
$visible: boolean;
|
|
6
|
-
}>> & string;
|
|
7
|
-
export declare const NotificationContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
-
export declare const NotificationTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
-
export declare const NotificationMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
-
export declare const CloseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
11
|
-
export declare const ProgressBar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
13
|
-
}>, {
|
|
14
|
-
$duration: number;
|
|
15
|
-
$mode: NotificationMode;
|
|
16
|
-
$isPaused: boolean;
|
|
17
|
-
}>, {
|
|
18
|
-
$duration: number;
|
|
19
|
-
$mode: NotificationMode;
|
|
20
|
-
$isPaused: boolean;
|
|
21
|
-
}>> & string;
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import styled, { keyframes } from 'styled-components';
|
|
2
|
-
const slideInFromTop = keyframes `
|
|
3
|
-
from {
|
|
4
|
-
opacity: 0;
|
|
5
|
-
transform: translateY(-100%);
|
|
6
|
-
}
|
|
7
|
-
to {
|
|
8
|
-
opacity: 1;
|
|
9
|
-
transform: translateY(0);
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
const slideInFromBottom = keyframes `
|
|
13
|
-
from {
|
|
14
|
-
opacity: 0;
|
|
15
|
-
transform: translateY(100%);
|
|
16
|
-
}
|
|
17
|
-
to {
|
|
18
|
-
opacity: 1;
|
|
19
|
-
transform: translateY(0);
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
const slideOut = keyframes `
|
|
23
|
-
from {
|
|
24
|
-
opacity: 1;
|
|
25
|
-
transform: scale(1);
|
|
26
|
-
}
|
|
27
|
-
to {
|
|
28
|
-
opacity: 0;
|
|
29
|
-
transform: scale(0.9);
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
const getModeColors = (mode) => {
|
|
33
|
-
const colors = {
|
|
34
|
-
success: {
|
|
35
|
-
bg: '#10b981',
|
|
36
|
-
bgDark: '#059669',
|
|
37
|
-
border: '#34d399',
|
|
38
|
-
text: '#ffffff',
|
|
39
|
-
},
|
|
40
|
-
error: {
|
|
41
|
-
bg: '#ef4444',
|
|
42
|
-
bgDark: '#dc2626',
|
|
43
|
-
border: '#f87171',
|
|
44
|
-
text: '#ffffff',
|
|
45
|
-
},
|
|
46
|
-
warning: {
|
|
47
|
-
bg: '#f59e0b',
|
|
48
|
-
bgDark: '#d97706',
|
|
49
|
-
border: '#fbbf24',
|
|
50
|
-
text: '#ffffff',
|
|
51
|
-
},
|
|
52
|
-
info: {
|
|
53
|
-
bg: '#3b82f6',
|
|
54
|
-
bgDark: '#2563eb',
|
|
55
|
-
border: '#60a5fa',
|
|
56
|
-
text: '#ffffff',
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
return colors[mode];
|
|
60
|
-
};
|
|
61
|
-
export const NotificationContainer = styled.div `
|
|
62
|
-
position: relative;
|
|
63
|
-
z-index: 1;
|
|
64
|
-
min-width: 320px;
|
|
65
|
-
max-width: 420px;
|
|
66
|
-
background: ${props => getModeColors(props.$mode).bg};
|
|
67
|
-
border-radius: 12px;
|
|
68
|
-
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2),
|
|
69
|
-
0 4px 12px rgba(0, 0, 0, 0.15);
|
|
70
|
-
padding: 16px 20px;
|
|
71
|
-
animation: ${props => {
|
|
72
|
-
if (!props.$visible)
|
|
73
|
-
return slideOut;
|
|
74
|
-
return props.$position.startsWith('top') ? slideInFromTop : slideInFromBottom;
|
|
75
|
-
}} 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
76
|
-
backdrop-filter: blur(10px);
|
|
77
|
-
border: 2px solid ${props => getModeColors(props.$mode).border};
|
|
78
|
-
color: ${props => getModeColors(props.$mode).text};
|
|
79
|
-
overflow: hidden;
|
|
80
|
-
|
|
81
|
-
[data-theme='dark'] & {
|
|
82
|
-
background: ${props => getModeColors(props.$mode).bgDark};
|
|
83
|
-
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
|
|
84
|
-
0 4px 12px rgba(0, 0, 0, 0.3);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@media (max-width: 768px) {
|
|
88
|
-
min-width: 280px;
|
|
89
|
-
max-width: calc(100vw - 48px);
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
export const NotificationContent = styled.div `
|
|
93
|
-
display: flex;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
gap: 6px;
|
|
96
|
-
padding-right: 24px;
|
|
97
|
-
`;
|
|
98
|
-
export const NotificationTitle = styled.div `
|
|
99
|
-
font-size: 16px;
|
|
100
|
-
font-weight: 600;
|
|
101
|
-
line-height: 1.4;
|
|
102
|
-
letter-spacing: -0.01em;
|
|
103
|
-
`;
|
|
104
|
-
export const NotificationMessage = styled.div `
|
|
105
|
-
font-size: 14px;
|
|
106
|
-
font-weight: 400;
|
|
107
|
-
line-height: 1.5;
|
|
108
|
-
opacity: 0.95;
|
|
109
|
-
`;
|
|
110
|
-
export const CloseButton = styled.button `
|
|
111
|
-
position: absolute;
|
|
112
|
-
top: 12px;
|
|
113
|
-
right: 12px;
|
|
114
|
-
background: transparent;
|
|
115
|
-
border: none;
|
|
116
|
-
color: inherit;
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
width: 24px;
|
|
119
|
-
height: 24px;
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: center;
|
|
122
|
-
justify-content: center;
|
|
123
|
-
border-radius: 6px;
|
|
124
|
-
transition: all 0.15s ease;
|
|
125
|
-
font-size: 18px;
|
|
126
|
-
line-height: 1;
|
|
127
|
-
padding: 0;
|
|
128
|
-
opacity: 0.8;
|
|
129
|
-
|
|
130
|
-
&:hover {
|
|
131
|
-
opacity: 1;
|
|
132
|
-
background: rgba(255, 255, 255, 0.2);
|
|
133
|
-
transform: scale(1.1);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
&:active {
|
|
137
|
-
transform: scale(0.95);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&:focus {
|
|
141
|
-
outline: 2px solid rgba(255, 255, 255, 0.5);
|
|
142
|
-
outline-offset: 2px;
|
|
143
|
-
}
|
|
144
|
-
`;
|
|
145
|
-
export const ProgressBar = styled.div.attrs(props => ({
|
|
146
|
-
style: {
|
|
147
|
-
animationDuration: `${props.$duration}ms`,
|
|
148
|
-
},
|
|
149
|
-
})) `
|
|
150
|
-
position: absolute;
|
|
151
|
-
bottom: 0;
|
|
152
|
-
left: 0;
|
|
153
|
-
height: 4px;
|
|
154
|
-
width: 100%;
|
|
155
|
-
background: ${props => getModeColors(props.$mode).border};
|
|
156
|
-
border-radius: 0 0 0 10px;
|
|
157
|
-
box-shadow: 0 0 8px ${props => getModeColors(props.$mode).border};
|
|
158
|
-
transform-origin: left;
|
|
159
|
-
animation: progress-shrink linear forwards;
|
|
160
|
-
animation-play-state: ${props => props.$isPaused ? 'paused' : 'running'};
|
|
161
|
-
|
|
162
|
-
@keyframes progress-shrink {
|
|
163
|
-
from {
|
|
164
|
-
transform: scaleX(1);
|
|
165
|
-
}
|
|
166
|
-
to {
|
|
167
|
-
transform: scaleX(0);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&::after {
|
|
172
|
-
content: '';
|
|
173
|
-
position: absolute;
|
|
174
|
-
top: 0;
|
|
175
|
-
right: 0;
|
|
176
|
-
width: 20px;
|
|
177
|
-
height: 100%;
|
|
178
|
-
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
|
|
179
|
-
}
|
|
180
|
-
`;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type NotificationMode = 'warning' | 'info' | 'error' | 'success';
|
|
2
|
-
export type NotificationPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
3
|
-
export interface NotificationProps {
|
|
4
|
-
title: string;
|
|
5
|
-
message: string;
|
|
6
|
-
mode?: NotificationMode;
|
|
7
|
-
position?: NotificationPosition;
|
|
8
|
-
duration?: number;
|
|
9
|
-
closable?: boolean;
|
|
10
|
-
stopOnMouseEnter?: boolean;
|
|
11
|
-
hasProgress?: boolean;
|
|
12
|
-
onClose?: () => void;
|
|
13
|
-
}
|
|
14
|
-
export interface NotificationState {
|
|
15
|
-
visible: boolean;
|
|
16
|
-
isPaused: boolean;
|
|
17
|
-
progress: number;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
export interface ITMContextMenuItemProps {
|
|
3
|
-
icon?: ReactNode;
|
|
4
|
-
text?: any;
|
|
5
|
-
items?: ITMContextMenuItemProps[];
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
isSelected?: boolean;
|
|
8
|
-
id?: string;
|
|
9
|
-
onItemClick?: () => void;
|
|
10
|
-
onItemMouseOver?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
11
|
-
}
|
|
12
|
-
export interface ITMContextMenuProps {
|
|
13
|
-
items?: ITMContextMenuItemProps[];
|
|
14
|
-
coords?: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
subMenuDir?: 'left' | 'right';
|
|
19
|
-
}
|
|
20
|
-
declare const TMContextMenu: ({ items, coords, subMenuDir, }: ITMContextMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export declare const useTMContextMenu: (ref: React.RefObject<HTMLElement>) => (boolean | {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
})[];
|
|
25
|
-
export default TMContextMenu;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { IconRight } from '../../helper/TMIcons';
|
|
5
|
-
const StyledContextMenuContainer = styled.div `
|
|
6
|
-
display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; z-index: 300; position: fixed; top: ${props => `${props.$top}px`}; left: ${props => `${props.$left}px`}; right: ${props => `${props.$right}px`}; bottom: ${props => `${props.$bottom}px`}; width: max-content; height: max-content; background-color: white; box-shadow: 1px 1px 2px #00000040;
|
|
7
|
-
`;
|
|
8
|
-
const StyledContextMenuItem = styled.div `
|
|
9
|
-
cursor: ${props => !props.$disabled ? 'pointer' : 'default'}; display: flex; align-items: center; gap: 5px; transition: ease 100ms; padding: 5px; background-color: ${props => props.$isSelected && '#e9e9e9'}; width: 100%; height: 100%; color: ${props => props.$disabled && '#d0d0d0'}; &:hover { background-color: ${props => !props.$disabled && '#e9e9e9'} ; }
|
|
10
|
-
`;
|
|
11
|
-
const TMContextMenu = ({ items = [], coords = { x: 0, y: 0 }, subMenuDir = 'right', }) => {
|
|
12
|
-
// Coordinates for sub-menus
|
|
13
|
-
const [subMenuCoords, setSubMenuCoords] = useState({ x: 0, y: 0 });
|
|
14
|
-
// Track which item is currently hovered
|
|
15
|
-
const [hoveredItem, setHoveredItem] = useState(null);
|
|
16
|
-
// Size of the menu
|
|
17
|
-
const [menuSize, setMenuSize] = useState({ x: 0, y: 0 });
|
|
18
|
-
// Current direction for submenus
|
|
19
|
-
const [currentSubMenuDir, setCurrentSubMenuDir] = useState(subMenuDir);
|
|
20
|
-
// Reference to the context menu DOM element
|
|
21
|
-
const contextMenuRef = useRef(null);
|
|
22
|
-
// Uupdate submenu direction based on incoming props
|
|
23
|
-
useEffect(() => setCurrentSubMenuDir(subMenuDir), [subMenuDir]);
|
|
24
|
-
// Calculate the size of the context menu and adjust submenu direction
|
|
25
|
-
// Run this effect only once when the component mounts
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (contextMenuRef.current) {
|
|
28
|
-
setMenuSize({
|
|
29
|
-
x: contextMenuRef.current.getBoundingClientRect().width || 0,
|
|
30
|
-
y: contextMenuRef.current.getBoundingClientRect().height || 0,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
// This effect checks the width on resize
|
|
36
|
-
const handleResize = () => {
|
|
37
|
-
if (window.innerWidth <= coords.x + menuSize.x) {
|
|
38
|
-
// Change direction to left if menu goes beyond right edge
|
|
39
|
-
setCurrentSubMenuDir('left');
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// Default to right if there's space
|
|
43
|
-
setCurrentSubMenuDir('right');
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
// Attach event listener
|
|
47
|
-
window.addEventListener('resize', handleResize);
|
|
48
|
-
handleResize(); // Call it initially to set the direction
|
|
49
|
-
// Clean up the event listener on unmount
|
|
50
|
-
return () => {
|
|
51
|
-
window.removeEventListener('resize', handleResize);
|
|
52
|
-
};
|
|
53
|
-
}, [coords, menuSize.x]); // Only watch coords and the width of menuSize
|
|
54
|
-
// Handle mouse over event on items to potentially show submenus
|
|
55
|
-
const onItemMouseOver = (item, index) => {
|
|
56
|
-
if (!item.disabled && item.items && item.items.length > 0) {
|
|
57
|
-
setHoveredItem(index);
|
|
58
|
-
const boundingRect = contextMenuRef.current?.getBoundingClientRect();
|
|
59
|
-
if (boundingRect) {
|
|
60
|
-
// Calculate the sub-menu position based on the current item position
|
|
61
|
-
const subMenuX = currentSubMenuDir === 'right' ? boundingRect.right : boundingRect.left - menuSize.x;
|
|
62
|
-
const subMenuY = boundingRect.top + index * 30; // Adjust Y coordinate to match item
|
|
63
|
-
setSubMenuCoords({ x: subMenuX, y: subMenuY });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// Clear hover state if the item has no sub-menu
|
|
68
|
-
setHoveredItem(null); // If no submenu, clear hover state
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
return (_jsx(StyledContextMenuContainer, { ref: contextMenuRef, "$left": currentSubMenuDir === 'right' ? coords.x : 'none', "$top": window.innerHeight > coords.y + menuSize.y ? coords.y : 'none', "$right": currentSubMenuDir === 'left' ? window.innerWidth - coords.x : 'none', "$bottom": window.innerHeight <= coords.y + menuSize.y ? window.innerHeight - coords.y : 'none', children: items.map((item, index) => (_jsxs("div", { style: { width: '100%' }, children: [_jsxs(StyledContextMenuItem, { id: item.id, onMouseOver: () => onItemMouseOver(item, index), onMouseEnter: () => onItemMouseOver(item, index), "$isSelected": item.isSelected, "$disabled": item.disabled, onClick: () => !item.disabled && item.onItemClick && item.onItemClick(), children: [_jsx("div", { style: { transform: 'translateY(3px)' }, children: item.icon }), _jsx("div", { style: { width: '100%' }, children: item.items && item.items.length > 0 ? (_jsxs("div", { style: {
|
|
72
|
-
width: '100%',
|
|
73
|
-
display: 'flex',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
gap: 5,
|
|
76
|
-
justifyContent: 'space-between',
|
|
77
|
-
}, children: [item.text, " ", _jsx(IconRight, { style: { transform: 'translateY(1px)' }, fontSize: 10 })] })) : (_jsx("div", { style: { width: '100%' }, children: item.text })) })] }), item.items && item.items.length > 0 && hoveredItem === index && (_jsx(TMContextMenu, { subMenuDir: currentSubMenuDir, coords: subMenuCoords, items: item.items }))] }, index))) }));
|
|
78
|
-
};
|
|
79
|
-
export const useTMContextMenu = (ref) => {
|
|
80
|
-
// Coordinates for the context menu
|
|
81
|
-
const [coords, setCoords] = useState({ x: 0, y: 0 });
|
|
82
|
-
// State to control visibility of the context menu
|
|
83
|
-
const [showContextMenu, setShowContexMenu] = useState(false);
|
|
84
|
-
// Effect to hide context menu when clicking outside of the referenced element
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
const menu = ref.current;
|
|
87
|
-
const deSelectAll = (e) => { if (menu && !menu.contains(e.target)) {
|
|
88
|
-
setShowContexMenu(false);
|
|
89
|
-
} };
|
|
90
|
-
window.addEventListener('contextmenu', deSelectAll);
|
|
91
|
-
return () => { window.removeEventListener('contextmenu', deSelectAll); };
|
|
92
|
-
}, []);
|
|
93
|
-
// Effect to hide context menu on left-click anywhere
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
const handleClick = () => { setShowContexMenu(false); };
|
|
96
|
-
window.addEventListener("click", handleClick);
|
|
97
|
-
return () => { window.removeEventListener("click", handleClick); };
|
|
98
|
-
}, []);
|
|
99
|
-
// Effect to show context menu on right-click and prevent default context menu
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
let menu = ref.current;
|
|
102
|
-
if (menu) {
|
|
103
|
-
menu?.addEventListener('contextmenu', (e) => { e.preventDefault(); setShowContexMenu(true); setCoords({ x: e.pageX, y: e.pageY }); });
|
|
104
|
-
}
|
|
105
|
-
return () => menu?.removeEventListener('contextmenu', (e) => { setCoords({ x: e.pageX, y: e.pageY }); });
|
|
106
|
-
}, [ref]);
|
|
107
|
-
return [coords, showContextMenu];
|
|
108
|
-
};
|
|
109
|
-
export default TMContextMenu;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const useContextMenu: () => {
|
|
3
|
-
clicked: boolean;
|
|
4
|
-
setClicked: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
-
points: {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
};
|
|
9
|
-
setPoints: React.Dispatch<React.SetStateAction<{
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
}>>;
|
|
13
|
-
};
|
|
14
|
-
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
15
|
-
$top: number;
|
|
16
|
-
$left: number;
|
|
17
|
-
}>> & string;
|
|
18
|
-
export declare const MenuOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
|
-
interface ITMContextMenu {
|
|
20
|
-
menuData: any[];
|
|
21
|
-
onMenuItemClick?: (item: string) => void;
|
|
22
|
-
top: number;
|
|
23
|
-
left: number;
|
|
24
|
-
}
|
|
25
|
-
declare const TMContextMenuOLD: React.FunctionComponent<ITMContextMenu>;
|
|
26
|
-
export default TMContextMenuOLD;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Colors, FontSize } from '../../utils/theme';
|
|
5
|
-
// #region Hook useContextMenu
|
|
6
|
-
export const useContextMenu = () => {
|
|
7
|
-
// boolean value to determine if the user has right clicked
|
|
8
|
-
const [clicked, setClicked] = useState(false);
|
|
9
|
-
// allows us to track the x,y coordinates of the users right click
|
|
10
|
-
const [points, setPoints] = useState({ x: 0, y: 0 });
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
// reset clicked to false on user click
|
|
13
|
-
const handleClick = () => {
|
|
14
|
-
setClicked(false);
|
|
15
|
-
};
|
|
16
|
-
// add listener for user click
|
|
17
|
-
document.addEventListener("click", handleClick);
|
|
18
|
-
// clean up listener function to avoid memory leaks
|
|
19
|
-
return () => {
|
|
20
|
-
document.removeEventListener("click", handleClick);
|
|
21
|
-
};
|
|
22
|
-
}, []);
|
|
23
|
-
return { clicked, setClicked, points, setPoints };
|
|
24
|
-
};
|
|
25
|
-
// #endregion
|
|
26
|
-
export const Container = styled.div `
|
|
27
|
-
position: absolute;
|
|
28
|
-
padding: 5px 5px;
|
|
29
|
-
background-color: white;
|
|
30
|
-
width: max-content;
|
|
31
|
-
height: max-content;
|
|
32
|
-
border-radius: 2px;
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
justify-content: flex-start;
|
|
36
|
-
align-items: center;
|
|
37
|
-
box-shadow: 2px 2px 10px #00000030;
|
|
38
|
-
z-index: 2;
|
|
39
|
-
top: ${(props) => props.$top || 0}px;
|
|
40
|
-
left: ${(props) => props.$left || 0}px;
|
|
41
|
-
`;
|
|
42
|
-
export const MenuOption = styled.div `
|
|
43
|
-
width: 100%;
|
|
44
|
-
height: 20px;
|
|
45
|
-
padding: 3px;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
font-size: ${FontSize.defaultFontSize};
|
|
48
|
-
|
|
49
|
-
&:hover {
|
|
50
|
-
color: ${Colors.primary};
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
const TMContextMenuOLD = ({ menuData, top, left, onMenuItemClick }) => {
|
|
54
|
-
return (_jsx(_Fragment, { children: _jsx(Container, { "$top": top, "$left": left, children: menuData.map((item, index) => (_jsx(MenuOption, { onClick: (e) => onMenuItemClick?.(e.target.innerText), children: item.text }, index))) }) }));
|
|
55
|
-
};
|
|
56
|
-
export default TMContextMenuOLD;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface ITMFloatingToolbarProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
backgroundColor: string | undefined;
|
|
5
|
-
initialLeft?: string;
|
|
6
|
-
initialTop?: string;
|
|
7
|
-
}
|
|
8
|
-
declare const TMFloatingToolbar: ({ children, backgroundColor, initialLeft, initialTop }: ITMFloatingToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export default TMFloatingToolbar;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { IconDraggabledots } from '../../helper/TMIcons';
|
|
5
|
-
const StyledFloatingToolbarContainer = styled.div `
|
|
6
|
-
position: absolute;
|
|
7
|
-
width: max-content;
|
|
8
|
-
height: max-content;
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: row;
|
|
11
|
-
background-color: ${props => `${props.$backgroundColor}a6`};
|
|
12
|
-
left: calc(50% - 90px);
|
|
13
|
-
top: calc(100% - 40px);
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
z-index: 10;
|
|
16
|
-
&:hover {
|
|
17
|
-
background: ${props => props.$backgroundColor};
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
const StyledFloatingToolbarDraggable = styled.div `
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
width: 25px;
|
|
25
|
-
height: 100%;
|
|
26
|
-
background-color: ${props => `${props.$backgroundColor}FF`};
|
|
27
|
-
border-top-left-radius: 8px;
|
|
28
|
-
border-bottom-left-radius: 8px;
|
|
29
|
-
padding: 10px 0px 10px 0px;
|
|
30
|
-
&:hover {
|
|
31
|
-
cursor: grab;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
const StyledFloatingToolbar = styled.div `
|
|
35
|
-
width: max-content;
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: row;
|
|
38
|
-
padding: 10px 10px 10px 20px;
|
|
39
|
-
gap: 8px;
|
|
40
|
-
border-radius: 8px;
|
|
41
|
-
`;
|
|
42
|
-
const TMFloatingToolbar = ({ children, backgroundColor, initialLeft, initialTop }) => {
|
|
43
|
-
const boxRef = useRef(null);
|
|
44
|
-
const boxDraggableRef = useRef(null);
|
|
45
|
-
const isClicked = useRef(false);
|
|
46
|
-
const coords = useRef({
|
|
47
|
-
startX: 0,
|
|
48
|
-
startY: 0,
|
|
49
|
-
lastX: 0,
|
|
50
|
-
lastY: 0
|
|
51
|
-
});
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (!boxRef.current)
|
|
54
|
-
return;
|
|
55
|
-
if (!boxDraggableRef.current)
|
|
56
|
-
return;
|
|
57
|
-
let container = boxRef.current?.parentElement;
|
|
58
|
-
if (!container)
|
|
59
|
-
return;
|
|
60
|
-
const box = boxRef.current;
|
|
61
|
-
box.style.top = initialTop ?? `0px`;
|
|
62
|
-
box.style.left = initialLeft ?? `0px`;
|
|
63
|
-
const onMouseDown = (e) => {
|
|
64
|
-
isClicked.current = true;
|
|
65
|
-
coords.current.startX = e.clientX;
|
|
66
|
-
coords.current.startY = e.clientY;
|
|
67
|
-
coords.current.lastX = box.offsetLeft;
|
|
68
|
-
coords.current.lastY = box.offsetTop;
|
|
69
|
-
};
|
|
70
|
-
const onMouseUp = (e) => {
|
|
71
|
-
isClicked.current = false;
|
|
72
|
-
coords.current.lastX = box.offsetLeft;
|
|
73
|
-
coords.current.lastY = box.offsetTop;
|
|
74
|
-
};
|
|
75
|
-
const onMouseMove = (e) => {
|
|
76
|
-
if (!isClicked.current)
|
|
77
|
-
return;
|
|
78
|
-
const nextX = e.clientX - coords.current.startX + coords.current.lastX;
|
|
79
|
-
const nextY = e.clientY - coords.current.startY + coords.current.lastY;
|
|
80
|
-
const screenWidth = container.getBoundingClientRect().width;
|
|
81
|
-
const screenHeight = container.getBoundingClientRect().height;
|
|
82
|
-
const boundedX = Math.max(0, Math.min(screenWidth - box.getBoundingClientRect().width, nextX));
|
|
83
|
-
const boundedY = Math.max(0, Math.min(screenHeight - box.getBoundingClientRect().height, nextY));
|
|
84
|
-
box.style.top = `${boundedY}px`;
|
|
85
|
-
box.style.left = `${boundedX}px`;
|
|
86
|
-
};
|
|
87
|
-
boxDraggableRef.current?.addEventListener('mousedown', onMouseDown);
|
|
88
|
-
window.addEventListener('mouseup', onMouseUp);
|
|
89
|
-
window.addEventListener('mousemove', onMouseMove);
|
|
90
|
-
window.addEventListener('mouseleave', onMouseUp);
|
|
91
|
-
const cleanup = () => {
|
|
92
|
-
boxDraggableRef.current?.removeEventListener('mousedown', onMouseDown);
|
|
93
|
-
window.removeEventListener('mouseup', onMouseUp);
|
|
94
|
-
window.removeEventListener('mousemove', onMouseMove);
|
|
95
|
-
window.removeEventListener('mouseleave', onMouseUp);
|
|
96
|
-
};
|
|
97
|
-
return cleanup;
|
|
98
|
-
}, [initialLeft, initialTop]);
|
|
99
|
-
return (_jsxs(StyledFloatingToolbarContainer, { ref: boxRef, "$backgroundColor": backgroundColor, children: [_jsx(StyledFloatingToolbarDraggable, { ref: boxDraggableRef, "$backgroundColor": backgroundColor, children: _jsx(IconDraggabledots, { color: 'white' }) }), _jsx(StyledFloatingToolbar, { "$backgroundColor": backgroundColor, children: children })] }));
|
|
100
|
-
};
|
|
101
|
-
export default TMFloatingToolbar;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DeviceType } from '../../base/TMDeviceProvider';
|
|
3
|
-
/**
|
|
4
|
-
* Proprietà del componente ToppyDraggableHelpCenter
|
|
5
|
-
*/
|
|
6
|
-
interface ToppyDraggableHelpCenterProps {
|
|
7
|
-
/** Contenuto da visualizzare nella speech bubble */
|
|
8
|
-
content?: React.ReactNode;
|
|
9
|
-
/** Tipo di dispositivo per adattare il comportamento */
|
|
10
|
-
deviceType?: DeviceType;
|
|
11
|
-
/** Allineamento iniziale del componente (destra o sinistra) */
|
|
12
|
-
align?: 'right' | 'left';
|
|
13
|
-
/** Stato iniziale collassato/espanso */
|
|
14
|
-
initialIsCollapsed?: boolean;
|
|
15
|
-
/** Callback chiamato quando si clicca sull'immagine di Toppy */
|
|
16
|
-
onToppyImageClick?: () => void;
|
|
17
|
-
/** Visibilità del componente */
|
|
18
|
-
isVisible?: boolean;
|
|
19
|
-
/** Se true, renderizza Toppy nel document.body tramite Portal invece che nel parent */
|
|
20
|
-
usePortal?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Componente ToppyDraggableHelpCenter
|
|
24
|
-
*
|
|
25
|
-
* Renderizza un assistente virtuale (Toppy) draggable che può mostrare contenuti
|
|
26
|
-
* in una speech bubble. Il componente può essere trascinato all'interno del suo
|
|
27
|
-
* contenitore e può essere collassato/espanso con un doppio click.
|
|
28
|
-
*/
|
|
29
|
-
declare const ToppyDraggableHelpCenter: React.FC<ToppyDraggableHelpCenterProps>;
|
|
30
|
-
export default ToppyDraggableHelpCenter;
|