@intlayer/design-system 5.5.11 → 5.7.0
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/README.md +1 -1
- package/dist/.vite/manifest.json +126 -570
- package/dist/components/Command/index.d.ts +5 -5
- package/dist/components/Container/index.cjs +2 -1
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.d.ts +2 -3
- package/dist/components/Container/index.d.ts.map +1 -1
- package/dist/components/Container/index.mjs +3 -2
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs +2 -27
- package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs +1 -26
- package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
- package/dist/components/{IDE/CopyButton.cjs → CopyButton/index.cjs} +6 -5
- package/dist/components/CopyButton/index.cjs.map +1 -0
- package/dist/components/{IDE/CopyButton.d.ts → CopyButton/index.d.ts} +3 -2
- package/dist/components/CopyButton/index.d.ts.map +1 -0
- package/dist/components/{IDE/CopyButton.mjs → CopyButton/index.mjs} +6 -5
- package/dist/components/CopyButton/index.mjs.map +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +2 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +2 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +9 -28
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +8 -27
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +10 -26
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +9 -25
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +7 -20
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +6 -19
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +2 -2
- package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -2
- package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -2
- package/dist/components/Form/elements/FormElementWrapper.cjs +1 -1
- package/dist/components/Form/elements/FormElementWrapper.mjs +1 -1
- package/dist/components/IDE/Code.cjs +3 -3
- package/dist/components/IDE/Code.cjs.map +1 -1
- package/dist/components/IDE/Code.d.ts +1 -1
- package/dist/components/IDE/Code.d.ts.map +1 -1
- package/dist/components/IDE/Code.mjs +3 -3
- package/dist/components/IDE/Code.mjs.map +1 -1
- package/dist/components/IDE/CodeContext.cjs +2 -2
- package/dist/components/IDE/CodeContext.mjs +2 -2
- package/dist/components/IDE/CopyCode.cjs +28 -0
- package/dist/components/IDE/CopyCode.cjs.map +1 -0
- package/dist/components/IDE/CopyCode.d.ts +7 -0
- package/dist/components/IDE/CopyCode.d.ts.map +1 -0
- package/dist/components/IDE/CopyCode.mjs +28 -0
- package/dist/components/IDE/CopyCode.mjs.map +1 -0
- package/dist/components/IDE/MonacoCode.cjs +2 -2
- package/dist/components/IDE/MonacoCode.cjs.map +1 -1
- package/dist/components/IDE/MonacoCode.mjs +1 -1
- package/dist/components/IDE/MonacoCode.mjs.map +1 -1
- package/dist/components/IDE/code.content.cjs +39 -0
- package/dist/components/IDE/code.content.cjs.map +1 -0
- package/dist/components/{Auth/ResetPasswordForm/useResetPasswordSchema.content.d.ts → IDE/code.content.d.ts} +23 -56
- package/dist/components/IDE/code.content.d.ts.map +1 -0
- package/dist/components/IDE/code.content.mjs +40 -0
- package/dist/components/IDE/code.content.mjs.map +1 -0
- package/dist/components/IDE/copyCode.content.cjs +39 -0
- package/dist/components/IDE/copyCode.content.cjs.map +1 -0
- package/dist/components/IDE/copyCode.content.d.ts +73 -0
- package/dist/components/IDE/copyCode.content.d.ts.map +1 -0
- package/dist/components/IDE/copyCode.content.mjs +40 -0
- package/dist/components/IDE/copyCode.content.mjs.map +1 -0
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +2 -2
- package/dist/components/Modal/Modal.cjs +3 -3
- package/dist/components/Modal/Modal.mjs +3 -3
- package/dist/components/Navbar/MobileNavbar.cjs +2 -2
- package/dist/components/Navbar/MobileNavbar.mjs +2 -2
- package/dist/components/Navbar/index.cjs +3 -3
- package/dist/components/Navbar/index.mjs +3 -3
- package/dist/components/Pattern/GridPattern.cjs +45 -48
- package/dist/components/Pattern/GridPattern.cjs.map +1 -1
- package/dist/components/Pattern/GridPattern.d.ts.map +1 -1
- package/dist/components/Pattern/GridPattern.mjs +45 -48
- package/dist/components/Pattern/GridPattern.mjs.map +1 -1
- package/dist/components/Popover/index.cjs +59 -15
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.ts +32 -6
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.mjs +60 -16
- package/dist/components/Popover/index.mjs.map +1 -1
- package/dist/components/SocialNetworks/index.cjs +1 -1
- package/dist/components/SocialNetworks/index.cjs.map +1 -1
- package/dist/components/SocialNetworks/index.mjs +1 -1
- package/dist/components/SocialNetworks/index.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +2 -2
- package/dist/components/SwitchSelector/index.mjs +2 -2
- package/dist/components/TabSelector/TabSelector.cjs +2 -2
- package/dist/components/TabSelector/TabSelector.mjs +2 -2
- package/dist/components/TextArea/AutocompleteTextArea.cjs +90 -13
- package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.mjs +92 -15
- package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/components/index.cjs +3 -38
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +4 -39
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +8 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +9 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs +29 -31
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +678 -10
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +29 -31
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.cjs +0 -1
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs +0 -1
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useAuth/index.cjs +9 -0
- package/dist/{components/Auth/AuthenticationBarrier → hooks/useAuth}/index.cjs.map +1 -1
- package/dist/hooks/useAuth/index.d.ts +4 -0
- package/dist/hooks/useAuth/index.d.ts.map +1 -0
- package/dist/hooks/useAuth/index.mjs +9 -0
- package/dist/{components/Auth/ExternalsLoginButtons → hooks/useAuth}/index.mjs.map +1 -1
- package/dist/hooks/useAuth/useAuth.cjs +25 -0
- package/dist/hooks/useAuth/useAuth.cjs.map +1 -0
- package/dist/{components/Auth/useAuth/index.d.ts → hooks/useAuth/useAuth.d.ts} +3 -13
- package/dist/hooks/useAuth/useAuth.d.ts.map +1 -0
- package/dist/{components/Auth/useAuth/index.mjs → hooks/useAuth/useAuth.mjs} +2 -8
- package/dist/hooks/useAuth/useAuth.mjs.map +1 -0
- package/dist/{components/Auth → hooks}/useAuth/useOAuth2.cjs +3 -3
- package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -0
- package/dist/{components/Auth → hooks}/useAuth/useOAuth2.d.ts +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts.map +1 -0
- package/dist/{components/Auth → hooks}/useAuth/useOAuth2.mjs +4 -4
- package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -0
- package/dist/{components/Auth → hooks}/useAuth/useSession.cjs +6 -25
- package/dist/hooks/useAuth/useSession.cjs.map +1 -0
- package/dist/{components/Auth → hooks}/useAuth/useSession.d.ts +3 -3
- package/dist/hooks/useAuth/useSession.d.ts.map +1 -0
- package/dist/hooks/useAuth/useSession.mjs +47 -0
- package/dist/hooks/useAuth/useSession.mjs.map +1 -0
- package/dist/hooks/useIntlayerAPI.cjs +5 -4
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +5 -4
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/{components/Auth → hooks}/useUser/index.cjs +7 -5
- package/dist/hooks/useUser/index.cjs.map +1 -0
- package/dist/hooks/useUser/index.d.ts +8 -0
- package/dist/hooks/useUser/index.d.ts.map +1 -0
- package/dist/{components/Auth → hooks}/useUser/index.mjs +6 -4
- package/dist/hooks/useUser/index.mjs.map +1 -0
- package/dist/{schemas-itjzX6bG.js → schemas-BIuxHDyZ.js} +3 -7
- package/dist/{schemas-itjzX6bG.js.map → schemas-BIuxHDyZ.js.map} +1 -1
- package/dist/{schemas-DlCjM5d_.cjs → schemas-Q6C7ZNs3.cjs} +3 -7
- package/dist/{schemas-DlCjM5d_.cjs.map → schemas-Q6C7ZNs3.cjs.map} +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +18 -18
- package/dist/components/Auth/AuthModal/index.cjs +0 -106
- package/dist/components/Auth/AuthModal/index.cjs.map +0 -1
- package/dist/components/Auth/AuthModal/index.d.ts +0 -20
- package/dist/components/Auth/AuthModal/index.d.ts.map +0 -1
- package/dist/components/Auth/AuthModal/index.mjs +0 -106
- package/dist/components/Auth/AuthModal/index.mjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs +0 -36
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.d.ts +0 -5
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.d.ts.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs +0 -36
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.cjs +0 -22
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.cjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts +0 -8
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.mjs +0 -22
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.mjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.cjs +0 -15
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.cjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts +0 -4
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.mjs +0 -15
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.mjs.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/index.cjs +0 -7
- package/dist/components/Auth/AuthenticationBarrier/index.d.ts +0 -23
- package/dist/components/Auth/AuthenticationBarrier/index.d.ts.map +0 -1
- package/dist/components/Auth/AuthenticationBarrier/index.mjs +0 -7
- package/dist/components/Auth/AuthenticationBarrier/index.mjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs +0 -95
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts +0 -9
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs +0 -95
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/changePasswordForm.content.cjs +0 -138
- package/dist/components/Auth/ChangePasswordForm/changePasswordForm.content.cjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/changePasswordForm.content.d.ts +0 -278
- package/dist/components/Auth/ChangePasswordForm/changePasswordForm.content.d.ts.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/changePasswordForm.content.mjs +0 -138
- package/dist/components/Auth/ChangePasswordForm/changePasswordForm.content.mjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/index.cjs +0 -7
- package/dist/components/Auth/ChangePasswordForm/index.cjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/index.d.ts +0 -3
- package/dist/components/Auth/ChangePasswordForm/index.d.ts.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/index.mjs +0 -7
- package/dist/components/Auth/ChangePasswordForm/index.mjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs +0 -34
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.cjs +0 -131
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.cjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.d.ts +0 -271
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.d.ts.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.mjs +0 -131
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.content.mjs.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts +0 -8
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts.map +0 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs +0 -34
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/DefineNewPasswordForm.cjs +0 -81
- package/dist/components/Auth/DefineNewPasswordForm/DefineNewPasswordForm.cjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/DefineNewPasswordForm.d.ts +0 -9
- package/dist/components/Auth/DefineNewPasswordForm/DefineNewPasswordForm.d.ts.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/DefineNewPasswordForm.mjs +0 -81
- package/dist/components/Auth/DefineNewPasswordForm/DefineNewPasswordForm.mjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.cjs +0 -106
- package/dist/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.cjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.d.ts +0 -210
- package/dist/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.d.ts.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.mjs +0 -106
- package/dist/components/Auth/DefineNewPasswordForm/defineNewPasswordForm.content.mjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/index.cjs +0 -7
- package/dist/components/Auth/DefineNewPasswordForm/index.cjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/index.d.ts +0 -3
- package/dist/components/Auth/DefineNewPasswordForm/index.d.ts.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/index.mjs +0 -7
- package/dist/components/Auth/DefineNewPasswordForm/index.mjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs +0 -29
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.cjs +0 -101
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.cjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.d.ts +0 -205
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.d.ts.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.mjs +0 -101
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.content.mjs.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.d.ts +0 -7
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.d.ts.map +0 -1
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs +0 -29
- package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +0 -81
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts +0 -9
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +0 -81
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.cjs +0 -15
- package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.cjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.d.ts +0 -3
- package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.d.ts.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.mjs +0 -15
- package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.mjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.cjs +0 -23
- package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.cjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.d.ts +0 -3
- package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.d.ts.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.mjs +0 -23
- package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.mjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs +0 -90
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.d.ts +0 -176
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.d.ts.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs +0 -90
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/index.cjs +0 -7
- package/dist/components/Auth/ExternalsLoginButtons/index.cjs.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/index.d.ts +0 -2
- package/dist/components/Auth/ExternalsLoginButtons/index.d.ts.map +0 -1
- package/dist/components/Auth/ExternalsLoginButtons/index.mjs +0 -7
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs +0 -113
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts +0 -11
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs +0 -113
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/index.cjs +0 -7
- package/dist/components/Auth/ResetPasswordForm/index.cjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/index.d.ts +0 -3
- package/dist/components/Auth/ResetPasswordForm/index.d.ts.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/index.mjs +0 -7
- package/dist/components/Auth/ResetPasswordForm/index.mjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/resetPasswordContent.content.cjs +0 -123
- package/dist/components/Auth/ResetPasswordForm/resetPasswordContent.content.cjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/resetPasswordContent.content.d.ts +0 -245
- package/dist/components/Auth/ResetPasswordForm/resetPasswordContent.content.d.ts.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/resetPasswordContent.content.mjs +0 -123
- package/dist/components/Auth/ResetPasswordForm/resetPasswordContent.content.mjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs +0 -15
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.content.cjs +0 -56
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.content.cjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.content.d.ts.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.content.mjs +0 -56
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.content.mjs.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts +0 -6
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts.map +0 -1
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs +0 -15
- package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs.map +0 -1
- package/dist/components/Auth/SignInForm/SignInForm.cjs +0 -105
- package/dist/components/Auth/SignInForm/SignInForm.cjs.map +0 -1
- package/dist/components/Auth/SignInForm/SignInForm.d.ts +0 -11
- package/dist/components/Auth/SignInForm/SignInForm.d.ts.map +0 -1
- package/dist/components/Auth/SignInForm/SignInForm.mjs +0 -105
- package/dist/components/Auth/SignInForm/SignInForm.mjs.map +0 -1
- package/dist/components/Auth/SignInForm/index.cjs +0 -7
- package/dist/components/Auth/SignInForm/index.cjs.map +0 -1
- package/dist/components/Auth/SignInForm/index.d.ts +0 -3
- package/dist/components/Auth/SignInForm/index.d.ts.map +0 -1
- package/dist/components/Auth/SignInForm/index.mjs +0 -7
- package/dist/components/Auth/SignInForm/index.mjs.map +0 -1
- package/dist/components/Auth/SignInForm/signIn.content.cjs +0 -217
- package/dist/components/Auth/SignInForm/signIn.content.cjs.map +0 -1
- package/dist/components/Auth/SignInForm/signIn.content.d.ts +0 -447
- package/dist/components/Auth/SignInForm/signIn.content.d.ts.map +0 -1
- package/dist/components/Auth/SignInForm/signIn.content.mjs +0 -217
- package/dist/components/Auth/SignInForm/signIn.content.mjs.map +0 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs +0 -23
- package/dist/components/Auth/SignInForm/useSignInSchema.cjs.map +0 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.content.cjs +0 -71
- package/dist/components/Auth/SignInForm/useSignInSchema.content.cjs.map +0 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.content.d.ts +0 -139
- package/dist/components/Auth/SignInForm/useSignInSchema.content.d.ts.map +0 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.content.mjs +0 -71
- package/dist/components/Auth/SignInForm/useSignInSchema.content.mjs.map +0 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.d.ts +0 -7
- package/dist/components/Auth/SignInForm/useSignInSchema.d.ts.map +0 -1
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs +0 -23
- package/dist/components/Auth/SignInForm/useSignInSchema.mjs.map +0 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs +0 -98
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +0 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.d.ts +0 -10
- package/dist/components/Auth/SignUpForm/SignUpForm.d.ts.map +0 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs +0 -98
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +0 -1
- package/dist/components/Auth/SignUpForm/index.cjs +0 -7
- package/dist/components/Auth/SignUpForm/index.cjs.map +0 -1
- package/dist/components/Auth/SignUpForm/index.d.ts +0 -3
- package/dist/components/Auth/SignUpForm/index.d.ts.map +0 -1
- package/dist/components/Auth/SignUpForm/index.mjs +0 -7
- package/dist/components/Auth/SignUpForm/index.mjs.map +0 -1
- package/dist/components/Auth/SignUpForm/signUpForm.content.cjs +0 -184
- package/dist/components/Auth/SignUpForm/signUpForm.content.cjs.map +0 -1
- package/dist/components/Auth/SignUpForm/signUpForm.content.d.ts +0 -380
- package/dist/components/Auth/SignUpForm/signUpForm.content.d.ts.map +0 -1
- package/dist/components/Auth/SignUpForm/signUpForm.content.mjs +0 -185
- package/dist/components/Auth/SignUpForm/signUpForm.content.mjs.map +0 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs +0 -33
- package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs.map +0 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.content.cjs +0 -116
- package/dist/components/Auth/SignUpForm/useSignUpSchema.content.cjs.map +0 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.content.d.ts +0 -238
- package/dist/components/Auth/SignUpForm/useSignUpSchema.content.d.ts.map +0 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.content.mjs +0 -116
- package/dist/components/Auth/SignUpForm/useSignUpSchema.content.mjs.map +0 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts +0 -8
- package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts.map +0 -1
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs +0 -33
- package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.cjs +0 -79
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.cjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.d.ts +0 -10
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.d.ts.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.mjs +0 -79
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailForm.mjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs +0 -8
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.d.ts +0 -4
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.d.ts.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs +0 -8
- package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/index.cjs +0 -5
- package/dist/components/Auth/VerifyEmailForm/index.cjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/index.content.cjs +0 -73
- package/dist/components/Auth/VerifyEmailForm/index.content.cjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/index.content.d.ts +0 -143
- package/dist/components/Auth/VerifyEmailForm/index.content.d.ts.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/index.content.mjs +0 -74
- package/dist/components/Auth/VerifyEmailForm/index.content.mjs.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/index.d.ts +0 -2
- package/dist/components/Auth/VerifyEmailForm/index.d.ts.map +0 -1
- package/dist/components/Auth/VerifyEmailForm/index.mjs +0 -5
- package/dist/components/Auth/VerifyEmailForm/index.mjs.map +0 -1
- package/dist/components/Auth/index.cjs +0 -39
- package/dist/components/Auth/index.cjs.map +0 -1
- package/dist/components/Auth/index.d.ts +0 -12
- package/dist/components/Auth/index.d.ts.map +0 -1
- package/dist/components/Auth/index.mjs +0 -39
- package/dist/components/Auth/index.mjs.map +0 -1
- package/dist/components/Auth/useAuth/index.cjs +0 -31
- package/dist/components/Auth/useAuth/index.cjs.map +0 -1
- package/dist/components/Auth/useAuth/index.d.ts.map +0 -1
- package/dist/components/Auth/useAuth/index.mjs.map +0 -1
- package/dist/components/Auth/useAuth/useCSRF.cjs +0 -27
- package/dist/components/Auth/useAuth/useCSRF.cjs.map +0 -1
- package/dist/components/Auth/useAuth/useCSRF.d.ts +0 -6
- package/dist/components/Auth/useAuth/useCSRF.d.ts.map +0 -1
- package/dist/components/Auth/useAuth/useCSRF.mjs +0 -27
- package/dist/components/Auth/useAuth/useCSRF.mjs.map +0 -1
- package/dist/components/Auth/useAuth/useOAuth2.cjs.map +0 -1
- package/dist/components/Auth/useAuth/useOAuth2.d.ts.map +0 -1
- package/dist/components/Auth/useAuth/useOAuth2.mjs.map +0 -1
- package/dist/components/Auth/useAuth/useSession.cjs.map +0 -1
- package/dist/components/Auth/useAuth/useSession.d.ts.map +0 -1
- package/dist/components/Auth/useAuth/useSession.mjs +0 -66
- package/dist/components/Auth/useAuth/useSession.mjs.map +0 -1
- package/dist/components/Auth/useUser/index.cjs.map +0 -1
- package/dist/components/Auth/useUser/index.d.ts +0 -8
- package/dist/components/Auth/useUser/index.d.ts.map +0 -1
- package/dist/components/Auth/useUser/index.mjs.map +0 -1
- package/dist/components/IDE/CopyButton.cjs.map +0 -1
- package/dist/components/IDE/CopyButton.d.ts.map +0 -1
- package/dist/components/IDE/CopyButton.mjs.map +0 -1
- package/dist/components/ProfileDropDown/index.cjs +0 -25
- package/dist/components/ProfileDropDown/index.cjs.map +0 -1
- package/dist/components/ProfileDropDown/index.d.ts +0 -6
- package/dist/components/ProfileDropDown/index.d.ts.map +0 -1
- package/dist/components/ProfileDropDown/index.mjs +0 -25
- package/dist/components/ProfileDropDown/index.mjs.map +0 -1
- package/dist/hooks/useIntlayerAPI.d.ts +0 -103
- package/dist/hooks/useIntlayerAPI.d.ts.map +0 -1
|
@@ -1,24 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.mjs";
|
|
3
|
+
import { Container } from "../Container/index.mjs";
|
|
4
|
+
const Popover = ({
|
|
5
|
+
children,
|
|
6
|
+
className,
|
|
7
|
+
identifier,
|
|
8
|
+
...props
|
|
9
|
+
}) => /* @__PURE__ */ jsx(
|
|
3
10
|
"div",
|
|
4
11
|
{
|
|
5
|
-
className: "group relative",
|
|
12
|
+
className: cn("group/popover relative flex cursor-pointer", className),
|
|
13
|
+
"aria-label": `Popover ${identifier}`,
|
|
14
|
+
id: `unrollable-panel-button-${identifier}`,
|
|
6
15
|
"aria-haspopup": true,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
children: [
|
|
10
|
-
children,
|
|
11
|
-
/* @__PURE__ */ jsx(
|
|
12
|
-
"div",
|
|
13
|
-
{
|
|
14
|
-
className: "bg-card absolute bottom-0 left-5 z-50 translate-y-[150%] rounded-md p-1 text-xs text-opacity-75 opacity-0 ring-2 ring-current transition-all delay-200 duration-200 ease-in-out hover:delay-0 group-hover:opacity-100",
|
|
15
|
-
"aria-hidden": true,
|
|
16
|
-
children: content
|
|
17
|
-
}
|
|
18
|
-
)
|
|
19
|
-
]
|
|
16
|
+
...props,
|
|
17
|
+
children
|
|
20
18
|
}
|
|
21
19
|
);
|
|
20
|
+
const Detail = ({
|
|
21
|
+
children,
|
|
22
|
+
isHidden = void 0,
|
|
23
|
+
isOverable = true,
|
|
24
|
+
isFocusable = false,
|
|
25
|
+
xAlign = "start",
|
|
26
|
+
yAlign = "bellow",
|
|
27
|
+
identifier,
|
|
28
|
+
className,
|
|
29
|
+
displayArrow = true,
|
|
30
|
+
...props
|
|
31
|
+
}) => /* @__PURE__ */ jsx(
|
|
32
|
+
Container,
|
|
33
|
+
{
|
|
34
|
+
transparency: "sm",
|
|
35
|
+
"aria-hidden": isHidden,
|
|
36
|
+
"aria-labelledby": `unrollable-panel-button-${identifier}`,
|
|
37
|
+
id: `unrollable-panel-${identifier}`,
|
|
38
|
+
className: cn(
|
|
39
|
+
"absolute z-[1000] min-w-full ring-neutral ring-1 rounded-md",
|
|
40
|
+
/* Positioning */
|
|
41
|
+
xAlign === "start" && "left-0",
|
|
42
|
+
xAlign === "end" && "right-0",
|
|
43
|
+
yAlign === "bellow" && "top-[calc(100%+1rem)]",
|
|
44
|
+
yAlign === "above" && "bottom-[calc(100%+1rem)]",
|
|
45
|
+
/* Arrow indicator */
|
|
46
|
+
displayArrow && 'before:absolute before:z-[999] before:content-[""] before:w-0 before:h-0',
|
|
47
|
+
/* Horizontal positioning */
|
|
48
|
+
displayArrow && xAlign === "start" && "before:left-2",
|
|
49
|
+
displayArrow && xAlign === "end" && "before:right-2",
|
|
50
|
+
/* Arrow pointing up (when popover is below trigger) */
|
|
51
|
+
displayArrow && yAlign === "bellow" && "before:-top-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-b-[10px] before:border-b-neutral",
|
|
52
|
+
/* Arrow pointing down (when popover is above trigger) */
|
|
53
|
+
displayArrow && yAlign === "above" && "before:-bottom-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-t-[10px] before:border-t-neutral",
|
|
54
|
+
/* Visibility management */
|
|
55
|
+
"overflow-x-visible transition-all duration-400 ease-in-out opacity-0",
|
|
56
|
+
isHidden !== false ? "invisible" : "delay-800 visible opacity-100",
|
|
57
|
+
isOverable && "group-hover/popover:visible group-hover/popover:opacity-100 group-hover/popover:delay-800",
|
|
58
|
+
isFocusable && "group-focus-within/popover:visible group-focus-within/popover:opacity-100 group-focus-within/popover:delay-800",
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
...props,
|
|
62
|
+
children
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
Popover.Detail = Detail;
|
|
22
66
|
export {
|
|
23
67
|
Popover
|
|
24
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import type { FC,
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import type { DetailedHTMLProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Container } from '../Container';\n\nexport type PopoverProps = DetailedHTMLProps<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n> & {\n identifier: string;\n};\n\nexport type PopoverType = FC<PopoverProps> & {\n Detail: FC<DetailProps>;\n};\n\n/**\n * Trigger allowing to open a popover menu.\n *\n * Example:\n * ```jsx\n * <Popover identifier=\"popover\">\n * Open popover\n *\n * <Popover.Detail identifier=\"popover\">\n * <div>Content</div>\n * </Popover.Detail>\n * </Popover>\n * ```\n *\n * > Note Popover.Trigger can be replaced by a button. Don't add a button inside the trigger.\n */\nexport const Popover: PopoverType = ({\n children,\n className,\n identifier,\n ...props\n}) => (\n <div\n className={cn('group/popover relative flex cursor-pointer', className)}\n aria-label={`Popover ${identifier}`}\n id={`unrollable-panel-button-${identifier}`}\n aria-haspopup\n {...props}\n >\n {children}\n </div>\n);\n\nexport type DetailProps = HTMLAttributes<HTMLDivElement> & {\n isFocusable?: boolean;\n isHidden?: boolean;\n isOverable?: boolean;\n identifier: string;\n xAlign?: 'start' | 'end';\n yAlign?: 'bellow' | 'above';\n displayArrow?: boolean;\n};\n\n/**\n * Component that opens a popover menu when the trigger is clicked.\n *\n * Example:\n * ```jsx\n * <Popover.Detail identifier=\"popover\">\n * <div>Content</div>\n * </Popover.Detail>\n * ```\n */\nconst Detail: FC<DetailProps> = ({\n children,\n isHidden = undefined,\n isOverable = true,\n isFocusable = false,\n xAlign = 'start',\n yAlign = 'bellow',\n identifier,\n className,\n displayArrow = true,\n ...props\n}) => (\n <Container\n transparency=\"sm\"\n aria-hidden={isHidden}\n aria-labelledby={`unrollable-panel-button-${identifier}`}\n id={`unrollable-panel-${identifier}`}\n className={cn(\n 'absolute z-[1000] min-w-full ring-neutral ring-1 rounded-md',\n\n /* Positioning */\n xAlign === 'start' && 'left-0',\n xAlign === 'end' && 'right-0',\n yAlign === 'bellow' && 'top-[calc(100%+1rem)]',\n yAlign === 'above' && 'bottom-[calc(100%+1rem)]',\n\n /* Arrow indicator */\n displayArrow &&\n 'before:absolute before:z-[999] before:content-[\"\"] before:w-0 before:h-0',\n\n /* Horizontal positioning */\n displayArrow && xAlign === 'start' && 'before:left-2',\n displayArrow && xAlign === 'end' && 'before:right-2',\n\n /* Arrow pointing up (when popover is below trigger) */\n displayArrow &&\n yAlign === 'bellow' &&\n 'before:-top-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-b-[10px] before:border-b-neutral',\n\n /* Arrow pointing down (when popover is above trigger) */\n displayArrow &&\n yAlign === 'above' &&\n 'before:-bottom-[10px] before:border-l-[10px] before:border-l-transparent before:border-r-[10px] before:border-r-transparent before:border-t-[10px] before:border-t-neutral',\n\n /* Visibility management */\n 'overflow-x-visible transition-all duration-400 ease-in-out opacity-0',\n isHidden !== false ? 'invisible' : 'delay-800 visible opacity-100',\n isOverable &&\n 'group-hover/popover:visible group-hover/popover:opacity-100 group-hover/popover:delay-800',\n isFocusable &&\n 'group-focus-within/popover:visible group-focus-within/popover:opacity-100 group-focus-within/popover:delay-800',\n className\n )}\n {...props}\n >\n {children}\n </Container>\n);\n\nPopover.Detail = Detail;\n"],"names":[],"mappings":";;;AA+BO,MAAM,UAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,GAAG,8CAA8C,SAAS;AAAA,IACrE,cAAY,WAAW,UAAU;AAAA,IACjC,IAAI,2BAA2B,UAAU;AAAA,IACzC,iBAAa;AAAA,IACZ,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAuBF,MAAM,SAA0B,CAAC;AAAA,EAC/B;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,cAAc;AAAA,EACd,SAAS;AAAA,EACT,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,cAAa;AAAA,IACb,eAAa;AAAA,IACb,mBAAiB,2BAA2B,UAAU;AAAA,IACtD,IAAI,oBAAoB,UAAU;AAAA,IAClC,WAAW;AAAA,MACT;AAAA;AAAA,MAGA,WAAW,WAAW;AAAA,MACtB,WAAW,SAAS;AAAA,MACpB,WAAW,YAAY;AAAA,MACvB,WAAW,WAAW;AAAA;AAAA,MAGtB,gBACE;AAAA;AAAA,MAGF,gBAAgB,WAAW,WAAW;AAAA,MACtC,gBAAgB,WAAW,SAAS;AAAA;AAAA,MAGpC,gBACE,WAAW,YACX;AAAA;AAAA,MAGF,gBACE,WAAW,WACX;AAAA;AAAA,MAGF;AAAA,MACA,aAAa,QAAQ,cAAc;AAAA,MACnC,cACE;AAAA,MACF,eACE;AAAA,MACF;AAAA,IACF;AAAA,IACC,GAAG;AAAA,IAEH;AAAA,EAAA;AACH;AAGF,QAAQ,SAAS;"}
|
|
@@ -36,7 +36,7 @@ const socialNetworks = [
|
|
|
36
36
|
label: "TikTok"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
href: "https://www.instagram.com/
|
|
39
|
+
href: "https://www.instagram.com/intlayer/",
|
|
40
40
|
component: /* @__PURE__ */ jsxRuntime.jsx(components_SocialNetworks_InstagramLogo.InstagramLogo, { className: "max-w-full max-h-full h-auto" }),
|
|
41
41
|
label: "Instagram"
|
|
42
42
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/SocialNetworks/index.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, DetailedHTMLProps, FC, ReactNode } from 'react';\nimport { FacebookLogo } from './FacebookLogo';\nimport { InstagramLogo } from './InstagramLogo';\nimport { LinkedInLogo } from './LinkedInLogo';\nimport { ProductHuntLogo } from './ProductHuntLogo';\nimport { TiktokLogo } from './TiktokLogo';\nimport { XLogo } from './XLogo';\nimport { YoutubeLogo } from './YoutubeLogo';\n\nconst socialNetworks = [\n {\n href: 'https://www.producthunt.com/posts/intlayer?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-intlayer',\n component: <ProductHuntLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Product Hunt',\n },\n {\n href: 'https://x.com/Intlayer183096',\n component: <XLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'X',\n },\n {\n href: 'https://www.youtube.com/@intlayer',\n component: <YoutubeLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'YouTube',\n },\n {\n href: 'https://www.linkedin.com/company/intlayerorg',\n component: <LinkedInLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'LinkedIn',\n },\n {\n href: 'https://www.tiktok.com/@intlayer',\n component: <TiktokLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'TikTok',\n },\n {\n href: 'https://www.instagram.com/
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/SocialNetworks/index.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, DetailedHTMLProps, FC, ReactNode } from 'react';\nimport { FacebookLogo } from './FacebookLogo';\nimport { InstagramLogo } from './InstagramLogo';\nimport { LinkedInLogo } from './LinkedInLogo';\nimport { ProductHuntLogo } from './ProductHuntLogo';\nimport { TiktokLogo } from './TiktokLogo';\nimport { XLogo } from './XLogo';\nimport { YoutubeLogo } from './YoutubeLogo';\n\nconst socialNetworks = [\n {\n href: 'https://www.producthunt.com/posts/intlayer?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-intlayer',\n component: <ProductHuntLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Product Hunt',\n },\n {\n href: 'https://x.com/Intlayer183096',\n component: <XLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'X',\n },\n {\n href: 'https://www.youtube.com/@intlayer',\n component: <YoutubeLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'YouTube',\n },\n {\n href: 'https://www.linkedin.com/company/intlayerorg',\n component: <LinkedInLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'LinkedIn',\n },\n {\n href: 'https://www.tiktok.com/@intlayer',\n component: <TiktokLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'TikTok',\n },\n {\n href: 'https://www.instagram.com/intlayer/',\n component: <InstagramLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Instagram',\n },\n {\n href: 'https://www.facebook.com/intlayer',\n component: <FacebookLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Facebook',\n },\n];\n\ntype SocialNetworksProps = {\n renderItem?: (item: (typeof socialNetworks)[number]) => ReactNode;\n} & DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n>;\n\ntype DefaultRenderItemProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> & {\n component: ReactNode;\n label: string;\n};\n\nconst DefaultRenderItem: FC<DefaultRenderItemProps> = ({\n href,\n component,\n label,\n ...iconProps\n}) => (\n <a\n key={href}\n href={href}\n aria-label={label}\n className=\"max-w-4 max-h-4\"\n {...iconProps}\n >\n {component}\n </a>\n);\n\nexport const SocialNetworks = ({\n renderItem,\n ...iconProps\n}: SocialNetworksProps) =>\n socialNetworks.map(\n renderItem ??\n ((props) => (\n <DefaultRenderItem {...props} {...iconProps} key={props.label} />\n ))\n );\n\nexport * from './FacebookLogo';\nexport * from './InstagramLogo';\nexport * from './LinkedInLogo';\nexport * from './ProductHuntLogo';\nexport * from './TiktokLogo';\nexport * from './XLogo';\nexport * from './YoutubeLogo';\n"],"names":["jsx","ProductHuntLogo","XLogo","YoutubeLogo","LinkedInLogo","TiktokLogo","InstagramLogo","FacebookLogo","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AC7B;AAAA,EACA,GAAG;AACL,MACE,eAAe;AAAA,EACb,eACG,CAAC,UACCQ,6BAAA,cAAA,mBAAA,EAAmB,GAAG,OAAQ,GAAG,WAAW,KAAK,MAAM,MAAO,CAAA;AAErE;;;;;;;;;"}
|
|
@@ -34,7 +34,7 @@ const socialNetworks = [
|
|
|
34
34
|
label: "TikTok"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
href: "https://www.instagram.com/
|
|
37
|
+
href: "https://www.instagram.com/intlayer/",
|
|
38
38
|
component: /* @__PURE__ */ jsx(InstagramLogo, { className: "max-w-full max-h-full h-auto" }),
|
|
39
39
|
label: "Instagram"
|
|
40
40
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/SocialNetworks/index.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, DetailedHTMLProps, FC, ReactNode } from 'react';\nimport { FacebookLogo } from './FacebookLogo';\nimport { InstagramLogo } from './InstagramLogo';\nimport { LinkedInLogo } from './LinkedInLogo';\nimport { ProductHuntLogo } from './ProductHuntLogo';\nimport { TiktokLogo } from './TiktokLogo';\nimport { XLogo } from './XLogo';\nimport { YoutubeLogo } from './YoutubeLogo';\n\nconst socialNetworks = [\n {\n href: 'https://www.producthunt.com/posts/intlayer?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-intlayer',\n component: <ProductHuntLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Product Hunt',\n },\n {\n href: 'https://x.com/Intlayer183096',\n component: <XLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'X',\n },\n {\n href: 'https://www.youtube.com/@intlayer',\n component: <YoutubeLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'YouTube',\n },\n {\n href: 'https://www.linkedin.com/company/intlayerorg',\n component: <LinkedInLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'LinkedIn',\n },\n {\n href: 'https://www.tiktok.com/@intlayer',\n component: <TiktokLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'TikTok',\n },\n {\n href: 'https://www.instagram.com/
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/SocialNetworks/index.tsx"],"sourcesContent":["import { AnchorHTMLAttributes, DetailedHTMLProps, FC, ReactNode } from 'react';\nimport { FacebookLogo } from './FacebookLogo';\nimport { InstagramLogo } from './InstagramLogo';\nimport { LinkedInLogo } from './LinkedInLogo';\nimport { ProductHuntLogo } from './ProductHuntLogo';\nimport { TiktokLogo } from './TiktokLogo';\nimport { XLogo } from './XLogo';\nimport { YoutubeLogo } from './YoutubeLogo';\n\nconst socialNetworks = [\n {\n href: 'https://www.producthunt.com/posts/intlayer?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-intlayer',\n component: <ProductHuntLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Product Hunt',\n },\n {\n href: 'https://x.com/Intlayer183096',\n component: <XLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'X',\n },\n {\n href: 'https://www.youtube.com/@intlayer',\n component: <YoutubeLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'YouTube',\n },\n {\n href: 'https://www.linkedin.com/company/intlayerorg',\n component: <LinkedInLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'LinkedIn',\n },\n {\n href: 'https://www.tiktok.com/@intlayer',\n component: <TiktokLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'TikTok',\n },\n {\n href: 'https://www.instagram.com/intlayer/',\n component: <InstagramLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Instagram',\n },\n {\n href: 'https://www.facebook.com/intlayer',\n component: <FacebookLogo className=\"max-w-full max-h-full h-auto\" />,\n label: 'Facebook',\n },\n];\n\ntype SocialNetworksProps = {\n renderItem?: (item: (typeof socialNetworks)[number]) => ReactNode;\n} & DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n>;\n\ntype DefaultRenderItemProps = DetailedHTMLProps<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n HTMLAnchorElement\n> & {\n component: ReactNode;\n label: string;\n};\n\nconst DefaultRenderItem: FC<DefaultRenderItemProps> = ({\n href,\n component,\n label,\n ...iconProps\n}) => (\n <a\n key={href}\n href={href}\n aria-label={label}\n className=\"max-w-4 max-h-4\"\n {...iconProps}\n >\n {component}\n </a>\n);\n\nexport const SocialNetworks = ({\n renderItem,\n ...iconProps\n}: SocialNetworksProps) =>\n socialNetworks.map(\n renderItem ??\n ((props) => (\n <DefaultRenderItem {...props} {...iconProps} key={props.label} />\n ))\n );\n\nexport * from './FacebookLogo';\nexport * from './InstagramLogo';\nexport * from './LinkedInLogo';\nexport * from './ProductHuntLogo';\nexport * from './TiktokLogo';\nexport * from './XLogo';\nexport * from './YoutubeLogo';\n"],"names":[],"mappings":";;;;;;;;;AASA,MAAM,iBAAiB;AAAA,EACrB;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,iBAAgB,EAAA,WAAU,+BAA+B,CAAA;AAAA,IACrE,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,OAAM,EAAA,WAAU,+BAA+B,CAAA;AAAA,IAC3D,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,aAAY,EAAA,WAAU,+BAA+B,CAAA;AAAA,IACjE,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,cAAa,EAAA,WAAU,+BAA+B,CAAA;AAAA,IAClE,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,YAAW,EAAA,WAAU,+BAA+B,CAAA;AAAA,IAChE,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,eAAc,EAAA,WAAU,+BAA+B,CAAA;AAAA,IACnE,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW,oBAAC,cAAa,EAAA,WAAU,+BAA+B,CAAA;AAAA,IAClE,OAAO;AAAA,EAAA;AAEX;AAiBA,MAAM,oBAAgD,CAAC;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC;AAAA,IACA,cAAY;AAAA,IACZ,WAAU;AAAA,IACT,GAAG;AAAA,IAEH,UAAA;AAAA,EAAA;AAAA,EANI;AAOP;AAGK,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MACE,eAAe;AAAA,EACb,eACG,CAAC,UACC,8BAAA,mBAAA,EAAmB,GAAG,OAAQ,GAAG,WAAW,KAAK,MAAM,MAAO,CAAA;AAErE;"}
|
|
@@ -5,10 +5,10 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
const ReactExports = require("react");
|
|
6
6
|
const classVarianceAuthority = require("class-variance-authority");
|
|
7
7
|
require("@intlayer/editor-react");
|
|
8
|
+
require("../Toaster/Toast.cjs");
|
|
9
|
+
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
8
10
|
require("@intlayer/api");
|
|
9
11
|
require("@intlayer/config/built");
|
|
10
|
-
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
11
|
-
require("../Toaster/Toast.cjs");
|
|
12
12
|
require("deepmerge");
|
|
13
13
|
const hooks_useItemSelector = require("../../hooks/useItemSelector.cjs");
|
|
14
14
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
@@ -3,10 +3,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState, useRef, useEffect, createElement } from "react";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import "@intlayer/editor-react";
|
|
6
|
+
import "../Toaster/Toast.mjs";
|
|
7
|
+
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
6
8
|
import "@intlayer/api";
|
|
7
9
|
import "@intlayer/config/built";
|
|
8
|
-
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
|
-
import "../Toaster/Toast.mjs";
|
|
10
10
|
import "deepmerge";
|
|
11
11
|
import { useItemSelector } from "../../hooks/useItemSelector.mjs";
|
|
12
12
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
@@ -5,10 +5,10 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
const classVarianceAuthority = require("class-variance-authority");
|
|
6
6
|
const ReactExports = require("react");
|
|
7
7
|
require("@intlayer/editor-react");
|
|
8
|
+
require("../Toaster/Toast.cjs");
|
|
9
|
+
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
8
10
|
require("@intlayer/api");
|
|
9
11
|
require("@intlayer/config/built");
|
|
10
|
-
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
11
|
-
require("../Toaster/Toast.cjs");
|
|
12
12
|
require("deepmerge");
|
|
13
13
|
const hooks_useItemSelector = require("../../hooks/useItemSelector.cjs");
|
|
14
14
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
@@ -3,10 +3,10 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { useRef, cloneElement } from "react";
|
|
5
5
|
import "@intlayer/editor-react";
|
|
6
|
+
import "../Toaster/Toast.mjs";
|
|
7
|
+
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
6
8
|
import "@intlayer/api";
|
|
7
9
|
import "@intlayer/config/built";
|
|
8
|
-
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
|
-
import "../Toaster/Toast.mjs";
|
|
10
10
|
import "deepmerge";
|
|
11
11
|
import { useItemSelector } from "../../hooks/useItemSelector.mjs";
|
|
12
12
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
@@ -6,6 +6,8 @@ const editorReact = require("@intlayer/editor-react");
|
|
|
6
6
|
const ReactExports = require("react");
|
|
7
7
|
const hooks_intlayerAPIHooks = require("../../hooks/intlayerAPIHooks.cjs");
|
|
8
8
|
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
9
|
+
require("@intlayer/api");
|
|
10
|
+
require("@intlayer/config/built");
|
|
9
11
|
require("deepmerge");
|
|
10
12
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
11
13
|
const components_TextArea_AutoSizeTextArea = require("./AutoSizeTextArea.cjs");
|
|
@@ -30,6 +32,11 @@ const AutoCompleteTextarea = ({
|
|
|
30
32
|
const [isTyped, setIsTyped] = ReactExports.useState(false);
|
|
31
33
|
const [text, setText] = ReactExports.useState(defaultValue);
|
|
32
34
|
const [suggestion, setSuggestion] = ReactExports.useState("");
|
|
35
|
+
const textareaRef = ReactExports.useRef(null);
|
|
36
|
+
const placeholderRef = ReactExports.useRef(null);
|
|
37
|
+
const ghostLayerRef = ReactExports.useRef(null);
|
|
38
|
+
const [suggestionPosition, setSuggestionPosition] = ReactExports.useState(null);
|
|
39
|
+
const [cursorAtFetch, setCursorAtFetch] = ReactExports.useState(-1);
|
|
33
40
|
const debouncedText = useDebounce(text, 200);
|
|
34
41
|
ReactExports.useEffect(() => {
|
|
35
42
|
if (typeof props.value === "undefined") return;
|
|
@@ -40,18 +47,33 @@ const AutoCompleteTextarea = ({
|
|
|
40
47
|
if (!isTyped) return;
|
|
41
48
|
const fetchSuggestion = async () => {
|
|
42
49
|
try {
|
|
50
|
+
const cursor = textareaRef.current?.selectionStart ?? debouncedText.length;
|
|
51
|
+
const before = debouncedText.slice(0, cursor);
|
|
52
|
+
const after = debouncedText.slice(cursor);
|
|
53
|
+
const numLines = 5;
|
|
54
|
+
const beforeLines = before.split("\n");
|
|
55
|
+
const contextBeforeLines = beforeLines.slice(
|
|
56
|
+
Math.max(0, beforeLines.length - numLines - 1),
|
|
57
|
+
-1
|
|
58
|
+
);
|
|
59
|
+
const contextBefore = contextBeforeLines.join("\n");
|
|
60
|
+
const currentLine = beforeLines[beforeLines.length - 1] ?? "";
|
|
61
|
+
const afterLines = after.split("\n");
|
|
62
|
+
const contextAfter = afterLines.slice(1, numLines + 1).join("\n");
|
|
43
63
|
const response = await autocomplete({
|
|
44
|
-
text:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
text: before,
|
|
65
|
+
contextBefore,
|
|
66
|
+
currentLine,
|
|
67
|
+
contextAfter,
|
|
68
|
+
aiOptions: {
|
|
69
|
+
apiKey: configuration.editor.openAiApiKey,
|
|
70
|
+
model: configuration.editor.openAiApiModel,
|
|
71
|
+
temperature: configuration.editor.openAiApiTemperature
|
|
72
|
+
}
|
|
48
73
|
});
|
|
49
74
|
const autocompletion = response?.data?.autocompletion ?? "";
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return setSuggestion(remaining);
|
|
53
|
-
}
|
|
54
|
-
return setSuggestion(autocompletion);
|
|
75
|
+
setSuggestion(autocompletion);
|
|
76
|
+
setCursorAtFetch(cursor);
|
|
55
77
|
} catch (err) {
|
|
56
78
|
console.error("Autocomplete error:", err);
|
|
57
79
|
}
|
|
@@ -62,31 +84,79 @@ const AutoCompleteTextarea = ({
|
|
|
62
84
|
} else {
|
|
63
85
|
setSuggestion("");
|
|
64
86
|
}
|
|
65
|
-
}, [debouncedText, isActive]);
|
|
87
|
+
}, [debouncedText, isActive, autocomplete, configuration]);
|
|
88
|
+
ReactExports.useEffect(() => {
|
|
89
|
+
if (!suggestion || cursorAtFetch === -1 || !placeholderRef.current || !ghostLayerRef.current) {
|
|
90
|
+
setSuggestionPosition(null);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const rect = placeholderRef.current.getBoundingClientRect();
|
|
94
|
+
const parentRect = ghostLayerRef.current.getBoundingClientRect();
|
|
95
|
+
setSuggestionPosition({
|
|
96
|
+
left: rect.left - parentRect.left,
|
|
97
|
+
top: rect.top - parentRect.top
|
|
98
|
+
});
|
|
99
|
+
}, [suggestion, cursorAtFetch, text]);
|
|
66
100
|
const acceptSuggestion = () => {
|
|
67
|
-
|
|
101
|
+
const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;
|
|
102
|
+
if (currentCursor !== cursorAtFetch) return;
|
|
103
|
+
const newText = text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);
|
|
104
|
+
setText(newText);
|
|
68
105
|
setSuggestion("");
|
|
106
|
+
setCursorAtFetch(-1);
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
textareaRef.current?.focus();
|
|
109
|
+
const newCursorPos = currentCursor + suggestion.length;
|
|
110
|
+
textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);
|
|
111
|
+
}, 0);
|
|
69
112
|
};
|
|
70
113
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", children: [
|
|
71
114
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
72
115
|
"div",
|
|
73
116
|
{
|
|
117
|
+
ref: ghostLayerRef,
|
|
74
118
|
className: "pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]",
|
|
75
119
|
"aria-hidden": "true",
|
|
76
120
|
children: [
|
|
77
|
-
/* @__PURE__ */ jsxRuntime.
|
|
78
|
-
|
|
121
|
+
suggestion && cursorAtFetch !== -1 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "align-text-top text-transparent", children: text.slice(0, cursorAtFetch) }),
|
|
123
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
+
"span",
|
|
125
|
+
{
|
|
126
|
+
ref: placeholderRef,
|
|
127
|
+
style: { visibility: "hidden" },
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
children: suggestion
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "align-text-top text-transparent", children: text.slice(cursorAtFetch) })
|
|
133
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "align-text-top text-transparent", children: text }),
|
|
134
|
+
suggestionProp && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral align-text-top", children: suggestionProp })
|
|
79
135
|
]
|
|
80
136
|
}
|
|
81
137
|
),
|
|
138
|
+
suggestion && suggestionPosition && /* @__PURE__ */ jsxRuntime.jsx(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
className: "pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]",
|
|
142
|
+
style: {
|
|
143
|
+
position: "absolute",
|
|
144
|
+
left: suggestionPosition.left,
|
|
145
|
+
top: suggestionPosition.top
|
|
146
|
+
},
|
|
147
|
+
children: suggestion
|
|
148
|
+
}
|
|
149
|
+
),
|
|
82
150
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
83
151
|
components_TextArea_AutoSizeTextArea.AutoSizedTextArea,
|
|
84
152
|
{
|
|
85
153
|
...props,
|
|
154
|
+
ref: textareaRef,
|
|
86
155
|
value: text,
|
|
87
156
|
onChange: (e) => {
|
|
88
157
|
setIsTyped(true);
|
|
89
158
|
setText(e.target.value);
|
|
159
|
+
setSuggestion("");
|
|
90
160
|
props.onChange?.(e);
|
|
91
161
|
},
|
|
92
162
|
onKeyDown: (e) => {
|
|
@@ -95,6 +165,13 @@ const AutoCompleteTextarea = ({
|
|
|
95
165
|
acceptSuggestion();
|
|
96
166
|
}
|
|
97
167
|
props.onKeyDown?.(e);
|
|
168
|
+
},
|
|
169
|
+
onSelect: (e) => {
|
|
170
|
+
if (suggestion && e.target.selectionStart !== cursorAtFetch) {
|
|
171
|
+
setSuggestion("");
|
|
172
|
+
setCursorAtFetch(-1);
|
|
173
|
+
}
|
|
174
|
+
props.onSelect?.(e);
|
|
98
175
|
}
|
|
99
176
|
}
|
|
100
177
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteTextArea.cjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useState, useEffect } from 'react';\nimport { useAutocomplete } from '../../hooks';\nimport {\n type AutoSizedTextAreaProps,\n AutoSizedTextArea,\n} from './AutoSizeTextArea';\n\nexport const useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Cleanup the timer if value changes before 'delay' ms\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\nexport type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {\n isActive?: boolean;\n suggestion?: string;\n};\n\nexport const AutoCompleteTextarea: FC<AutocompleteTextAreaProps> = ({\n isActive = true,\n suggestion: suggestionProp,\n ...props\n}) => {\n const defaultValue = String(props.value ?? props.defaultValue ?? '');\n const { autocomplete } = useAutocomplete();\n const configuration = useConfiguration();\n const [isTyped, setIsTyped] = useState(false);\n const [text, setText] = useState(defaultValue);\n const [suggestion, setSuggestion] = useState('');\n\n // Only update this “debouncedText” after the user stops typing for 500ms\n const debouncedText = useDebounce(text, 200);\n\n useEffect(() => {\n if (typeof props.value === 'undefined') return;\n setText(defaultValue);\n }, [props.value, props.defaultValue]);\n\n useEffect(() => {\n if (!isActive) return;\n if (!isTyped) return;\n\n const fetchSuggestion = async () => {\n try {\n const response = await autocomplete({\n text: debouncedText,\n openAiApiKey: configuration.editor.openAiApiKey,\n model: configuration.editor.openAiApiModel,\n temperature: configuration.editor.openAiApiTemperature,\n });\n // e.g. response.data.autocompletion = \"Hello World\"\n const autocompletion = response?.data?.autocompletion ?? '';\n\n // If the suggested text starts with what the user typed,\n // we only store the *remaining* part as the suggestion\n // so that we can render \"ghost\" text appropriately.\n if (autocompletion.startsWith(debouncedText)) {\n const remaining = autocompletion.slice(debouncedText.length);\n return setSuggestion(remaining);\n }\n\n return setSuggestion(autocompletion);\n } catch (err) {\n console.error('Autocomplete error:', err);\n }\n };\n\n if (debouncedText.length > 3) {\n // Only fetch if user typed more than 3 chars and has paused\n setSuggestion('');\n fetchSuggestion();\n } else {\n // If typed less than threshold, clear the suggestion\n setSuggestion('');\n }\n }, [debouncedText, isActive]);\n\n const acceptSuggestion = () => {\n // Merge the typed text with the suggestion\n setText((prevText) => prevText + suggestion);\n setSuggestion('');\n };\n\n return (\n <div className=\"relative w-full\">\n {/*\n --- Background/Ghost layer ---\n Mirrors user's typed text and shows suggestion as ghosted/gray\n */}\n <div\n className=\"pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]\"\n aria-hidden=\"true\"\n >\n <span className=\"align-text-top text-transparent\">{text}</span>\n {(suggestion || suggestionProp) && (\n <span className=\"text-neutral ml-3 align-text-top\">\n {suggestionProp ?? suggestion}\n </span>\n )}\n </div>\n {/*\n --- Actual editable textarea ---\n Must share the same styling (font size, line-height, etc.) so\n text lines up exactly underneath the background layer.\n */}\n <AutoSizedTextArea\n {...props}\n value={text}\n onChange={(e) => {\n setIsTyped(true);\n setText(e.target.value);\n props.onChange?.(e);\n }}\n onKeyDown={(e) => {\n // If user presses Tab and we have a suggestion, accept it\n if (e.key === 'Tab' && suggestion) {\n e.preventDefault();\n acceptSuggestion();\n }\n props.onKeyDown?.(e);\n }}\n />\n </div>\n );\n};\n"],"names":["useState","useEffect","useAutocomplete","useConfiguration","jsxs","jsx","AutoSizedTextArea"],"mappings":";;;;;;;;;;;AAUa,MAAA,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,aAAAA,SAAY,KAAK;AAE7DC,eAAAA,UAAU,MAAM;AACR,UAAA,Q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A;AAAA,IAE5C;AAEI,QAAA,cAAc,SAAS,GAAG;AAE5B,oBAAc,EAAE;AACA,sBAAA;AAAA,IAAA,OACX;AAEL,oBAAc,EAAE;AAAA,IAAA;AAAA,EAClB,GACC,CAAC,eAAe,QAAQ,CAAC;AAE5B,QAAM,mBAAmB,MAAM;AAErB,YAAA,CAAC,aAAa,WAAW,UAAU;AAC3C,kBAAc,EAAE;AAAA,EAClB;AAGE,SAAAG,2BAAA,KAAC,OAAI,EAAA,WAAU,mBAKb,UAAA;AAAA,IAAAA,2BAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,eAAY;AAAA,QAEZ,UAAA;AAAA,UAACC,2BAAA,IAAA,QAAA,EAAK,WAAU,mCAAmC,UAAK,MAAA;AAAA,WACtD,cAAc,mBACdA,2BAAAA,IAAC,UAAK,WAAU,oCACb,4BAAkB,WACrB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,IAMAA,2BAAA;AAAA,MAACC,qCAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,OAAO;AAAA,QACP,UAAU,CAAC,MAAM;AACf,qBAAW,IAAI;AACP,kBAAA,EAAE,OAAO,KAAK;AACtB,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,QACA,WAAW,CAAC,MAAM;AAEZ,cAAA,EAAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAe;AACA,6BAAA;AAAA,UAAA;AAEnB,gBAAM,YAAY,CAAC;AAAA,QAAA;AAAA,MACrB;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;;"}
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.cjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks';\nimport {\n type AutoSizedTextAreaProps,\n AutoSizedTextArea,\n} from './AutoSizeTextArea';\n\nexport const useDebounce = <T,>(value: T, delay: number): T => {\n const [debouncedValue, setDebouncedValue] = useState<T>(value);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n // Cleanup the timer if value changes before 'delay' ms\n return () => clearTimeout(timer);\n }, [value, delay]);\n\n return debouncedValue;\n};\n\nexport type AutocompleteTextAreaProps = AutoSizedTextAreaProps & {\n isActive?: boolean;\n suggestion?: string;\n};\n\nexport const AutoCompleteTextarea: FC<AutocompleteTextAreaProps> = ({\n isActive = true,\n suggestion: suggestionProp,\n ...props\n}) => {\n const defaultValue = String(props.value ?? props.defaultValue ?? '');\n const { autocomplete } = useAutocomplete();\n const configuration = useConfiguration();\n const [isTyped, setIsTyped] = useState(false);\n const [text, setText] = useState(defaultValue);\n const [suggestion, setSuggestion] = useState('');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const placeholderRef = useRef<HTMLSpanElement>(null);\n const ghostLayerRef = useRef<HTMLDivElement>(null);\n const [suggestionPosition, setSuggestionPosition] = useState<{\n left: number;\n top: number;\n } | null>(null);\n const [cursorAtFetch, setCursorAtFetch] = useState(-1);\n\n // Only update this “debouncedText” after the user stops typing for 200ms\n const debouncedText = useDebounce(text, 200);\n\n useEffect(() => {\n if (typeof props.value === 'undefined') return;\n setText(defaultValue);\n }, [props.value, props.defaultValue]);\n\n useEffect(() => {\n if (!isActive) return;\n if (!isTyped) return;\n\n const fetchSuggestion = async () => {\n try {\n const cursor =\n textareaRef.current?.selectionStart ?? debouncedText.length;\n const before = debouncedText.slice(0, cursor);\n const after = debouncedText.slice(cursor);\n const numLines = 5;\n const beforeLines = before.split('\\n');\n const contextBeforeLines = beforeLines.slice(\n Math.max(0, beforeLines.length - numLines - 1),\n -1\n );\n const contextBefore = contextBeforeLines.join('\\n');\n const currentLine = beforeLines[beforeLines.length - 1] ?? '';\n const afterLines = after.split('\\n');\n const contextAfter = afterLines.slice(1, numLines + 1).join('\\n');\n\n const response = await autocomplete({\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.editor.openAiApiKey,\n model: configuration.editor.openAiApiModel,\n temperature: configuration.editor.openAiApiTemperature,\n },\n });\n const autocompletion = response?.data?.autocompletion ?? '';\n\n setSuggestion(autocompletion);\n setCursorAtFetch(cursor);\n } catch (err) {\n console.error('Autocomplete error:', err);\n }\n };\n\n if (debouncedText.length > 3) {\n // Only fetch if user typed more than 3 chars and has paused\n setSuggestion('');\n fetchSuggestion();\n } else {\n // If typed less than threshold, clear the suggestion\n setSuggestion('');\n }\n }, [debouncedText, isActive, autocomplete, configuration]);\n\n useEffect(() => {\n if (\n !suggestion ||\n cursorAtFetch === -1 ||\n !placeholderRef.current ||\n !ghostLayerRef.current\n ) {\n setSuggestionPosition(null);\n return;\n }\n\n const rect = placeholderRef.current.getBoundingClientRect();\n const parentRect = ghostLayerRef.current.getBoundingClientRect();\n setSuggestionPosition({\n left: rect.left - parentRect.left,\n top: rect.top - parentRect.top,\n });\n }, [suggestion, cursorAtFetch, text]);\n\n const acceptSuggestion = () => {\n const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;\n if (currentCursor !== cursorAtFetch) return;\n const newText =\n text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);\n setText(newText);\n setSuggestion('');\n setCursorAtFetch(-1);\n setTimeout(() => {\n textareaRef.current?.focus();\n const newCursorPos = currentCursor + suggestion.length;\n textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);\n }, 0);\n };\n\n return (\n <div className=\"relative w-full\">\n <div\n ref={ghostLayerRef}\n className=\"pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]\"\n aria-hidden=\"true\"\n >\n {suggestion && cursorAtFetch !== -1 ? (\n <>\n <span className=\"align-text-top text-transparent\">\n {text.slice(0, cursorAtFetch)}\n </span>\n <span\n ref={placeholderRef}\n style={{ visibility: 'hidden' }}\n aria-hidden=\"true\"\n >\n {suggestion}\n </span>\n <span className=\"align-text-top text-transparent\">\n {text.slice(cursorAtFetch)}\n </span>\n </>\n ) : (\n <span className=\"align-text-top text-transparent\">{text}</span>\n )}\n {suggestionProp && (\n <span className=\"text-neutral align-text-top\">{suggestionProp}</span>\n )}\n </div>\n {suggestion && suggestionPosition && (\n <div\n className=\"pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]\"\n style={{\n position: 'absolute',\n left: suggestionPosition.left,\n top: suggestionPosition.top,\n }}\n >\n {suggestion}\n </div>\n )}\n <AutoSizedTextArea\n {...props}\n ref={textareaRef}\n value={text}\n onChange={(e) => {\n setIsTyped(true);\n setText(e.target.value);\n setSuggestion('');\n props.onChange?.(e);\n }}\n onKeyDown={(e) => {\n if (e.key === 'Tab' && suggestion) {\n e.preventDefault();\n acceptSuggestion();\n }\n props.onKeyDown?.(e);\n }}\n onSelect={(e) => {\n if (\n suggestion &&\n (e.target as HTMLTextAreaElement).selectionStart !== cursorAtFetch\n ) {\n setSuggestion('');\n setCursorAtFetch(-1);\n }\n props.onSelect?.(e);\n }}\n />\n </div>\n );\n};\n"],"names":["useState","useEffect","useAutocomplete","useConfiguration","useRef","jsxs","Fragment","jsx","AutoSizedTextArea"],"mappings":";;;;;;;;;;;;;AAUa,MAAA,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,aAAAA,SAAY,KAAK;AAE7DC,eAAAA,UAAU,MAAM;AACR,UAAA,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,OACtB,KAAK;AAGD,WAAA,MAAM,aAAa,KAAK;AAAA,EAAA,GAC9B,CAAC,OAAO,KAAK,CAAC;AAEV,SAAA;AACT;AAOO,MAAM,uBAAsD,CAAC;AAAA,EAClE,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,QAAM,e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ACtB,wBAAc,EAAE;AAChB,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,QACA,WAAW,CAAC,MAAM;AACZ,cAAA,EAAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAe;AACA,6BAAA;AAAA,UAAA;AAEnB,gBAAM,YAAY,CAAC;AAAA,QACrB;AAAA,QACA,UAAU,CAAC,MAAM;AACf,cACE,cACC,EAAE,OAA+B,mBAAmB,eACrD;AACA,0BAAc,EAAE;AAChB,6BAAiB,EAAE;AAAA,UAAA;AAErB,gBAAM,WAAW,CAAC;AAAA,QAAA;AAAA,MACpB;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,WAAW,GAAI,CAAC,EAAG,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,CAazD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAyL9D,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
4
|
-
import { useState, useEffect } from "react";
|
|
4
|
+
import { useState, useEffect, useRef } from "react";
|
|
5
5
|
import { useAutocomplete } from "../../hooks/intlayerAPIHooks.mjs";
|
|
6
6
|
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
7
|
+
import "@intlayer/api";
|
|
8
|
+
import "@intlayer/config/built";
|
|
7
9
|
import "deepmerge";
|
|
8
10
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
9
11
|
import { AutoSizedTextArea } from "./AutoSizeTextArea.mjs";
|
|
@@ -28,6 +30,11 @@ const AutoCompleteTextarea = ({
|
|
|
28
30
|
const [isTyped, setIsTyped] = useState(false);
|
|
29
31
|
const [text, setText] = useState(defaultValue);
|
|
30
32
|
const [suggestion, setSuggestion] = useState("");
|
|
33
|
+
const textareaRef = useRef(null);
|
|
34
|
+
const placeholderRef = useRef(null);
|
|
35
|
+
const ghostLayerRef = useRef(null);
|
|
36
|
+
const [suggestionPosition, setSuggestionPosition] = useState(null);
|
|
37
|
+
const [cursorAtFetch, setCursorAtFetch] = useState(-1);
|
|
31
38
|
const debouncedText = useDebounce(text, 200);
|
|
32
39
|
useEffect(() => {
|
|
33
40
|
if (typeof props.value === "undefined") return;
|
|
@@ -38,18 +45,33 @@ const AutoCompleteTextarea = ({
|
|
|
38
45
|
if (!isTyped) return;
|
|
39
46
|
const fetchSuggestion = async () => {
|
|
40
47
|
try {
|
|
48
|
+
const cursor = textareaRef.current?.selectionStart ?? debouncedText.length;
|
|
49
|
+
const before = debouncedText.slice(0, cursor);
|
|
50
|
+
const after = debouncedText.slice(cursor);
|
|
51
|
+
const numLines = 5;
|
|
52
|
+
const beforeLines = before.split("\n");
|
|
53
|
+
const contextBeforeLines = beforeLines.slice(
|
|
54
|
+
Math.max(0, beforeLines.length - numLines - 1),
|
|
55
|
+
-1
|
|
56
|
+
);
|
|
57
|
+
const contextBefore = contextBeforeLines.join("\n");
|
|
58
|
+
const currentLine = beforeLines[beforeLines.length - 1] ?? "";
|
|
59
|
+
const afterLines = after.split("\n");
|
|
60
|
+
const contextAfter = afterLines.slice(1, numLines + 1).join("\n");
|
|
41
61
|
const response = await autocomplete({
|
|
42
|
-
text:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
text: before,
|
|
63
|
+
contextBefore,
|
|
64
|
+
currentLine,
|
|
65
|
+
contextAfter,
|
|
66
|
+
aiOptions: {
|
|
67
|
+
apiKey: configuration.editor.openAiApiKey,
|
|
68
|
+
model: configuration.editor.openAiApiModel,
|
|
69
|
+
temperature: configuration.editor.openAiApiTemperature
|
|
70
|
+
}
|
|
46
71
|
});
|
|
47
72
|
const autocompletion = response?.data?.autocompletion ?? "";
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return setSuggestion(remaining);
|
|
51
|
-
}
|
|
52
|
-
return setSuggestion(autocompletion);
|
|
73
|
+
setSuggestion(autocompletion);
|
|
74
|
+
setCursorAtFetch(cursor);
|
|
53
75
|
} catch (err) {
|
|
54
76
|
console.error("Autocomplete error:", err);
|
|
55
77
|
}
|
|
@@ -60,31 +82,79 @@ const AutoCompleteTextarea = ({
|
|
|
60
82
|
} else {
|
|
61
83
|
setSuggestion("");
|
|
62
84
|
}
|
|
63
|
-
}, [debouncedText, isActive]);
|
|
85
|
+
}, [debouncedText, isActive, autocomplete, configuration]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!suggestion || cursorAtFetch === -1 || !placeholderRef.current || !ghostLayerRef.current) {
|
|
88
|
+
setSuggestionPosition(null);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const rect = placeholderRef.current.getBoundingClientRect();
|
|
92
|
+
const parentRect = ghostLayerRef.current.getBoundingClientRect();
|
|
93
|
+
setSuggestionPosition({
|
|
94
|
+
left: rect.left - parentRect.left,
|
|
95
|
+
top: rect.top - parentRect.top
|
|
96
|
+
});
|
|
97
|
+
}, [suggestion, cursorAtFetch, text]);
|
|
64
98
|
const acceptSuggestion = () => {
|
|
65
|
-
|
|
99
|
+
const currentCursor = textareaRef.current?.selectionStart ?? cursorAtFetch;
|
|
100
|
+
if (currentCursor !== cursorAtFetch) return;
|
|
101
|
+
const newText = text.slice(0, currentCursor) + suggestion + text.slice(currentCursor);
|
|
102
|
+
setText(newText);
|
|
66
103
|
setSuggestion("");
|
|
104
|
+
setCursorAtFetch(-1);
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
textareaRef.current?.focus();
|
|
107
|
+
const newCursorPos = currentCursor + suggestion.length;
|
|
108
|
+
textareaRef.current?.setSelectionRange(newCursorPos, newCursorPos);
|
|
109
|
+
}, 0);
|
|
67
110
|
};
|
|
68
111
|
return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
69
112
|
/* @__PURE__ */ jsxs(
|
|
70
113
|
"div",
|
|
71
114
|
{
|
|
115
|
+
ref: ghostLayerRef,
|
|
72
116
|
className: "pointer-events-none absolute inset-0 whitespace-pre-wrap break-words px-1 py-3 text-base leading-[1.45rem] md:py-1 md:text-sm md:leading-[1.23rem]",
|
|
73
117
|
"aria-hidden": "true",
|
|
74
118
|
children: [
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
|
|
119
|
+
suggestion && cursorAtFetch !== -1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
120
|
+
/* @__PURE__ */ jsx("span", { className: "align-text-top text-transparent", children: text.slice(0, cursorAtFetch) }),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
"span",
|
|
123
|
+
{
|
|
124
|
+
ref: placeholderRef,
|
|
125
|
+
style: { visibility: "hidden" },
|
|
126
|
+
"aria-hidden": "true",
|
|
127
|
+
children: suggestion
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: "align-text-top text-transparent", children: text.slice(cursorAtFetch) })
|
|
131
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "align-text-top text-transparent", children: text }),
|
|
132
|
+
suggestionProp && /* @__PURE__ */ jsx("span", { className: "text-neutral align-text-top", children: suggestionProp })
|
|
77
133
|
]
|
|
78
134
|
}
|
|
79
135
|
),
|
|
136
|
+
suggestion && suggestionPosition && /* @__PURE__ */ jsx(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
className: "pointer-events-none text-neutral whitespace-pre-wrap break-words text-base leading-[1.45rem] md:text-sm md:leading-[1.23rem]",
|
|
140
|
+
style: {
|
|
141
|
+
position: "absolute",
|
|
142
|
+
left: suggestionPosition.left,
|
|
143
|
+
top: suggestionPosition.top
|
|
144
|
+
},
|
|
145
|
+
children: suggestion
|
|
146
|
+
}
|
|
147
|
+
),
|
|
80
148
|
/* @__PURE__ */ jsx(
|
|
81
149
|
AutoSizedTextArea,
|
|
82
150
|
{
|
|
83
151
|
...props,
|
|
152
|
+
ref: textareaRef,
|
|
84
153
|
value: text,
|
|
85
154
|
onChange: (e) => {
|
|
86
155
|
setIsTyped(true);
|
|
87
156
|
setText(e.target.value);
|
|
157
|
+
setSuggestion("");
|
|
88
158
|
props.onChange?.(e);
|
|
89
159
|
},
|
|
90
160
|
onKeyDown: (e) => {
|
|
@@ -93,6 +163,13 @@ const AutoCompleteTextarea = ({
|
|
|
93
163
|
acceptSuggestion();
|
|
94
164
|
}
|
|
95
165
|
props.onKeyDown?.(e);
|
|
166
|
+
},
|
|
167
|
+
onSelect: (e) => {
|
|
168
|
+
if (suggestion && e.target.selectionStart !== cursorAtFetch) {
|
|
169
|
+
setSuggestion("");
|
|
170
|
+
setCursorAtFetch(-1);
|
|
171
|
+
}
|
|
172
|
+
props.onSelect?.(e);
|
|
96
173
|
}
|
|
97
174
|
}
|
|
98
175
|
)
|