@faasjs/react 3.7.1 → 4.0.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/index.d.mts CHANGED
@@ -3,7 +3,7 @@ export { FaasAction, FaasData, FaasParams } from '@faasjs/types';
3
3
  import { Response, BaseUrl, ResponseError, Options, FaasBrowserClient } from '@faasjs/browser';
4
4
  export { Options, Response, ResponseError, ResponseHeaders } from '@faasjs/browser';
5
5
  import * as react from 'react';
6
- import { ReactNode, Dispatch, SetStateAction, ReactElement, Component, ComponentType, ComponentProps, JSXElementConstructor } from 'react';
6
+ import { ReactNode, Dispatch, SetStateAction, JSX, ReactElement, Component, ComponentType, ComponentProps, JSXElementConstructor } from 'react';
7
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
8
 
9
9
  /**
@@ -371,7 +371,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
371
371
  static whyDidYouRender: boolean;
372
372
  constructor(props: ErrorBoundaryProps);
373
373
  componentDidCatch(error: Error | null, info: any): void;
374
- render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element;
374
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode>> | react_jsx_runtime.JSX.Element;
375
375
  }
376
376
 
377
377
  type OptionalWrapperProps<TWrapper extends ComponentType<{
@@ -413,7 +413,7 @@ declare const OptionalWrapper: React.FC<OptionalWrapperProps> & {
413
413
  */
414
414
  type FormButtonElementProps = {
415
415
  children?: React.ReactNode;
416
- disabled: boolean;
416
+ submitting?: boolean;
417
417
  submit: () => Promise<void>;
418
418
  };
419
419
 
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { FaasAction, FaasData, FaasParams } from '@faasjs/types';
3
3
  import { Response, BaseUrl, ResponseError, Options, FaasBrowserClient } from '@faasjs/browser';
4
4
  export { Options, Response, ResponseError, ResponseHeaders } from '@faasjs/browser';
5
5
  import * as react from 'react';
6
- import { ReactNode, Dispatch, SetStateAction, ReactElement, Component, ComponentType, ComponentProps, JSXElementConstructor } from 'react';
6
+ import { ReactNode, Dispatch, SetStateAction, JSX, ReactElement, Component, ComponentType, ComponentProps, JSXElementConstructor } from 'react';
7
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
8
 
9
9
  /**
@@ -371,7 +371,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
371
371
  static whyDidYouRender: boolean;
372
372
  constructor(props: ErrorBoundaryProps);
373
373
  componentDidCatch(error: Error | null, info: any): void;
374
- render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element;
374
+ render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode>> | react_jsx_runtime.JSX.Element;
375
375
  }
376
376
 
377
377
  type OptionalWrapperProps<TWrapper extends ComponentType<{
@@ -413,7 +413,7 @@ declare const OptionalWrapper: React.FC<OptionalWrapperProps> & {
413
413
  */
414
414
  type FormButtonElementProps = {
415
415
  children?: React.ReactNode;
416
- disabled: boolean;
416
+ submitting?: boolean;
417
417
  submit: () => Promise<void>;
418
418
  };
419
419
 
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var browser = require('@faasjs/browser');
6
6
 
7
7
  // src/constant.ts
8
8
  function useConstant(fn) {
9
- const ref = react.useRef();
9
+ const ref = react.useRef(null);
10
10
  if (!ref.current) {
11
11
  ref.current = { v: fn() };
12
12
  }
@@ -78,7 +78,7 @@ function useEqualCallback(callback, dependencies) {
78
78
  );
79
79
  }
