@memori.ai/memori-react 8.45.1 → 8.45.4
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/CHANGELOG.md +27 -0
- package/dist/components/Chat/Chat.js +4 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +4 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +2 -1
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/PositionPopover/PositionPopover.js +38 -25
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +3 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -2
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/dist/components/layouts/chat.css +27 -4
- package/dist/context/widgetSurfaceContext.js +2 -2
- package/dist/context/widgetSurfaceContext.js.map +1 -1
- package/dist/helpers/constants.d.ts +3 -2
- package/dist/helpers/constants.js +19 -20
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/positionPopover.d.ts +2 -1
- package/dist/helpers/positionPopover.js +12 -3
- package/dist/helpers/positionPopover.js.map +1 -1
- package/dist/helpers/tts/muteSpeaker.js +4 -3
- package/dist/helpers/tts/muteSpeaker.js.map +1 -1
- package/dist/helpers/usePressTooltip.js +2 -1
- package/dist/helpers/usePressTooltip.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -1
- package/dist/helpers/utils.js +7 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/icons/MemoriIcon.js +1 -1
- package/dist/icons/MemoriIcon.js.map +1 -1
- package/dist/styles.css +1 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/Chat/Chat.js +4 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +2 -1
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +4 -1
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +16 -4
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/esm/components/layouts/chat.css +27 -4
- package/esm/helpers/constants.d.ts +3 -2
- package/esm/helpers/constants.js +18 -19
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/utils.d.ts +2 -1
- package/esm/helpers/utils.js +6 -1
- package/esm/helpers/utils.js.map +1 -1
- package/esm/styles.css +1 -2
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +6 -7
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +0 -3
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +0 -64
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +0 -1
- package/dist/testUtils.d.ts +0 -5
- package/dist/testUtils.js +0 -18
- package/dist/testUtils.js.map +0 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +0 -3
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +0 -62
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +0 -1
- package/src/I18nWrapper.tsx +0 -13
- package/src/__snapshots__/index.test.tsx.snap +0 -96
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +0 -95
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +0 -46
- package/src/components/AgeVerificationModal/AgeVerificationModal.test.tsx +0 -33
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +0 -99
- package/src/components/AgeVerificationModal/__snapshots__/AgeVerificationModal.test.tsx.snap +0 -19
- package/src/components/Auth/Auth.css +0 -57
- package/src/components/Auth/Auth.stories.tsx +0 -90
- package/src/components/Auth/Auth.test.tsx +0 -63
- package/src/components/Auth/Auth.tsx +0 -201
- package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +0 -143
- package/src/components/Avatar/Avatar.css +0 -151
- package/src/components/Avatar/Avatar.stories.tsx +0 -160
- package/src/components/Avatar/Avatar.test.tsx +0 -158
- package/src/components/Avatar/Avatar.tsx +0 -245
- package/src/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.tsx +0 -103
- package/src/components/Avatar/AvatarView/AvatarComponent/avatarComponent.tsx +0 -105
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +0 -338
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.ts +0 -44
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.ts +0 -1091
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.ts +0 -83
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +0 -301
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controls.tsx +0 -100
- package/src/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.tsx +0 -152
- package/src/components/Avatar/AvatarView/AvatarComponent/components/loader.tsx +0 -31
- package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +0 -141
- package/src/components/Avatar/AvatarView/AvatarComponent/lights/Lights.tsx +0 -145
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +0 -111
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.tsx +0 -201
- package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +0 -254
- package/src/components/Avatar/AvatarView/index.tsx +0 -194
- package/src/components/Avatar/AvatarView/utils/hideHands.ts +0 -11
- package/src/components/Avatar/AvatarView/utils/useEyeBlink.ts +0 -100
- package/src/components/Avatar/AvatarView/utils/useHeadMovement.ts +0 -72
- package/src/components/Avatar/AvatarView/utils/useLoadingMorphAnim.ts +0 -38
- package/src/components/Avatar/AvatarView/utils/useMouthAnimation.ts +0 -93
- package/src/components/Avatar/AvatarView/utils/useSmile.ts +0 -39
- package/src/components/Avatar/AvatarView/utils/utils.ts +0 -55
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +0 -246
- package/src/components/Blob/Blob.css +0 -286
- package/src/components/Blob/Blob.stories.tsx +0 -53
- package/src/components/Blob/Blob.test.tsx +0 -18
- package/src/components/Blob/Blob.tsx +0 -26
- package/src/components/Blob/__snapshots__/Blob.test.tsx.snap +0 -80
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +0 -40
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +0 -58
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.test.tsx +0 -53
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx +0 -74
- package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +0 -181
- package/src/components/ChangeMode/ChangeMode.css +0 -22
- package/src/components/ChangeMode/ChangeMode.stories.tsx +0 -50
- package/src/components/ChangeMode/ChangeMode.test.tsx +0 -24
- package/src/components/ChangeMode/ChangeMode.tsx +0 -51
- package/src/components/ChangeMode/__snapshots__/ChangeMode.test.tsx.snap +0 -107
- package/src/components/Chat/Chat.css +0 -285
- package/src/components/Chat/Chat.stories.tsx +0 -1684
- package/src/components/Chat/Chat.test.tsx +0 -372
- package/src/components/Chat/Chat.tsx +0 -778
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +0 -6816
- package/src/components/ChatBubble/ChatBubble.css +0 -430
- package/src/components/ChatBubble/ChatBubble.stories.tsx +0 -1192
- package/src/components/ChatBubble/ChatBubble.test.tsx +0 -481
- package/src/components/ChatBubble/ChatBubble.tsx +0 -776
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +0 -8734
- package/src/components/ChatHistoryDrawer/ChatHistory.css +0 -587
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +0 -410
- package/src/components/ChatHistoryDrawer/ChatHistory.test.tsx +0 -107
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +0 -1298
- package/src/components/ChatHistoryDrawer/__snapshots__/ChatHistory.test.tsx.snap +0 -27
- package/src/components/ChatInputs/ChatInputs.css +0 -340
- package/src/components/ChatInputs/ChatInputs.stories.tsx +0 -251
- package/src/components/ChatInputs/ChatInputs.tsx +0 -487
- package/src/components/ChatTextArea/ChatTextArea.css +0 -185
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
- package/src/components/ChatTextArea/ChatTextArea.test.tsx +0 -28
- package/src/components/ChatTextArea/ChatTextArea.tsx +0 -171
- package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +0 -68
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.css +0 -36
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +0 -296
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.test.tsx +0 -31
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +0 -232
- package/src/components/CompletionProviderStatus/__snapshots__/CompletionProviderStatus.test.tsx.snap +0 -96
- package/src/components/ContentPreviewModal/ContentPreviewModal.css +0 -128
- package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +0 -67
- package/src/components/ContentPreviewModal/index.ts +0 -2
- package/src/components/CustomGLBModelViewer/ModelViewer.css +0 -11
- package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
- package/src/components/CustomGLBModelViewer/ModelViewer.test.tsx +0 -13
- package/src/components/CustomGLBModelViewer/ModelViewer.tsx +0 -37
- package/src/components/CustomGLBModelViewer/__snapshots__/ModelViewer.test.tsx.snap +0 -20
- package/src/components/DateSelector/DateSelector.css +0 -158
- package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
- package/src/components/DateSelector/DateSelector.test.tsx +0 -149
- package/src/components/DateSelector/DateSelector.tsx +0 -251
- package/src/components/DateSelector/__snapshots__/DateSelector.test.tsx.snap +0 -1954
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +0 -54
- package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -67
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +0 -54
- package/src/components/ExpertsDrawer/ExpertsDrawer.test.tsx +0 -53
- package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +0 -69
- package/src/components/ExpertsDrawer/__snapshots__/ExpertsDrawer.test.tsx.snap +0 -11
- package/src/components/ExportHistoryButton/ExportHistoryButton.css +0 -22
- package/src/components/FeedbackButtons/FeedbackButtons.css +0 -107
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +0 -52
- package/src/components/FeedbackButtons/FeedbackButtons.test.tsx +0 -11
- package/src/components/FeedbackButtons/FeedbackButtons.tsx +0 -152
- package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +0 -42
- package/src/components/FilePreview/FilePreview.css +0 -358
- package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
- package/src/components/FilePreview/FilePreview.test.tsx +0 -26
- package/src/components/FilePreview/FilePreview.tsx +0 -277
- package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +0 -185
- package/src/components/Header/ChatConsumptionDropdown.test.tsx +0 -117
- package/src/components/Header/ChatConsumptionDropdown.tsx +0 -275
- package/src/components/Header/Header.css +0 -282
- package/src/components/Header/Header.stories.tsx +0 -338
- package/src/components/Header/Header.test.tsx +0 -371
- package/src/components/Header/Header.tsx +0 -442
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +0 -964
- package/src/components/KnownFacts/KnownFacts.css +0 -19
- package/src/components/KnownFacts/KnownFacts.stories.tsx +0 -80
- package/src/components/KnownFacts/KnownFacts.test.tsx +0 -57
- package/src/components/KnownFacts/KnownFacts.tsx +0 -376
- package/src/components/KnownFacts/__snapshots__/KnownFacts.test.tsx.snap +0 -19
- package/src/components/LoginDrawer/LoginDrawer.css +0 -1616
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +0 -102
- package/src/components/LoginDrawer/LoginDrawer.test.tsx +0 -199
- package/src/components/LoginDrawer/LoginDrawer.tsx +0 -600
- package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +0 -91
- package/src/components/MediaWidget/DocumentCard.test.tsx +0 -45
- package/src/components/MediaWidget/DocumentCard.tsx +0 -19
- package/src/components/MediaWidget/MediaItemWidget.css +0 -1398
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +0 -423
- package/src/components/MediaWidget/MediaItemWidget.test.tsx +0 -248
- package/src/components/MediaWidget/MediaItemWidget.tsx +0 -997
- package/src/components/MediaWidget/MediaItemWidget.types.ts +0 -65
- package/src/components/MediaWidget/MediaItemWidget.utils.test.ts +0 -367
- package/src/components/MediaWidget/MediaItemWidget.utils.ts +0 -227
- package/src/components/MediaWidget/MediaPreviewModal.test.tsx +0 -271
- package/src/components/MediaWidget/MediaPreviewModal.tsx +0 -425
- package/src/components/MediaWidget/MediaWidget.css +0 -131
- package/src/components/MediaWidget/MediaWidget.stories.tsx +0 -319
- package/src/components/MediaWidget/MediaWidget.test.tsx +0 -41
- package/src/components/MediaWidget/MediaWidget.tsx +0 -107
- package/src/components/MediaWidget/__snapshots__/DocumentCard.test.tsx.snap +0 -24
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +0 -791
- package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +0 -154
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -2299
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +0 -163
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +0 -250
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +0 -30
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +0 -467
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.tsx +0 -89
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.ts +0 -619
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/index.ts +0 -9
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +0 -489
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.tsx +0 -90
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/types.ts +0 -73
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.ts +0 -454
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +0 -1059
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +0 -431
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +0 -150
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.tsx +0 -79
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +0 -253
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +0 -561
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +0 -355
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +0 -160
- package/src/components/MemoriArtifactSystem/context/ArtifactContext.tsx +0 -167
- package/src/components/MemoriArtifactSystem/types/artifact.types.ts +0 -35
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +0 -308
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.tsx +0 -379
- package/src/components/MemoriArtifactSystem/utils/applyEdits.test.ts +0 -85
- package/src/components/MemoriArtifactSystem/utils/applyEdits.ts +0 -173
- package/src/components/MemoriWidget/MemoriWidget.css +0 -220
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +0 -274
- package/src/components/MemoriWidget/MemoriWidget.tsx +0 -3930
- package/src/components/MicrophoneButton/MicrophoneButton.css +0 -142
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +0 -52
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +0 -128
- package/src/components/PositionDrawer/PositionDrawer.stories.tsx +0 -51
- package/src/components/PositionDrawer/PositionDrawer.test.tsx +0 -39
- package/src/components/PositionDrawer/PositionDrawer.tsx +0 -50
- package/src/components/PositionDrawer/__snapshots__/PositionDrawer.test.tsx.snap +0 -17
- package/src/components/PoweredBy/PoweredBy.css +0 -47
- package/src/components/PoweredBy/PoweredBy.stories.tsx +0 -75
- package/src/components/PoweredBy/PoweredBy.test.tsx +0 -15
- package/src/components/PoweredBy/PoweredBy.tsx +0 -44
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +0 -55
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.css +0 -47
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +0 -58
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.test.tsx +0 -17
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.tsx +0 -82
- package/src/components/SendOnEnterMenu/__snapshots__/SendOnEnterMenu.test.tsx.snap +0 -57
- package/src/components/SettingsDrawer/SettingsDrawer.css +0 -24
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +0 -94
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +0 -202
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +0 -255
- package/src/components/SettingsDrawer/__snapshots__/SettingsDrawer.test.tsx.snap +0 -59
- package/src/components/ShareButton/ShareButton.css +0 -73
- package/src/components/ShareButton/ShareButton.stories.tsx +0 -98
- package/src/components/ShareButton/ShareButton.test.tsx +0 -53
- package/src/components/ShareButton/ShareButton.tsx +0 -395
- package/src/components/ShareButton/__snapshots__/ShareButton.test.tsx.snap +0 -316
- package/src/components/Snippet/Snippet.css +0 -142
- package/src/components/Snippet/Snippet.stories.tsx +0 -286
- package/src/components/Snippet/Snippet.test.tsx +0 -176
- package/src/components/Snippet/Snippet.tsx +0 -148
- package/src/components/Snippet/__snapshots__/Snippet.test.tsx.snap +0 -603
- package/src/components/StartPanel/StartPanel.css +0 -273
- package/src/components/StartPanel/StartPanel.stories.tsx +0 -404
- package/src/components/StartPanel/StartPanel.test.tsx +0 -360
- package/src/components/StartPanel/StartPanel.tsx +0 -426
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +0 -1986
- package/src/components/Typing/Typing.stories.tsx +0 -130
- package/src/components/Typing/Typing.test.tsx +0 -62
- package/src/components/Typing/Typing.tsx +0 -154
- package/src/components/Typing/__snapshots__/Typing.test.tsx.snap +0 -133
- package/src/components/UploadButton/UploadButton.css +0 -542
- package/src/components/UploadButton/UploadButton.stories.tsx +0 -376
- package/src/components/UploadButton/UploadButton.test.tsx +0 -11
- package/src/components/UploadButton/UploadButton.tsx +0 -684
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +0 -405
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +0 -538
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +0 -165
- package/src/components/VenueWidget/VenueWidget.css +0 -163
- package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -66
- package/src/components/VenueWidget/VenueWidget.test.tsx +0 -49
- package/src/components/VenueWidget/VenueWidget.tsx +0 -458
- package/src/components/VenueWidget/__snapshots__/VenueWidget.test.tsx.snap +0 -370
- package/src/components/WhyThisAnswer/WhyThisAnswer.css +0 -171
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +0 -285
- package/src/components/WhyThisAnswer/WhyThisAnswer.test.tsx +0 -245
- package/src/components/WhyThisAnswer/WhyThisAnswer.tsx +0 -233
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +0 -27
- package/src/components/icons/AI.tsx +0 -34
- package/src/components/icons/Alert.tsx +0 -31
- package/src/components/icons/ArrowUp.tsx +0 -28
- package/src/components/icons/Bug.tsx +0 -81
- package/src/components/icons/Chat.tsx +0 -30
- package/src/components/icons/ChevronDown.tsx +0 -26
- package/src/components/icons/ChevronLeft.tsx +0 -28
- package/src/components/icons/ChevronRight.tsx +0 -28
- package/src/components/icons/ChevronUp.tsx +0 -24
- package/src/components/icons/Clear.tsx +0 -23
- package/src/components/icons/Close.tsx +0 -30
- package/src/components/icons/Code.tsx +0 -24
- package/src/components/icons/Copy.tsx +0 -23
- package/src/components/icons/DeepThought.tsx +0 -38
- package/src/components/icons/Delete.tsx +0 -23
- package/src/components/icons/Document.tsx +0 -50
- package/src/components/icons/Download.tsx +0 -23
- package/src/components/icons/Edit.tsx +0 -17
- package/src/components/icons/Expand.tsx +0 -23
- package/src/components/icons/Eye.tsx +0 -17
- package/src/components/icons/EyeInvisible.tsx +0 -24
- package/src/components/icons/Facebook.tsx +0 -23
- package/src/components/icons/Feedback.tsx +0 -24
- package/src/components/icons/File.tsx +0 -17
- package/src/components/icons/FileExcel.tsx +0 -23
- package/src/components/icons/FilePdf.tsx +0 -23
- package/src/components/icons/FileWord.tsx +0 -23
- package/src/components/icons/Fullscreen.tsx +0 -23
- package/src/components/icons/FullscreenExit.tsx +0 -23
- package/src/components/icons/GasStation.tsx +0 -36
- package/src/components/icons/Group.tsx +0 -30
- package/src/components/icons/History.tsx +0 -33
- package/src/components/icons/Image.tsx +0 -37
- package/src/components/icons/Info.tsx +0 -31
- package/src/components/icons/Link.tsx +0 -17
- package/src/components/icons/Linkedin.tsx +0 -23
- package/src/components/icons/Loading.tsx +0 -28
- package/src/components/icons/Logout.tsx +0 -27
- package/src/components/icons/Mail.tsx +0 -17
- package/src/components/icons/MapMarker.tsx +0 -26
- package/src/components/icons/MenuHorizontal.tsx +0 -29
- package/src/components/icons/MenuVertical.tsx +0 -29
- package/src/components/icons/Message.tsx +0 -23
- package/src/components/icons/Microphone.tsx +0 -23
- package/src/components/icons/Minus.tsx +0 -23
- package/src/components/icons/MinusCircle.tsx +0 -24
- package/src/components/icons/PaperClip.tsx +0 -23
- package/src/components/icons/Picture.tsx +0 -23
- package/src/components/icons/Plus.tsx +0 -18
- package/src/components/icons/Preview.tsx +0 -29
- package/src/components/icons/Print.tsx +0 -38
- package/src/components/icons/QuestionHelp.tsx +0 -30
- package/src/components/icons/Refresh.tsx +0 -30
- package/src/components/icons/SelectIcon.tsx +0 -28
- package/src/components/icons/Send.tsx +0 -17
- package/src/components/icons/Setting.tsx +0 -23
- package/src/components/icons/Share.tsx +0 -23
- package/src/components/icons/Sound.tsx +0 -23
- package/src/components/icons/SoundDeactivated.tsx +0 -27
- package/src/components/icons/Telegram.tsx +0 -26
- package/src/components/icons/ThumbDown.tsx +0 -29
- package/src/components/icons/ThumbUp.tsx +0 -29
- package/src/components/icons/Translation.tsx +0 -24
- package/src/components/icons/Twitter.tsx +0 -23
- package/src/components/icons/Upload.tsx +0 -34
- package/src/components/icons/User.tsx +0 -17
- package/src/components/icons/Warning.tsx +0 -24
- package/src/components/icons/WhatsApp.tsx +0 -24
- package/src/components/icons/icons.stories.css +0 -5
- package/src/components/icons/icons.stories.tsx +0 -81
- package/src/components/icons/loading.css +0 -14
- package/src/components/layouts/Chat.test.tsx +0 -40
- package/src/components/layouts/Chat.tsx +0 -69
- package/src/components/layouts/FullBody/FullBody.stories.tsx +0 -110
- package/src/components/layouts/FullPage.test.tsx +0 -65
- package/src/components/layouts/FullPage.tsx +0 -80
- package/src/components/layouts/HiddenChat.test.tsx +0 -40
- package/src/components/layouts/HiddenChat.tsx +0 -233
- package/src/components/layouts/Totem/Totem.stories.tsx +0 -131
- package/src/components/layouts/Totem.test.tsx +0 -40
- package/src/components/layouts/Totem.tsx +0 -49
- package/src/components/layouts/WebsiteAssistant.test.tsx +0 -40
- package/src/components/layouts/WebsiteAssistant.tsx +0 -132
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +0 -131
- package/src/components/layouts/ZoomedFullBody.test.tsx +0 -40
- package/src/components/layouts/ZoomedFullBody.tsx +0 -81
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +0 -457
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +0 -1045
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +0 -460
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +0 -566
- package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +0 -59
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +0 -523
- package/src/components/layouts/chat.css +0 -451
- package/src/components/layouts/hidden-chat.css +0 -276
- package/src/components/layouts/layouts.stories.tsx +0 -231
- package/src/components/layouts/totem.css +0 -221
- package/src/components/layouts/website-assistant.css +0 -677
- package/src/components/layouts/zoomed-full-body.css +0 -18
- package/src/components/ui/Alert.css +0 -93
- package/src/components/ui/Alert.stories.tsx +0 -137
- package/src/components/ui/Alert.test.tsx +0 -129
- package/src/components/ui/Alert.tsx +0 -123
- package/src/components/ui/Button.css +0 -167
- package/src/components/ui/Button.stories.tsx +0 -156
- package/src/components/ui/Button.test.tsx +0 -74
- package/src/components/ui/Button.tsx +0 -107
- package/src/components/ui/Card.css +0 -65
- package/src/components/ui/Card.stories.tsx +0 -95
- package/src/components/ui/Card.test.tsx +0 -47
- package/src/components/ui/Card.tsx +0 -48
- package/src/components/ui/Checkbox.css +0 -116
- package/src/components/ui/Checkbox.stories.tsx +0 -74
- package/src/components/ui/Checkbox.test.tsx +0 -28
- package/src/components/ui/Checkbox.tsx +0 -58
- package/src/components/ui/ConfirmDialog.css +0 -42
- package/src/components/ui/ConfirmDialog.stories.tsx +0 -216
- package/src/components/ui/ConfirmDialog.test.tsx +0 -124
- package/src/components/ui/ConfirmDialog.tsx +0 -58
- package/src/components/ui/Details.css +0 -66
- package/src/components/ui/Drawer.css +0 -270
- package/src/components/ui/Drawer.stories.tsx +0 -267
- package/src/components/ui/Drawer.test.tsx +0 -130
- package/src/components/ui/Drawer.tsx +0 -293
- package/src/components/ui/Dropdown.css +0 -173
- package/src/components/ui/Dropdown.tsx +0 -63
- package/src/components/ui/Expandable.css +0 -15
- package/src/components/ui/Expandable.stories.tsx +0 -180
- package/src/components/ui/Expandable.test.tsx +0 -107
- package/src/components/ui/Expandable.tsx +0 -121
- package/src/components/ui/Modal.css +0 -98
- package/src/components/ui/Modal.stories.tsx +0 -171
- package/src/components/ui/Modal.test.tsx +0 -111
- package/src/components/ui/Modal.tsx +0 -117
- package/src/components/ui/Select.css +0 -138
- package/src/components/ui/Select.stories.tsx +0 -79
- package/src/components/ui/Select.test.tsx +0 -84
- package/src/components/ui/Select.tsx +0 -79
- package/src/components/ui/Slider.css +0 -192
- package/src/components/ui/Slider.stories.tsx +0 -63
- package/src/components/ui/Slider.tsx +0 -142
- package/src/components/ui/Spin.css +0 -31
- package/src/components/ui/Spin.stories.tsx +0 -64
- package/src/components/ui/Spin.test.tsx +0 -41
- package/src/components/ui/Spin.tsx +0 -31
- package/src/components/ui/Table.css +0 -132
- package/src/components/ui/Tooltip.css +0 -171
- package/src/components/ui/Tooltip.stories.tsx +0 -109
- package/src/components/ui/Tooltip.test.tsx +0 -102
- package/src/components/ui/Tooltip.tsx +0 -163
- package/src/components/ui/__snapshots__/Alert.test.tsx.snap +0 -59
- package/src/components/ui/__snapshots__/Button.test.tsx.snap +0 -204
- package/src/components/ui/__snapshots__/Card.test.tsx.snap +0 -321
- package/src/components/ui/__snapshots__/Checkbox.test.tsx.snap +0 -131
- package/src/components/ui/__snapshots__/ConfirmDialog.test.tsx.snap +0 -35
- package/src/components/ui/__snapshots__/Drawer.test.tsx.snap +0 -67
- package/src/components/ui/__snapshots__/Expandable.test.tsx.snap +0 -159
- package/src/components/ui/__snapshots__/Modal.test.tsx.snap +0 -59
- package/src/components/ui/__snapshots__/Select.test.tsx.snap +0 -254
- package/src/components/ui/__snapshots__/Spin.test.tsx.snap +0 -193
- package/src/components/ui/__snapshots__/Tooltip.test.tsx.snap +0 -113
- package/src/components/ui/definitions.stories.tsx +0 -139
- package/src/context/visemeContext.tsx +0 -384
- package/src/helpers/chatPdfExport.ts +0 -544
- package/src/helpers/configuration.ts +0 -42
- package/src/helpers/constants.ts +0 -267
- package/src/helpers/convertDocument.test.ts +0 -67
- package/src/helpers/convertDocument.ts +0 -35
- package/src/helpers/credits.ts +0 -54
- package/src/helpers/error.test.ts +0 -29
- package/src/helpers/error.ts +0 -278
- package/src/helpers/imageCompression.ts +0 -230
- package/src/helpers/llmUsage.ts +0 -328
- package/src/helpers/markedExtendedTables.js +0 -217
- package/src/helpers/media.test.ts +0 -169
- package/src/helpers/media.ts +0 -81
- package/src/helpers/message.test.ts +0 -126
- package/src/helpers/message.ts +0 -219
- package/src/helpers/nats/getNatsConfig.ts +0 -148
- package/src/helpers/nats/isSessionExpiredError.test.ts +0 -38
- package/src/helpers/nats/isSessionExpiredError.ts +0 -51
- package/src/helpers/nats/useNats.test.tsx +0 -81
- package/src/helpers/nats/useNats.ts +0 -204
- package/src/helpers/nats/useNatsSession.test.ts +0 -16
- package/src/helpers/nats/useNatsSession.ts +0 -460
- package/src/helpers/piiDetection.test.ts +0 -186
- package/src/helpers/piiDetection.ts +0 -91
- package/src/helpers/sanitizer.ts +0 -17
- package/src/helpers/statistics.ts +0 -58
- package/src/helpers/stt/useSTT.ts +0 -515
- package/src/helpers/translations.ts +0 -39
- package/src/helpers/tts/ttsVoiceUtility.ts +0 -275
- package/src/helpers/tts/useTTS.ts +0 -621
- package/src/helpers/utils.test.ts +0 -321
- package/src/helpers/utils.ts +0 -586
- package/src/helpers/venue.ts +0 -36
- package/src/i18n.ts +0 -39
- package/src/index.stories.tsx +0 -220
- package/src/index.test.tsx +0 -156
- package/src/index.tsx +0 -592
- package/src/locales/de.json +0 -680
- package/src/locales/en.json +0 -754
- package/src/locales/es.json +0 -682
- package/src/locales/fr.json +0 -682
- package/src/locales/it.json +0 -750
- package/src/mocks/data.ts +0 -790
- package/src/styles.css +0 -126
- package/src/types/integration.test.ts +0 -32
- package/src/types/integration.ts +0 -31
- package/src/types/layout.ts +0 -50
- package/src/version.ts +0 -2
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
.memori-alert {
|
|
2
|
-
position: fixed;
|
|
3
|
-
z-index: 1000;
|
|
4
|
-
top: 20px;
|
|
5
|
-
right: 20px;
|
|
6
|
-
width: var(--memori-alert--width, 400px);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.memori-alert--container {
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: flex-start;
|
|
12
|
-
padding: 16px;
|
|
13
|
-
border-radius: 8px;
|
|
14
|
-
margin-bottom: 8px;
|
|
15
|
-
background-color: white;
|
|
16
|
-
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.memori-alert--icon {
|
|
20
|
-
flex-shrink: 0;
|
|
21
|
-
margin-right: 12px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.memori-alert--content {
|
|
25
|
-
min-width: 0;
|
|
26
|
-
flex: 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.memori-alert--title {
|
|
30
|
-
margin-bottom: 4px;
|
|
31
|
-
font-size: 16px;
|
|
32
|
-
font-weight: 600;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.memori-alert--description {
|
|
36
|
-
color: rgb(107 114 128);
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.memori-alert--actions {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
margin-left: 16px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.memori-alert--action {
|
|
47
|
-
margin-right: 8px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.memori-alert--close {
|
|
51
|
-
flex-shrink: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/* Alert types */
|
|
55
|
-
.memori-alert--success {
|
|
56
|
-
--alert-color: rgb(34 197 94);
|
|
57
|
-
--alert-bg: rgb(240 253 244);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.memori-alert--warning {
|
|
61
|
-
--alert-color: rgb(234 179 8);
|
|
62
|
-
--alert-bg: rgb(254 252 232);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.memori-alert--error {
|
|
66
|
-
--alert-color: rgb(239 68 68);
|
|
67
|
-
--alert-bg: rgb(254 242 242);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.memori-alert--info {
|
|
71
|
-
--alert-color: rgb(59 130 246);
|
|
72
|
-
--alert-bg: rgb(239 246 255);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.memori-alert--success .memori-alert--container {
|
|
76
|
-
border: 1px solid var(--alert-color);
|
|
77
|
-
background-color: var(--alert-bg);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.memori-alert--warning .memori-alert--container {
|
|
81
|
-
border: 1px solid var(--alert-color);
|
|
82
|
-
background-color: var(--alert-bg);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.memori-alert--error .memori-alert--container {
|
|
86
|
-
border: 1px solid var(--alert-color);
|
|
87
|
-
background-color: var(--alert-bg);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.memori-alert--info .memori-alert--container {
|
|
91
|
-
border: 1px solid var(--alert-color);
|
|
92
|
-
background-color: var(--alert-bg);
|
|
93
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import Alert, { Props } from './Alert';
|
|
4
|
-
import Button from './Button';
|
|
5
|
-
import './Alert.css';
|
|
6
|
-
|
|
7
|
-
const meta: Meta = {
|
|
8
|
-
title: 'UI/Alert',
|
|
9
|
-
component: Alert,
|
|
10
|
-
argTypes: {
|
|
11
|
-
type: {
|
|
12
|
-
control: {
|
|
13
|
-
type: 'select',
|
|
14
|
-
options: ['success', 'warning', 'error', 'info']
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
title: {
|
|
18
|
-
control: {
|
|
19
|
-
type: 'text'
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
description: {
|
|
23
|
-
control: {
|
|
24
|
-
type: 'text'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
open: {
|
|
28
|
-
control: {
|
|
29
|
-
type: 'boolean'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
closable: {
|
|
33
|
-
control: {
|
|
34
|
-
type: 'boolean'
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
width: {
|
|
38
|
-
control: {
|
|
39
|
-
type: 'text'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
parameters: {
|
|
44
|
-
controls: { expanded: true }
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default meta;
|
|
49
|
-
|
|
50
|
-
const Template: Story<Props> = args => {
|
|
51
|
-
const [isOpen, setIsOpen] = React.useState(!!args.open);
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
<Button onClick={() => setIsOpen(true)}>Show Alert</Button>
|
|
55
|
-
<Alert
|
|
56
|
-
{...args}
|
|
57
|
-
open={isOpen}
|
|
58
|
-
onClose={() => setIsOpen(false)}
|
|
59
|
-
/>
|
|
60
|
-
</>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const Default = Template.bind({});
|
|
65
|
-
Default.args = {
|
|
66
|
-
open: false,
|
|
67
|
-
type: 'info',
|
|
68
|
-
title: 'Information',
|
|
69
|
-
description: 'This is an informative alert message.'
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const Success = Template.bind({});
|
|
73
|
-
Success.args = {
|
|
74
|
-
open: true,
|
|
75
|
-
type: 'success',
|
|
76
|
-
title: 'Success!',
|
|
77
|
-
description: 'Operation completed successfully.'
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const Warning = Template.bind({});
|
|
81
|
-
Warning.args = {
|
|
82
|
-
open: true,
|
|
83
|
-
type: 'warning',
|
|
84
|
-
title: 'Warning',
|
|
85
|
-
description: 'Please review this important warning message.'
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const Error = Template.bind({});
|
|
89
|
-
Error.args = {
|
|
90
|
-
open: true,
|
|
91
|
-
type: 'error',
|
|
92
|
-
title: 'Error',
|
|
93
|
-
description: 'An error occurred while processing your request.'
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const WithAction = Template.bind({});
|
|
97
|
-
WithAction.args = {
|
|
98
|
-
open: true,
|
|
99
|
-
type: 'info',
|
|
100
|
-
title: 'Update Available',
|
|
101
|
-
description: 'A new version is available.',
|
|
102
|
-
action: <Button primary>Update Now</Button>
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const NonClosable = Template.bind({});
|
|
106
|
-
NonClosable.args = {
|
|
107
|
-
open: true,
|
|
108
|
-
type: 'warning',
|
|
109
|
-
title: 'Important Notice',
|
|
110
|
-
description: 'This message cannot be dismissed.',
|
|
111
|
-
closable: false
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const CustomWidth = Template.bind({});
|
|
115
|
-
CustomWidth.args = {
|
|
116
|
-
open: true,
|
|
117
|
-
type: 'info',
|
|
118
|
-
title: 'Custom Width',
|
|
119
|
-
description: 'This alert has a custom width.',
|
|
120
|
-
width: '500px'
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const WithoutDescription = Template.bind({});
|
|
124
|
-
WithoutDescription.args = {
|
|
125
|
-
open: true,
|
|
126
|
-
type: 'success',
|
|
127
|
-
title: 'Operation Successful'
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const AutoDismiss = Template.bind({});
|
|
131
|
-
AutoDismiss.args = {
|
|
132
|
-
open: true,
|
|
133
|
-
type: 'success',
|
|
134
|
-
title: 'Auto Dismiss',
|
|
135
|
-
description: 'This alert will dismiss automatically after 3 seconds.',
|
|
136
|
-
duration: 3000
|
|
137
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent, act } from '@testing-library/react';
|
|
3
|
-
import Alert from './Alert';
|
|
4
|
-
import Warning from '../icons/Warning';
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
// Mock IntersectionObserver
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
window.IntersectionObserver = jest.fn(() => ({
|
|
10
|
-
observe: jest.fn(),
|
|
11
|
-
unobserve: jest.fn(),
|
|
12
|
-
disconnect: jest.fn(),
|
|
13
|
-
takeRecords: jest.fn(),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
// Mock setTimeout/clearTimeout
|
|
17
|
-
jest.useFakeTimers();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
jest.useRealTimers();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('Alert Component', () => {
|
|
25
|
-
it('renders Alert unchanged', () => {
|
|
26
|
-
const { container } = render(
|
|
27
|
-
<Alert
|
|
28
|
-
open={false}
|
|
29
|
-
onClose={jest.fn()}
|
|
30
|
-
title="Test Alert"
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
expect(container).toMatchSnapshot();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('renders Alert open unchanged', () => {
|
|
37
|
-
const { container } = render(
|
|
38
|
-
<Alert
|
|
39
|
-
open={true}
|
|
40
|
-
onClose={jest.fn()}
|
|
41
|
-
title="Test Alert"
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
expect(container).toMatchSnapshot();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('calls onClose when close button is clicked', () => {
|
|
48
|
-
const onClose = jest.fn();
|
|
49
|
-
render(
|
|
50
|
-
<Alert
|
|
51
|
-
open={true}
|
|
52
|
-
onClose={onClose}
|
|
53
|
-
title="Test Alert"
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const closeButton = screen.getByTitle('close');
|
|
58
|
-
fireEvent.click(closeButton);
|
|
59
|
-
expect(onClose).toHaveBeenCalled();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
it('auto-dismisses after duration', () => {
|
|
64
|
-
const onClose = jest.fn();
|
|
65
|
-
render(
|
|
66
|
-
<Alert
|
|
67
|
-
open={true}
|
|
68
|
-
onClose={onClose}
|
|
69
|
-
title="Test Alert"
|
|
70
|
-
duration={3000}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
act(() => {
|
|
75
|
-
jest.advanceTimersByTime(3000);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
expect(onClose).toHaveBeenCalled();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('renders with custom width', () => {
|
|
82
|
-
const { container } = render(
|
|
83
|
-
<Alert
|
|
84
|
-
open={true}
|
|
85
|
-
onClose={jest.fn()}
|
|
86
|
-
title="Test Alert"
|
|
87
|
-
width="500px"
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
const style = window.getComputedStyle(container.firstChild as Element);
|
|
92
|
-
expect(style.getPropertyValue('--memori-alert--width')).toBe('500px');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('renders with action button', () => {
|
|
96
|
-
const actionClick = jest.fn();
|
|
97
|
-
render(
|
|
98
|
-
<Alert
|
|
99
|
-
open={true}
|
|
100
|
-
onClose={jest.fn()}
|
|
101
|
-
title="Test Alert"
|
|
102
|
-
action={<button onClick={actionClick}>Action</button>}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const actionButton = screen.getByText('Action');
|
|
107
|
-
fireEvent.click(actionButton);
|
|
108
|
-
expect(actionClick).toHaveBeenCalled();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('cleans up timer on unmount', () => {
|
|
112
|
-
const onClose = jest.fn();
|
|
113
|
-
const { unmount } = render(
|
|
114
|
-
<Alert
|
|
115
|
-
open={true}
|
|
116
|
-
onClose={onClose}
|
|
117
|
-
title="Test Alert"
|
|
118
|
-
duration={3000}
|
|
119
|
-
/>
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
unmount();
|
|
123
|
-
act(() => {
|
|
124
|
-
jest.advanceTimersByTime(3000);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
expect(onClose).not.toHaveBeenCalled();
|
|
128
|
-
});
|
|
129
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
import { Transition } from '@headlessui/react';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import Close from '../icons/Close';
|
|
5
|
-
import Button from './Button';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
|
-
export type AlertType = 'success' | 'warning' | 'error' | 'info';
|
|
9
|
-
|
|
10
|
-
export interface Props {
|
|
11
|
-
open?: boolean;
|
|
12
|
-
onClose: (value: boolean) => void;
|
|
13
|
-
className?: string;
|
|
14
|
-
title?: string | JSX.Element | React.ReactNode;
|
|
15
|
-
description?: string | JSX.Element | React.ReactNode;
|
|
16
|
-
children?: JSX.Element | React.ReactNode;
|
|
17
|
-
type?: AlertType;
|
|
18
|
-
icon?: JSX.Element | React.ReactNode;
|
|
19
|
-
closable?: boolean;
|
|
20
|
-
duration?: number | null;
|
|
21
|
-
action?: JSX.Element | React.ReactNode;
|
|
22
|
-
width?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const Alert: FC<Props> = ({
|
|
26
|
-
open = false,
|
|
27
|
-
onClose,
|
|
28
|
-
className,
|
|
29
|
-
title,
|
|
30
|
-
description,
|
|
31
|
-
children,
|
|
32
|
-
type = 'info',
|
|
33
|
-
icon,
|
|
34
|
-
closable = true,
|
|
35
|
-
duration = null,
|
|
36
|
-
action,
|
|
37
|
-
width = '400px',
|
|
38
|
-
}: Props) => {
|
|
39
|
-
const { t } = useTranslation();
|
|
40
|
-
|
|
41
|
-
// Auto-close functionality
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (duration && open) {
|
|
44
|
-
const timer = setTimeout(() => {
|
|
45
|
-
onClose(false);
|
|
46
|
-
}, duration);
|
|
47
|
-
return () => clearTimeout(timer);
|
|
48
|
-
}
|
|
49
|
-
}, [duration, open, onClose]);
|
|
50
|
-
|
|
51
|
-
const getTypeStyles = (type: AlertType) => {
|
|
52
|
-
switch (type) {
|
|
53
|
-
case 'success':
|
|
54
|
-
return 'memori-alert--success';
|
|
55
|
-
case 'warning':
|
|
56
|
-
return 'memori-alert--warning';
|
|
57
|
-
case 'error':
|
|
58
|
-
return 'memori-alert--error';
|
|
59
|
-
default:
|
|
60
|
-
return 'memori-alert--info';
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Transition
|
|
66
|
-
show={open}
|
|
67
|
-
as={React.Fragment}
|
|
68
|
-
appear
|
|
69
|
-
>
|
|
70
|
-
<div className={cx('memori-alert', getTypeStyles(type), className)}>
|
|
71
|
-
<style
|
|
72
|
-
dangerouslySetInnerHTML={{
|
|
73
|
-
__html: `
|
|
74
|
-
.memori-alert {
|
|
75
|
-
--memori-alert--width: ${width};
|
|
76
|
-
}
|
|
77
|
-
`,
|
|
78
|
-
}}
|
|
79
|
-
/>
|
|
80
|
-
<Transition.Child
|
|
81
|
-
as={React.Fragment}
|
|
82
|
-
enter="ease-out duration-300"
|
|
83
|
-
enterFrom="opacity-0 translate-y-4"
|
|
84
|
-
enterTo="opacity-100 translate-y-0"
|
|
85
|
-
leave="ease-in duration-200"
|
|
86
|
-
leaveFrom="opacity-100 translate-y-0"
|
|
87
|
-
leaveTo="opacity-0 translate-y-4"
|
|
88
|
-
>
|
|
89
|
-
<div className="memori-alert--container">
|
|
90
|
-
{icon && <div className="memori-alert--icon">{icon}</div>}
|
|
91
|
-
|
|
92
|
-
<div className="memori-alert--content">
|
|
93
|
-
{title && (
|
|
94
|
-
<div className="memori-alert--title">{title}</div>
|
|
95
|
-
)}
|
|
96
|
-
{description && (
|
|
97
|
-
<div className="memori-alert--description">{description}</div>
|
|
98
|
-
)}
|
|
99
|
-
{children}
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div className="memori-alert--actions">
|
|
103
|
-
{action && <div className="memori-alert--action">{action}</div>}
|
|
104
|
-
{closable && (
|
|
105
|
-
<Button
|
|
106
|
-
ghost
|
|
107
|
-
padded
|
|
108
|
-
shape="circle"
|
|
109
|
-
icon={<Close />}
|
|
110
|
-
title={t('close') || 'Close'}
|
|
111
|
-
onClick={() => onClose(false)}
|
|
112
|
-
className="memori-alert--close"
|
|
113
|
-
/>
|
|
114
|
-
)}
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
</Transition.Child>
|
|
118
|
-
</div>
|
|
119
|
-
</Transition>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default Alert;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
.memori-button {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
padding: 4px 15px;
|
|
6
|
-
border: 1px solid var(--memori-button-border-color, #d9d9d9);
|
|
7
|
-
border-radius: var(--memori-button-radius, 5px);
|
|
8
|
-
background: var(--memori-button-bg, #fff);
|
|
9
|
-
box-shadow: var(--memori-button-box-shadow);
|
|
10
|
-
color: var(--memori-button-text, #333);
|
|
11
|
-
font-family: var(--memori-font-family);
|
|
12
|
-
font-size: 14px;
|
|
13
|
-
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
14
|
-
}
|
|
15
|
-
.memori-button--active {
|
|
16
|
-
background: var(--memori-primary);
|
|
17
|
-
color: var(--memori-primary-text);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.memori-button:hover {
|
|
21
|
-
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02), 0 4px 8px rgba(0, 0, 0, 0.04);
|
|
22
|
-
color: #333;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.memori-button:hover,
|
|
27
|
-
.memori-button:focus {
|
|
28
|
-
border-color: var(--memori-primary);
|
|
29
|
-
color: var(--memori-primary);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.memori-button:focus {
|
|
33
|
-
outline-color: var(--memori-primary);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.memori-button:active {
|
|
37
|
-
box-shadow: inset var(--memori-button-box-shadow);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.memori-button--padded {
|
|
41
|
-
padding: var(--memori-button-padding);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.memori-button--block {
|
|
45
|
-
display: block;
|
|
46
|
-
width: 100%;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.memori-button--primary {
|
|
50
|
-
background: var(--memori-primary);
|
|
51
|
-
color: var(--memori-primary-text);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.memori-button--primary:hover,
|
|
55
|
-
.memori-button--primary:focus {
|
|
56
|
-
color: var(--memori-primary-text);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.memori-button--primary:active {
|
|
60
|
-
transform: scale(0.95);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.memori-button--outlined {
|
|
64
|
-
border-color: var(--memori-primary);
|
|
65
|
-
background: none;
|
|
66
|
-
color: var(--memori-primary);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.memori-button--outlined:hover,
|
|
70
|
-
.memori-button--outlined:focus {
|
|
71
|
-
border-color: var(--memori-primary);
|
|
72
|
-
background-color: var(--memori-primary);
|
|
73
|
-
color: var(--memori-primary-text);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.memori-button--outlined:active {
|
|
77
|
-
transform: scale(0.95);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.memori-button--ghost {
|
|
81
|
-
border: 1px solid transparent;
|
|
82
|
-
background: none;
|
|
83
|
-
box-shadow: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.memori-button--ghost:hover,
|
|
87
|
-
.memori-button--ghost:focus {
|
|
88
|
-
border-color: transparent;
|
|
89
|
-
background: rgba(0, 0, 0, 0.04);
|
|
90
|
-
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02), 0 4px 8px rgba(0, 0, 0, 0.04);
|
|
91
|
-
color: inherit;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.memori-button--ghost:focus {
|
|
95
|
-
border: 1px solid var(--memori-primary);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.memori-button--square {
|
|
99
|
-
border-radius: 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.memori-button--rounded {
|
|
103
|
-
border-radius: var(--memori-button-radius);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.memori-button--danger {
|
|
107
|
-
border-color: var(--memori-error-color);
|
|
108
|
-
background: rgba(0, 0, 0, 0.02);
|
|
109
|
-
color: var(--memori-error-color);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.memori-button--danger:hover,
|
|
113
|
-
.memori-button--danger:focus {
|
|
114
|
-
border-color: var(--memori-error-color);
|
|
115
|
-
background-color: var(--memori-error-color);
|
|
116
|
-
color: #fff;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.memori-button--danger.memori-button--ghost {
|
|
120
|
-
border-color: transparent;
|
|
121
|
-
background: none;
|
|
122
|
-
box-shadow: none;
|
|
123
|
-
color: var(--memori-error-color);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.memori-button--danger.memori-button--ghost:hover,
|
|
127
|
-
.memori-button--danger.memori-button--ghost:focus {
|
|
128
|
-
border-color: var(--memori-error-color);
|
|
129
|
-
background: rgba(0, 0, 0, 0.02);
|
|
130
|
-
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02), 0 4px 8px rgba(0, 0, 0, 0.04);
|
|
131
|
-
color: var(--memori-error-color);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.memori-button--circle {
|
|
135
|
-
padding: 0.75em;
|
|
136
|
-
border-radius: 50%;
|
|
137
|
-
aspect-ratio: 1/1;
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.memori-button--icon {
|
|
142
|
-
display: inline-flex;
|
|
143
|
-
color: currentColor;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.memori-button--icon svg {
|
|
147
|
-
width: 1.25em;
|
|
148
|
-
height: 1.25em;
|
|
149
|
-
fill: currentColor;
|
|
150
|
-
font-size: 1em;
|
|
151
|
-
line-height: 1;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.memori-button--icon svg[fill='none'] {
|
|
155
|
-
fill: none;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.memori-button--with-icon .memori-button--icon {
|
|
159
|
-
margin-right: 0.5em;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.memori-button[disabled] {
|
|
163
|
-
background: var(--memori-button-disabled-bg, #ccc);
|
|
164
|
-
color: var(--memori-button-disabled-color, #000);
|
|
165
|
-
cursor: not-allowed;
|
|
166
|
-
opacity: 0.5;
|
|
167
|
-
}
|