@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,74 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import Checkbox, { Props } from './Checkbox';
|
|
4
|
-
import './Checkbox.css';
|
|
5
|
-
|
|
6
|
-
const meta: Meta = {
|
|
7
|
-
title: 'UI/Checkbox',
|
|
8
|
-
component: Checkbox,
|
|
9
|
-
argTypes: {
|
|
10
|
-
label: {
|
|
11
|
-
control: {
|
|
12
|
-
type: 'text',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
className: {
|
|
16
|
-
control: {
|
|
17
|
-
type: 'text',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
disabled: {
|
|
21
|
-
control: {
|
|
22
|
-
type: 'boolean',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
parameters: {
|
|
27
|
-
controls: { expanded: true },
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default meta;
|
|
32
|
-
|
|
33
|
-
const Template: Story<Props> = args => <Checkbox {...args} />;
|
|
34
|
-
|
|
35
|
-
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
36
|
-
// https://storybook.js.org/docs/react/workflows/unit-testing
|
|
37
|
-
export const Default = Template.bind({});
|
|
38
|
-
Default.args = {
|
|
39
|
-
label: 'Check me',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const Checked = Template.bind({});
|
|
43
|
-
Checked.args = {
|
|
44
|
-
label: 'Uncheck me',
|
|
45
|
-
checked: true,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Disabled = Template.bind({});
|
|
49
|
-
Disabled.args = {
|
|
50
|
-
label: 'Do not check me',
|
|
51
|
-
disabled: true,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const DisabledChecked = Template.bind({});
|
|
55
|
-
DisabledChecked.args = {
|
|
56
|
-
label: 'Do not uncheck me',
|
|
57
|
-
checked: true,
|
|
58
|
-
disabled: true,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Indeterminate = Template.bind({});
|
|
62
|
-
Indeterminate.args = {
|
|
63
|
-
label: 'Indeterminate',
|
|
64
|
-
checked: true,
|
|
65
|
-
indeterminate: true,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const DisabledIndeterminate = Template.bind({});
|
|
69
|
-
DisabledIndeterminate.args = {
|
|
70
|
-
label: 'Indeterminate',
|
|
71
|
-
checked: false,
|
|
72
|
-
indeterminate: true,
|
|
73
|
-
disabled: true,
|
|
74
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import Checkbox from './Checkbox';
|
|
4
|
-
|
|
5
|
-
it('renders Checkbox unchanged', () => {
|
|
6
|
-
const { container } = render(<Checkbox label="Check me" />);
|
|
7
|
-
expect(container).toMatchSnapshot();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('renders Checkbox checked unchanged', () => {
|
|
11
|
-
const { container } = render(<Checkbox label="Check me" checked />);
|
|
12
|
-
expect(container).toMatchSnapshot();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('renders Checkbox disabled unchanged', () => {
|
|
16
|
-
const { container } = render(<Checkbox label="Check me" disabled />);
|
|
17
|
-
expect(container).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('renders Checkbox checked and disabled unchanged', () => {
|
|
21
|
-
const { container } = render(<Checkbox label="Check me" checked disabled />);
|
|
22
|
-
expect(container).toMatchSnapshot();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('renders Checkbox indeterminate unchanged', () => {
|
|
26
|
-
const { container } = render(<Checkbox label="Check me" indeterminate />);
|
|
27
|
-
expect(container).toMatchSnapshot();
|
|
28
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { FC, useEffect, useRef } from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
|
|
4
|
-
export interface Props extends React.HTMLAttributes<HTMLInputElement> {
|
|
5
|
-
label?: string;
|
|
6
|
-
checked?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
indeterminate?: boolean;
|
|
9
|
-
name?: string;
|
|
10
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Checkbox: FC<Props> = ({
|
|
14
|
-
label,
|
|
15
|
-
className,
|
|
16
|
-
disabled = false,
|
|
17
|
-
indeterminate = false,
|
|
18
|
-
checked,
|
|
19
|
-
children,
|
|
20
|
-
onChange,
|
|
21
|
-
name,
|
|
22
|
-
...props
|
|
23
|
-
}) => {
|
|
24
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!inputRef.current) return;
|
|
28
|
-
inputRef.current.indeterminate = indeterminate;
|
|
29
|
-
}, [inputRef, indeterminate]);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<label
|
|
33
|
-
className={cx('memori-checkbox', className, {
|
|
34
|
-
'memori-checkbox--disabled': disabled,
|
|
35
|
-
'memori-checkbox--indeterminate': indeterminate,
|
|
36
|
-
})}
|
|
37
|
-
>
|
|
38
|
-
<span className="memori-checkbox--input-wrapper">
|
|
39
|
-
<input
|
|
40
|
-
ref={inputRef}
|
|
41
|
-
type="checkbox"
|
|
42
|
-
{...props}
|
|
43
|
-
name={name}
|
|
44
|
-
disabled={disabled}
|
|
45
|
-
checked={checked || indeterminate}
|
|
46
|
-
className="memori-checkbox--input"
|
|
47
|
-
onChange={onChange}
|
|
48
|
-
/>
|
|
49
|
-
<span className="memori-checkbox--inner" />
|
|
50
|
-
</span>
|
|
51
|
-
{!!label?.length && (
|
|
52
|
-
<span className="memori-checkbox--text">{label}</span>
|
|
53
|
-
)}
|
|
54
|
-
</label>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default Checkbox;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* Confirmation dialog styles */
|
|
2
|
-
.memori-confirm-dialog--backdrop {
|
|
3
|
-
position: fixed;
|
|
4
|
-
z-index: 100;
|
|
5
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
6
|
-
inset: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.memori-confirm-dialog--container {
|
|
10
|
-
position: fixed;
|
|
11
|
-
z-index: 101;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
padding: 1rem;
|
|
16
|
-
inset: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.memori-confirm-dialog--panel {
|
|
20
|
-
width: 100%;
|
|
21
|
-
max-width: 28rem;
|
|
22
|
-
padding: 1.5rem;
|
|
23
|
-
border-radius: 0.5rem;
|
|
24
|
-
background-color: white;
|
|
25
|
-
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.memori-confirm-dialog--title {
|
|
29
|
-
margin-bottom: 0.75rem;
|
|
30
|
-
font-size: 1.25rem;
|
|
31
|
-
font-weight: 600;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.memori-confirm-dialog--message {
|
|
35
|
-
margin-bottom: 1.5rem;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.memori-confirm-dialog--actions {
|
|
39
|
-
display: flex;
|
|
40
|
-
justify-content: flex-end;
|
|
41
|
-
gap: 0.5rem;
|
|
42
|
-
}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import ConfirmDialog from './ConfirmDialog';
|
|
4
|
-
import Button from './Button';
|
|
5
|
-
|
|
6
|
-
import './ConfirmDialog.css';
|
|
7
|
-
|
|
8
|
-
type Props = React.ComponentProps<typeof ConfirmDialog>;
|
|
9
|
-
|
|
10
|
-
const meta: Meta = {
|
|
11
|
-
title: 'UI/ConfirmDialog',
|
|
12
|
-
component: ConfirmDialog,
|
|
13
|
-
argTypes: {
|
|
14
|
-
isOpen: {
|
|
15
|
-
control: {
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
title: {
|
|
20
|
-
control: {
|
|
21
|
-
type: 'text',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
message: {
|
|
25
|
-
control: {
|
|
26
|
-
type: 'text',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
confirmText: {
|
|
30
|
-
control: {
|
|
31
|
-
type: 'text',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
cancelText: {
|
|
35
|
-
control: {
|
|
36
|
-
type: 'text',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
parameters: {
|
|
41
|
-
controls: { expanded: true },
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default meta;
|
|
46
|
-
|
|
47
|
-
const Template: Story<Props> = args => {
|
|
48
|
-
const [isOpen, setIsOpen] = React.useState(!!args.isOpen || false);
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<>
|
|
52
|
-
<Button onClick={() => setIsOpen(true)}>Open Confirm Dialog</Button>
|
|
53
|
-
<ConfirmDialog
|
|
54
|
-
{...args}
|
|
55
|
-
isOpen={isOpen}
|
|
56
|
-
onClose={() => setIsOpen(false)}
|
|
57
|
-
onConfirm={() => {
|
|
58
|
-
console.log('Confirmed!');
|
|
59
|
-
setIsOpen(false);
|
|
60
|
-
}}
|
|
61
|
-
/>
|
|
62
|
-
</>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Basic examples
|
|
67
|
-
export const Default = Template.bind({});
|
|
68
|
-
Default.args = {
|
|
69
|
-
isOpen: false,
|
|
70
|
-
title: 'Confirm Action',
|
|
71
|
-
message: 'Are you sure you want to proceed with this action?',
|
|
72
|
-
confirmText: 'Confirm',
|
|
73
|
-
cancelText: 'Cancel',
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const Open = Template.bind({});
|
|
77
|
-
Open.args = {
|
|
78
|
-
isOpen: true,
|
|
79
|
-
title: 'Confirm Action',
|
|
80
|
-
message: 'Are you sure you want to proceed with this action?',
|
|
81
|
-
confirmText: 'Confirm',
|
|
82
|
-
cancelText: 'Cancel',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const WithCustomTitle = Template.bind({});
|
|
86
|
-
WithCustomTitle.args = {
|
|
87
|
-
isOpen: true,
|
|
88
|
-
title: 'Delete Item',
|
|
89
|
-
message: 'Are you sure you want to proceed with this action?',
|
|
90
|
-
confirmText: 'Confirm',
|
|
91
|
-
cancelText: 'Cancel',
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const WithCustomMessage = Template.bind({});
|
|
95
|
-
WithCustomMessage.args = {
|
|
96
|
-
isOpen: true,
|
|
97
|
-
title: 'Confirm Action',
|
|
98
|
-
message: 'This action cannot be undone. All associated data will be permanently deleted from the system.',
|
|
99
|
-
confirmText: 'Confirm',
|
|
100
|
-
cancelText: 'Cancel',
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export const WithCustomButtonText = Template.bind({});
|
|
104
|
-
WithCustomButtonText.args = {
|
|
105
|
-
isOpen: true,
|
|
106
|
-
title: 'Delete Item',
|
|
107
|
-
message: 'Are you sure you want to delete this item? This action cannot be undone.',
|
|
108
|
-
confirmText: 'Yes, Delete',
|
|
109
|
-
cancelText: 'No, Keep It',
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
// Use case examples
|
|
113
|
-
const DeleteTemplate: Story<Props> = args => {
|
|
114
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
115
|
-
const [isDeleted, setIsDeleted] = React.useState(false);
|
|
116
|
-
|
|
117
|
-
const handleConfirm = () => {
|
|
118
|
-
setIsDeleted(true);
|
|
119
|
-
setIsOpen(false);
|
|
120
|
-
console.log('Item deleted!');
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<>
|
|
125
|
-
{isDeleted ? (
|
|
126
|
-
<div style={{
|
|
127
|
-
padding: '12px',
|
|
128
|
-
background: '#f8d7da',
|
|
129
|
-
color: '#721c24',
|
|
130
|
-
borderRadius: '4px',
|
|
131
|
-
marginBottom: '20px'
|
|
132
|
-
}}>
|
|
133
|
-
Item has been deleted successfully!
|
|
134
|
-
</div>
|
|
135
|
-
) : (
|
|
136
|
-
<Button onClick={() => setIsOpen(true)}>Delete Item</Button>
|
|
137
|
-
)}
|
|
138
|
-
|
|
139
|
-
<ConfirmDialog
|
|
140
|
-
{...args}
|
|
141
|
-
isOpen={isOpen}
|
|
142
|
-
onClose={() => setIsOpen(false)}
|
|
143
|
-
onConfirm={handleConfirm}
|
|
144
|
-
/>
|
|
145
|
-
</>
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const DeleteConfirmation = DeleteTemplate.bind({});
|
|
150
|
-
DeleteConfirmation.args = {
|
|
151
|
-
title: 'Delete Item',
|
|
152
|
-
message: 'Are you sure you want to delete this item? This action cannot be undone.',
|
|
153
|
-
confirmText: 'Delete',
|
|
154
|
-
cancelText: 'Cancel',
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const SaveTemplate: Story<Props> = args => {
|
|
158
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
159
|
-
const [navigatedAway, setNavigatedAway] = React.useState(false);
|
|
160
|
-
|
|
161
|
-
const handleTryNavigate = () => {
|
|
162
|
-
setIsOpen(true);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const handleConfirm = () => {
|
|
166
|
-
setNavigatedAway(true);
|
|
167
|
-
setIsOpen(false);
|
|
168
|
-
console.log('Navigated without saving!');
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<>
|
|
173
|
-
{navigatedAway ? (
|
|
174
|
-
<div style={{
|
|
175
|
-
padding: '12px',
|
|
176
|
-
background: '#d4edda',
|
|
177
|
-
color: '#155724',
|
|
178
|
-
borderRadius: '4px',
|
|
179
|
-
marginBottom: '20px'
|
|
180
|
-
}}>
|
|
181
|
-
Navigated away without saving changes.
|
|
182
|
-
</div>
|
|
183
|
-
) : (
|
|
184
|
-
<div>
|
|
185
|
-
<div style={{
|
|
186
|
-
padding: '20px',
|
|
187
|
-
border: '1px solid #ddd',
|
|
188
|
-
borderRadius: '4px',
|
|
189
|
-
marginBottom: '20px'
|
|
190
|
-
}}>
|
|
191
|
-
<h3>Unsaved Form</h3>
|
|
192
|
-
<p>This is a form with unsaved changes.</p>
|
|
193
|
-
<input type="text" placeholder="Your name" style={{ padding: '8px', marginBottom: '10px', width: '100%' }} />
|
|
194
|
-
<textarea placeholder="Your message" style={{ padding: '8px', width: '100%', height: '100px' }} />
|
|
195
|
-
</div>
|
|
196
|
-
<Button onClick={handleTryNavigate}>Navigate Away</Button>
|
|
197
|
-
</div>
|
|
198
|
-
)}
|
|
199
|
-
|
|
200
|
-
<ConfirmDialog
|
|
201
|
-
{...args}
|
|
202
|
-
isOpen={isOpen}
|
|
203
|
-
onClose={() => setIsOpen(false)}
|
|
204
|
-
onConfirm={handleConfirm}
|
|
205
|
-
/>
|
|
206
|
-
</>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const UnsavedChanges = SaveTemplate.bind({});
|
|
211
|
-
UnsavedChanges.args = {
|
|
212
|
-
title: 'Unsaved Changes',
|
|
213
|
-
message: 'You have unsaved changes. Are you sure you want to leave without saving?',
|
|
214
|
-
confirmText: 'Leave',
|
|
215
|
-
cancelText: 'Stay',
|
|
216
|
-
};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import ConfirmDialog from './ConfirmDialog';
|
|
4
|
-
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
window.IntersectionObserver = jest.fn(() => ({
|
|
8
|
-
observe: jest.fn(),
|
|
9
|
-
unobserve: jest.fn(),
|
|
10
|
-
disconnect: jest.fn(),
|
|
11
|
-
takeRecords: jest.fn(),
|
|
12
|
-
}));
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('renders ConfirmDialog unchanged', () => {
|
|
16
|
-
const { container } = render(
|
|
17
|
-
<ConfirmDialog
|
|
18
|
-
isOpen={false}
|
|
19
|
-
onClose={jest.fn()}
|
|
20
|
-
onConfirm={jest.fn()}
|
|
21
|
-
title="Test Title"
|
|
22
|
-
message="Test Message"
|
|
23
|
-
confirmText="Confirm"
|
|
24
|
-
cancelText="Cancel"
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
expect(container).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('renders ConfirmDialog open unchanged', () => {
|
|
31
|
-
const { container } = render(
|
|
32
|
-
<ConfirmDialog
|
|
33
|
-
isOpen={true}
|
|
34
|
-
onClose={jest.fn()}
|
|
35
|
-
onConfirm={jest.fn()}
|
|
36
|
-
title="Test Title"
|
|
37
|
-
message="Test Message"
|
|
38
|
-
confirmText="Confirm"
|
|
39
|
-
cancelText="Cancel"
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
expect(container).toMatchSnapshot();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('renders ConfirmDialog with custom title unchanged', () => {
|
|
46
|
-
const { container } = render(
|
|
47
|
-
<ConfirmDialog
|
|
48
|
-
isOpen={true}
|
|
49
|
-
onClose={jest.fn()}
|
|
50
|
-
onConfirm={jest.fn()}
|
|
51
|
-
title="Custom Title"
|
|
52
|
-
message="Test Message"
|
|
53
|
-
confirmText="Confirm"
|
|
54
|
-
cancelText="Cancel"
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
57
|
-
expect(container).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('renders ConfirmDialog with custom message unchanged', () => {
|
|
61
|
-
const { container } = render(
|
|
62
|
-
<ConfirmDialog
|
|
63
|
-
isOpen={true}
|
|
64
|
-
onClose={jest.fn()}
|
|
65
|
-
onConfirm={jest.fn()}
|
|
66
|
-
title="Test Title"
|
|
67
|
-
message="Custom confirmation message for testing purposes"
|
|
68
|
-
confirmText="Confirm"
|
|
69
|
-
cancelText="Cancel"
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
expect(container).toMatchSnapshot();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('renders ConfirmDialog with custom button text unchanged', () => {
|
|
76
|
-
const { container } = render(
|
|
77
|
-
<ConfirmDialog
|
|
78
|
-
isOpen={true}
|
|
79
|
-
onClose={jest.fn()}
|
|
80
|
-
onConfirm={jest.fn()}
|
|
81
|
-
title="Test Title"
|
|
82
|
-
message="Test Message"
|
|
83
|
-
confirmText="Yes, proceed"
|
|
84
|
-
cancelText="No, go back"
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
expect(container).toMatchSnapshot();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('calls onClose when cancel button is clicked', () => {
|
|
91
|
-
const onCloseMock = jest.fn();
|
|
92
|
-
render(
|
|
93
|
-
<ConfirmDialog
|
|
94
|
-
isOpen={true}
|
|
95
|
-
onClose={onCloseMock}
|
|
96
|
-
onConfirm={jest.fn()}
|
|
97
|
-
title="Test Title"
|
|
98
|
-
message="Test Message"
|
|
99
|
-
confirmText="Confirm"
|
|
100
|
-
cancelText="Cancel"
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
fireEvent.click(screen.getByText('Cancel'));
|
|
105
|
-
expect(onCloseMock).toHaveBeenCalledTimes(1);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('calls onConfirm when confirm button is clicked', () => {
|
|
109
|
-
const onConfirmMock = jest.fn();
|
|
110
|
-
render(
|
|
111
|
-
<ConfirmDialog
|
|
112
|
-
isOpen={true}
|
|
113
|
-
onClose={jest.fn()}
|
|
114
|
-
onConfirm={onConfirmMock}
|
|
115
|
-
title="Test Title"
|
|
116
|
-
message="Test Message"
|
|
117
|
-
confirmText="Confirm"
|
|
118
|
-
cancelText="Cancel"
|
|
119
|
-
/>
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
fireEvent.click(screen.getByText('Confirm'));
|
|
123
|
-
expect(onConfirmMock).toHaveBeenCalledTimes(1);
|
|
124
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Dialog, Transition } from '@headlessui/react';
|
|
3
|
-
import Button from './Button';
|
|
4
|
-
|
|
5
|
-
// Custom confirm dialog component
|
|
6
|
-
const ConfirmDialog: React.FC<{
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
onClose: () => void;
|
|
9
|
-
onConfirm: () => void;
|
|
10
|
-
title: string;
|
|
11
|
-
message: string;
|
|
12
|
-
confirmText: string;
|
|
13
|
-
cancelText: string;
|
|
14
|
-
}> = ({
|
|
15
|
-
isOpen,
|
|
16
|
-
onClose,
|
|
17
|
-
onConfirm,
|
|
18
|
-
title,
|
|
19
|
-
message,
|
|
20
|
-
confirmText,
|
|
21
|
-
cancelText,
|
|
22
|
-
}) => {
|
|
23
|
-
return (
|
|
24
|
-
<Transition appear show={isOpen} as={React.Fragment}>
|
|
25
|
-
<Dialog as="div" className="memori-confirm-dialog" onClose={onClose}>
|
|
26
|
-
<div className="memori-confirm-dialog--backdrop" />
|
|
27
|
-
<div className="memori-confirm-dialog--container">
|
|
28
|
-
<Transition.Child
|
|
29
|
-
as={React.Fragment}
|
|
30
|
-
enter="ease-out duration-300"
|
|
31
|
-
enterFrom="opacity-0 scale-95"
|
|
32
|
-
enterTo="opacity-100 scale-100"
|
|
33
|
-
leave="ease-in duration-200"
|
|
34
|
-
leaveFrom="opacity-100 scale-100"
|
|
35
|
-
leaveTo="opacity-0 scale-95"
|
|
36
|
-
>
|
|
37
|
-
<Dialog.Panel className="memori-confirm-dialog--panel">
|
|
38
|
-
<Dialog.Title className="memori-confirm-dialog--title">
|
|
39
|
-
{title}
|
|
40
|
-
</Dialog.Title>
|
|
41
|
-
<Dialog.Description className="memori-confirm-dialog--message">
|
|
42
|
-
{message}
|
|
43
|
-
</Dialog.Description>
|
|
44
|
-
<div className="memori-confirm-dialog--actions">
|
|
45
|
-
<Button onClick={onClose}>{cancelText}</Button>
|
|
46
|
-
<Button primary onClick={onConfirm}>
|
|
47
|
-
{confirmText}
|
|
48
|
-
</Button>
|
|
49
|
-
</div>
|
|
50
|
-
</Dialog.Panel>
|
|
51
|
-
</Transition.Child>
|
|
52
|
-
</div>
|
|
53
|
-
</Dialog>
|
|
54
|
-
</Transition>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default ConfirmDialog;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
details.memori--details {
|
|
2
|
-
display: block;
|
|
3
|
-
margin-top: 0.5rem;
|
|
4
|
-
margin-bottom: 1.5rem;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
details.memori--details+details.memori--details {
|
|
8
|
-
margin-top: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
details.memori--details summary {
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
font-size: 1.15rem;
|
|
14
|
-
line-height: 1;
|
|
15
|
-
list-style-type: none;
|
|
16
|
-
transition: color 0.2s ease-in-out;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
details.memori--details summary::-webkit-details-marker {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
details.memori--details summary::marker {
|
|
24
|
-
display: none;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
details.memori--details summary::-moz-list-bullet {
|
|
28
|
-
list-style-type: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
details.memori--details summary::after {
|
|
32
|
-
display: block;
|
|
33
|
-
width: 1rem;
|
|
34
|
-
height: 1rem;
|
|
35
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(162, 175, 185)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
|
|
36
|
-
background-position: right center;
|
|
37
|
-
background-repeat: no-repeat;
|
|
38
|
-
background-size: 1rem auto;
|
|
39
|
-
content: "";
|
|
40
|
-
float: right;
|
|
41
|
-
margin-inline-start: 1.5rem;
|
|
42
|
-
transform: rotate(-90deg);
|
|
43
|
-
transition: transform 0.2s ease-in-out;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
details.memori--details summary:focus {
|
|
47
|
-
outline: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
details.memori--details summary:focus-visible {
|
|
51
|
-
color: var(--memori-primary);
|
|
52
|
-
outline: 1px solid var(--memori-primary);
|
|
53
|
-
outline-offset: 1.5rem;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
details.memori--details[open]>summary {
|
|
57
|
-
margin-bottom: 1rem;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
details.memori--details[open]>summary:not(:focus) {
|
|
61
|
-
color: var(--memori-primary);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
details.memori--details[open]>summary::after {
|
|
65
|
-
transform: rotate(0deg);
|
|
66
|
-
}
|