@rpcbase/client 0.192.0 → 0.194.0-mongoosetsindex.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/helpers/postRPC.js +1 -1
- package/i18n/index.js +1 -1
- package/package.json +1 -1
- package/types.ts +6 -0
- package/ui/Modal/HashStateModal.js +0 -2
- package/ui/SubmitButton/index.js +38 -21
package/helpers/postRPC.js
CHANGED
|
@@ -4,7 +4,7 @@ import axios from "axios"
|
|
|
4
4
|
import _get from "lodash/get"
|
|
5
5
|
import _set from "lodash/set"
|
|
6
6
|
|
|
7
|
-
import get_txn_id from "@rpcbase/std
|
|
7
|
+
import {get_txn_id} from "@rpcbase/std"
|
|
8
8
|
|
|
9
9
|
import getBaseUrl from "../getBaseUrl"
|
|
10
10
|
import getTenantId from "../auth/getTenantId"
|
package/i18n/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {initReactI18next} from "react-i18next"
|
|
|
4
4
|
import ChainedBackend from "i18next-chained-backend"
|
|
5
5
|
import resourcesToBackend from "i18next-resources-to-backend"
|
|
6
6
|
|
|
7
|
-
import getLocaleFromCode from "@rpcbase/std
|
|
7
|
+
import {getLocaleFromCode} from "@rpcbase/std"
|
|
8
8
|
|
|
9
9
|
import {RB_DEFAULT_LOCALE, RB_LOCALES} from "env"
|
|
10
10
|
|
package/package.json
CHANGED
package/types.ts
ADDED
package/ui/SubmitButton/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import {useFormContext} from "react-hook-form"
|
|
2
2
|
import ActivityIndicator from "../ActivityIndicator"
|
|
3
3
|
|
|
4
4
|
|
|
@@ -10,23 +10,40 @@ type Props = {
|
|
|
10
10
|
onClick: Function,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const SubmitButton = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
export const SubmitButton = ({
|
|
14
|
+
className = "",
|
|
15
|
+
id = "btn-submit",
|
|
16
|
+
title,
|
|
17
|
+
submittingTitle,
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}: Props) => {
|
|
21
|
+
|
|
22
|
+
const {formState} = useFormContext()
|
|
23
|
+
|
|
24
|
+
const {isSubmitting} = formState
|
|
25
|
+
|
|
26
|
+
const isDisabled = props.disabled || props.isLoading || isSubmitting
|
|
27
|
+
const isLoading = props.isLoading || isSubmitting
|
|
28
|
+
|
|
29
|
+
if (title && children) {
|
|
30
|
+
throw new Error("button cannot have both title and children props")
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<button
|
|
35
|
+
id={id}
|
|
36
|
+
type="submit"
|
|
37
|
+
className={cx("btn btn-primary d-flex flex-row align-items-center align-self-start", className)}
|
|
38
|
+
disabled={isDisabled}
|
|
39
|
+
onClick={props.onClick}
|
|
40
|
+
>
|
|
41
|
+
{isLoading && (
|
|
42
|
+
<ActivityIndicator style={{marginRight: 7}} color="#FFF" size={15} />
|
|
43
|
+
)}
|
|
44
|
+
{title && !isSubmitting && title}
|
|
45
|
+
{submittingTitle && isSubmitting && submittingTitle}
|
|
46
|
+
{children}
|
|
47
|
+
</button>
|
|
48
|
+
)
|
|
49
|
+
}
|