@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.
@@ -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/get_txn_id"
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/get_locale_from_code"
7
+ import {getLocaleFromCode} from "@rpcbase/std"
8
8
 
9
9
  import {RB_DEFAULT_LOCALE, RB_LOCALES} from "env"
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/client",
3
- "version": "0.192.0",
3
+ "version": "0.194.0-mongoosetsindex.0",
4
4
  "scripts": {
5
5
  "build": "../../node_modules/.bin/wireit",
6
6
  "test": "../../node_modules/.bin/wireit"
package/types.ts ADDED
@@ -0,0 +1,6 @@
1
+
2
+ export type NestedKeyOf<ObjectType extends object> =
3
+ {[Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object
4
+ ? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}`
5
+ : `${Key}`
6
+ }[keyof ObjectType & (string | number)];
@@ -13,8 +13,6 @@ const HashStateModal = ({hashPropName, children}) => {
13
13
 
14
14
  const show = !!hashState[hashPropName]
15
15
 
16
- console.log("WOWOOW", show)
17
-
18
16
  if (!show) return null
19
17
 
20
18
  const onHide = () => {
@@ -1,4 +1,4 @@
1
- /* @flow */
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 = ({className = "", id = "btn-submit", ...props}: Props) => (
14
- <button
15
- id={id}
16
- type="submit"
17
- className={cx("submit-button btn btn-primary fw-bold d-flex flex-row align-items-center", className)}
18
- disabled={props.disabled || props.isLoading}
19
- onClick={props.onClick}
20
- >
21
- {props.isLoading && (
22
- <>
23
- <ActivityIndicator style={{marginRight: 6}} color="#FFF" size={15} />
24
-
25
- {props.children}
26
- </>
27
- )}
28
- {!props.isLoading && <>{props.children}</>}
29
- </button>
30
- )
31
-
32
- export default SubmitButton
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
+ }