80
80
  function usePrevious(value) {
81
- const ref = react.useRef();
81
+ const ref = react.useRef(void 0);
82
82
  react.useEffect(() => {
83
83
  ref.current = value;
84
84
  });
@@ -193,7 +193,7 @@ function useFaas(action, defaultParams, options = {}) {
193
193
  const [skip, setSkip] = react.useState(
194
194
  typeof options.skip === "function" ? options.skip(defaultParams) : options.skip
195
195
  );
196
- const promiseRef = react.useRef();
196
+ const promiseRef = react.useRef(null);
197
197
  const controllerRef = react.useRef(null);
198
198
  useEqualEffect(() => {
199
199
  setSkip(
@@ -478,7 +478,7 @@ function FormFooter() {
478
478
  return /* @__PURE__ */ jsxRuntime.jsx(
479
479
  Elements.Button,
480
480
  {
481
- disabled: submitting,
481
+ submitting,
482
482
  submit: async () => {
483
483
  setSubmitting(true);
484
484
  const errors = await validValues(rules, items, values, lang);
@@ -495,11 +495,11 @@ function FormFooter() {
495
495
  }
496
496
  FormFooter.displayName = "FormFooter";
497
497
  FormFooter.whyDidYouRender = true;
498
- var FormButtonElement = react.forwardRef(({ disabled, children, submit, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
498
+ var FormButtonElement = react.forwardRef(({ children, submit, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
499
499
  "button",
500
500
  {
501
501
  type: "button",
502
- disabled,
502
+ disabled: props.submitting,
503
503
  onClick: submit,
504
504
  ...props,
505
505
  ref,
@@ -507,10 +507,10 @@ var FormButtonElement = react.forwardRef(({ disabled, children, submit, ...props
507
507
  }
508
508
  ));
509
509
  FormButtonElement.displayName = "FormButtonElement";
510
- FormButtonElement.whyDidYouRender = true;
510
+ Object.assign(FormButtonElement, { whyDidYouRender: true });
511
511
  var FormInputElement = react.forwardRef(({ onChange, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("input", { ...props, onChange: (e) => onChange(e.target.value), ref }));
512
512
  FormInputElement.displayName = "FormInputElement";
513
- FormInputElement.whyDidYouRender = true;
513
+ Object.assign(FormInputElement, { whyDidYouRender: true });
514
514
  var FormLabelElement = ({
515
515
  name,
516
516
  title,
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { FaasBrowserClient } from '@faasjs/browser';
4
4
 
5
5
  // src/constant.ts
6
6
  function useConstant(fn) {
7
- const ref = useRef();
7
+ const ref = useRef(null);
8
8
  if (!ref.current) {
9
9
  ref.current = { v: fn() };
10
10
  }
@@ -76,7 +76,7 @@ function useEqualCallback(callback, dependencies) {
76
76
  );
77
77
  }
78
78
  function usePrevious(value) {
79
- const ref = useRef();
79
+ const ref = useRef(void 0);
80
80
  useEffect(() => {
81
81
  ref.current = value;
82
82
  });
@@ -191,7 +191,7 @@ function useFaas(action, defaultParams, options = {}) {
191
191
  const [skip, setSkip] = useState(
192
192
  typeof options.skip === "function" ? options.skip(defaultParams) : options.skip
193
193
  );
194
- const promiseRef = useRef();
194
+ const promiseRef = useRef(null);
195
195
  const controllerRef = useRef(null);
196
196
  useEqualEffect(() => {
197
197
  setSkip(
@@ -476,7 +476,7 @@ function FormFooter() {
476
476
  return /* @__PURE__ */ jsx(
477
477
  Elements.Button,
478
478
  {
479
- disabled: submitting,
479
+ submitting,
480
480
  submit: async () => {
481
481
  setSubmitting(true);
482
482
  const errors = await validValues(rules, items, values, lang);
@@ -493,11 +493,11 @@ function FormFooter() {
493
493
  }
494
494
  FormFooter.displayName = "FormFooter";
495
495
  FormFooter.whyDidYouRender = true;
496
- var FormButtonElement = forwardRef(({ disabled, children, submit, ...props }, ref) => /* @__PURE__ */ jsx(
496
+ var FormButtonElement = forwardRef(({ children, submit, ...props }, ref) => /* @__PURE__ */ jsx(
497
497
  "button",
498
498
  {
499
499
  type: "button",
500
- disabled,
500
+ disabled: props.submitting,
501
501
  onClick: submit,
502
502
  ...props,
503
503
  ref,
@@ -505,10 +505,10 @@ var FormButtonElement = forwardRef(({ disabled, children, submit, ...props }, re
505
505
  }
506
506
  ));
507
507
  FormButtonElement.displayName = "FormButtonElement";
508
- FormButtonElement.whyDidYouRender = true;
508
+ Object.assign(FormButtonElement, { whyDidYouRender: true });
509
509
  var FormInputElement = forwardRef(({ onChange, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, onChange: (e) => onChange(e.target.value), ref }));
510
510
  FormInputElement.displayName = "FormInputElement";
511
- FormInputElement.whyDidYouRender = true;
511
+ Object.assign(FormInputElement, { whyDidYouRender: true });
512
512
  var FormLabelElement = ({
513
513
  name,
514
514
  title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/react",
3
- "version": "3.7.1",
3
+ "version": "4.0.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,10 +34,10 @@
34
34
  "dist"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@faasjs/browser": "3.7.1"
37
+ "@faasjs/browser": "4.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@faasjs/browser": "3.7.1",
40
+ "@faasjs/browser": "4.0.0",
41
41
  "@types/react": "*",
42
42
  "react": "*"
43
43
  },