@intlayer/design-system 3.3.5 → 3.4.7
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 +23 -0
- package/dist/components/Auth/AuthModal/index.cjs +4 -4
- package/dist/components/Auth/AuthModal/index.cjs.map +1 -1
- package/dist/components/Auth/AuthModal/index.mjs +4 -4
- package/dist/components/Auth/AuthModal/index.mjs.map +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.cjs.map +1 -1
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.mjs +1 -1
- package/dist/components/Avatar/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +9 -6
- 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 +9 -6
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +3 -2
- 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 +3 -2
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +6 -3
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +6 -3
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.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.d.ts.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 +12 -9
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +12 -9
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +13 -4
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +13 -4
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +7 -4
- 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 +7 -4
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +6 -3
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +6 -3
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +10 -7
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +10 -7
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +6 -3
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +6 -3
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +3 -2
- 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 +3 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/IDE/CodeRender.cjs +2 -0
- package/dist/components/IDE/CodeRender.cjs.map +1 -1
- package/dist/components/IDE/CodeRender.d.ts.map +1 -1
- package/dist/components/IDE/CodeRender.mjs +2 -0
- package/dist/components/IDE/CodeRender.mjs.map +1 -1
- package/dist/components/Input/Checkbox.cjs.map +1 -1
- package/dist/components/Input/Checkbox.d.ts +1 -1
- package/dist/components/Input/Checkbox.d.ts.map +1 -1
- package/dist/components/Input/Checkbox.mjs.map +1 -1
- package/dist/components/Link/Link.cjs +2 -1
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.d.ts.map +1 -1
- package/dist/components/Link/Link.mjs +2 -1
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +1 -1
- package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +3 -3
- package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +3 -3
- package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs +26 -5
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.d.ts +2 -0
- package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs +26 -5
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/RightDrawer/index.cjs +0 -1
- package/dist/components/RightDrawer/index.cjs.map +1 -1
- package/dist/components/RightDrawer/index.mjs +1 -2
- package/dist/components/RightDrawer/useRightDrawerStore.cjs +15 -12
- package/dist/components/RightDrawer/useRightDrawerStore.cjs.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.d.ts +5 -5
- package/dist/components/RightDrawer/useRightDrawerStore.d.ts.map +1 -1
- package/dist/components/RightDrawer/useRightDrawerStore.mjs +15 -12
- package/dist/components/RightDrawer/useRightDrawerStore.mjs.map +1 -1
- package/dist/components/index.cjs +0 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.mjs +1 -2
- package/dist/hooks/useAsync/useAsync.cjs +3 -46
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs +3 -46
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useScrollBlockage/index.cjs +8 -1
- package/dist/hooks/useScrollBlockage/index.cjs.map +1 -1
- package/dist/hooks/useScrollBlockage/index.d.ts.map +1 -1
- package/dist/hooks/useScrollBlockage/index.mjs +8 -1
- package/dist/hooks/useScrollBlockage/index.mjs.map +1 -1
- package/dist/hooks/useScrollBlockage/useScrollBlockageStore.cjs +1 -1
- package/dist/hooks/useScrollBlockage/useScrollBlockageStore.cjs.map +1 -1
- package/dist/hooks/useScrollBlockage/useScrollBlockageStore.mjs +1 -1
- package/dist/hooks/useScrollBlockage/useScrollBlockageStore.mjs.map +1 -1
- package/dist/shallow-lhDIFtEp.cjs +48 -0
- package/dist/shallow-lhDIFtEp.cjs.map +1 -0
- package/dist/shallow-m9BpCkKh.js +49 -0
- package/dist/shallow-m9BpCkKh.js.map +1 -0
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.js +1 -0
- package/package.json +16 -16
package/dist/.vite/manifest.json
CHANGED
|
@@ -75,6 +75,14 @@
|
|
|
75
75
|
"file": "jsx-runtime-XHKiWCTo.cjs",
|
|
76
76
|
"name": "jsx-runtime"
|
|
77
77
|
},
|
|
78
|
+
"_shallow-lhDIFtEp.cjs": {
|
|
79
|
+
"file": "shallow-lhDIFtEp.cjs",
|
|
80
|
+
"name": "shallow"
|
|
81
|
+
},
|
|
82
|
+
"_shallow-m9BpCkKh.js": {
|
|
83
|
+
"file": "shallow-m9BpCkKh.js",
|
|
84
|
+
"name": "shallow"
|
|
85
|
+
},
|
|
78
86
|
"_zod-BV4nCGJE.js": {
|
|
79
87
|
"file": "zod-BV4nCGJE.js",
|
|
80
88
|
"name": "zod"
|
|
@@ -567,6 +575,7 @@
|
|
|
567
575
|
"isEntry": true,
|
|
568
576
|
"imports": [
|
|
569
577
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
578
|
+
"_shallow-lhDIFtEp.cjs",
|
|
570
579
|
"_index-BtZWYJhL.cjs",
|
|
571
580
|
"src/components/DictionaryEditor/useEditedContentStore.ts",
|
|
572
581
|
"src/components/DictionaryEditor/useEditionPanelStore.ts",
|
|
@@ -657,6 +666,7 @@
|
|
|
657
666
|
"isEntry": true,
|
|
658
667
|
"imports": [
|
|
659
668
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
669
|
+
"_shallow-lhDIFtEp.cjs",
|
|
660
670
|
"src/hooks/useScrollBlockage/useScrollBlockageStore.ts",
|
|
661
671
|
"src/hooks/useAsync/useAsyncStateStore.ts",
|
|
662
672
|
"src/hooks/intlayerAPIHooks.ts",
|
|
@@ -713,6 +723,7 @@
|
|
|
713
723
|
"isEntry": true,
|
|
714
724
|
"imports": [
|
|
715
725
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
726
|
+
"_shallow-lhDIFtEp.cjs",
|
|
716
727
|
"src/hooks/useScrollBlockage/useScrollBlockageStore.ts",
|
|
717
728
|
"src/hooks/useAsync/useAsyncStateStore.ts",
|
|
718
729
|
"src/libs/intlayer-api/index.ts",
|
|
@@ -816,6 +827,7 @@
|
|
|
816
827
|
"isEntry": true,
|
|
817
828
|
"imports": [
|
|
818
829
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
830
|
+
"_shallow-lhDIFtEp.cjs",
|
|
819
831
|
"src/components/Button/Button.tsx",
|
|
820
832
|
"src/components/Container/index.tsx",
|
|
821
833
|
"src/components/DictionaryEditor/useEditedContentStore.ts",
|
|
@@ -845,6 +857,7 @@
|
|
|
845
857
|
"isEntry": true,
|
|
846
858
|
"imports": [
|
|
847
859
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
860
|
+
"_shallow-lhDIFtEp.cjs",
|
|
848
861
|
"src/components/EditableField/EditableFieldInput.tsx",
|
|
849
862
|
"src/components/EditableField/EditableFieldTextArea.tsx",
|
|
850
863
|
"src/utils/camelCase.ts",
|
|
@@ -874,6 +887,7 @@
|
|
|
874
887
|
"isEntry": true,
|
|
875
888
|
"imports": [
|
|
876
889
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
890
|
+
"_shallow-lhDIFtEp.cjs",
|
|
877
891
|
"src/utils/dictionary.ts",
|
|
878
892
|
"src/utils/object.ts",
|
|
879
893
|
"src/components/Button/Button.tsx",
|
|
@@ -916,6 +930,7 @@
|
|
|
916
930
|
"isEntry": true,
|
|
917
931
|
"imports": [
|
|
918
932
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
933
|
+
"_shallow-lhDIFtEp.cjs",
|
|
919
934
|
"src/components/ContentEditor/ContentEditorTextArea.tsx",
|
|
920
935
|
"src/components/DictionaryEditor/useEditedContentStore.ts",
|
|
921
936
|
"src/components/DictionaryEditor/useEditionPanelStore.ts",
|
|
@@ -950,6 +965,7 @@
|
|
|
950
965
|
"isEntry": true,
|
|
951
966
|
"imports": [
|
|
952
967
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
968
|
+
"_shallow-lhDIFtEp.cjs",
|
|
953
969
|
"src/utils/camelCase.ts",
|
|
954
970
|
"src/utils/dictionary.ts",
|
|
955
971
|
"src/components/Accordion/Accordion.tsx",
|
|
@@ -983,6 +999,7 @@
|
|
|
983
999
|
"isEntry": true,
|
|
984
1000
|
"imports": [
|
|
985
1001
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
1002
|
+
"_shallow-lhDIFtEp.cjs",
|
|
986
1003
|
"src/components/Container/index.tsx",
|
|
987
1004
|
"src/components/DictionaryEditor/useEditedContentStore.ts",
|
|
988
1005
|
"src/components/DictionaryEditor/useEditionPanelStore.ts",
|
|
@@ -1010,6 +1027,7 @@
|
|
|
1010
1027
|
"isEntry": true,
|
|
1011
1028
|
"imports": [
|
|
1012
1029
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
1030
|
+
"_shallow-lhDIFtEp.cjs",
|
|
1013
1031
|
"src/utils/dictionary.ts",
|
|
1014
1032
|
"src/components/DictionaryEditor/useEditedContentStore.ts",
|
|
1015
1033
|
"src/components/DictionaryEditor/useEditionPanelStore.ts",
|
|
@@ -1036,6 +1054,7 @@
|
|
|
1036
1054
|
"isEntry": true,
|
|
1037
1055
|
"imports": [
|
|
1038
1056
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
1057
|
+
"_shallow-lhDIFtEp.cjs",
|
|
1039
1058
|
"src/hooks/useScrollBlockage/useScrollBlockageStore.ts",
|
|
1040
1059
|
"src/hooks/useAsync/useAsyncStateStore.ts",
|
|
1041
1060
|
"src/hooks/intlayerAPIHooks.ts",
|
|
@@ -1496,6 +1515,7 @@
|
|
|
1496
1515
|
"isEntry": true,
|
|
1497
1516
|
"imports": [
|
|
1498
1517
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
1518
|
+
"src/hooks/useIsMounted.ts",
|
|
1499
1519
|
"src/utils/cn.ts",
|
|
1500
1520
|
"src/components/Loader/index.tsx"
|
|
1501
1521
|
]
|
|
@@ -2007,6 +2027,7 @@
|
|
|
2007
2027
|
"isEntry": true,
|
|
2008
2028
|
"imports": [
|
|
2009
2029
|
"_jsx-runtime-XHKiWCTo.cjs",
|
|
2030
|
+
"_shallow-lhDIFtEp.cjs",
|
|
2010
2031
|
"src/hooks/useDevice.ts",
|
|
2011
2032
|
"src/hooks/useScrollBlockage/index.tsx",
|
|
2012
2033
|
"src/utils/isElementAtTopAndNotCovered.tsx",
|
|
@@ -2364,6 +2385,7 @@
|
|
|
2364
2385
|
"src": "src/hooks/useAsync/useAsync.ts",
|
|
2365
2386
|
"isEntry": true,
|
|
2366
2387
|
"imports": [
|
|
2388
|
+
"_shallow-lhDIFtEp.cjs",
|
|
2367
2389
|
"src/hooks/useAsync/useAsyncStateStore.ts"
|
|
2368
2390
|
]
|
|
2369
2391
|
},
|
|
@@ -2437,6 +2459,7 @@
|
|
|
2437
2459
|
"src": "src/hooks/useScrollBlockage/index.tsx",
|
|
2438
2460
|
"isEntry": true,
|
|
2439
2461
|
"imports": [
|
|
2462
|
+
"_shallow-lhDIFtEp.cjs",
|
|
2440
2463
|
"src/hooks/useGetElementOrWindow.ts",
|
|
2441
2464
|
"src/hooks/useScrollBlockage/useScrollBlockageStore.ts"
|
|
2442
2465
|
]
|
|
@@ -33,7 +33,7 @@ const AuthModal = ({
|
|
|
33
33
|
email,
|
|
34
34
|
password
|
|
35
35
|
}).then(async (response) => {
|
|
36
|
-
if (response
|
|
36
|
+
if (response?.data) {
|
|
37
37
|
await onSignInSuccess?.(response.data);
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -41,12 +41,12 @@ const AuthModal = ({
|
|
|
41
41
|
email,
|
|
42
42
|
password
|
|
43
43
|
}).then(async (response) => {
|
|
44
|
-
if (response
|
|
44
|
+
if (response?.data) {
|
|
45
45
|
await onSignUpSuccess?.(response.data);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
const onSubmitResetPasswordSuccess = async ({ email }) => await askResetPassword(email).then(async (response) => {
|
|
49
|
-
if (response
|
|
49
|
+
if (response?.data) {
|
|
50
50
|
await onResetPasswordSuccess?.(response.data);
|
|
51
51
|
}
|
|
52
52
|
});
|
|
@@ -57,7 +57,7 @@ const AuthModal = ({
|
|
|
57
57
|
oldPassword: currentPassword,
|
|
58
58
|
newPassword
|
|
59
59
|
}).then(async (response) => {
|
|
60
|
-
if (response
|
|
60
|
+
if (response?.data) {
|
|
61
61
|
await onChangePasswordSuccess?.(response.data);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Auth/AuthModal/index.tsx"],"sourcesContent":["'use client';\n\nimport type { UserAPI } from '@intlayer/backend';\nimport { useState, type FC } from 'react';\nimport {\n useAskResetPassword,\n useChangePassword,\n useLogin,\n useRegister,\n} from '../../../hooks';\nimport { Modal } from '../../Modal/Modal';\nimport { type ChangePassword, ChangePasswordForm } from '../ChangePasswordForm';\nimport { type ResetPassword, ResetPasswordForm } from '../ResetPasswordForm';\nimport { type SignIn, SignInForm } from '../SignInForm';\nimport { type SignUp, SignUpForm } from '../SignUpForm';\n\nenum AuthState {\n SignIn,\n SignUp,\n ResetPassword,\n ChangePassword,\n}\n\ntype AuthModalProps = {\n onClose: () => void;\n isOpen: boolean;\n state?: AuthState.SignIn;\n onSignInSuccess?: (data: UserAPI) => Promise<void>;\n onSignUpSuccess?: (data: UserAPI) => Promise<void>;\n onResetPasswordSuccess?: (data: UserAPI) => Promise<void>;\n onChangePasswordSuccess?: (data: UserAPI) => Promise<void>;\n};\n\nexport const AuthModal: FC<AuthModalProps> = ({\n onClose,\n isOpen,\n state: initialState = AuthState.SignIn,\n onSignInSuccess,\n onSignUpSuccess,\n onResetPasswordSuccess,\n onChangePasswordSuccess,\n}) => {\n const [state, setState] = useState<AuthState>(initialState);\n const { login } = useLogin();\n const { register } = useRegister();\n const { askResetPassword } = useAskResetPassword();\n const { changePassword } = useChangePassword();\n\n const onSubmitSignInSuccess = async ({ email, password }: SignIn) =>\n await login({\n email,\n password,\n }).then(async (response) => {\n if (response
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Auth/AuthModal/index.tsx"],"sourcesContent":["'use client';\n\nimport type { UserAPI } from '@intlayer/backend';\nimport { useState, type FC } from 'react';\nimport {\n useAskResetPassword,\n useChangePassword,\n useLogin,\n useRegister,\n} from '../../../hooks';\nimport { Modal } from '../../Modal/Modal';\nimport { type ChangePassword, ChangePasswordForm } from '../ChangePasswordForm';\nimport { type ResetPassword, ResetPasswordForm } from '../ResetPasswordForm';\nimport { type SignIn, SignInForm } from '../SignInForm';\nimport { type SignUp, SignUpForm } from '../SignUpForm';\n\nenum AuthState {\n SignIn,\n SignUp,\n ResetPassword,\n ChangePassword,\n}\n\ntype AuthModalProps = {\n onClose: () => void;\n isOpen: boolean;\n state?: AuthState.SignIn;\n onSignInSuccess?: (data: UserAPI) => Promise<void>;\n onSignUpSuccess?: (data: UserAPI) => Promise<void>;\n onResetPasswordSuccess?: (data: UserAPI) => Promise<void>;\n onChangePasswordSuccess?: (data: UserAPI) => Promise<void>;\n};\n\nexport const AuthModal: FC<AuthModalProps> = ({\n onClose,\n isOpen,\n state: initialState = AuthState.SignIn,\n onSignInSuccess,\n onSignUpSuccess,\n onResetPasswordSuccess,\n onChangePasswordSuccess,\n}) => {\n const [state, setState] = useState<AuthState>(initialState);\n const { login } = useLogin();\n const { register } = useRegister();\n const { askResetPassword } = useAskResetPassword();\n const { changePassword } = useChangePassword();\n\n const onSubmitSignInSuccess = async ({ email, password }: SignIn) =>\n await login({\n email,\n password,\n }).then(async (response) => {\n if (response?.data) {\n await onSignInSuccess?.(response.data);\n }\n });\n\n const onSubmitSignUpSuccess = async ({ email, password }: SignUp) =>\n await register({\n email,\n password,\n }).then(async (response) => {\n if (response?.data) {\n await onSignUpSuccess?.(response.data);\n }\n });\n\n const onSubmitResetPasswordSuccess = async ({ email }: ResetPassword) =>\n await askResetPassword(email).then(async (response) => {\n if (response?.data) {\n await onResetPasswordSuccess?.(response.data);\n }\n });\n\n const onSubmitChangePasswordSuccess = async ({\n currentPassword,\n newPassword,\n }: ChangePassword) =>\n await changePassword({\n oldPassword: currentPassword,\n newPassword,\n }).then(async (response) => {\n if (response?.data) {\n await onChangePasswordSuccess?.(response.data);\n }\n });\n\n return (\n <Modal onClose={onClose} isOpen={isOpen}>\n {state === AuthState.SignIn && (\n <SignInForm\n onSubmitSuccess={onSubmitSignInSuccess}\n onClickForgotPassword={() => setState(AuthState.ResetPassword)}\n onClickSignUp={() => setState(AuthState.SignUp)}\n />\n )}\n {state === AuthState.SignUp && (\n <SignUpForm\n onSubmitSuccess={onSubmitSignUpSuccess}\n onClickBackToSignIn={() => setState(AuthState.SignIn)}\n />\n )}\n {state === AuthState.ResetPassword && (\n <ResetPasswordForm\n onSubmitSuccess={onSubmitResetPasswordSuccess}\n onClickBackToLogin={() => setState(AuthState.SignIn)}\n />\n )}\n {state === AuthState.ChangePassword && (\n <ChangePasswordForm\n onSubmitSuccess={onSubmitChangePasswordSuccess}\n onClickBackToHome={() => setState(AuthState.SignIn)}\n />\n )}\n </Modal>\n );\n};\n"],"names":["useState","useLogin","useRegister","useAskResetPassword","useChangePassword","jsxs","Modal","jsx","SignInForm","SignUpForm","ResetPasswordForm","ChangePasswordForm"],"mappings":";;;;;;;;;;;;;;;;;AAiCO,MAAM,YAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA,OAAO,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAIA,oBAAoB,YAAY;AACpD,QAAA,EAAE,UAAUC,uBAAAA;AACZ,QAAA,EAAE,aAAaC,uBAAAA;AACf,QAAA,EAAE,qBAAqBC,uBAAAA;AACvB,QAAA,EAAE,mBAAmBC,uBAAAA;AAE3B,QAAM,wBAAwB,OAAO,EAAE,OAAO,SAAS,MACrD,MAAM,MAAM;AAAA,IACV;AAAA,IACA;AAAA,EAAA,CACD,EAAE,KAAK,OAAO,aAAa;AAC1B,QAAI,UAAU,MAAM;AACZ,YAAA,kBAAkB,SAAS,IAAI;AAAA,IACvC;AAAA,EAAA,CACD;AAEH,QAAM,wBAAwB,OAAO,EAAE,OAAO,SAAS,MACrD,MAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,EAAA,CACD,EAAE,KAAK,OAAO,aAAa;AAC1B,QAAI,UAAU,MAAM;AACZ,YAAA,kBAAkB,SAAS,IAAI;AAAA,IACvC;AAAA,EAAA,CACD;AAEG,QAAA,+BAA+B,OAAO,EAAE,YAC5C,MAAM,iBAAiB,KAAK,EAAE,KAAK,OAAO,aAAa;AACrD,QAAI,UAAU,MAAM;AACZ,YAAA,yBAAyB,SAAS,IAAI;AAAA,IAC9C;AAAA,EAAA,CACD;AAEH,QAAM,gCAAgC,OAAO;AAAA,IAC3C;AAAA,IACA;AAAA,EACF,MACE,MAAM,eAAe;AAAA,IACnB,aAAa;AAAA,IACb;AAAA,EAAA,CACD,EAAE,KAAK,OAAO,aAAa;AAC1B,QAAI,UAAU,MAAM;AACZ,YAAA,0BAA0B,SAAS,IAAI;AAAA,IAC/C;AAAA,EAAA,CACD;AAGD,SAAAC,2BAAA,kBAAA,KAACC,uBAAM,OAAA,EAAA,SAAkB,QACtB,UAAA;AAAA,IAAA,UAAU,KACTC,2BAAA,kBAAA;AAAA,MAACC,sCAAA;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,uBAAuB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAuB;AAAA,QAC7D,eAAe,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IAChD;AAAA,IAED,UAAU,KACTD,2BAAA,kBAAA;AAAA,MAACE,sCAAA;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,qBAAqB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IACtD;AAAA,IAED,UAAU,KACTF,2BAAA,kBAAA;AAAA,MAACG,oDAAA;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,oBAAoB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IACrD;AAAA,IAED,UAAU,KACTH,2BAAA,kBAAA;AAAA,MAACI,sDAAA;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,mBAAmB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IACpD;AAAA,EAEJ,EAAA,CAAA;AAEJ;;"}
|
|
@@ -31,7 +31,7 @@ const AuthModal = ({
|
|
|
31
31
|
email,
|
|
32
32
|
password
|
|
33
33
|
}).then(async (response) => {
|
|
34
|
-
if (response
|
|
34
|
+
if (response?.data) {
|
|
35
35
|
await onSignInSuccess?.(response.data);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -39,12 +39,12 @@ const AuthModal = ({
|
|
|
39
39
|
email,
|
|
40
40
|
password
|
|
41
41
|
}).then(async (response) => {
|
|
42
|
-
if (response
|
|
42
|
+
if (response?.data) {
|
|
43
43
|
await onSignUpSuccess?.(response.data);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
const onSubmitResetPasswordSuccess = async ({ email }) => await askResetPassword(email).then(async (response) => {
|
|
47
|
-
if (response
|
|
47
|
+
if (response?.data) {
|
|
48
48
|
await onResetPasswordSuccess?.(response.data);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
@@ -55,7 +55,7 @@ const AuthModal = ({
|
|
|
55
55
|
oldPassword: currentPassword,
|
|
56
56
|
newPassword
|
|
57
57
|
}).then(async (response) => {
|
|
58
|
-
if (response
|
|
58
|
+
if (response?.data) {
|
|
59
59
|
await onChangePasswordSuccess?.(response.data);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/components/Auth/AuthModal/index.tsx"],"sourcesContent":["'use client';\n\nimport type { UserAPI } from '@intlayer/backend';\nimport { useState, type FC } from 'react';\nimport {\n useAskResetPassword,\n useChangePassword,\n useLogin,\n useRegister,\n} from '../../../hooks';\nimport { Modal } from '../../Modal/Modal';\nimport { type ChangePassword, ChangePasswordForm } from '../ChangePasswordForm';\nimport { type ResetPassword, ResetPasswordForm } from '../ResetPasswordForm';\nimport { type SignIn, SignInForm } from '../SignInForm';\nimport { type SignUp, SignUpForm } from '../SignUpForm';\n\nenum AuthState {\n SignIn,\n SignUp,\n ResetPassword,\n ChangePassword,\n}\n\ntype AuthModalProps = {\n onClose: () => void;\n isOpen: boolean;\n state?: AuthState.SignIn;\n onSignInSuccess?: (data: UserAPI) => Promise<void>;\n onSignUpSuccess?: (data: UserAPI) => Promise<void>;\n onResetPasswordSuccess?: (data: UserAPI) => Promise<void>;\n onChangePasswordSuccess?: (data: UserAPI) => Promise<void>;\n};\n\nexport const AuthModal: FC<AuthModalProps> = ({\n onClose,\n isOpen,\n state: initialState = AuthState.SignIn,\n onSignInSuccess,\n onSignUpSuccess,\n onResetPasswordSuccess,\n onChangePasswordSuccess,\n}) => {\n const [state, setState] = useState<AuthState>(initialState);\n const { login } = useLogin();\n const { register } = useRegister();\n const { askResetPassword } = useAskResetPassword();\n const { changePassword } = useChangePassword();\n\n const onSubmitSignInSuccess = async ({ email, password }: SignIn) =>\n await login({\n email,\n password,\n }).then(async (response) => {\n if (response
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/components/Auth/AuthModal/index.tsx"],"sourcesContent":["'use client';\n\nimport type { UserAPI } from '@intlayer/backend';\nimport { useState, type FC } from 'react';\nimport {\n useAskResetPassword,\n useChangePassword,\n useLogin,\n useRegister,\n} from '../../../hooks';\nimport { Modal } from '../../Modal/Modal';\nimport { type ChangePassword, ChangePasswordForm } from '../ChangePasswordForm';\nimport { type ResetPassword, ResetPasswordForm } from '../ResetPasswordForm';\nimport { type SignIn, SignInForm } from '../SignInForm';\nimport { type SignUp, SignUpForm } from '../SignUpForm';\n\nenum AuthState {\n SignIn,\n SignUp,\n ResetPassword,\n ChangePassword,\n}\n\ntype AuthModalProps = {\n onClose: () => void;\n isOpen: boolean;\n state?: AuthState.SignIn;\n onSignInSuccess?: (data: UserAPI) => Promise<void>;\n onSignUpSuccess?: (data: UserAPI) => Promise<void>;\n onResetPasswordSuccess?: (data: UserAPI) => Promise<void>;\n onChangePasswordSuccess?: (data: UserAPI) => Promise<void>;\n};\n\nexport const AuthModal: FC<AuthModalProps> = ({\n onClose,\n isOpen,\n state: initialState = AuthState.SignIn,\n onSignInSuccess,\n onSignUpSuccess,\n onResetPasswordSuccess,\n onChangePasswordSuccess,\n}) => {\n const [state, setState] = useState<AuthState>(initialState);\n const { login } = useLogin();\n const { register } = useRegister();\n const { askResetPassword } = useAskResetPassword();\n const { changePassword } = useChangePassword();\n\n const onSubmitSignInSuccess = async ({ email, password }: SignIn) =>\n await login({\n email,\n password,\n }).then(async (response) => {\n if (response?.data) {\n await onSignInSuccess?.(response.data);\n }\n });\n\n const onSubmitSignUpSuccess = async ({ email, password }: SignUp) =>\n await register({\n email,\n password,\n }).then(async (response) => {\n if (response?.data) {\n await onSignUpSuccess?.(response.data);\n }\n });\n\n const onSubmitResetPasswordSuccess = async ({ email }: ResetPassword) =>\n await askResetPassword(email).then(async (response) => {\n if (response?.data) {\n await onResetPasswordSuccess?.(response.data);\n }\n });\n\n const onSubmitChangePasswordSuccess = async ({\n currentPassword,\n newPassword,\n }: ChangePassword) =>\n await changePassword({\n oldPassword: currentPassword,\n newPassword,\n }).then(async (response) => {\n if (response?.data) {\n await onChangePasswordSuccess?.(response.data);\n }\n });\n\n return (\n <Modal onClose={onClose} isOpen={isOpen}>\n {state === AuthState.SignIn && (\n <SignInForm\n onSubmitSuccess={onSubmitSignInSuccess}\n onClickForgotPassword={() => setState(AuthState.ResetPassword)}\n onClickSignUp={() => setState(AuthState.SignUp)}\n />\n )}\n {state === AuthState.SignUp && (\n <SignUpForm\n onSubmitSuccess={onSubmitSignUpSuccess}\n onClickBackToSignIn={() => setState(AuthState.SignIn)}\n />\n )}\n {state === AuthState.ResetPassword && (\n <ResetPasswordForm\n onSubmitSuccess={onSubmitResetPasswordSuccess}\n onClickBackToLogin={() => setState(AuthState.SignIn)}\n />\n )}\n {state === AuthState.ChangePassword && (\n <ChangePasswordForm\n onSubmitSuccess={onSubmitChangePasswordSuccess}\n onClickBackToHome={() => setState(AuthState.SignIn)}\n />\n )}\n </Modal>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;AAiCO,MAAM,YAAgC,CAAC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA,OAAO,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoB,YAAY;AACpD,QAAA,EAAE,UAAU;AACZ,QAAA,EAAE,aAAa;AACf,QAAA,EAAE,qBAAqB;AACvB,QAAA,EAAE,mBAAmB;AAE3B,QAAM,wBAAwB,OAAO,EAAE,OAAO,SAAS,MACrD,MAAM,MAAM;AAAA,IACV;AAAA,IACA;AAAA,EAAA,CACD,EAAE,KAAK,OAAO,aAAa;AAC1B,QAAI,UAAU,MAAM;AACZ,YAAA,kBAAkB,SAAS,IAAI;AAAA,IACvC;AAAA,EAAA,CACD;AAEH,QAAM,wBAAwB,OAAO,EAAE,OAAO,SAAS,MACrD,MAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,EAAA,CACD,EAAE,KAAK,OAAO,aAAa;AAC1B,QAAI,UAAU,MAAM;AACZ,YAAA,kBAAkB,SAAS,IAAI;AAAA,IACvC;AAAA,EAAA,CACD;AAEG,QAAA,+BAA+B,OAAO,EAAE,YAC5C,MAAM,iBAAiB,KAAK,EAAE,KAAK,OAAO,aAAa;AACrD,QAAI,UAAU,MAAM;AACZ,YAAA,yBAAyB,SAAS,IAAI;AAAA,IAC9C;AAAA,EAAA,CACD;AAEH,QAAM,gCAAgC,OAAO;AAAA,IAC3C;AAAA,IACA;AAAA,EACF,MACE,MAAM,eAAe;AAAA,IACnB,aAAa;AAAA,IACb;AAAA,EAAA,CACD,EAAE,KAAK,OAAO,aAAa;AAC1B,QAAI,UAAU,MAAM;AACZ,YAAA,0BAA0B,SAAS,IAAI;AAAA,IAC/C;AAAA,EAAA,CACD;AAGD,SAAAA,kCAAA,KAAC,OAAM,EAAA,SAAkB,QACtB,UAAA;AAAA,IAAA,UAAU,KACTC,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,uBAAuB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAuB;AAAA,QAC7D,eAAe,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IAChD;AAAA,IAED,UAAU,KACTA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,qBAAqB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IACtD;AAAA,IAED,UAAU,KACTA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,oBAAoB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IACrD;AAAA,IAED,UAAU,KACTA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,iBAAiB;AAAA,QACjB,mBAAmB,MAAM;AAAA,UAAS;AAAA;AAAA,QAAgB;AAAA,MAAA;AAAA,IACpD;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
|
@@ -49,7 +49,7 @@ const Avatar = ({
|
|
|
49
49
|
displayInitials && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
50
50
|
"div",
|
|
51
51
|
{
|
|
52
|
-
className: "flex size-full items-center justify-center gap-[0.1rem] text-sm font-bold",
|
|
52
|
+
className: "flex size-full items-center justify-center gap-[0.1rem] text-sm font-bold max-md:py-1",
|
|
53
53
|
"aria-label": "Initials of user's name",
|
|
54
54
|
children: capitals?.map((capital) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("span", { children: capital }, capital))
|
|
55
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Avatar/index.tsx"],"sourcesContent":["import { User } from 'lucide-react';\nimport type { ComponentProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Loader } from '../Loader';\n\nconst getCapitals = (name: string): string[] =>\n name\n .split(' ') // split by space\n .map((word) => word[0]) // get first letter of each word\n .filter(Boolean) // remove empty strings\n .map((char) => char.toUpperCase()); // convert to uppercase\n\nexport type AvatarProps = ComponentProps<'button'> & {\n src?: string;\n fullname?: string;\n isLoading?: boolean;\n isLoggedIn?: boolean;\n};\n\nexport const Avatar: FC<AvatarProps> = ({\n fullname,\n className,\n isLoading,\n isLoggedIn,\n src,\n onClick,\n ...props\n}) => {\n const isImageDefined = Boolean(src);\n const isNameDefined = Boolean((fullname ?? '').length > 0);\n const capitals = fullname ? getCapitals(fullname) : undefined;\n\n const displayLoader = isLoading;\n const displayAvatar =\n isLoggedIn && !displayLoader && !displayLoader && isImageDefined;\n const displayInitials =\n isLoggedIn && !displayLoader && !displayAvatar && isNameDefined;\n const displayUserIcon =\n isLoggedIn && !displayLoader && !displayAvatar && !displayInitials;\n\n const isClickable = onClick !== undefined;\n\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Avatar/index.tsx"],"sourcesContent":["import { User } from 'lucide-react';\nimport type { ComponentProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Loader } from '../Loader';\n\nconst getCapitals = (name: string): string[] =>\n name\n .split(' ') // split by space\n .map((word) => word[0]) // get first letter of each word\n .filter(Boolean) // remove empty strings\n .map((char) => char.toUpperCase()); // convert to uppercase\n\nexport type AvatarProps = ComponentProps<'button'> & {\n src?: string;\n fullname?: string;\n isLoading?: boolean;\n isLoggedIn?: boolean;\n};\n\nexport const Avatar: FC<AvatarProps> = ({\n fullname,\n className,\n isLoading,\n isLoggedIn,\n src,\n onClick,\n ...props\n}) => {\n const isImageDefined = Boolean(src);\n const isNameDefined = Boolean((fullname ?? '').length > 0);\n const capitals = fullname ? getCapitals(fullname) : undefined;\n\n const displayLoader = isLoading;\n const displayAvatar =\n isLoggedIn && !displayLoader && !displayLoader && isImageDefined;\n const displayInitials =\n isLoggedIn && !displayLoader && !displayAvatar && isNameDefined;\n const displayUserIcon =\n isLoggedIn && !displayLoader && !displayAvatar && !displayInitials;\n\n const isClickable = onClick !== undefined;\n\n const Container = (props: HTMLAttributes<HTMLElement>) =>\n isClickable ? <button {...props} /> : <div {...props} />;\n\n return (\n <Container\n className={cn(\n `border-text dark:border-text-dark size-9 rounded-full border-[1.5px] p-[1.5px]`,\n isClickable && `cursor-pointer`,\n className\n )}\n onClick={onClick}\n {...props}\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n <div className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text absolute left-0 top-0 flex size-full flex-col items-center justify-center rounded-full\">\n {displayLoader && <Loader className=\"w-3/4\" />}\n {displayAvatar && (\n <img\n className=\"size-full rounded-full\"\n src={src}\n srcSet={src}\n alt={`avatar of ${fullname}`}\n width={59}\n height={59}\n />\n )}\n {displayInitials && (\n <div\n className=\"flex size-full items-center justify-center gap-[0.1rem] text-sm font-bold max-md:py-1\"\n aria-label=\"Initials of user's name\"\n >\n {capitals?.map((capital) => <span key={capital}>{capital}</span>)}\n </div>\n )}\n {displayUserIcon && <User size={25} />}\n </div>\n </div>\n </Container>\n );\n};\n"],"names":["props","jsx","cn","jsxs","Loader","User"],"mappings":";;;;;;AAKA,MAAM,cAAc,CAAC,SACnB,KACG,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EACrB,OAAO,OAAO,EACd,IAAI,CAAC,SAAS,KAAK,YAAA,CAAa;AAS9B,MAAM,SAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,iBAAiB,QAAQ,GAAG;AAClC,QAAM,gBAAgB,SAAS,YAAY,IAAI,SAAS,CAAC;AACzD,QAAM,WAAW,WAAW,YAAY,QAAQ,IAAI;AAEpD,QAAM,gBAAgB;AACtB,QAAM,gBACJ,cAAc,CAAC,iBAAiB,CAAC,iBAAiB;AACpD,QAAM,kBACJ,cAAc,CAAC,iBAAiB,CAAC,iBAAiB;AACpD,QAAM,kBACJ,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;AAErD,QAAM,cAAc,YAAY;AAEhC,QAAM,YAAY,CAACA,WACjB,cAAeC,2BAAAA,kBAAAA,IAAA,UAAA,EAAQ,GAAGD,OAAO,CAAA,IAAKC,2BAAAA,kBAAAA,IAAC,OAAK,EAAA,GAAGD,OAAO,CAAA;AAGtD,SAAAC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACA,eAAe;AAAA,QACf;AAAA,MACF;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEJ,2DAAC,OAAI,EAAA,WAAU,gEACb,UAACC,2BAAAA,kBAAAA,KAAA,OAAA,EAAI,WAAU,kJACZ,UAAA;AAAA,QAAiB,iBAAAF,2BAAAA,kBAAAA,IAACG,wBAAAA,QAAO,EAAA,WAAU,QAAQ,CAAA;AAAA,QAC3C,iBACCH,2BAAA,kBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV;AAAA,YACA,QAAQ;AAAA,YACR,KAAK,aAAa,QAAQ;AAAA,YAC1B,OAAO;AAAA,YACP,QAAQ;AAAA,UAAA;AAAA,QACV;AAAA,QAED,mBACCA,2BAAA,kBAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,cAAW;AAAA,YAEV,UAAA,UAAU,IAAI,CAAC,6DAAa,QAAoB,EAAA,UAAA,QAAA,GAAV,OAAkB,CAAO;AAAA,UAAA;AAAA,QAClE;AAAA,QAED,mBAAmBA,2BAAAA,kBAAAA,IAACI,YAAAA,MAAK,EAAA,MAAM,GAAI,CAAA;AAAA,MAAA,EAAA,CACtC,EACF,CAAA;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAkB,MAAM,OAAO,CAAC;AAWhE,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Avatar/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,EAAE,EAAkB,MAAM,OAAO,CAAC;AAWhE,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CA8DlC,CAAC"}
|
|
@@ -47,7 +47,7 @@ const Avatar = ({
|
|
|
47
47
|
displayInitials && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
|
-
className: "flex size-full items-center justify-center gap-[0.1rem] text-sm font-bold",
|
|
50
|
+
className: "flex size-full items-center justify-center gap-[0.1rem] text-sm font-bold max-md:py-1",
|
|
51
51
|
"aria-label": "Initials of user's name",
|
|
52
52
|
children: capitals?.map((capital) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capital }, capital))
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/components/Avatar/index.tsx"],"sourcesContent":["import { User } from 'lucide-react';\nimport type { ComponentProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Loader } from '../Loader';\n\nconst getCapitals = (name: string): string[] =>\n name\n .split(' ') // split by space\n .map((word) => word[0]) // get first letter of each word\n .filter(Boolean) // remove empty strings\n .map((char) => char.toUpperCase()); // convert to uppercase\n\nexport type AvatarProps = ComponentProps<'button'> & {\n src?: string;\n fullname?: string;\n isLoading?: boolean;\n isLoggedIn?: boolean;\n};\n\nexport const Avatar: FC<AvatarProps> = ({\n fullname,\n className,\n isLoading,\n isLoggedIn,\n src,\n onClick,\n ...props\n}) => {\n const isImageDefined = Boolean(src);\n const isNameDefined = Boolean((fullname ?? '').length > 0);\n const capitals = fullname ? getCapitals(fullname) : undefined;\n\n const displayLoader = isLoading;\n const displayAvatar =\n isLoggedIn && !displayLoader && !displayLoader && isImageDefined;\n const displayInitials =\n isLoggedIn && !displayLoader && !displayAvatar && isNameDefined;\n const displayUserIcon =\n isLoggedIn && !displayLoader && !displayAvatar && !displayInitials;\n\n const isClickable = onClick !== undefined;\n\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/components/Avatar/index.tsx"],"sourcesContent":["import { User } from 'lucide-react';\nimport type { ComponentProps, FC, HTMLAttributes } from 'react';\nimport { cn } from '../../utils/cn';\nimport { Loader } from '../Loader';\n\nconst getCapitals = (name: string): string[] =>\n name\n .split(' ') // split by space\n .map((word) => word[0]) // get first letter of each word\n .filter(Boolean) // remove empty strings\n .map((char) => char.toUpperCase()); // convert to uppercase\n\nexport type AvatarProps = ComponentProps<'button'> & {\n src?: string;\n fullname?: string;\n isLoading?: boolean;\n isLoggedIn?: boolean;\n};\n\nexport const Avatar: FC<AvatarProps> = ({\n fullname,\n className,\n isLoading,\n isLoggedIn,\n src,\n onClick,\n ...props\n}) => {\n const isImageDefined = Boolean(src);\n const isNameDefined = Boolean((fullname ?? '').length > 0);\n const capitals = fullname ? getCapitals(fullname) : undefined;\n\n const displayLoader = isLoading;\n const displayAvatar =\n isLoggedIn && !displayLoader && !displayLoader && isImageDefined;\n const displayInitials =\n isLoggedIn && !displayLoader && !displayAvatar && isNameDefined;\n const displayUserIcon =\n isLoggedIn && !displayLoader && !displayAvatar && !displayInitials;\n\n const isClickable = onClick !== undefined;\n\n const Container = (props: HTMLAttributes<HTMLElement>) =>\n isClickable ? <button {...props} /> : <div {...props} />;\n\n return (\n <Container\n className={cn(\n `border-text dark:border-text-dark size-9 rounded-full border-[1.5px] p-[1.5px]`,\n isClickable && `cursor-pointer`,\n className\n )}\n onClick={onClick}\n {...props}\n >\n <div className=\"relative flex size-full flex-row items-center justify-center\">\n <div className=\"bg-text text-text-dark dark:bg-text-dark dark:text-text absolute left-0 top-0 flex size-full flex-col items-center justify-center rounded-full\">\n {displayLoader && <Loader className=\"w-3/4\" />}\n {displayAvatar && (\n <img\n className=\"size-full rounded-full\"\n src={src}\n srcSet={src}\n alt={`avatar of ${fullname}`}\n width={59}\n height={59}\n />\n )}\n {displayInitials && (\n <div\n className=\"flex size-full items-center justify-center gap-[0.1rem] text-sm font-bold max-md:py-1\"\n aria-label=\"Initials of user's name\"\n >\n {capitals?.map((capital) => <span key={capital}>{capital}</span>)}\n </div>\n )}\n {displayUserIcon && <User size={25} />}\n </div>\n </div>\n </Container>\n );\n};\n"],"names":["props","jsx","jsxs"],"mappings":";;;;AAKA,MAAM,cAAc,CAAC,SACnB,KACG,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EACrB,OAAO,OAAO,EACd,IAAI,CAAC,SAAS,KAAK,YAAA,CAAa;AAS9B,MAAM,SAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,iBAAiB,QAAQ,GAAG;AAClC,QAAM,gBAAgB,SAAS,YAAY,IAAI,SAAS,CAAC;AACzD,QAAM,WAAW,WAAW,YAAY,QAAQ,IAAI;AAEpD,QAAM,gBAAgB;AACtB,QAAM,gBACJ,cAAc,CAAC,iBAAiB,CAAC,iBAAiB;AACpD,QAAM,kBACJ,cAAc,CAAC,iBAAiB,CAAC,iBAAiB;AACpD,QAAM,kBACJ,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;AAErD,QAAM,cAAc,YAAY;AAEhC,QAAM,YAAY,CAACA,WACjB,cAAeC,kCAAAA,IAAA,UAAA,EAAQ,GAAGD,OAAO,CAAA,IAAKC,kCAAAA,IAAC,OAAK,EAAA,GAAGD,OAAO,CAAA;AAGtD,SAAAC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,eAAe;AAAA,QACf;AAAA,MACF;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEJ,gDAAC,OAAI,EAAA,WAAU,gEACb,UAACC,kCAAAA,KAAA,OAAA,EAAI,WAAU,kJACZ,UAAA;AAAA,QAAiB,iBAAAD,kCAAAA,IAAC,QAAO,EAAA,WAAU,QAAQ,CAAA;AAAA,QAC3C,iBACCA,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV;AAAA,YACA,QAAQ;AAAA,YACR,KAAK,aAAa,QAAQ;AAAA,YAC1B,OAAO;AAAA,YACP,QAAQ;AAAA,UAAA;AAAA,QACV;AAAA,QAED,mBACCA,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,cAAW;AAAA,YAEV,UAAA,UAAU,IAAI,CAAC,kDAAa,QAAoB,EAAA,UAAA,QAAA,GAAV,OAAkB,CAAO;AAAA,UAAA;AAAA,QAClE;AAAA,QAED,mBAAmBA,kCAAAA,IAAC,MAAK,EAAA,MAAM,GAAI,CAAA;AAAA,MAAA,EAAA,CACtC,EACF,CAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("../../jsx-runtime-XHKiWCTo.cjs");
|
|
5
5
|
const require$$0 = require("react");
|
|
6
|
+
const shallow = require("../../shallow-lhDIFtEp.cjs");
|
|
6
7
|
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../index-BtZWYJhL.cjs");
|
|
7
8
|
const components_DictionaryEditor_useEditedContentStore = require("./useEditedContentStore.cjs");
|
|
8
9
|
const components_DictionaryEditor_useEditionPanelStore = require("./useEditionPanelStore.cjs");
|
|
@@ -11,15 +12,17 @@ const DictionaryEditor = ({
|
|
|
11
12
|
dictionary,
|
|
12
13
|
...props
|
|
13
14
|
}) => {
|
|
14
|
-
const { addEditedContent, editedContent } = components_DictionaryEditor_useEditedContentStore.useEditedContentStore(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const { addEditedContent, editedContent } = components_DictionaryEditor_useEditedContentStore.useEditedContentStore(
|
|
16
|
+
shallow.useShallow((s) => ({
|
|
17
|
+
addEditedContent: s.addEditedContent,
|
|
18
|
+
editedContent: s.editedContent
|
|
19
|
+
}))
|
|
20
|
+
);
|
|
18
21
|
const { focusedContent, setFocusedContentKeyPath } = components_DictionaryEditor_useEditionPanelStore.useEditionPanelStore(
|
|
19
|
-
(s) => ({
|
|
22
|
+
shallow.useShallow((s) => ({
|
|
20
23
|
focusedContent: s.focusedContent,
|
|
21
24
|
setFocusedContentKeyPath: s.setFocusedContentKeyPath
|
|
22
|
-
})
|
|
25
|
+
}))
|
|
23
26
|
);
|
|
24
27
|
const focusedKeyPath = focusedContent?.keyPath;
|
|
25
28
|
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col justify-between gap-2", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.cjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport type { FC } from 'react';\nimport { NodeWrapper } from './NodeWrapper';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { useEditionPanelStore } from './useEditionPanelStore';\nimport { ValidDictionaryChangeButtons } from './ValidDictionaryChangeButtons';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n onClickEdit?: (keyPath: KeyPath[]) => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n ...props\n}) => {\n const { addEditedContent, editedContent } = useEditedContentStore((s) => ({\n
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.cjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport type { FC } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { NodeWrapper } from './NodeWrapper';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { useEditionPanelStore } from './useEditionPanelStore';\nimport { ValidDictionaryChangeButtons } from './ValidDictionaryChangeButtons';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n onClickEdit?: (keyPath: KeyPath[]) => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n ...props\n}) => {\n const { addEditedContent, editedContent } = useEditedContentStore(\n useShallow((s) => ({\n addEditedContent: s.addEditedContent,\n editedContent: s.editedContent,\n }))\n );\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n }))\n );\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex h-full flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n key={JSON.stringify(\n (editedContent[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <ValidDictionaryChangeButtons dictionary={dictionary} />\n </div>\n );\n};\n"],"names":["useEditedContentStore","useShallow","useEditionPanelStore","jsxs","jsx","createElement","NodeWrapper","ValidDictionaryChangeButtons"],"mappings":";;;;;;;;;;AAiBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,EAAE,kBAAkB,cAAA,IAAkBA,kDAAA;AAAA,IAC1CC,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,kBAAkB,EAAE;AAAA,MACpB,eAAe,EAAE;AAAA,IAAA,EACjB;AAAA,EAAA;AAEE,QAAA,EAAE,gBAAgB,yBAAA,IAA6BC,iDAAA;AAAA,IACnDD,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,0BAA0B,EAAE;AAAA,IAAA,EAC5B;AAAA,EAAA;AAGJ,QAAM,iBAAiB,gBAAgB;AAGrC,SAAAE,2BAAA,kBAAA,KAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAAC,iDAAC,OACC,EAAA,UAAAC,2BAAA;AAAA,MAACC,qDAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV,KAAK,KAAK;AAAA,WACP,cAAc,WAAW,GAAG,KAAK,YAAY;AAAA,QAChD;AAAA,QACA,eAAe,cAAc,WAAW,GAAG,GAAG;AAAA,QAC9C;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACAF,iDAACG,yDAAAA,gCAA6B,YAAwB;AAAA,EACxD,EAAA,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAwCtD,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as jsxRuntimeExports } from "../../jsx-runtime-DaNGiM0W.js";
|
|
3
3
|
import { createElement } from "react";
|
|
4
|
+
import { u as useShallow } from "../../shallow-m9BpCkKh.js";
|
|
4
5
|
import { N as NodeWrapper } from "../../index-D9oaKvKC.js";
|
|
5
6
|
import { useEditedContentStore } from "./useEditedContentStore.mjs";
|
|
6
7
|
import { useEditionPanelStore } from "./useEditionPanelStore.mjs";
|
|
@@ -9,15 +10,17 @@ const DictionaryEditor = ({
|
|
|
9
10
|
dictionary,
|
|
10
11
|
...props
|
|
11
12
|
}) => {
|
|
12
|
-
const { addEditedContent, editedContent } = useEditedContentStore(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const { addEditedContent, editedContent } = useEditedContentStore(
|
|
14
|
+
useShallow((s) => ({
|
|
15
|
+
addEditedContent: s.addEditedContent,
|
|
16
|
+
editedContent: s.editedContent
|
|
17
|
+
}))
|
|
18
|
+
);
|
|
16
19
|
const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(
|
|
17
|
-
(s) => ({
|
|
20
|
+
useShallow((s) => ({
|
|
18
21
|
focusedContent: s.focusedContent,
|
|
19
22
|
setFocusedContentKeyPath: s.setFocusedContentKeyPath
|
|
20
|
-
})
|
|
23
|
+
}))
|
|
21
24
|
);
|
|
22
25
|
const focusedKeyPath = focusedContent?.keyPath;
|
|
23
26
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col justify-between gap-2", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditor.mjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport type { FC } from 'react';\nimport { NodeWrapper } from './NodeWrapper';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { useEditionPanelStore } from './useEditionPanelStore';\nimport { ValidDictionaryChangeButtons } from './ValidDictionaryChangeButtons';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n onClickEdit?: (keyPath: KeyPath[]) => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n ...props\n}) => {\n const { addEditedContent, editedContent } = useEditedContentStore((s) => ({\n
|
|
1
|
+
{"version":3,"file":"DictionaryEditor.mjs","sources":["../../../src/components/DictionaryEditor/DictionaryEditor.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport type { FC } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { NodeWrapper } from './NodeWrapper';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { useEditionPanelStore } from './useEditionPanelStore';\nimport { ValidDictionaryChangeButtons } from './ValidDictionaryChangeButtons';\n\ntype DictionaryEditorProps = {\n dictionary: Dictionary;\n locale: Locales;\n onClickEdit?: (keyPath: KeyPath[]) => void;\n};\n\nexport const DictionaryEditor: FC<DictionaryEditorProps> = ({\n dictionary,\n ...props\n}) => {\n const { addEditedContent, editedContent } = useEditedContentStore(\n useShallow((s) => ({\n addEditedContent: s.addEditedContent,\n editedContent: s.editedContent,\n }))\n );\n const { focusedContent, setFocusedContentKeyPath } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContentKeyPath: s.setFocusedContentKeyPath,\n }))\n );\n\n const focusedKeyPath = focusedContent?.keyPath;\n\n return (\n <div className=\"flex h-full flex-col justify-between gap-2\">\n <div>\n <NodeWrapper\n {...props}\n keyPath={[]}\n key={JSON.stringify(\n (editedContent[dictionary.key] ?? dictionary).content\n )}\n editedContent={editedContent[dictionary.key]?.content}\n focusedKeyPath={focusedKeyPath}\n section={dictionary.content}\n onContentChange={(content) => {\n addEditedContent(dictionary.key, content.newValue, content.keyPath);\n }}\n onFocusKeyPath={setFocusedContentKeyPath}\n />\n </div>\n <ValidDictionaryChangeButtons dictionary={dictionary} />\n </div>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;AAiBO,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA,GAAG;AACL,MAAM;AACE,QAAA,EAAE,kBAAkB,cAAA,IAAkB;AAAA,IAC1C,WAAW,CAAC,OAAO;AAAA,MACjB,kBAAkB,EAAE;AAAA,MACpB,eAAe,EAAE;AAAA,IAAA,EACjB;AAAA,EAAA;AAEE,QAAA,EAAE,gBAAgB,yBAAA,IAA6B;AAAA,IACnD,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,0BAA0B,EAAE;AAAA,IAAA,EAC5B;AAAA,EAAA;AAGJ,QAAM,iBAAiB,gBAAgB;AAGrC,SAAAA,kCAAA,KAAC,OAAI,EAAA,WAAU,8CACb,UAAA;AAAA,IAAAC,sCAAC,OACC,EAAA,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,SAAS,CAAC;AAAA,QACV,KAAK,KAAK;AAAA,WACP,cAAc,WAAW,GAAG,KAAK,YAAY;AAAA,QAChD;AAAA,QACA,eAAe,cAAc,WAAW,GAAG,GAAG;AAAA,QAC9C;AAAA,QACA,SAAS,WAAW;AAAA,QACpB,iBAAiB,CAAC,YAAY;AAC5B,2BAAiB,WAAW,KAAK,QAAQ,UAAU,QAAQ,OAAO;AAAA,QACpE;AAAA,QACA,gBAAgB;AAAA,MAAA;AAAA,IAAA,GAEpB;AAAA,IACAA,sCAAC,gCAA6B,YAAwB;AAAA,EACxD,EAAA,CAAA;AAEJ;"}
|
|
@@ -5,6 +5,7 @@ const jsxRuntime = require("../../jsx-runtime-XHKiWCTo.cjs");
|
|
|
5
5
|
const lucideReact = require("lucide-react");
|
|
6
6
|
const require$$0 = require("react");
|
|
7
7
|
const reactIntlayer = require("react-intlayer");
|
|
8
|
+
const shallow = require("../../shallow-lhDIFtEp.cjs");
|
|
8
9
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
9
10
|
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
10
11
|
const hooks_intlayerAPIHooks = require("../../hooks/intlayerAPIHooks.cjs");
|
|
@@ -23,10 +24,10 @@ const ValidDictionaryChangeButtons = ({ dictionary }) => {
|
|
|
23
24
|
);
|
|
24
25
|
const { pushDictionaries } = hooks_intlayerAPIHooks.usePushDictionaries();
|
|
25
26
|
const { editedContent, restoreEditedContent } = components_DictionaryEditor_useEditedContentStore.useEditedContentStore(
|
|
26
|
-
(s) => ({
|
|
27
|
+
shallow.useShallow((s) => ({
|
|
27
28
|
editedContent: s.editedContent,
|
|
28
29
|
restoreEditedContent: s.restoreEditedContent
|
|
29
|
-
})
|
|
30
|
+
}))
|
|
30
31
|
);
|
|
31
32
|
const { form, isSubmitting } = components_Form_FormBase.useForm(
|
|
32
33
|
ValidDictionaryChangeButtonsSchemaSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n (s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n })\n );\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\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 <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\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 isFullWidth\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 isFullWidth\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 isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContentStore","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n }))\n );\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\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 <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\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 isFullWidth\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 isFullWidth\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 isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContentStore","useShallow","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJA,+DAAAA;AAEF,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IACjDC,iEAAA;AAAA,EAAA;AAGI,QAAA,EAAE,qBAAqBC,uBAAAA;AAEvB,QAAA,EAAE,eAAe,qBAAA,IAAyBC,kDAAA;AAAA,IAC9CC,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,eAAe,EAAE;AAAA,MACjB,sBAAsB,EAAE;AAAA,IAAA,EACxB;AAAA,EAAA;AAEE,QAAA,EAAE,MAAM,aAAA,IAAiBC,yBAAA;AAAA,IAC7B;AAAA,EAAA;AAGF,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAAA;AAGhC,QAAM,WAAWA,WAAA;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAAA;AAG/B,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,2BAAAA,kBAAAA,IAAC,OAAI,EAAA,WAAU,QACb,UAAAC,2BAAA,kBAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAF,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY,MAAM;AAAA,YACzB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAMC,YAAA;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCH,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc,MAAM;AAAA,YAC3B,UAAU,CAAC,YAAY;AAAA,YACvB,MAAME,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEJ,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW,MAAM;AAAA,YACxB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMG,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR,EAAA,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AASzC,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,iCAAiC,CAsGlC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { j as jsxRuntimeExports } from "../../jsx-runtime-DaNGiM0W.js";
|
|
|
3
3
|
import { RotateCcw, ArrowUpFromLine, Save } from "lucide-react";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { useDictionary } from "react-intlayer";
|
|
6
|
+
import { u as useShallow } from "../../shallow-m9BpCkKh.js";
|
|
6
7
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
7
8
|
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
8
9
|
import { usePushDictionaries } from "../../hooks/intlayerAPIHooks.mjs";
|
|
@@ -21,10 +22,10 @@ const ValidDictionaryChangeButtons = ({ dictionary }) => {
|
|
|
21
22
|
);
|
|
22
23
|
const { pushDictionaries } = usePushDictionaries();
|
|
23
24
|
const { editedContent, restoreEditedContent } = useEditedContentStore(
|
|
24
|
-
(s) => ({
|
|
25
|
+
useShallow((s) => ({
|
|
25
26
|
editedContent: s.editedContent,
|
|
26
27
|
restoreEditedContent: s.restoreEditedContent
|
|
27
|
-
})
|
|
28
|
+
}))
|
|
28
29
|
);
|
|
29
30
|
const { form, isSubmitting } = useForm(
|
|
30
31
|
ValidDictionaryChangeButtonsSchemaSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n (s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n })\n );\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\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 <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\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 isFullWidth\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 isFullWidth\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 isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["jsx","jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { useEditedContentStore } from './useEditedContentStore';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContentStore(\n useShallow((s) => ({\n editedContent: s.editedContent,\n restoreEditedContent: s.restoreEditedContent,\n }))\n );\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\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 <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\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 isFullWidth\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 isFullWidth\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 isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJ;AAEF,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAA;AAAA,IACjD;AAAA,EAAA;AAGI,QAAA,EAAE,qBAAqB;AAEvB,QAAA,EAAE,eAAe,qBAAA,IAAyB;AAAA,IAC9C,WAAW,CAAC,OAAO;AAAA,MACjB,eAAe,EAAE;AAAA,MACjB,sBAAsB,EAAE;AAAA,IAAA,EACxB;AAAA,EAAA;AAEE,QAAA,EAAE,MAAM,aAAA,IAAiB;AAAA,IAC7B;AAAA,EAAA;AAGF,QAAM,mBAAmB;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAAA;AAGhC,QAAM,WAAW;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAAA;AAG/B,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,kCAAAA,IAAC,OAAI,EAAA,WAAU,QACb,UAAAC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAD,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,aAAW;AAAA,YACX,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,aAAW;AAAA,YACX,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,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QACd;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR,EAAA,CAAA;AAEJ;"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("../../../jsx-runtime-XHKiWCTo.cjs");
|
|
5
5
|
const require$$0 = require("react");
|
|
6
6
|
const reactIntlayer = require("react-intlayer");
|
|
7
|
+
const shallow = require("../../../shallow-lhDIFtEp.cjs");
|
|
7
8
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
8
9
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
9
10
|
require("../../../libs/intlayer-api/index.cjs");
|
|
@@ -31,9 +32,11 @@ const DictionariesSelector = ({
|
|
|
31
32
|
onClickDictionaryList
|
|
32
33
|
}) => {
|
|
33
34
|
const { online, locale, isLoading } = hooks_useGetAllDictionaries.useGetAllDictionaries();
|
|
34
|
-
const { focusedContent } = components_DictionaryEditor_useEditionPanelStore.useEditionPanelStore(
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const { focusedContent } = components_DictionaryEditor_useEditionPanelStore.useEditionPanelStore(
|
|
36
|
+
shallow.useShallow((s) => ({
|
|
37
|
+
focusedContent: s.focusedContent
|
|
38
|
+
}))
|
|
39
|
+
);
|
|
37
40
|
const { noDictionaryMessage, dictionaryNotFoundMessage } = reactIntlayer.useDictionary(
|
|
38
41
|
components_DictionaryFieldEditor_DictionariesSelector_dictionariesSelector_content.dictionariesSelectorContent
|
|
39
42
|
);
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { useEditionPanelStore } from '../../DictionaryEditor';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useEditionPanelStore((s) => ({\n
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { useEditionPanelStore } from '../../DictionaryEditor';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n }))\n );\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryId\n ? (online?.[focusedContent?.dictionaryId] ??\n locale?.[focusedContent?.dictionaryId])\n : null,\n [online, locale, focusedContent?.dictionaryId]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryId) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n );\n};\n"],"names":["useGetAllDictionaries","useEditionPanelStore","useShallow","useDictionary","dictionariesSelectorContent","useMemo","jsx","Loader","DictionaryFieldEditor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,cAAcA,4BAAsB,sBAAA;AACtD,QAAA,EAAE,mBAAmBC,iDAAA;AAAA,IACzBC,QAAA,WAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAEE,QAAA,EAAE,qBAAqB,0BAAA,IAA8BC,cAAA;AAAA,IACzDC,mFAAA;AAAA,EAAA;AAEF,QAAM,aAAaC,WAAA;AAAA,IACjB,MACE,gBAAgB,eACX,SAAS,gBAAgB,YAAY,KACtC,SAAS,gBAAgB,YAAY,IACrC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,YAAY;AAAA,EAAA;AAG3C,MAAA,UAAkB,QAAAC,2BAAAA,kBAAAA,IAACC,wBAAO,QAAA,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,aAAqB,QAAA;AAEtC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAD,2BAAA,kBAAA;AAAA,IAACE,uDAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAUzC,KAAK,yBAAyB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAiC9D,CAAC"}
|