@intlayer/design-system 5.8.1 → 6.0.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +34 -106
- package/dist/better-auth.CMQ3rA-I-7umXOENE.js.map +1 -1
- package/dist/better-auth.CMQ3rA-I-C2nBKRMa.cjs.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.cjs +3 -1
- package/dist/components/Breadcrumb/breadcrumb.content.cjs.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.d.ts +3 -0
- package/dist/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -1
- package/dist/components/Breadcrumb/breadcrumb.content.mjs +3 -1
- package/dist/components/Breadcrumb/breadcrumb.content.mjs.map +1 -1
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts.map +1 -1
- package/dist/components/Breadcrumb/index.mjs.map +1 -1
- package/dist/components/CopyButton/CopyButton.content.cjs +3 -1
- package/dist/components/CopyButton/CopyButton.content.cjs.map +1 -1
- package/dist/components/CopyButton/CopyButton.content.d.ts +3 -0
- package/dist/components/CopyButton/CopyButton.content.d.ts.map +1 -1
- package/dist/components/CopyButton/CopyButton.content.mjs +3 -1
- package/dist/components/CopyButton/CopyButton.content.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +7 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +7 -3
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +83 -34
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +83 -34
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +13 -9
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +12 -8
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs +27 -13
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +27 -0
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +27 -13
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs +9 -4
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +9 -0
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs +9 -4
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +29 -25
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +27 -23
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +37 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +64 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +37 -17
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs +25 -12
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +25 -0
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs +25 -12
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +4 -5
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +4 -5
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +25 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +25 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +25 -12
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +36 -31
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +36 -31
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -28
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +32 -5
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -28
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -5
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -5
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs +9 -4
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +9 -0
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs +9 -4
- package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +3 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +3 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +4 -6
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts +3 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +4 -6
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs +7 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +7 -0
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs +7 -3
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs +9 -6
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +9 -4
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs +9 -6
- package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs +28 -14
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +29 -2
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs +28 -14
- package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
- package/dist/components/DropDown/index.cjs +2 -2
- package/dist/components/DropDown/index.cjs.map +1 -1
- package/dist/components/DropDown/index.d.ts.map +1 -1
- package/dist/components/DropDown/index.mjs +2 -2
- package/dist/components/DropDown/index.mjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -5
- package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -5
- package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +2 -2
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
- package/dist/components/ExpandCollapse/expandCollapse.content.cjs +5 -2
- package/dist/components/ExpandCollapse/expandCollapse.content.cjs.map +1 -1
- package/dist/components/ExpandCollapse/expandCollapse.content.d.ts +3 -0
- package/dist/components/ExpandCollapse/expandCollapse.content.d.ts.map +1 -1
- package/dist/components/ExpandCollapse/expandCollapse.content.mjs +5 -2
- package/dist/components/ExpandCollapse/expandCollapse.content.mjs.map +1 -1
- package/dist/components/Flags/Flag.cjs +2 -1
- package/dist/components/Flags/Flag.cjs.map +1 -1
- package/dist/components/Flags/Flag.d.ts.map +1 -1
- package/dist/components/Flags/Flag.mjs +2 -1
- package/dist/components/Flags/Flag.mjs.map +1 -1
- package/dist/components/IDE/Code.cjs +8 -8
- package/dist/components/IDE/Code.cjs.map +1 -1
- package/dist/components/IDE/Code.mjs +8 -8
- package/dist/components/IDE/Code.mjs.map +1 -1
- package/dist/components/IDE/CodeBlockClient.cjs +1 -1
- package/dist/components/IDE/CodeBlockClient.cjs.map +1 -1
- package/dist/components/IDE/CodeBlockClient.d.ts +1 -1
- package/dist/components/IDE/CodeBlockClient.d.ts.map +1 -1
- package/dist/components/IDE/CodeBlockClient.mjs +1 -1
- package/dist/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/components/IDE/CodeContext.cjs +1 -3
- package/dist/components/IDE/CodeContext.cjs.map +1 -1
- package/dist/components/IDE/CodeContext.mjs +1 -3
- package/dist/components/IDE/CodeContext.mjs.map +1 -1
- package/dist/components/IDE/code.content.cjs +5 -2
- package/dist/components/IDE/code.content.cjs.map +1 -1
- package/dist/components/IDE/code.content.d.ts +5 -0
- package/dist/components/IDE/code.content.d.ts.map +1 -1
- package/dist/components/IDE/code.content.mjs +5 -2
- package/dist/components/IDE/code.content.mjs.map +1 -1
- package/dist/components/IDE/copyCode.content.cjs +5 -2
- package/dist/components/IDE/copyCode.content.cjs.map +1 -1
- package/dist/components/IDE/copyCode.content.d.ts +5 -0
- package/dist/components/IDE/copyCode.content.d.ts.map +1 -1
- package/dist/components/IDE/copyCode.content.mjs +5 -2
- package/dist/components/IDE/copyCode.content.mjs.map +1 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.d.ts +2 -2
- package/dist/components/Input/Checkbox.d.ts.map +1 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Loader/index.content.cjs +6 -1
- package/dist/components/Loader/index.content.cjs.map +1 -1
- package/dist/components/Loader/index.content.d.ts +33 -2
- package/dist/components/Loader/index.content.d.ts.map +1 -1
- package/dist/components/Loader/index.content.mjs +6 -1
- package/dist/components/Loader/index.content.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +1 -3
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs +17 -8
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +17 -0
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs +17 -8
- package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs +13 -6
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +13 -0
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs +13 -6
- package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +2 -4
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.mjs +2 -4
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -3
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -3
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs +2 -4
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.mjs +2 -4
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +1 -3
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.mjs +1 -3
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +1 -3
- package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.d.ts +1 -1
- package/dist/components/TabSelector/TabSelector.d.ts.map +1 -1
- package/dist/components/TabSelector/TabSelector.mjs +1 -3
- package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
- package/dist/components/Table/table.content.cjs +3 -1
- package/dist/components/Table/table.content.cjs.map +1 -1
- package/dist/components/Table/table.content.d.ts +3 -0
- package/dist/components/Table/table.content.d.ts.map +1 -1
- package/dist/components/Table/table.content.mjs +3 -1
- package/dist/components/Table/table.content.mjs.map +1 -1
- package/dist/components/Tag/index.cjs +22 -88
- package/dist/components/Tag/index.cjs.map +1 -1
- package/dist/components/Tag/index.d.ts +5 -5
- package/dist/components/Tag/index.mjs +22 -88
- package/dist/components/Tag/index.mjs.map +1 -1
- package/dist/components/TextArea/AutocompleteTextArea.cjs +20 -21
- 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 +20 -21
- package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/hooks/auth.cjs +26 -11
- package/dist/hooks/auth.cjs.map +1 -1
- package/dist/hooks/auth.mjs +26 -11
- package/dist/hooks/auth.mjs.map +1 -1
- package/dist/hooks/index.cjs +65 -66
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +4 -8
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/reactQuery.cjs +648 -0
- package/dist/hooks/reactQuery.cjs.map +1 -0
- package/dist/hooks/reactQuery.d.ts +899 -0
- package/dist/hooks/reactQuery.d.ts.map +1 -0
- package/dist/hooks/reactQuery.mjs +646 -0
- package/dist/hooks/reactQuery.mjs.map +1 -0
- package/dist/hooks/useAuth/useOAuth2.cjs +13 -10
- package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts +1 -1
- package/dist/hooks/useAuth/useOAuth2.d.ts.map +1 -1
- package/dist/hooks/useAuth/useOAuth2.mjs +13 -10
- package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/hooks/useAuth/useSession.cjs +23 -26
- package/dist/hooks/useAuth/useSession.cjs.map +1 -1
- package/dist/hooks/useAuth/useSession.d.ts +4 -352
- package/dist/hooks/useAuth/useSession.d.ts.map +1 -1
- package/dist/hooks/useAuth/useSession.mjs +23 -26
- package/dist/hooks/useAuth/useSession.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.cjs +2 -3
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +2 -3
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/useUser/index.cjs +6 -9
- package/dist/hooks/useUser/index.cjs.map +1 -1
- package/dist/hooks/useUser/index.d.ts +2 -18
- package/dist/hooks/useUser/index.d.ts.map +1 -1
- package/dist/hooks/useUser/index.mjs +6 -9
- package/dist/hooks/useUser/index.mjs.map +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/providers/ReactQueryProvider.cjs +85 -0
- package/dist/providers/ReactQueryProvider.cjs.map +1 -0
- package/dist/providers/ReactQueryProvider.d.ts +13 -0
- package/dist/providers/ReactQueryProvider.d.ts.map +1 -0
- package/dist/providers/ReactQueryProvider.mjs +85 -0
- package/dist/providers/ReactQueryProvider.mjs.map +1 -0
- package/dist/providers/index.cjs +5 -0
- package/dist/{hooks/useAsync → providers}/index.cjs.map +1 -1
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.mjs +5 -0
- package/dist/{hooks/useAsync → providers}/index.mjs.map +1 -1
- package/package.json +30 -20
- package/dist/hooks/intlayerAPIHooks.cjs +0 -542
- package/dist/hooks/intlayerAPIHooks.cjs.map +0 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +0 -968
- package/dist/hooks/intlayerAPIHooks.d.ts.map +0 -1
- package/dist/hooks/intlayerAPIHooks.mjs +0 -542
- package/dist/hooks/intlayerAPIHooks.mjs.map +0 -1
- package/dist/hooks/useAsync/index.cjs +0 -8
- package/dist/hooks/useAsync/index.d.ts +0 -3
- package/dist/hooks/useAsync/index.d.ts.map +0 -1
- package/dist/hooks/useAsync/index.mjs +0 -8
- package/dist/hooks/useAsync/useAsync.cjs +0 -244
- package/dist/hooks/useAsync/useAsync.cjs.map +0 -1
- package/dist/hooks/useAsync/useAsync.d.ts +0 -73
- package/dist/hooks/useAsync/useAsync.d.ts.map +0 -1
- package/dist/hooks/useAsync/useAsync.mjs +0 -244
- package/dist/hooks/useAsync/useAsync.mjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +0 -150
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts +0 -52
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +0 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +0 -150
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncWrapper.cjs +0 -10
- package/dist/hooks/useAsync/useAsyncWrapper.cjs.map +0 -1
- package/dist/hooks/useAsync/useAsyncWrapper.d.ts +0 -37
- package/dist/hooks/useAsync/useAsyncWrapper.d.ts.map +0 -1
- package/dist/hooks/useAsync/useAsyncWrapper.mjs +0 -10
- package/dist/hooks/useAsync/useAsyncWrapper.mjs.map +0 -1
- package/dist/hooks/useGetAllDictionaries.cjs +0 -35
- package/dist/hooks/useGetAllDictionaries.cjs.map +0 -1
- package/dist/hooks/useGetAllDictionaries.d.ts +0 -11
- package/dist/hooks/useGetAllDictionaries.d.ts.map +0 -1
- package/dist/hooks/useGetAllDictionaries.mjs +0 -35
- package/dist/hooks/useGetAllDictionaries.mjs.map +0 -1
|
@@ -40,102 +40,36 @@ var TagBackground = /* @__PURE__ */ ((TagBackground2) => {
|
|
|
40
40
|
const containerVariants = cva("backdrop-blur w-fit", {
|
|
41
41
|
variants: {
|
|
42
42
|
roundedSize: {
|
|
43
|
-
[
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
]: "rounded-
|
|
47
|
-
[
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]: "rounded-
|
|
51
|
-
[
|
|
52
|
-
"md"
|
|
53
|
-
/* MD */
|
|
54
|
-
]: "rounded-md",
|
|
55
|
-
[
|
|
56
|
-
"lg"
|
|
57
|
-
/* LG */
|
|
58
|
-
]: "rounded-lg",
|
|
59
|
-
[
|
|
60
|
-
"xl"
|
|
61
|
-
/* XL */
|
|
62
|
-
]: "rounded-xl",
|
|
63
|
-
[
|
|
64
|
-
"2xl"
|
|
65
|
-
/* XXL */
|
|
66
|
-
]: "rounded-2xl",
|
|
67
|
-
[
|
|
68
|
-
"3xl"
|
|
69
|
-
/* XXXL */
|
|
70
|
-
]: "rounded-3xl",
|
|
71
|
-
[
|
|
72
|
-
"full"
|
|
73
|
-
/* FULL */
|
|
74
|
-
]: "rounded-full"
|
|
43
|
+
[`${"none"}`]: "rounded-none",
|
|
44
|
+
[`${"sm"}`]: "rounded-sm",
|
|
45
|
+
[`${"md"}`]: "rounded-md",
|
|
46
|
+
[`${"lg"}`]: "rounded-lg",
|
|
47
|
+
[`${"xl"}`]: "rounded-xl",
|
|
48
|
+
[`${"2xl"}`]: "rounded-2xl",
|
|
49
|
+
[`${"3xl"}`]: "rounded-3xl",
|
|
50
|
+
[`${"full"}`]: "rounded-full"
|
|
75
51
|
},
|
|
76
52
|
color: {
|
|
77
|
-
[
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]: "bg-
|
|
81
|
-
[
|
|
82
|
-
"error"
|
|
83
|
-
/* ERROR */
|
|
84
|
-
]: "bg-error/10 border-error text-error",
|
|
85
|
-
[
|
|
86
|
-
"warning"
|
|
87
|
-
/* WARNING */
|
|
88
|
-
]: "bg-warning/10 border-warning text-warning",
|
|
89
|
-
[
|
|
90
|
-
"neutral"
|
|
91
|
-
/* NEUTRAL */
|
|
92
|
-
]: "bg-neutral/10 /10 border-neutral text-neutral ",
|
|
93
|
-
[
|
|
94
|
-
"text"
|
|
95
|
-
/* TEXT */
|
|
96
|
-
]: "bg-text/10 border-text text-text"
|
|
53
|
+
[`${"success"}`]: "bg-success/10 border-success text-success ",
|
|
54
|
+
[`${"error"}`]: "bg-error/10 border-error text-error",
|
|
55
|
+
[`${"warning"}`]: "bg-warning/10 border-warning text-warning",
|
|
56
|
+
[`${"neutral"}`]: "bg-neutral/10 /10 border-neutral text-neutral ",
|
|
57
|
+
[`${"text"}`]: "bg-text/10 border-text text-text"
|
|
97
58
|
},
|
|
98
59
|
size: {
|
|
99
|
-
[
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
]: "py-
|
|
103
|
-
[
|
|
104
|
-
"sm"
|
|
105
|
-
/* SM */
|
|
106
|
-
]: "py-0.5 px-2 text-sm border-[1.5px]",
|
|
107
|
-
[
|
|
108
|
-
"md"
|
|
109
|
-
/* MD */
|
|
110
|
-
]: "py-1 px-2 text-base border-2",
|
|
111
|
-
[
|
|
112
|
-
"lg"
|
|
113
|
-
/* LG */
|
|
114
|
-
]: "py-2 px-3 text-lg border-2",
|
|
115
|
-
[
|
|
116
|
-
"xl"
|
|
117
|
-
/* XL */
|
|
118
|
-
]: "py-4 px-5 text-xl border-2"
|
|
60
|
+
[`${"xs"}`]: "py-0.5 px-2 text-xs border-[1.2px]",
|
|
61
|
+
[`${"sm"}`]: "py-0.5 px-2 text-sm border-[1.5px]",
|
|
62
|
+
[`${"md"}`]: "py-1 px-2 text-base border-2",
|
|
63
|
+
[`${"lg"}`]: "py-2 px-3 text-lg border-2",
|
|
64
|
+
[`${"xl"}`]: "py-4 px-5 text-xl border-2"
|
|
119
65
|
},
|
|
120
66
|
border: {
|
|
121
|
-
[
|
|
122
|
-
|
|
123
|
-
/* NONE */
|
|
124
|
-
]: "border-none",
|
|
125
|
-
[
|
|
126
|
-
"with"
|
|
127
|
-
/* WITH */
|
|
128
|
-
]: "border-text border-[1.5px]"
|
|
67
|
+
[`${"none"}`]: "border-none",
|
|
68
|
+
[`${"with"}`]: "border-text border-[1.5px]"
|
|
129
69
|
},
|
|
130
70
|
background: {
|
|
131
|
-
[
|
|
132
|
-
|
|
133
|
-
/* NONE */
|
|
134
|
-
]: "bg-none",
|
|
135
|
-
[
|
|
136
|
-
"with"
|
|
137
|
-
/* WITH */
|
|
138
|
-
]: ""
|
|
71
|
+
[`${"none"}`]: "bg-none",
|
|
72
|
+
[`${"with"}`]: ""
|
|
139
73
|
}
|
|
140
74
|
},
|
|
141
75
|
defaultVariants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { type VariantProps, cva } from 'class-variance-authority';\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nexport enum TagRoundedSize {\n NONE = 'none',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n XXL = '2xl',\n XXXL = '3xl',\n FULL = 'full',\n}\n\nexport enum TagColor {\n SUCCESS = 'success',\n ERROR = 'error',\n WARNING = 'warning',\n NEUTRAL = 'neutral',\n TEXT = 'text',\n}\n\nexport enum TagSize {\n XS = 'xs',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n}\n\nexport enum TagBorder {\n NONE = 'none',\n WITH = 'with',\n}\n\nexport enum TagBackground {\n NONE = 'none',\n WITH = 'with',\n}\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n [TagRoundedSize.NONE]: 'rounded-none',\n [TagRoundedSize.SM]: 'rounded-sm',\n [TagRoundedSize.MD]: 'rounded-md',\n [TagRoundedSize.LG]: 'rounded-lg',\n [TagRoundedSize.XL]: 'rounded-xl',\n [TagRoundedSize.XXL]: 'rounded-2xl',\n [TagRoundedSize.XXXL]: 'rounded-3xl',\n [TagRoundedSize.FULL]: 'rounded-full',\n },\n color: {\n [TagColor.SUCCESS]: 'bg-success/10 border-success text-success ',\n [TagColor.ERROR]: 'bg-error/10 border-error text-error',\n [TagColor.WARNING]: 'bg-warning/10 border-warning text-warning',\n [TagColor.NEUTRAL]: 'bg-neutral/10 /10 border-neutral text-neutral ',\n [TagColor.TEXT]: 'bg-text/10 border-text text-text',\n },\n size: {\n [TagSize.XS]: 'py-0.5 px-2 text-xs border-[1.2px]',\n [TagSize.SM]: 'py-0.5 px-2 text-sm border-[1.5px]',\n [TagSize.MD]: 'py-1 px-2 text-base border-2',\n [TagSize.LG]: 'py-2 px-3 text-lg border-2',\n [TagSize.XL]: 'py-4 px-5 text-xl border-2',\n },\n border: {\n [TagBorder.NONE]: 'border-none',\n [TagBorder.WITH]: 'border-text border-[1.5px]',\n },\n background: {\n [TagBackground.NONE]: 'bg-none',\n [TagBackground.WITH]: '',\n },\n },\n\n defaultVariants: {\n roundedSize: TagRoundedSize.FULL,\n border: TagBorder.NONE,\n color: TagColor.TEXT,\n size: TagSize.MD,\n },\n});\n\nexport const Tag: FC<TagProps> = ({\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n}) => {\n return (\n <div\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["TagRoundedSize","TagColor","TagSize","TagBorder","TagBackground"],"mappings":";;AAMO,IAAK,mCAAAA,oBAAL;AACLA,kBAAA,MAAA,IAAO;AACPA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,KAAA,IAAM;AACNA,kBAAA,MAAA,IAAO;AACPA,kBAAA,MAAA,IAAO;AARG,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAWL,IAAK,6BAAAC,cAAL;AACLA,YAAA,SAAA,IAAU;AACVA,YAAA,OAAA,IAAQ;AACRA,YAAA,SAAA,IAAU;AACVA,YAAA,SAAA,IAAU;AACVA,YAAA,MAAA,IAAO;AALG,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AAQL,IAAK,4BAAAC,aAAL;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AALK,SAAAA;AAAA,GAAA,WAAA,CAAA,CAAA;AAQL,IAAK,8BAAAC,eAAL;AACLA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAKL,IAAK,kCAAAC,mBAAL;AACLA,iBAAA,MAAA,IAAO;AACPA,iBAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKZ,MAAM,oBAAoB,IAAI,uBAAuB;AAAA,EACnD,UAAU;AAAA,IACR,aAAa;AAAA,MACX
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/Tag/index.tsx"],"sourcesContent":["import { type VariantProps, cva } from 'class-variance-authority';\nimport type { FC, HTMLAttributes, PropsWithChildren } from 'react';\n\ntype TagProps = PropsWithChildren<VariantProps<typeof containerVariants>> &\n HTMLAttributes<HTMLDivElement>;\n\nexport enum TagRoundedSize {\n NONE = 'none',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n XXL = '2xl',\n XXXL = '3xl',\n FULL = 'full',\n}\n\nexport enum TagColor {\n SUCCESS = 'success',\n ERROR = 'error',\n WARNING = 'warning',\n NEUTRAL = 'neutral',\n TEXT = 'text',\n}\n\nexport enum TagSize {\n XS = 'xs',\n SM = 'sm',\n MD = 'md',\n LG = 'lg',\n XL = 'xl',\n}\n\nexport enum TagBorder {\n NONE = 'none',\n WITH = 'with',\n}\n\nexport enum TagBackground {\n NONE = 'none',\n WITH = 'with',\n}\n\nconst containerVariants = cva('backdrop-blur w-fit', {\n variants: {\n roundedSize: {\n [`${TagRoundedSize.NONE}`]: 'rounded-none',\n [`${TagRoundedSize.SM}`]: 'rounded-sm',\n [`${TagRoundedSize.MD}`]: 'rounded-md',\n [`${TagRoundedSize.LG}`]: 'rounded-lg',\n [`${TagRoundedSize.XL}`]: 'rounded-xl',\n [`${TagRoundedSize.XXL}`]: 'rounded-2xl',\n [`${TagRoundedSize.XXXL}`]: 'rounded-3xl',\n [`${TagRoundedSize.FULL}`]: 'rounded-full',\n },\n color: {\n [`${TagColor.SUCCESS}`]: 'bg-success/10 border-success text-success ',\n [`${TagColor.ERROR}`]: 'bg-error/10 border-error text-error',\n [`${TagColor.WARNING}`]: 'bg-warning/10 border-warning text-warning',\n [`${TagColor.NEUTRAL}`]: 'bg-neutral/10 /10 border-neutral text-neutral ',\n [`${TagColor.TEXT}`]: 'bg-text/10 border-text text-text',\n },\n size: {\n [`${TagSize.XS}`]: 'py-0.5 px-2 text-xs border-[1.2px]',\n [`${TagSize.SM}`]: 'py-0.5 px-2 text-sm border-[1.5px]',\n [`${TagSize.MD}`]: 'py-1 px-2 text-base border-2',\n [`${TagSize.LG}`]: 'py-2 px-3 text-lg border-2',\n [`${TagSize.XL}`]: 'py-4 px-5 text-xl border-2',\n },\n border: {\n [`${TagBorder.NONE}`]: 'border-none',\n [`${TagBorder.WITH}`]: 'border-text border-[1.5px]',\n },\n background: {\n [`${TagBackground.NONE}`]: 'bg-none',\n [`${TagBackground.WITH}`]: '',\n },\n },\n\n defaultVariants: {\n roundedSize: TagRoundedSize.FULL,\n border: TagBorder.NONE,\n color: TagColor.TEXT,\n size: TagSize.MD,\n },\n});\n\nexport const Tag: FC<TagProps> = ({\n children,\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n ...props\n}) => {\n return (\n <div\n className={containerVariants({\n color,\n roundedSize,\n size,\n border,\n background,\n className,\n })}\n {...props}\n >\n {children}\n </div>\n );\n};\n"],"names":["TagRoundedSize","TagColor","TagSize","TagBorder","TagBackground"],"mappings":";;AAMO,IAAK,mCAAAA,oBAAL;AACLA,kBAAA,MAAA,IAAO;AACPA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,IAAA,IAAK;AACLA,kBAAA,KAAA,IAAM;AACNA,kBAAA,MAAA,IAAO;AACPA,kBAAA,MAAA,IAAO;AARG,SAAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AAWL,IAAK,6BAAAC,cAAL;AACLA,YAAA,SAAA,IAAU;AACVA,YAAA,OAAA,IAAQ;AACRA,YAAA,SAAA,IAAU;AACVA,YAAA,SAAA,IAAU;AACVA,YAAA,MAAA,IAAO;AALG,SAAAA;AAAA,GAAA,YAAA,CAAA,CAAA;AAQL,IAAK,4BAAAC,aAAL;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AACLA,WAAA,IAAA,IAAK;AALK,SAAAA;AAAA,GAAA,WAAA,CAAA,CAAA;AAQL,IAAK,8BAAAC,eAAL;AACLA,aAAA,MAAA,IAAO;AACPA,aAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AAKL,IAAK,kCAAAC,mBAAL;AACLA,iBAAA,MAAA,IAAO;AACPA,iBAAA,MAAA,IAAO;AAFG,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKZ,MAAM,oBAAoB,IAAI,uBAAuB;AAAA,EACn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AAEV,CAAC;AAEM,MAAM,MAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,kBAAkB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAAA,MACA,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -4,13 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
5
|
const editorReact = require("@intlayer/editor-react");
|
|
6
6
|
const ReactExports = require("react");
|
|
7
|
-
require("
|
|
8
|
-
require("../../better-auth.CMQ3rA-I-C2nBKRMa.cjs");
|
|
9
|
-
const hooks_intlayerAPIHooks = require("../../hooks/intlayerAPIHooks.cjs");
|
|
10
|
-
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
11
|
-
require("@intlayer/api");
|
|
12
|
-
require("deepmerge");
|
|
13
|
-
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
7
|
+
const hooks_reactQuery = require("../../hooks/reactQuery.cjs");
|
|
14
8
|
const components_TextArea_AutoSizeTextArea = require("./AutoSizeTextArea.cjs");
|
|
15
9
|
const useDebounce = (value, delay) => {
|
|
16
10
|
const [debouncedValue, setDebouncedValue] = ReactExports.useState(value);
|
|
@@ -28,7 +22,7 @@ const AutoCompleteTextarea = ({
|
|
|
28
22
|
...props
|
|
29
23
|
}) => {
|
|
30
24
|
const defaultValue = String(props.value ?? props.defaultValue ?? "");
|
|
31
|
-
const { autocomplete } =
|
|
25
|
+
const { mutate: autocomplete } = hooks_reactQuery.useAutocomplete();
|
|
32
26
|
const configuration = editorReact.useConfiguration();
|
|
33
27
|
const [isTyped, setIsTyped] = ReactExports.useState(false);
|
|
34
28
|
const [text, setText] = ReactExports.useState(defaultValue);
|
|
@@ -61,20 +55,25 @@ const AutoCompleteTextarea = ({
|
|
|
61
55
|
const currentLine = beforeLines[beforeLines.length - 1] ?? "";
|
|
62
56
|
const afterLines = after.split("\n");
|
|
63
57
|
const contextAfter = afterLines.slice(1, numLines + 1).join("\n");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
autocomplete(
|
|
59
|
+
{
|
|
60
|
+
text: before,
|
|
61
|
+
contextBefore,
|
|
62
|
+
currentLine,
|
|
63
|
+
contextAfter,
|
|
64
|
+
aiOptions: {
|
|
65
|
+
apiKey: configuration.ai?.apiKey,
|
|
66
|
+
model: configuration.ai?.model,
|
|
67
|
+
temperature: configuration.ai?.temperature
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
onSuccess: (data) => {
|
|
72
|
+
setSuggestion(data.data?.autocompletion ?? "");
|
|
73
|
+
setCursorAtFetch(cursor);
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
const autocompletion = response?.data?.autocompletion ?? "";
|
|
76
|
-
setSuggestion(autocompletion);
|
|
77
|
-
setCursorAtFetch(cursor);
|
|
76
|
+
);
|
|
78
77
|
} catch (err) {
|
|
79
78
|
console.error("Autocomplete error:", err);
|
|
80
79
|
}
|
|
@@ -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, 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.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\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":";;;;;;;;;;;;;;AAUO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,aAAAA,SAAY,KAAK;AAE7DC,eAAAA,UAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAGR,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;AAOO,MAAM,uBAAsD,CAAC;AAAA,EAClE,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,QAAM,eAAe,OAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AACnE,QAAM,E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tB,wBAAc,EAAE;AAChB,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,QACA,WAAW,CAAC,MAAM;AAChB,cAAI,EAAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAA;AACF,6BAAA;AAAA,UACF;AACA,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,UACrB;AACA,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;;"}
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.cjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { AutocompleteResponse } from '@intlayer/backend';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks/reactQuery';\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 { mutate: 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 autocomplete(\n {\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (data: AutocompleteResponse) => {\n setSuggestion(data.data?.autocompletion ?? '');\n setCursorAtFetch(cursor);\n },\n }\n );\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":";;;;;;;;AAWO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,aAAAA,SAAY,KAAK;AAE7DC,eAAAA,UAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAGR,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;AAOO,MAAM,uBAAsD,CAAC;AAAA,EAClE,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,QAAM,eAAe,OAAO,MAAM,SAAS,MAAM,gBAAgB,EAAE;AACnE,QAAM,EAAE,QAAQ,aAAA,IAAiBC,iCAAA;AACjC,QAAM,gBAAgBC,YAAAA,iBAAA;AACtB,QAAM,CAAC,SAAS,UAAU,IAAIH,aAAAA,SAAS,KAAK;AAC5C,QAAM,CAAC,MAAM,OAAO,IAAIA,aAAAA,SAAS,YAAY;AAC7C,QAAM,CAAC,YAAY,aAAa,IAAIA,aAAAA,SAAS,EAAE;AAC/C,QAAM,cAAcI,aAAAA,OAA4B,IAAI;AACpD,QAAM,iBAAiBA,aAAAA,OAAwB,IAAI;AACnD,QAAM,gBAAgBA,aAAAA,OAAuB,IAAI;AACjD,QAAM,CAAC,oBAAoB,qBAAqB,IAAIJ,aAAAA,SAG1C,IAAI;AACd,QAAM,CAAC,eAAe,gBAAgB,IAAIA,aAAAA,SAAS,EAAE;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"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"names":[],"mappings":"AAIA,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,CA6L9D,CAAC"}
|
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
4
4
|
import { useState, useEffect, useRef } from "react";
|
|
5
|
-
import "
|
|
6
|
-
import "../../better-auth.CMQ3rA-I-7umXOENE.js";
|
|
7
|
-
import { useAutocomplete } from "../../hooks/intlayerAPIHooks.mjs";
|
|
8
|
-
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
|
-
import "@intlayer/api";
|
|
10
|
-
import "deepmerge";
|
|
11
|
-
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
5
|
+
import { useAutocomplete } from "../../hooks/reactQuery.mjs";
|
|
12
6
|
import { AutoSizedTextArea } from "./AutoSizeTextArea.mjs";
|
|
13
7
|
const useDebounce = (value, delay) => {
|
|
14
8
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
@@ -26,7 +20,7 @@ const AutoCompleteTextarea = ({
|
|
|
26
20
|
...props
|
|
27
21
|
}) => {
|
|
28
22
|
const defaultValue = String(props.value ?? props.defaultValue ?? "");
|
|
29
|
-
const { autocomplete } = useAutocomplete();
|
|
23
|
+
const { mutate: autocomplete } = useAutocomplete();
|
|
30
24
|
const configuration = useConfiguration();
|
|
31
25
|
const [isTyped, setIsTyped] = useState(false);
|
|
32
26
|
const [text, setText] = useState(defaultValue);
|
|
@@ -59,20 +53,25 @@ const AutoCompleteTextarea = ({
|
|
|
59
53
|
const currentLine = beforeLines[beforeLines.length - 1] ?? "";
|
|
60
54
|
const afterLines = after.split("\n");
|
|
61
55
|
const contextAfter = afterLines.slice(1, numLines + 1).join("\n");
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
autocomplete(
|
|
57
|
+
{
|
|
58
|
+
text: before,
|
|
59
|
+
contextBefore,
|
|
60
|
+
currentLine,
|
|
61
|
+
contextAfter,
|
|
62
|
+
aiOptions: {
|
|
63
|
+
apiKey: configuration.ai?.apiKey,
|
|
64
|
+
model: configuration.ai?.model,
|
|
65
|
+
temperature: configuration.ai?.temperature
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
onSuccess: (data) => {
|
|
70
|
+
setSuggestion(data.data?.autocompletion ?? "");
|
|
71
|
+
setCursorAtFetch(cursor);
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
const autocompletion = response?.data?.autocompletion ?? "";
|
|
74
|
-
setSuggestion(autocompletion);
|
|
75
|
-
setCursorAtFetch(cursor);
|
|
74
|
+
);
|
|
76
75
|
} catch (err) {
|
|
77
76
|
console.error("Autocomplete error:", err);
|
|
78
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteTextArea.mjs","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.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\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":[],"mappings":";;;;;;;;;;;;AAUO,MAAM,cAAc,CAAK,OAAU,UAAqB;AAC7D,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAY,KAAK;AAE7D,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM;AAC7B,wBAAkB,KAAK;AAAA,IACzB,GAAG,KAAK;AAGR,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,SAAO;AACT;AAOO,MAAM,uBAAsD,CAAC;AAAA,EAClE,WAAW;AAAA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AAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAA;AACF,6BAAA;AAAA,UACF;AACA,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,UACrB;AACA,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"AutocompleteTextArea.mjs","sources":["../../../src/components/TextArea/AutocompleteTextArea.tsx"],"sourcesContent":["'use client';\n\nimport { AutocompleteResponse } from '@intlayer/backend';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { useAutocomplete } from '../../hooks/reactQuery';\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 { mutate: 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 autocomplete(\n {\n text: before,\n contextBefore,\n currentLine,\n contextAfter,\n aiOptions: {\n apiKey: configuration.ai?.apiKey,\n model: configuration.ai?.model,\n temperature: configuration.ai?.temperature,\n },\n },\n {\n onSuccess: (data: AutocompleteResponse) => {\n setSuggestion(data.data?.autocompletion ?? '');\n setCursorAtFetch(cursor);\n },\n }\n );\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 HTMLText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A;AAAA,MAAA;AAAA,IAAA;AAAA,IAGjE,cAAc,sBACb;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO;AAAA,UACL,UAAU;AAAA,UACV,MAAM,mBAAmB;AAAA,UACzB,KAAK,mBAAmB;AAAA,QAAA;AAAA,QAGzB,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGL;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,OAAO;AAAA,QACP,UAAU,CAAC,MAAM;AACf,qBAAW,IAAI;AACf,kBAAQ,EAAE,OAAO,KAAK;AACtB,wBAAc,EAAE;AAChB,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,QACA,WAAW,CAAC,MAAM;AAChB,cAAI,EAAE,QAAQ,SAAS,YAAY;AACjC,cAAE,eAAA;AACF,6BAAA;AAAA,UACF;AACA,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,UACrB;AACA,gBAAM,WAAW,CAAC;AAAA,QACpB;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
package/dist/hooks/auth.cjs
CHANGED
|
@@ -1214,18 +1214,22 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
1214
1214
|
error: null,
|
|
1215
1215
|
isPending: true,
|
|
1216
1216
|
isRefetching: false,
|
|
1217
|
-
refetch: () => {
|
|
1218
|
-
return fn();
|
|
1217
|
+
refetch: (queryParams) => {
|
|
1218
|
+
return fn(queryParams);
|
|
1219
1219
|
}
|
|
1220
1220
|
});
|
|
1221
|
-
const fn = () => {
|
|
1221
|
+
const fn = (queryParams) => {
|
|
1222
1222
|
const opts = typeof options === "function" ? options({
|
|
1223
1223
|
data: value.get().data,
|
|
1224
1224
|
error: value.get().error,
|
|
1225
1225
|
isPending: value.get().isPending
|
|
1226
1226
|
}) : options;
|
|
1227
|
-
|
|
1227
|
+
$fetch(path, {
|
|
1228
1228
|
...opts,
|
|
1229
|
+
query: {
|
|
1230
|
+
...opts?.query,
|
|
1231
|
+
...queryParams?.query
|
|
1232
|
+
},
|
|
1229
1233
|
async onSuccess(context) {
|
|
1230
1234
|
value.set({
|
|
1231
1235
|
data: context.data,
|
|
@@ -1261,6 +1265,14 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
1261
1265
|
});
|
|
1262
1266
|
await opts?.onRequest?.(context);
|
|
1263
1267
|
}
|
|
1268
|
+
}).catch((error) => {
|
|
1269
|
+
value.set({
|
|
1270
|
+
error,
|
|
1271
|
+
data: null,
|
|
1272
|
+
isPending: false,
|
|
1273
|
+
isRefetching: false,
|
|
1274
|
+
refetch: value.value.refetch
|
|
1275
|
+
});
|
|
1264
1276
|
});
|
|
1265
1277
|
};
|
|
1266
1278
|
initializedAtom = Array.isArray(initializedAtom) ? initializedAtom : [initializedAtom];
|
|
@@ -1465,13 +1477,7 @@ const getClientConfig = (options) => {
|
|
|
1465
1477
|
strict: false
|
|
1466
1478
|
});
|
|
1467
1479
|
},
|
|
1468
|
-
customFetchImpl:
|
|
1469
|
-
try {
|
|
1470
|
-
return await fetch(input, init);
|
|
1471
|
-
} catch (error) {
|
|
1472
|
-
return Response.error();
|
|
1473
|
-
}
|
|
1474
|
-
},
|
|
1480
|
+
customFetchImpl: fetch,
|
|
1475
1481
|
...restOfFetchOptions,
|
|
1476
1482
|
plugins: [
|
|
1477
1483
|
lifeCyclePlugin,
|
|
@@ -1540,6 +1546,9 @@ const getClientConfig = (options) => {
|
|
|
1540
1546
|
$store
|
|
1541
1547
|
};
|
|
1542
1548
|
};
|
|
1549
|
+
function isAtom(value) {
|
|
1550
|
+
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
1551
|
+
}
|
|
1543
1552
|
function getMethod(path, knownPathMethods, args) {
|
|
1544
1553
|
const method = knownPathMethods[path];
|
|
1545
1554
|
const { fetchOptions, query, ...body } = args || {};
|
|
@@ -1559,6 +1568,9 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
1559
1568
|
return new Proxy(function() {
|
|
1560
1569
|
}, {
|
|
1561
1570
|
get(target, prop) {
|
|
1571
|
+
if (prop === "then" || prop === "catch" || prop === "finally") {
|
|
1572
|
+
return void 0;
|
|
1573
|
+
}
|
|
1562
1574
|
const fullPath = [...path, prop];
|
|
1563
1575
|
let current = routes;
|
|
1564
1576
|
for (const segment of fullPath) {
|
|
@@ -1572,6 +1584,9 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
1572
1584
|
if (typeof current === "function") {
|
|
1573
1585
|
return current;
|
|
1574
1586
|
}
|
|
1587
|
+
if (isAtom(current)) {
|
|
1588
|
+
return current;
|
|
1589
|
+
}
|
|
1575
1590
|
return createProxy(fullPath);
|
|
1576
1591
|
},
|
|
1577
1592
|
apply: async (_, __, args) => {
|