@intlayer/design-system 3.1.0 → 3.2.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/dist/.vite/manifest.json +481 -455
- package/dist/TabSelector-BmkzVPXl.js +660 -0
- package/dist/TabSelector-BmkzVPXl.js.map +1 -0
- package/dist/TabSelector-o_NRBvPQ.cjs +659 -0
- package/dist/TabSelector-o_NRBvPQ.cjs.map +1 -0
- package/dist/components/Auth/AuthModal/index.cjs +17 -62
- package/dist/components/Auth/AuthModal/index.cjs.map +1 -1
- package/dist/components/Auth/AuthModal/index.d.ts.map +1 -1
- package/dist/components/Auth/AuthModal/index.mjs +17 -62
- package/dist/components/Auth/AuthModal/index.mjs.map +1 -1
- package/dist/components/Auth/AuthProvider/index.cjs.map +1 -1
- package/dist/components/Auth/AuthProvider/index.d.ts +3 -3
- package/dist/components/Auth/AuthProvider/index.d.ts.map +1 -1
- package/dist/components/Auth/AuthProvider/index.mjs.map +1 -1
- package/dist/components/Auth/AuthProvider/useSession.cjs +7 -8
- package/dist/components/Auth/AuthProvider/useSession.cjs.map +1 -1
- package/dist/components/Auth/AuthProvider/useSession.d.ts.map +1 -1
- package/dist/components/Auth/AuthProvider/useSession.mjs +7 -8
- package/dist/components/Auth/AuthProvider/useSession.mjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs +2 -2
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs +1 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.cjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts +2 -2
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.mjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.cjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts +1 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/accessValidation.mjs.map +1 -1
- package/dist/components/Auth/AuthenticationBarrier/index.d.ts +3 -3
- package/dist/components/Auth/AuthenticationBarrier/index.d.ts.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs +1 -0
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs +1 -0
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/index.content.d.ts +10 -10
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +3 -2
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +3 -2
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.d.ts +5 -5
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs +1 -0
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs +1 -0
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/index.content.d.ts +7 -7
- package/dist/components/Auth/SignInForm/SignInForm.cjs +4 -3
- package/dist/components/Auth/SignInForm/SignInForm.cjs.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.d.ts +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.d.ts.map +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.mjs +4 -3
- package/dist/components/Auth/SignInForm/SignInForm.mjs.map +1 -1
- package/dist/components/Auth/SignInForm/index.content.d.ts +13 -13
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs +3 -3
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.d.ts +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.d.ts.map +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs +3 -3
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +1 -1
- package/dist/components/Auth/SignUpForm/index.content.d.ts +11 -11
- package/dist/components/Auth/index.cjs +2 -4
- package/dist/components/Auth/index.cjs.map +1 -1
- package/dist/components/Auth/index.d.ts +1 -1
- package/dist/components/Auth/index.d.ts.map +1 -1
- package/dist/components/Auth/index.mjs +1 -3
- package/dist/components/Auth/useAuth/index.cjs +39 -0
- package/dist/components/Auth/useAuth/index.cjs.map +1 -0
- package/dist/components/Auth/useAuth/index.d.ts +24 -0
- package/dist/components/Auth/useAuth/index.d.ts.map +1 -0
- package/dist/components/Auth/useAuth/index.mjs +39 -0
- package/dist/components/Auth/useAuth/index.mjs.map +1 -0
- package/dist/components/Auth/useAuth/useCSRF.cjs +22 -0
- package/dist/components/Auth/useAuth/useCSRF.cjs.map +1 -0
- package/dist/components/Auth/useAuth/useCSRF.d.ts +5 -0
- package/dist/components/Auth/useAuth/useCSRF.d.ts.map +1 -0
- package/dist/components/Auth/useAuth/useCSRF.mjs +22 -0
- package/dist/components/Auth/useAuth/useCSRF.mjs.map +1 -0
- package/dist/components/Auth/useAuth/useOAuth2.cjs +26 -0
- package/dist/components/Auth/useAuth/useOAuth2.cjs.map +1 -0
- package/dist/components/Auth/useAuth/useOAuth2.d.ts +4 -0
- package/dist/components/Auth/useAuth/useOAuth2.d.ts.map +1 -0
- package/dist/components/Auth/useAuth/useOAuth2.mjs +26 -0
- package/dist/components/Auth/useAuth/useOAuth2.mjs.map +1 -0
- package/dist/components/Auth/useAuth/useSession.cjs +60 -0
- package/dist/components/Auth/useAuth/useSession.cjs.map +1 -0
- package/dist/components/Auth/useAuth/useSession.d.ts +8 -0
- package/dist/components/Auth/useAuth/useSession.d.ts.map +1 -0
- package/dist/components/Auth/useAuth/useSession.mjs +60 -0
- package/dist/components/Auth/useAuth/useSession.mjs.map +1 -0
- package/dist/components/Auth/useUser/index.cjs +3 -3
- package/dist/components/Auth/useUser/index.cjs.map +1 -1
- package/dist/components/Auth/useUser/index.d.ts.map +1 -1
- package/dist/components/Auth/useUser/index.mjs +3 -3
- package/dist/components/Auth/useUser/index.mjs.map +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.d.ts +1 -2
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/Command/index.d.ts +2 -2
- package/dist/components/Command/index.d.ts.map +1 -1
- package/dist/components/Container/index.cjs +1 -0
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.d.ts +8 -8
- package/dist/components/Container/index.d.ts.map +1 -1
- package/dist/components/Container/index.mjs +1 -0
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +4 -17
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +4 -17
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs +0 -21
- package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs.map +1 -1
- package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts +0 -9
- package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs +0 -21
- package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +3 -2
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +3 -2
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +7 -24
- 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 +6 -23
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs +0 -42
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +0 -18
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +0 -42
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.d.ts +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +4 -36
- 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 +3 -35
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.d.ts +4 -4
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +0 -47
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +0 -19
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +0 -47
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +3 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +3 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +3 -2
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +3 -2
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +4 -17
- 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 +4 -17
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +0 -21
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +0 -9
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +0 -21
- package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
- package/dist/components/Form/FormBase.cjs +4 -1
- package/dist/components/Form/FormBase.cjs.map +1 -1
- package/dist/components/Form/FormBase.d.ts +1 -1
- package/dist/components/Form/FormBase.d.ts.map +1 -1
- package/dist/components/Form/FormBase.mjs +4 -1
- package/dist/components/Form/FormBase.mjs.map +1 -1
- package/dist/components/Input/Checkbox.d.ts +1 -1
- package/dist/components/Input/Input.cjs +8 -2
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.d.ts +1 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.mjs +8 -2
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Modal/Modal.cjs +3 -1
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.mjs +3 -1
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +3 -1
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +3 -1
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/Navbar/index.cjs +3 -1
- package/dist/components/Navbar/index.cjs.map +1 -1
- package/dist/components/Navbar/index.mjs +3 -1
- package/dist/components/Navbar/index.mjs.map +1 -1
- package/dist/components/Select/Multiselect.d.ts +1 -1
- package/dist/components/Select/Multiselect.d.ts.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +3 -1
- package/dist/components/SwitchSelector/index.cjs.map +1 -1
- package/dist/components/SwitchSelector/index.d.ts +1 -1
- package/dist/components/SwitchSelector/index.mjs +3 -1
- package/dist/components/SwitchSelector/index.mjs.map +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +13 -10
- 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 +13 -10
- package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
- package/dist/components/Tag/index.cjs +79 -0
- package/dist/components/Tag/index.cjs.map +1 -0
- package/dist/components/Tag/index.d.ts +12 -0
- package/dist/components/Tag/index.d.ts.map +1 -0
- package/dist/components/Tag/index.mjs +79 -0
- package/dist/components/Tag/index.mjs.map +1 -0
- package/dist/components/Toaster/Toast.d.ts +1 -1
- package/dist/components/index.cjs +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.mjs +3 -3
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +4 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +5 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs +257 -126
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +43 -38
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +258 -127
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.cjs +142 -104
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.d.ts +0 -2
- package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs +143 -105
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +50 -112
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts +3 -9
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +50 -112
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useAsync/useProxyState.d.ts +3 -0
- package/dist/hooks/useAsync/useProxyState.d.ts.map +1 -0
- package/dist/hooks/useIntlayerAPI.cjs +6 -5
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +51 -45
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +5 -4
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/useItemSelector.cjs +11 -2
- package/dist/hooks/useItemSelector.cjs.map +1 -1
- package/dist/hooks/useItemSelector.d.ts +3 -2
- package/dist/hooks/useItemSelector.d.ts.map +1 -1
- package/dist/hooks/useItemSelector.mjs +11 -2
- package/dist/hooks/useItemSelector.mjs.map +1 -1
- package/dist/hooks/usePersistedStore.cjs +22 -0
- package/dist/hooks/usePersistedStore.cjs.map +1 -0
- package/dist/hooks/usePersistedStore.d.ts +2 -0
- package/dist/hooks/usePersistedStore.d.ts.map +1 -0
- package/dist/hooks/usePersistedStore.mjs +22 -0
- package/dist/hooks/usePersistedStore.mjs.map +1 -0
- package/dist/hooks/usePersistenceStore.cjs +22 -0
- package/dist/hooks/usePersistenceStore.cjs.map +1 -0
- package/dist/hooks/usePersistenceStore.d.ts +2 -0
- package/dist/hooks/usePersistenceStore.d.ts.map +1 -0
- package/dist/hooks/usePersistenceStore.mjs +22 -0
- package/dist/hooks/usePersistenceStore.mjs.map +1 -0
- package/dist/libs/intlayer-api/auth.cjs +14 -2
- package/dist/libs/intlayer-api/auth.cjs.map +1 -1
- package/dist/libs/intlayer-api/auth.d.ts +7 -3
- package/dist/libs/intlayer-api/auth.d.ts.map +1 -1
- package/dist/libs/intlayer-api/auth.mjs +14 -2
- package/dist/libs/intlayer-api/auth.mjs.map +1 -1
- package/dist/libs/intlayer-api/fetcher.cjs +7 -1
- package/dist/libs/intlayer-api/fetcher.cjs.map +1 -1
- package/dist/libs/intlayer-api/fetcher.d.ts.map +1 -1
- package/dist/libs/intlayer-api/fetcher.mjs +7 -1
- package/dist/libs/intlayer-api/fetcher.mjs.map +1 -1
- package/dist/libs/intlayer-api/index.cjs +3 -1
- package/dist/libs/intlayer-api/index.cjs.map +1 -1
- package/dist/libs/intlayer-api/index.d.ts +12 -2
- package/dist/libs/intlayer-api/index.d.ts.map +1 -1
- package/dist/libs/intlayer-api/index.mjs +3 -1
- package/dist/libs/intlayer-api/index.mjs.map +1 -1
- package/dist/libs/intlayer-api/stripe.cjs +22 -0
- package/dist/libs/intlayer-api/stripe.cjs.map +1 -0
- package/dist/libs/intlayer-api/stripe.d.ts +6 -0
- package/dist/libs/intlayer-api/stripe.d.ts.map +1 -0
- package/dist/libs/intlayer-api/stripe.mjs +22 -0
- package/dist/libs/intlayer-api/stripe.mjs.map +1 -0
- package/dist/stripe-BsI0lJWz.js +22 -0
- package/dist/stripe-BsI0lJWz.js.map +1 -0
- package/dist/stripe-C-u5RvGh.js +22 -0
- package/dist/stripe-C-u5RvGh.js.map +1 -0
- package/dist/stripe-CF_E65Vu.js +22 -0
- package/dist/stripe-CF_E65Vu.js.map +1 -0
- package/dist/stripe-CpGvfq6T.cjs +21 -0
- package/dist/stripe-CpGvfq6T.cjs.map +1 -0
- package/dist/stripe-DEv4DjAL.cjs +21 -0
- package/dist/stripe-DEv4DjAL.cjs.map +1 -0
- package/dist/stripe-DuG0uaEn.cjs +21 -0
- package/dist/stripe-DuG0uaEn.cjs.map +1 -0
- package/dist/tailwind.css +1 -1
- package/dist/useProxyState-D5GLrY2y.js +20 -0
- package/dist/useProxyState-D5GLrY2y.js.map +1 -0
- package/dist/useProxyState-DewdF3no.cjs +19 -0
- package/dist/useProxyState-DewdF3no.cjs.map +1 -0
- package/package.json +15 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport {\n useEditedContentStore,\n useEditionPanelStore,\n} from '../DictionaryEditor';\nimport { H2 } from '../Headers';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { EditorView } from './EditorView/EditorView';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n};\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n}) => {\n const { content: dictionaryContent, key } = dictionary;\n const { editedContent, dictionaryRecord, setDictionariesRecord } =\n useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n dictionaryRecord: s.dictionariesRecord,\n setDictionariesRecord: s.setDictionariesRecord,\n }));\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n (s) => ({\n focusedContent: s.focusedContent,\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n })\n );\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n const section = editedContent[key]?.content ?? dictionaryContent;\n\n useEffect(() => {\n if (dictionaryRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionaryRecord]);\n\n return (\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex gap-2 max-md:flex-col\">\n <Container\n border\n background={false}\n className=\"top-6 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"xl\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionaryKey={key}\n />\n </Container>\n <div className=\"top-6 flex h-full flex-1 flex-col gap-6 md:sticky\">\n {(focusedKeyPath?.length ?? 0) > 0 && (\n <Container\n border\n background={false}\n className=\"h-full flex-1 overflow-hidden\"\n roundedSize=\"xl\"\n >\n <EditorView dictionary={dictionary} dictionaryKey={key} />\n </Container>\n )}\n <SaveForm dictionary={dictionary} />\n </div>\n </div>\n </Container>\n </div>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport {\n useEditedContentStore,\n useEditionPanelStore,\n} from '../DictionaryEditor';\nimport { H2 } from '../Headers';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { EditorView } from './EditorView/EditorView';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n};\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n}) => {\n const { content: dictionaryContent, key } = dictionary;\n const { editedContent, dictionaryRecord, setDictionariesRecord } =\n useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n dictionaryRecord: s.dictionariesRecord,\n setDictionariesRecord: s.setDictionariesRecord,\n }));\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n (s) => ({\n focusedContent: s.focusedContent,\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n })\n );\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n const section = editedContent[key]?.content ?? dictionaryContent;\n\n useEffect(() => {\n if (dictionaryRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionaryRecord]);\n\n return (\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label.value}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex gap-2 max-md:flex-col\">\n <Container\n border\n background={false}\n className=\"top-6 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"xl\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionaryKey={key}\n />\n </Container>\n <div className=\"top-6 flex h-full flex-1 flex-col gap-6 md:sticky\">\n {(focusedKeyPath?.length ?? 0) > 0 && (\n <Container\n border\n background={false}\n className=\"h-full flex-1 overflow-hidden\"\n roundedSize=\"xl\"\n >\n <EditorView dictionary={dictionary} dictionaryKey={key} />\n </Container>\n )}\n <SaveForm dictionary={dictionary} />\n </div>\n </div>\n </Container>\n </div>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":"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"}
|
|
@@ -17,18 +17,19 @@ require("clsx");
|
|
|
17
17
|
require("tailwind-merge");
|
|
18
18
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
19
19
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
20
|
-
require("../../Auth/AuthProvider/index.cjs");
|
|
21
20
|
require("../../../libs/intlayer-api/auth.cjs");
|
|
22
21
|
require("../../../libs/intlayer-api/dictionary.cjs");
|
|
23
22
|
require("../../../libs/intlayer-api/organization.cjs");
|
|
24
23
|
require("../../../libs/intlayer-api/project.cjs");
|
|
24
|
+
require("../../../libs/intlayer-api/stripe.cjs");
|
|
25
25
|
require("../../../libs/intlayer-api/user.cjs");
|
|
26
|
+
require("@intlayer/config/client");
|
|
27
|
+
require("../../Toaster/Toast.cjs");
|
|
26
28
|
require("@intlayer/dictionaries-entry");
|
|
27
29
|
require("deepmerge");
|
|
28
30
|
require("../../Form/FormBase.cjs");
|
|
29
31
|
require("../../Form/FormField.cjs");
|
|
30
32
|
require("../../../Form-DERuauvB.cjs");
|
|
31
|
-
require("../../Toaster/Toast.cjs");
|
|
32
33
|
require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
33
34
|
require("zod");
|
|
34
35
|
const components_Label_index = require("../../Label/index.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorView.cjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath, type Dictionary } from '@intlayer/core';\nimport { X } from 'lucide-react';\nimport { type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { EditableFieldInput } from '../..//EditableField';\nimport {\n camelCaseToSentence,\n sentenceToCamelCase,\n} from '../../../utils/camelCase';\nimport { getDictionaryValueByKeyPath } from '../../../utils/dictionary';\nimport { Button } from '../../Button';\nimport {\n useEditedContentStore,\n useEditionPanelStore,\n} from '../../DictionaryEditor';\nimport { Label } from '../../Label';\nimport { editorViewContent } from '../editorView.content';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { TextEditor } from './TextEditor';\n\ntype EditorViewProps = {\n dictionaryKey: string;\n dictionary: Dictionary;\n};\n\nexport const EditorView: FC<EditorViewProps> = ({\n dictionaryKey,\n dictionary,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n (s) => ({\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n focusedContent: s.focusedContent,\n })\n );\n const keyPath = focusedContent?.keyPath ?? [];\n const initialKeyName = keyPath[keyPath.length - 1]?.key ?? '';\n const { titleInput, deleteButton, nodeTypeSelector } =\n useDictionary(editorViewContent);\n\n const { editedContent, renameEditedContent, addEditedContent } =\n useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n renameEditedContent: s.renameEditedContent,\n addEditedContent: s.addEditedContent,\n }));\n\n const section = editedContent[dictionaryKey]?.content\n ? getDictionaryValueByKeyPath(editedContent[dictionaryKey].content, keyPath)\n : getDictionaryValueByKeyPath(dictionary.content, keyPath);\n\n const isEditableSection = getIsEditableSection(section);\n\n const handleRenameNodeKey = (keyName: string) => {\n const camelCaseSentence = sentenceToCamelCase(keyName);\n renameEditedContent(dictionaryKey, camelCaseSentence, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: camelCaseSentence } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <>\n {isEditableSection && (\n <TextEditor\n key={keyPath.join('.')}\n keyPath={keyPath}\n section={section}\n dictionaryKey={dictionaryKey}\n />\n )}\n {keyPath.length > 0 ? (\n <form\n className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text flex w-full flex-col items-start justify-between gap-6 px-4 py-2\"\n key={JSON.stringify(focusedContent?.keyPath)}\n >\n <div className=\"flex w-full flex-wrap items-start justify-between gap-6\">\n {typeof initialKeyName === 'string' && (\n <div className=\"flex flex-col gap-3\">\n <Label>{titleInput.label}</Label>\n <div className=\"flex flex-wrap items-center gap-4\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n key={initialKeyName}\n placeholder={titleInput.placeholder.value}\n defaultValue={camelCaseToSentence(initialKeyName)}\n onSave={(value) => handleRenameNodeKey(value)}\n className=\"h-8\"\n variant=\"invisible\"\n />\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n ({initialKeyName})\n </span>\n </div>\n </div>\n )}\n\n <div>\n <Label>{nodeTypeSelector.label}</Label>\n\n <NodeTypeSelector\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n />\n </div>\n </div>\n {keyPath.length > 0 && (\n <Button\n label={deleteButton.label.value}\n variant=\"outline\"\n color=\"error\"\n className=\"ml-auto\"\n Icon={X}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n >\n {deleteButton.text}\n </Button>\n )}\n </form>\n ) : (\n <span className=\"h-8\"></span>\n )}\n </>\n );\n};\n"],"names":["useEditionPanelStore","useDictionary","editorViewContent","useEditedContentStore","getDictionaryValueByKeyPath","getIsEditableSection","sentenceToCamelCase","jsxs","Fragment","jsx","TextEditor","Label","EditableFieldInput","camelCaseToSentence","NodeTypeSelector","Button","X"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorView.cjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath, type Dictionary } from '@intlayer/core';\nimport { X } from 'lucide-react';\nimport { type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { EditableFieldInput } from '../..//EditableField';\nimport {\n camelCaseToSentence,\n sentenceToCamelCase,\n} from '../../../utils/camelCase';\nimport { getDictionaryValueByKeyPath } from '../../../utils/dictionary';\nimport { Button } from '../../Button';\nimport {\n useEditedContentStore,\n useEditionPanelStore,\n} from '../../DictionaryEditor';\nimport { Label } from '../../Label';\nimport { editorViewContent } from '../editorView.content';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { TextEditor } from './TextEditor';\n\ntype EditorViewProps = {\n dictionaryKey: string;\n dictionary: Dictionary;\n};\n\nexport const EditorView: FC<EditorViewProps> = ({\n dictionaryKey,\n dictionary,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n (s) => ({\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n focusedContent: s.focusedContent,\n })\n );\n const keyPath = focusedContent?.keyPath ?? [];\n const initialKeyName = keyPath[keyPath.length - 1]?.key ?? '';\n const { titleInput, deleteButton, nodeTypeSelector } =\n useDictionary(editorViewContent);\n\n const { editedContent, renameEditedContent, addEditedContent } =\n useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n renameEditedContent: s.renameEditedContent,\n addEditedContent: s.addEditedContent,\n }));\n\n const section = editedContent[dictionaryKey]?.content\n ? getDictionaryValueByKeyPath(editedContent[dictionaryKey].content, keyPath)\n : getDictionaryValueByKeyPath(dictionary.content, keyPath);\n\n const isEditableSection = getIsEditableSection(section);\n\n const handleRenameNodeKey = (keyName: string) => {\n const camelCaseSentence = sentenceToCamelCase(keyName);\n renameEditedContent(dictionaryKey, camelCaseSentence, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: camelCaseSentence } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <>\n {isEditableSection && (\n <TextEditor\n key={keyPath.join('.')}\n keyPath={keyPath}\n section={section}\n dictionaryKey={dictionaryKey}\n />\n )}\n {keyPath.length > 0 ? (\n <form\n className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text flex w-full flex-col items-start justify-between gap-6 px-4 py-2\"\n key={JSON.stringify(focusedContent?.keyPath)}\n >\n <div className=\"flex w-full flex-wrap items-start justify-between gap-6\">\n {typeof initialKeyName === 'string' && (\n <div className=\"flex flex-col gap-3\">\n <Label>{titleInput.label}</Label>\n <div className=\"flex flex-wrap items-center gap-4\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n key={initialKeyName}\n placeholder={titleInput.placeholder.value}\n defaultValue={camelCaseToSentence(initialKeyName)}\n onSave={(value) => handleRenameNodeKey(value)}\n className=\"h-8\"\n variant=\"invisible\"\n />\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n ({initialKeyName})\n </span>\n </div>\n </div>\n )}\n\n <div>\n <Label>{nodeTypeSelector.label}</Label>\n\n <NodeTypeSelector\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n />\n </div>\n </div>\n {keyPath.length > 0 && (\n <Button\n label={deleteButton.label.value}\n variant=\"outline\"\n color=\"error\"\n className=\"ml-auto\"\n Icon={X}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n >\n {deleteButton.text}\n </Button>\n )}\n </form>\n ) : (\n <span className=\"h-8\"></span>\n )}\n </>\n );\n};\n"],"names":["useEditionPanelStore","useDictionary","editorViewContent","useEditedContentStore","getDictionaryValueByKeyPath","getIsEditableSection","sentenceToCamelCase","jsxs","Fragment","jsx","TextEditor","Label","EditableFieldInput","camelCaseToSentence","NodeTypeSelector","Button","X"],"mappings":"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"}
|
|
@@ -15,18 +15,19 @@ import "clsx";
|
|
|
15
15
|
import "tailwind-merge";
|
|
16
16
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
17
17
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
18
|
-
import "../../Auth/AuthProvider/index.mjs";
|
|
19
18
|
import "../../../libs/intlayer-api/auth.mjs";
|
|
20
19
|
import "../../../libs/intlayer-api/dictionary.mjs";
|
|
21
20
|
import "../../../libs/intlayer-api/organization.mjs";
|
|
22
21
|
import "../../../libs/intlayer-api/project.mjs";
|
|
22
|
+
import "../../../libs/intlayer-api/stripe.mjs";
|
|
23
23
|
import "../../../libs/intlayer-api/user.mjs";
|
|
24
|
+
import "@intlayer/config/client";
|
|
25
|
+
import "../../Toaster/Toast.mjs";
|
|
24
26
|
import "@intlayer/dictionaries-entry";
|
|
25
27
|
import "deepmerge";
|
|
26
28
|
import "../../Form/FormBase.mjs";
|
|
27
29
|
import "../../Form/FormField.mjs";
|
|
28
30
|
import "../../../Form-DyFBmVya.js";
|
|
29
|
-
import "../../Toaster/Toast.mjs";
|
|
30
31
|
import "../../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
31
32
|
import "zod";
|
|
32
33
|
import { Label } from "../../Label/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorView.mjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath, type Dictionary } from '@intlayer/core';\nimport { X } from 'lucide-react';\nimport { type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { EditableFieldInput } from '../..//EditableField';\nimport {\n camelCaseToSentence,\n sentenceToCamelCase,\n} from '../../../utils/camelCase';\nimport { getDictionaryValueByKeyPath } from '../../../utils/dictionary';\nimport { Button } from '../../Button';\nimport {\n useEditedContentStore,\n useEditionPanelStore,\n} from '../../DictionaryEditor';\nimport { Label } from '../../Label';\nimport { editorViewContent } from '../editorView.content';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { TextEditor } from './TextEditor';\n\ntype EditorViewProps = {\n dictionaryKey: string;\n dictionary: Dictionary;\n};\n\nexport const EditorView: FC<EditorViewProps> = ({\n dictionaryKey,\n dictionary,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n (s) => ({\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n focusedContent: s.focusedContent,\n })\n );\n const keyPath = focusedContent?.keyPath ?? [];\n const initialKeyName = keyPath[keyPath.length - 1]?.key ?? '';\n const { titleInput, deleteButton, nodeTypeSelector } =\n useDictionary(editorViewContent);\n\n const { editedContent, renameEditedContent, addEditedContent } =\n useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n renameEditedContent: s.renameEditedContent,\n addEditedContent: s.addEditedContent,\n }));\n\n const section = editedContent[dictionaryKey]?.content\n ? getDictionaryValueByKeyPath(editedContent[dictionaryKey].content, keyPath)\n : getDictionaryValueByKeyPath(dictionary.content, keyPath);\n\n const isEditableSection = getIsEditableSection(section);\n\n const handleRenameNodeKey = (keyName: string) => {\n const camelCaseSentence = sentenceToCamelCase(keyName);\n renameEditedContent(dictionaryKey, camelCaseSentence, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: camelCaseSentence } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <>\n {isEditableSection && (\n <TextEditor\n key={keyPath.join('.')}\n keyPath={keyPath}\n section={section}\n dictionaryKey={dictionaryKey}\n />\n )}\n {keyPath.length > 0 ? (\n <form\n className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text flex w-full flex-col items-start justify-between gap-6 px-4 py-2\"\n key={JSON.stringify(focusedContent?.keyPath)}\n >\n <div className=\"flex w-full flex-wrap items-start justify-between gap-6\">\n {typeof initialKeyName === 'string' && (\n <div className=\"flex flex-col gap-3\">\n <Label>{titleInput.label}</Label>\n <div className=\"flex flex-wrap items-center gap-4\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n key={initialKeyName}\n placeholder={titleInput.placeholder.value}\n defaultValue={camelCaseToSentence(initialKeyName)}\n onSave={(value) => handleRenameNodeKey(value)}\n className=\"h-8\"\n variant=\"invisible\"\n />\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n ({initialKeyName})\n </span>\n </div>\n </div>\n )}\n\n <div>\n <Label>{nodeTypeSelector.label}</Label>\n\n <NodeTypeSelector\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n />\n </div>\n </div>\n {keyPath.length > 0 && (\n <Button\n label={deleteButton.label.value}\n variant=\"outline\"\n color=\"error\"\n className=\"ml-auto\"\n Icon={X}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n >\n {deleteButton.text}\n </Button>\n )}\n </form>\n ) : (\n <span className=\"h-8\"></span>\n )}\n </>\n );\n};\n"],"names":["jsxs","Fragment","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorView.mjs","sources":["../../../../src/components/DictionaryFieldEditor/EditorView/EditorView.tsx"],"sourcesContent":["'use client';\n\nimport { type KeyPath, type Dictionary } from '@intlayer/core';\nimport { X } from 'lucide-react';\nimport { type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { EditableFieldInput } from '../..//EditableField';\nimport {\n camelCaseToSentence,\n sentenceToCamelCase,\n} from '../../../utils/camelCase';\nimport { getDictionaryValueByKeyPath } from '../../../utils/dictionary';\nimport { Button } from '../../Button';\nimport {\n useEditedContentStore,\n useEditionPanelStore,\n} from '../../DictionaryEditor';\nimport { Label } from '../../Label';\nimport { editorViewContent } from '../editorView.content';\nimport { getIsEditableSection } from '../getIsEditableSection';\nimport { NodeTypeSelector } from '../NodeTypeSelector';\nimport { TextEditor } from './TextEditor';\n\ntype EditorViewProps = {\n dictionaryKey: string;\n dictionary: Dictionary;\n};\n\nexport const EditorView: FC<EditorViewProps> = ({\n dictionaryKey,\n dictionary,\n}) => {\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n (s) => ({\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n focusedContent: s.focusedContent,\n })\n );\n const keyPath = focusedContent?.keyPath ?? [];\n const initialKeyName = keyPath[keyPath.length - 1]?.key ?? '';\n const { titleInput, deleteButton, nodeTypeSelector } =\n useDictionary(editorViewContent);\n\n const { editedContent, renameEditedContent, addEditedContent } =\n useEditedContentStore((s) => ({\n editedContent: s.editedContent,\n renameEditedContent: s.renameEditedContent,\n addEditedContent: s.addEditedContent,\n }));\n\n const section = editedContent[dictionaryKey]?.content\n ? getDictionaryValueByKeyPath(editedContent[dictionaryKey].content, keyPath)\n : getDictionaryValueByKeyPath(dictionary.content, keyPath);\n\n const isEditableSection = getIsEditableSection(section);\n\n const handleRenameNodeKey = (keyName: string) => {\n const camelCaseSentence = sentenceToCamelCase(keyName);\n renameEditedContent(dictionaryKey, camelCaseSentence, keyPath);\n const prevKeyPath: KeyPath[] = keyPath.slice(0, -1);\n const lastKeyPath: KeyPath = keyPath[keyPath.length - 1];\n const newKeyPath: KeyPath[] = [\n ...prevKeyPath,\n { ...lastKeyPath, key: camelCaseSentence } as KeyPath,\n ];\n setFocusedContentKeyPath(newKeyPath);\n };\n\n return (\n <>\n {isEditableSection && (\n <TextEditor\n key={keyPath.join('.')}\n keyPath={keyPath}\n section={section}\n dictionaryKey={dictionaryKey}\n />\n )}\n {keyPath.length > 0 ? (\n <form\n className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text flex w-full flex-col items-start justify-between gap-6 px-4 py-2\"\n key={JSON.stringify(focusedContent?.keyPath)}\n >\n <div className=\"flex w-full flex-wrap items-start justify-between gap-6\">\n {typeof initialKeyName === 'string' && (\n <div className=\"flex flex-col gap-3\">\n <Label>{titleInput.label}</Label>\n <div className=\"flex flex-wrap items-center gap-4\">\n <EditableFieldInput\n name=\"key\"\n aria-label=\"Key\"\n key={initialKeyName}\n placeholder={titleInput.placeholder.value}\n defaultValue={camelCaseToSentence(initialKeyName)}\n onSave={(value) => handleRenameNodeKey(value)}\n className=\"h-8\"\n variant=\"invisible\"\n />\n <span className=\"text-neutral dark:text-neutral-dark text-sm\">\n ({initialKeyName})\n </span>\n </div>\n </div>\n )}\n\n <div>\n <Label>{nodeTypeSelector.label}</Label>\n\n <NodeTypeSelector\n keyPath={keyPath}\n dictionaryKey={dictionaryKey}\n section={section}\n />\n </div>\n </div>\n {keyPath.length > 0 && (\n <Button\n label={deleteButton.label.value}\n variant=\"outline\"\n color=\"error\"\n className=\"ml-auto\"\n Icon={X}\n onClick={() => {\n addEditedContent(dictionaryKey, undefined, keyPath);\n\n const parentKeyPath: KeyPath[] = keyPath.slice(0, -1);\n setFocusedContentKeyPath(parentKeyPath);\n }}\n >\n {deleteButton.text}\n </Button>\n )}\n </form>\n ) : (\n <span className=\"h-8\"></span>\n )}\n </>\n );\n};\n"],"names":["jsxs","Fragment","jsx"],"mappings":"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"}
|
|
@@ -19,18 +19,18 @@ require("../../EditableField/EditableFieldInput.cjs");
|
|
|
19
19
|
require("../../EditableField/EditableFieldTextArea.cjs");
|
|
20
20
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
21
21
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
22
|
-
require("../../Auth/AuthProvider/index.cjs");
|
|
23
22
|
require("../../../libs/intlayer-api/auth.cjs");
|
|
24
23
|
require("../../../libs/intlayer-api/dictionary.cjs");
|
|
25
24
|
require("../../../libs/intlayer-api/organization.cjs");
|
|
26
25
|
require("../../../libs/intlayer-api/project.cjs");
|
|
26
|
+
require("../../../libs/intlayer-api/stripe.cjs");
|
|
27
27
|
require("../../../libs/intlayer-api/user.cjs");
|
|
28
|
+
require("../../Toaster/Toast.cjs");
|
|
28
29
|
require("@intlayer/dictionaries-entry");
|
|
29
30
|
require("deepmerge");
|
|
30
31
|
require("../../Form/FormBase.cjs");
|
|
31
32
|
require("../../Form/FormField.cjs");
|
|
32
33
|
require("../../../Form-DERuauvB.cjs");
|
|
33
|
-
require("../../Toaster/Toast.cjs");
|
|
34
34
|
require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
35
35
|
require("zod");
|
|
36
36
|
const components_DictionaryFieldEditor_EnumKeyInput = require("../EnumKeyInput.cjs");
|
|
@@ -17,18 +17,18 @@ import "../../EditableField/EditableFieldInput.mjs";
|
|
|
17
17
|
import "../../EditableField/EditableFieldTextArea.mjs";
|
|
18
18
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
19
19
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
20
|
-
import "../../Auth/AuthProvider/index.mjs";
|
|
21
20
|
import "../../../libs/intlayer-api/auth.mjs";
|
|
22
21
|
import "../../../libs/intlayer-api/dictionary.mjs";
|
|
23
22
|
import "../../../libs/intlayer-api/organization.mjs";
|
|
24
23
|
import "../../../libs/intlayer-api/project.mjs";
|
|
24
|
+
import "../../../libs/intlayer-api/stripe.mjs";
|
|
25
25
|
import "../../../libs/intlayer-api/user.mjs";
|
|
26
|
+
import "../../Toaster/Toast.mjs";
|
|
26
27
|
import "@intlayer/dictionaries-entry";
|
|
27
28
|
import "deepmerge";
|
|
28
29
|
import "../../Form/FormBase.mjs";
|
|
29
30
|
import "../../Form/FormField.mjs";
|
|
30
31
|
import "../../../Form-DyFBmVya.js";
|
|
31
|
-
import "../../Toaster/Toast.mjs";
|
|
32
32
|
import "../../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
33
33
|
import "zod";
|
|
34
34
|
import { EnumKeyInput } from "../EnumKeyInput.mjs";
|
|
@@ -18,18 +18,18 @@ require("../../EditableField/EditableFieldInput.cjs");
|
|
|
18
18
|
require("../../EditableField/EditableFieldTextArea.cjs");
|
|
19
19
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
20
20
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
21
|
-
require("../../Auth/AuthProvider/index.cjs");
|
|
22
21
|
require("../../../libs/intlayer-api/auth.cjs");
|
|
23
22
|
require("../../../libs/intlayer-api/dictionary.cjs");
|
|
24
23
|
require("../../../libs/intlayer-api/organization.cjs");
|
|
25
24
|
require("../../../libs/intlayer-api/project.cjs");
|
|
25
|
+
require("../../../libs/intlayer-api/stripe.cjs");
|
|
26
26
|
require("../../../libs/intlayer-api/user.cjs");
|
|
27
|
+
require("../../Toaster/Toast.cjs");
|
|
27
28
|
require("@intlayer/dictionaries-entry");
|
|
28
29
|
require("deepmerge");
|
|
29
30
|
require("../../Form/FormBase.cjs");
|
|
30
31
|
require("../../Form/FormField.cjs");
|
|
31
32
|
require("../../../Form-DERuauvB.cjs");
|
|
32
|
-
require("../../Toaster/Toast.cjs");
|
|
33
33
|
require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
34
34
|
require("zod");
|
|
35
35
|
const components_DictionaryFieldEditor_getIsEditableSection = require("../getIsEditableSection.cjs");
|
|
@@ -16,18 +16,18 @@ import "../../EditableField/EditableFieldInput.mjs";
|
|
|
16
16
|
import "../../EditableField/EditableFieldTextArea.mjs";
|
|
17
17
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
18
18
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
19
|
-
import "../../Auth/AuthProvider/index.mjs";
|
|
20
19
|
import "../../../libs/intlayer-api/auth.mjs";
|
|
21
20
|
import "../../../libs/intlayer-api/dictionary.mjs";
|
|
22
21
|
import "../../../libs/intlayer-api/organization.mjs";
|
|
23
22
|
import "../../../libs/intlayer-api/project.mjs";
|
|
23
|
+
import "../../../libs/intlayer-api/stripe.mjs";
|
|
24
24
|
import "../../../libs/intlayer-api/user.mjs";
|
|
25
|
+
import "../../Toaster/Toast.mjs";
|
|
25
26
|
import "@intlayer/dictionaries-entry";
|
|
26
27
|
import "deepmerge";
|
|
27
28
|
import "../../Form/FormBase.mjs";
|
|
28
29
|
import "../../Form/FormField.mjs";
|
|
29
30
|
import "../../../Form-DyFBmVya.js";
|
|
30
|
-
import "../../Toaster/Toast.mjs";
|
|
31
31
|
import "../../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
32
32
|
import "zod";
|
|
33
33
|
import { getIsEditableSection } from "../getIsEditableSection.mjs";
|
|
@@ -17,18 +17,18 @@ require("../EditableField/EditableFieldInput.cjs");
|
|
|
17
17
|
require("../EditableField/EditableFieldTextArea.cjs");
|
|
18
18
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
19
19
|
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
20
|
-
require("../Auth/AuthProvider/index.cjs");
|
|
21
20
|
require("../../libs/intlayer-api/auth.cjs");
|
|
22
21
|
require("../../libs/intlayer-api/dictionary.cjs");
|
|
23
22
|
require("../../libs/intlayer-api/organization.cjs");
|
|
24
23
|
require("../../libs/intlayer-api/project.cjs");
|
|
24
|
+
require("../../libs/intlayer-api/stripe.cjs");
|
|
25
25
|
require("../../libs/intlayer-api/user.cjs");
|
|
26
|
+
require("../Toaster/Toast.cjs");
|
|
26
27
|
require("@intlayer/dictionaries-entry");
|
|
27
28
|
require("deepmerge");
|
|
28
29
|
require("../Form/FormBase.cjs");
|
|
29
30
|
require("../Form/FormField.cjs");
|
|
30
31
|
require("../../Form-DERuauvB.cjs");
|
|
31
|
-
require("../Toaster/Toast.cjs");
|
|
32
32
|
require("../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
33
33
|
require("zod");
|
|
34
34
|
require("../Select/Multiselect.cjs");
|
|
@@ -15,18 +15,18 @@ import "../EditableField/EditableFieldInput.mjs";
|
|
|
15
15
|
import "../EditableField/EditableFieldTextArea.mjs";
|
|
16
16
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
17
17
|
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
18
|
-
import "../Auth/AuthProvider/index.mjs";
|
|
19
18
|
import "../../libs/intlayer-api/auth.mjs";
|
|
20
19
|
import "../../libs/intlayer-api/dictionary.mjs";
|
|
21
20
|
import "../../libs/intlayer-api/organization.mjs";
|
|
22
21
|
import "../../libs/intlayer-api/project.mjs";
|
|
22
|
+
import "../../libs/intlayer-api/stripe.mjs";
|
|
23
23
|
import "../../libs/intlayer-api/user.mjs";
|
|
24
|
+
import "../Toaster/Toast.mjs";
|
|
24
25
|
import "@intlayer/dictionaries-entry";
|
|
25
26
|
import "deepmerge";
|
|
26
27
|
import "../Form/FormBase.mjs";
|
|
27
28
|
import "../Form/FormField.mjs";
|
|
28
29
|
import "../../Form-DyFBmVya.js";
|
|
29
|
-
import "../Toaster/Toast.mjs";
|
|
30
30
|
import "../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
31
31
|
import "zod";
|
|
32
32
|
import "../Select/Multiselect.mjs";
|
|
@@ -20,8 +20,6 @@ require("../../EditableField/EditableFieldTextArea.cjs");
|
|
|
20
20
|
const components_Form_FormBase = require("../../Form/FormBase.cjs");
|
|
21
21
|
require("../../Form/FormField.cjs");
|
|
22
22
|
const components_Form_layout_FormItemLayout = require("../../../Form-DERuauvB.cjs");
|
|
23
|
-
require("../../Toaster/Toast.cjs");
|
|
24
|
-
const components_Toaster_useToast = require("../../Toaster/useToast.cjs");
|
|
25
23
|
require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
26
24
|
require("zod");
|
|
27
25
|
const components_DictionaryFieldEditor_SaveForm_saveForm_content = require("./saveForm.content.cjs");
|
|
@@ -37,8 +35,9 @@ const SaveForm = ({ dictionary }) => {
|
|
|
37
35
|
})
|
|
38
36
|
);
|
|
39
37
|
const { form, isSubmitting } = components_Form_FormBase.useForm(SaveFormSchema);
|
|
40
|
-
const {
|
|
41
|
-
|
|
38
|
+
const { resetButton, saveButton, publishButton } = reactIntlayer.useDictionary(
|
|
39
|
+
components_DictionaryFieldEditor_SaveForm_saveForm_content.saveDictionaryContent
|
|
40
|
+
);
|
|
42
41
|
const editedDictionary = require$$0.useMemo(
|
|
43
42
|
() => editedContent[dictionary.key],
|
|
44
43
|
[editedContent, dictionary.key]
|
|
@@ -60,19 +59,7 @@ const SaveForm = ({ dictionary }) => {
|
|
|
60
59
|
...dictionary,
|
|
61
60
|
...editedContent[dictionary.key]
|
|
62
61
|
}
|
|
63
|
-
])
|
|
64
|
-
toast({
|
|
65
|
-
title: updateDictionaryToasts.updated.title.value,
|
|
66
|
-
description: updateDictionaryToasts.updated.description,
|
|
67
|
-
variant: "success"
|
|
68
|
-
});
|
|
69
|
-
}).catch((error) => {
|
|
70
|
-
toast({
|
|
71
|
-
title: updateDictionaryToasts.failed.title.value,
|
|
72
|
-
description: error.message,
|
|
73
|
-
variant: "error"
|
|
74
|
-
});
|
|
75
|
-
});
|
|
62
|
+
]);
|
|
76
63
|
};
|
|
77
64
|
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
78
65
|
components_Form_layout_FormItemLayout.Form,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries, usePushDictionaries } from '../../../hooks';\nimport { useEditedContentStore } from '../../DictionaryEditor';\nimport { Form, useForm } from '../../Form';\nimport {
|
|
1
|
+
{"version":3,"file":"SaveForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries, usePushDictionaries } from '../../../hooks';\nimport { useEditedContentStore } from '../../DictionaryEditor';\nimport { Form, useForm } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { getSaveFormSchema } from './SaveFormSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({ dictionary }) => {\n const { pushDictionaries } = usePushDictionaries();\n const SaveFormSchema = getSaveFormSchema();\n const { online } = useGetAllDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n (s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n })\n );\n const { form, isSubmitting } = useForm(SaveFormSchema);\n const { resetButton, saveButton, publishButton } = useDictionary(\n saveDictionaryContent\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const onlineDictionary = useMemo(() => {\n return online?.[dictionary.key];\n }, [online, dictionary.key]);\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(onlineDictionary?.content),\n [onlineDictionary, editedDictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <Form\n className=\"flex w-full flex-1 flex-row justify-end gap-3\"\n {...form}\n schema={SaveFormSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label.value}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label.value}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label.value}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n );\n};\n"],"names":["usePushDictionaries","getSaveFormSchema","useGetAllDictionaries","useEditedContentStore","useForm","useDictionary","saveDictionaryContent","useMemo","jsxs","Form","jsx","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,WAAuC,CAAC,EAAE,iBAAiB;AAChE,QAAA,EAAE,qBAAqBA,uBAAAA;AAC7B,QAAM,iBAAiBC,yDAAAA;AACjB,QAAA,EAAE,WAAWC,4BAAAA;AAEb,QAAA,EAAE,eAAe,qBAAA,IAAyBC,kDAAA;AAAA,IAC9C,CAAC,OAAO;AAAA,MACN,eAAe,EAAE;AAAA,MACjB,sBAAsB,EAAE;AAAA,IAAA;AAAA,EAC1B;AAEF,QAAM,EAAE,MAAM,aAAa,IAAIC,iCAAQ,cAAc;AACrD,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IACjDC,2DAAA;AAAA,EAAA;AAGF,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAAA;AAG1B,QAAA,mBAAmBA,WAAAA,QAAQ,MAAM;AAC9B,WAAA,SAAS,WAAW,GAAG;AAAA,EAC7B,GAAA,CAAC,QAAQ,WAAW,GAAG,CAAC;AAE3B,QAAM,WAAWA,WAAA;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,kBAAkB,OAAO;AAAA,IAC5C,CAAC,kBAAkB,gBAAgB;AAAA,EAAA;AAGrC,QAAM,oBAAoBA,WAAA;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EAAA;AAGb,QAAM,kBAAkB,YAAY;AAClC,UAAM,iBAAiB;AAAA,MACrB;AAAA,QACE,GAAG;AAAA,QACH,GAAG,cAAc,WAAW,GAAG;AAAA,MACjC;AAAA,IAAA,CACD;AAAA,EAAA;AAID,SAAAC,2BAAA,kBAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAC,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY,MAAM;AAAA,YACzB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAME,YAAA;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCD,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc,MAAM;AAAA,YAC3B,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMG,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEF,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW,MAAM;AAAA,YACxB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMI,YAAA;AAAA,YACN,OAAM;AAAA,YACN,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAKV;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SaveForm.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AASzC,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,sBAAsB,CAgG/C,CAAC"}
|
|
@@ -18,8 +18,6 @@ import "../../EditableField/EditableFieldTextArea.mjs";
|
|
|
18
18
|
import { useForm } from "../../Form/FormBase.mjs";
|
|
19
19
|
import "../../Form/FormField.mjs";
|
|
20
20
|
import { F as Form } from "../../../Form-DyFBmVya.js";
|
|
21
|
-
import "../../Toaster/Toast.mjs";
|
|
22
|
-
import { useToast } from "../../Toaster/useToast.mjs";
|
|
23
21
|
import "../../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
24
22
|
import "zod";
|
|
25
23
|
import { saveDictionaryContent } from "./saveForm.content.mjs";
|
|
@@ -35,8 +33,9 @@ const SaveForm = ({ dictionary }) => {
|
|
|
35
33
|
})
|
|
36
34
|
);
|
|
37
35
|
const { form, isSubmitting } = useForm(SaveFormSchema);
|
|
38
|
-
const {
|
|
39
|
-
|
|
36
|
+
const { resetButton, saveButton, publishButton } = useDictionary(
|
|
37
|
+
saveDictionaryContent
|
|
38
|
+
);
|
|
40
39
|
const editedDictionary = useMemo(
|
|
41
40
|
() => editedContent[dictionary.key],
|
|
42
41
|
[editedContent, dictionary.key]
|
|
@@ -58,19 +57,7 @@ const SaveForm = ({ dictionary }) => {
|
|
|
58
57
|
...dictionary,
|
|
59
58
|
...editedContent[dictionary.key]
|
|
60
59
|
}
|
|
61
|
-
])
|
|
62
|
-
toast({
|
|
63
|
-
title: updateDictionaryToasts.updated.title.value,
|
|
64
|
-
description: updateDictionaryToasts.updated.description,
|
|
65
|
-
variant: "success"
|
|
66
|
-
});
|
|
67
|
-
}).catch((error) => {
|
|
68
|
-
toast({
|
|
69
|
-
title: updateDictionaryToasts.failed.title.value,
|
|
70
|
-
description: error.message,
|
|
71
|
-
variant: "error"
|
|
72
|
-
});
|
|
73
|
-
});
|
|
60
|
+
]);
|
|
74
61
|
};
|
|
75
62
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
76
63
|
Form,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries, usePushDictionaries } from '../../../hooks';\nimport { useEditedContentStore } from '../../DictionaryEditor';\nimport { Form, useForm } from '../../Form';\nimport {
|
|
1
|
+
{"version":3,"file":"SaveForm.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries, usePushDictionaries } from '../../../hooks';\nimport { useEditedContentStore } from '../../DictionaryEditor';\nimport { Form, useForm } from '../../Form';\nimport { saveDictionaryContent } from './saveForm.content';\nimport { getSaveFormSchema } from './SaveFormSchema';\n\ntype DictionaryDetailsProps = {\n dictionary: Dictionary;\n};\n\nexport const SaveForm: FC<DictionaryDetailsProps> = ({ dictionary }) => {\n const { pushDictionaries } = usePushDictionaries();\n const SaveFormSchema = getSaveFormSchema();\n const { online } = useGetAllDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n (s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n })\n );\n const { form, isSubmitting } = useForm(SaveFormSchema);\n const { resetButton, saveButton, publishButton } = useDictionary(\n saveDictionaryContent\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const onlineDictionary = useMemo(() => {\n return online?.[dictionary.key];\n }, [online, dictionary.key]);\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(onlineDictionary?.content),\n [onlineDictionary, editedDictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <Form\n className=\"flex w-full flex-1 flex-row justify-end gap-3\"\n {...form}\n schema={SaveFormSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label.value}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label.value}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label.value}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,WAAuC,CAAC,EAAE,iBAAiB;AAChE,QAAA,EAAE,qBAAqB;AAC7B,QAAM,iBAAiB;AACjB,QAAA,EAAE,WAAW;AAEb,QAAA,EAAE,eAAe,qBAAA,IAAyB;AAAA,IAC9C,CAAC,OAAO;AAAA,MACN,eAAe,EAAE;AAAA,MACjB,sBAAsB,EAAE;AAAA,IAAA;AAAA,EAC1B;AAEF,QAAM,EAAE,MAAM,aAAa,IAAI,QAAQ,cAAc;AACrD,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAA;AAAA,IACjD;AAAA,EAAA;AAGF,QAAM,mBAAmB;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAAA;AAG1B,QAAA,mBAAmB,QAAQ,MAAM;AAC9B,WAAA,SAAS,WAAW,GAAG;AAAA,EAC7B,GAAA,CAAC,QAAQ,WAAW,GAAG,CAAC;AAE3B,QAAM,WAAW;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,kBAAkB,OAAO;AAAA,IAC5C,CAAC,kBAAkB,gBAAgB;AAAA,EAAA;AAGrC,QAAM,oBAAoB;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EAAA;AAGb,QAAM,kBAAkB,YAAY;AAClC,UAAM,iBAAiB;AAAA,MACrB;AAAA,QACE,GAAG;AAAA,QACH,GAAG,cAAc,WAAW,GAAG;AAAA,MACjC;AAAA,IAAA,CACD;AAAA,EAAA;AAID,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAC,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY,MAAM;AAAA,YACzB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAM;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc,MAAM;AAAA,YAC3B,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW,MAAM;AAAA,YACxB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAKV;"}
|
|
@@ -39,27 +39,6 @@ const saveDictionaryContent = {
|
|
|
39
39
|
fr: "Cliquez pour publier dictionnaire",
|
|
40
40
|
es: "Haga clic para publicar el diccionario"
|
|
41
41
|
})
|
|
42
|
-
},
|
|
43
|
-
updateDictionaryToasts: {
|
|
44
|
-
updated: {
|
|
45
|
-
title: intlayer.t({
|
|
46
|
-
en: "Dictionary updated",
|
|
47
|
-
fr: "Dictionnaire mis à jour",
|
|
48
|
-
es: "Diccionario actualizado"
|
|
49
|
-
}),
|
|
50
|
-
description: intlayer.t({
|
|
51
|
-
en: "Your dictionary has been updated successfully",
|
|
52
|
-
fr: "Votre dictionnaire a été mis à jour avec succès",
|
|
53
|
-
es: "Su diccionario se ha actualizado con éxito"
|
|
54
|
-
})
|
|
55
|
-
},
|
|
56
|
-
failed: {
|
|
57
|
-
title: intlayer.t({
|
|
58
|
-
en: "Dictionary update failed",
|
|
59
|
-
fr: "La mise à jour du dictionnaire a échoué",
|
|
60
|
-
es: "La actualización del diccionario ha fallado"
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
42
|
}
|
|
64
43
|
}
|
|
65
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveForm.content.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/saveForm.content.tsx"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nexport const saveDictionaryContent = {\n key: 'save-dictionary-details',\n content: {\n resetButton: {\n text: t({\n en: 'Reset changes',\n fr: 'Réinitialiser les modifications',\n es: 'Restablecer cambios',\n }),\n label: t({\n en: 'Click to reset changes',\n fr: 'Cliquez pour réinitialiser les modifications',\n es: 'Haga clic para restablecer los cambios',\n }),\n },\n saveButton: {\n text: t({\n en: 'Save changes',\n fr: 'Enregistrer les modifications',\n es: 'Guardar cambios',\n }),\n label: t({\n en: 'Click to save changes',\n fr: 'Cliquez pour enregistrer les modifications',\n es: 'Haga clic para guardar los cambios',\n }),\n },\n publishButton: {\n text: t({\n en: 'Publish dictionary',\n fr: 'Publier dictionnaire',\n es: 'Publicar diccionario',\n }),\n label: t({\n en: 'Click to publish dictionary',\n fr: 'Cliquez pour publier dictionnaire',\n es: 'Haga clic para publicar el diccionario',\n }),\n },\n
|
|
1
|
+
{"version":3,"file":"saveForm.content.cjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/saveForm.content.tsx"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nexport const saveDictionaryContent = {\n key: 'save-dictionary-details',\n content: {\n resetButton: {\n text: t({\n en: 'Reset changes',\n fr: 'Réinitialiser les modifications',\n es: 'Restablecer cambios',\n }),\n label: t({\n en: 'Click to reset changes',\n fr: 'Cliquez pour réinitialiser les modifications',\n es: 'Haga clic para restablecer los cambios',\n }),\n },\n saveButton: {\n text: t({\n en: 'Save changes',\n fr: 'Enregistrer les modifications',\n es: 'Guardar cambios',\n }),\n label: t({\n en: 'Click to save changes',\n fr: 'Cliquez pour enregistrer les modifications',\n es: 'Haga clic para guardar los cambios',\n }),\n },\n publishButton: {\n text: t({\n en: 'Publish dictionary',\n fr: 'Publier dictionnaire',\n es: 'Publicar diccionario',\n }),\n label: t({\n en: 'Click to publish dictionary',\n fr: 'Cliquez pour publier dictionnaire',\n es: 'Haga clic para publicar el diccionario',\n }),\n },\n },\n} satisfies DeclarationContent;\n"],"names":["t"],"mappings":";;;AAEO,MAAM,wBAAwB;AAAA,EACnC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,aAAa;AAAA,MACX,MAAMA,SAAAA,EAAE;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,MACD,OAAOA,SAAAA,EAAE;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,IACH;AAAA,IACA,YAAY;AAAA,MACV,MAAMA,SAAAA,EAAE;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,MACD,OAAOA,SAAAA,EAAE;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,IACH;AAAA,IACA,eAAe;AAAA,MACb,MAAMA,SAAAA,EAAE;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,MACD,OAAOA,SAAAA,EAAE;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,IACH;AAAA,EACF;AACF;;"}
|
|
@@ -13,15 +13,6 @@ export declare const saveDictionaryContent: {
|
|
|
13
13
|
text: import('@intlayer/core').TranslationContent<string>;
|
|
14
14
|
label: import('@intlayer/core').TranslationContent<string>;
|
|
15
15
|
};
|
|
16
|
-
updateDictionaryToasts: {
|
|
17
|
-
updated: {
|
|
18
|
-
title: import('@intlayer/core').TranslationContent<string>;
|
|
19
|
-
description: import('@intlayer/core').TranslationContent<string>;
|
|
20
|
-
};
|
|
21
|
-
failed: {
|
|
22
|
-
title: import('@intlayer/core').TranslationContent<string>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
16
|
};
|
|
26
17
|
};
|
|
27
18
|
//# sourceMappingURL=saveForm.content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveForm.content.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/saveForm.content.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"saveForm.content.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/saveForm.content.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;CAwCJ,CAAC"}
|
|
@@ -37,27 +37,6 @@ const saveDictionaryContent = {
|
|
|
37
37
|
fr: "Cliquez pour publier dictionnaire",
|
|
38
38
|
es: "Haga clic para publicar el diccionario"
|
|
39
39
|
})
|
|
40
|
-
},
|
|
41
|
-
updateDictionaryToasts: {
|
|
42
|
-
updated: {
|
|
43
|
-
title: t({
|
|
44
|
-
en: "Dictionary updated",
|
|
45
|
-
fr: "Dictionnaire mis à jour",
|
|
46
|
-
es: "Diccionario actualizado"
|
|
47
|
-
}),
|
|
48
|
-
description: t({
|
|
49
|
-
en: "Your dictionary has been updated successfully",
|
|
50
|
-
fr: "Votre dictionnaire a été mis à jour avec succès",
|
|
51
|
-
es: "Su diccionario se ha actualizado con éxito"
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
failed: {
|
|
55
|
-
title: t({
|
|
56
|
-
en: "Dictionary update failed",
|
|
57
|
-
fr: "La mise à jour du dictionnaire a échoué",
|
|
58
|
-
es: "La actualización del diccionario ha fallado"
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
40
|
}
|
|
62
41
|
}
|
|
63
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveForm.content.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/saveForm.content.tsx"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nexport const saveDictionaryContent = {\n key: 'save-dictionary-details',\n content: {\n resetButton: {\n text: t({\n en: 'Reset changes',\n fr: 'Réinitialiser les modifications',\n es: 'Restablecer cambios',\n }),\n label: t({\n en: 'Click to reset changes',\n fr: 'Cliquez pour réinitialiser les modifications',\n es: 'Haga clic para restablecer los cambios',\n }),\n },\n saveButton: {\n text: t({\n en: 'Save changes',\n fr: 'Enregistrer les modifications',\n es: 'Guardar cambios',\n }),\n label: t({\n en: 'Click to save changes',\n fr: 'Cliquez pour enregistrer les modifications',\n es: 'Haga clic para guardar los cambios',\n }),\n },\n publishButton: {\n text: t({\n en: 'Publish dictionary',\n fr: 'Publier dictionnaire',\n es: 'Publicar diccionario',\n }),\n label: t({\n en: 'Click to publish dictionary',\n fr: 'Cliquez pour publier dictionnaire',\n es: 'Haga clic para publicar el diccionario',\n }),\n },\n
|
|
1
|
+
{"version":3,"file":"saveForm.content.mjs","sources":["../../../../src/components/DictionaryFieldEditor/SaveForm/saveForm.content.tsx"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nexport const saveDictionaryContent = {\n key: 'save-dictionary-details',\n content: {\n resetButton: {\n text: t({\n en: 'Reset changes',\n fr: 'Réinitialiser les modifications',\n es: 'Restablecer cambios',\n }),\n label: t({\n en: 'Click to reset changes',\n fr: 'Cliquez pour réinitialiser les modifications',\n es: 'Haga clic para restablecer los cambios',\n }),\n },\n saveButton: {\n text: t({\n en: 'Save changes',\n fr: 'Enregistrer les modifications',\n es: 'Guardar cambios',\n }),\n label: t({\n en: 'Click to save changes',\n fr: 'Cliquez pour enregistrer les modifications',\n es: 'Haga clic para guardar los cambios',\n }),\n },\n publishButton: {\n text: t({\n en: 'Publish dictionary',\n fr: 'Publier dictionnaire',\n es: 'Publicar diccionario',\n }),\n label: t({\n en: 'Click to publish dictionary',\n fr: 'Cliquez pour publier dictionnaire',\n es: 'Haga clic para publicar el diccionario',\n }),\n },\n },\n} satisfies DeclarationContent;\n"],"names":[],"mappings":";AAEO,MAAM,wBAAwB;AAAA,EACnC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,aAAa;AAAA,MACX,MAAM,EAAE;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,MACD,OAAO,EAAE;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,IACH;AAAA,IACA,YAAY;AAAA,MACV,MAAM,EAAE;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,MACD,OAAO,EAAE;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,IACH;AAAA,IACA,eAAe;AAAA,MACb,MAAM,EAAE;AAAA,QACN,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,MACD,OAAO,EAAE;AAAA,QACP,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA,CACL;AAAA,IACH;AAAA,EACF;AACF;"}
|
|
@@ -23,7 +23,10 @@ const Form = require$$0.forwardRef(
|
|
|
23
23
|
...props
|
|
24
24
|
}, ref) => {
|
|
25
25
|
const onSubmit = async (values) => {
|
|
26
|
-
const parsedValues = schema
|
|
26
|
+
const parsedValues = schema?.safeParse(values) ?? {
|
|
27
|
+
success: true,
|
|
28
|
+
data: void 0
|
|
29
|
+
};
|
|
27
30
|
await awaitFunction(onSubmitProp?.(values));
|
|
28
31
|
if (parsedValues.success) {
|
|
29
32
|
await awaitFunction(onSubmitSuccessProp?.(parsedValues.data));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormBase.cjs","sources":["../../../src/components/Form/FormBase.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { forwardRef, type Ref, type HTMLAttributes } from 'react';\nimport {\n FormProvider,\n type FormProviderProps,\n useForm as useFormReactHookForm,\n type UseFormProps,\n} from 'react-hook-form';\nimport type { ZodType, z } from 'zod';\nimport { cn } from '../../utils/cn';\n\ntype FormProps<T extends ZodType> = HTMLAttributes<HTMLFormElement> &\n FormProviderProps<z.infer<T>> & {\n schema
|
|
1
|
+
{"version":3,"file":"FormBase.cjs","sources":["../../../src/components/Form/FormBase.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { forwardRef, type Ref, type HTMLAttributes } from 'react';\nimport {\n FormProvider,\n type FormProviderProps,\n useForm as useFormReactHookForm,\n type UseFormProps,\n} from 'react-hook-form';\nimport type { ZodType, z } from 'zod';\nimport { cn } from '../../utils/cn';\n\ntype FormProps<T extends ZodType> = HTMLAttributes<HTMLFormElement> &\n FormProviderProps<z.infer<T>> & {\n schema?: T;\n onSubmit?: (data: z.infer<T>) => void | Promise<void>;\n onSubmitSuccess?: (data: z.infer<T>) => void | Promise<void>;\n onSubmitError?: (error: Error) => void | Promise<void>;\n autoComplete?: boolean;\n };\n\nconst awaitFunction = async (fn: any) => {\n // Check if result is a Promise (Thenable)\n\n if (fn && typeof fn.then === 'function') {\n // It's a Promise, so wait for it to resolve\n await fn;\n }\n // If not a Promise, it will just execute without awaiting\n};\n\nexport const Form = forwardRef(\n <T extends ZodType>(\n {\n schema,\n onSubmit: onSubmitProp,\n onSubmitSuccess: onSubmitSuccessProp,\n onSubmitError: onSubmitErrorProp,\n className,\n children,\n autoComplete,\n ...props\n }: FormProps<T>,\n ref: Ref<HTMLFormElement>\n ) => {\n const onSubmit = async (values: T) => {\n const parsedValues = schema?.safeParse(values) ?? {\n success: true,\n data: undefined,\n };\n\n // onSubmitProp?.(values);\n await awaitFunction(onSubmitProp?.(values));\n\n if (parsedValues.success) {\n await awaitFunction(onSubmitSuccessProp?.(parsedValues.data));\n } else {\n await awaitFunction(\n onSubmitErrorProp?.(\n new Error(\n parsedValues.error.errors.map((error) => error.message).join(', ')\n )\n )\n );\n }\n };\n\n return (\n <FormProvider {...props}>\n <form\n className={cn('flex size-full flex-col gap-y-6', className)}\n onSubmit={props.handleSubmit(onSubmit)}\n autoComplete={autoComplete ? 'on' : 'off'}\n ref={ref}\n >\n {children}\n </form>\n </FormProvider>\n );\n }\n);\n\nForm.displayName = 'Form';\n\nexport const useForm = <T extends ZodType>(\n schema: T,\n props?: UseFormProps<z.infer<T>>\n) => {\n const form = useFormReactHookForm<z.infer<T>>({\n resolver: zodResolver(schema),\n ...props,\n });\n\n const isSubmitting = form.formState.isSubmitting;\n const isSubmitted = form.formState.isSubmitted;\n const isLoading = form.formState.isLoading;\n const isValid = form.formState.isValid;\n\n return {\n form,\n isSubmitting,\n isSubmitted,\n isLoading,\n isValid,\n };\n};\n"],"names":["forwardRef","jsx","FormProvider","cn","useFormReactHookForm","zodResolver"],"mappings":";;;;;;;;AAuBA,MAAM,gBAAgB,OAAO,OAAY;AAGvC,MAAI,MAAM,OAAO,GAAG,SAAS,YAAY;AAEjC,UAAA;AAAA,EACR;AAEF;AAEO,MAAM,OAAOA,WAAA;AAAA,EAClB,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,KAEL,QACG;AACG,UAAA,WAAW,OAAO,WAAc;AACpC,YAAM,eAAe,QAAQ,UAAU,MAAM,KAAK;AAAA,QAChD,SAAS;AAAA,QACT,MAAM;AAAA,MAAA;AAIF,YAAA,cAAc,eAAe,MAAM,CAAC;AAE1C,UAAI,aAAa,SAAS;AACxB,cAAM,cAAc,sBAAsB,aAAa,IAAI,CAAC;AAAA,MAAA,OACvD;AACC,cAAA;AAAA,UACJ;AAAA,YACE,IAAI;AAAA,cACF,aAAa,MAAM,OAAO,IAAI,CAAC,UAAU,MAAM,OAAO,EAAE,KAAK,IAAI;AAAA,YACnE;AAAA,UACF;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAIA,WAAAC,2BAAA,kBAAA,IAACC,cAAc,cAAA,EAAA,GAAG,OAChB,UAAAD,2BAAA,kBAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWE,SAAAA,GAAG,mCAAmC,SAAS;AAAA,QAC1D,UAAU,MAAM,aAAa,QAAQ;AAAA,QACrC,cAAc,eAAe,OAAO;AAAA,QACpC;AAAA,QAEC;AAAA,MAAA;AAAA,IAEL,EAAA,CAAA;AAAA,EAEJ;AACF;AAEA,KAAK,cAAc;AAEN,MAAA,UAAU,CACrB,QACA,UACG;AACH,QAAM,OAAOC,cAAAA,QAAiC;AAAA,IAC5C,UAAUC,MAAY,MAAM;AAAA,IAC5B,GAAG;AAAA,EAAA,CACJ;AAEK,QAAA,eAAe,KAAK,UAAU;AAC9B,QAAA,cAAc,KAAK,UAAU;AAC7B,QAAA,YAAY,KAAK,UAAU;AAC3B,QAAA,UAAU,KAAK,UAAU;AAExB,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;;"}
|