@faasjs/react 3.7.0-beta.1 → 3.7.0-beta.3
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/README.md +3 -0
- package/dist/index.d.mts +19 -10
- package/dist/index.d.ts +19 -10
- package/dist/index.js +31 -2
- package/dist/index.mjs +31 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -78,8 +78,11 @@ npm install @faasjs/react
|
|
|
78
78
|
- [FaasParams](type-aliases/FaasParams.md)
|
|
79
79
|
- [FaasReactClientInstance](type-aliases/FaasReactClientInstance.md)
|
|
80
80
|
- [FaasReactClientOptions](type-aliases/FaasReactClientOptions.md)
|
|
81
|
+
- [FormButtonElementProps](type-aliases/FormButtonElementProps.md)
|
|
81
82
|
- [FormContextProps](type-aliases/FormContextProps.md)
|
|
82
83
|
- [FormElementTypes](type-aliases/FormElementTypes.md)
|
|
84
|
+
- [FormInputElementProps](type-aliases/FormInputElementProps.md)
|
|
85
|
+
- [FormLabelElementProps](type-aliases/FormLabelElementProps.md)
|
|
83
86
|
- [FormProps](type-aliases/FormProps.md)
|
|
84
87
|
- [OnError](type-aliases/OnError.md)
|
|
85
88
|
- [OptionalWrapperProps](type-aliases/OptionalWrapperProps.md)
|
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 } from 'react';
|
|
6
|
+
import { ReactNode, Dispatch, SetStateAction, ReactElement, Component, ComponentType, ComponentProps, JSXElementConstructor } from 'react';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -212,6 +212,7 @@ type FaasDataWrapperProps<PathOrData extends FaasAction> = {
|
|
|
212
212
|
};
|
|
213
213
|
declare function FaasDataWrapper<PathOrData extends FaasAction>(props: FaasDataWrapperProps<PathOrData>): JSX.Element;
|
|
214
214
|
declare namespace FaasDataWrapper {
|
|
215
|
+
var displayName: string;
|
|
215
216
|
var whyDidYouRender: boolean;
|
|
216
217
|
}
|
|
217
218
|
/**
|
|
@@ -336,6 +337,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
|
336
337
|
componentStack?: string;
|
|
337
338
|
};
|
|
338
339
|
}> {
|
|
340
|
+
static displayName: string;
|
|
339
341
|
static whyDidYouRender: boolean;
|
|
340
342
|
constructor(props: ErrorBoundaryProps);
|
|
341
343
|
componentDidCatch(error: Error | null, info: any): void;
|
|
@@ -383,16 +385,19 @@ type FormInputElementProps = {
|
|
|
383
385
|
onChange: (value: any) => void;
|
|
384
386
|
};
|
|
385
387
|
|
|
386
|
-
type
|
|
388
|
+
type InferFormInputProps<T extends ComponentType<FormInputElementProps> | JSXElementConstructor<any>> = T extends ComponentType<FormInputElementProps> ? Omit<ComponentProps<T>, 'name' | 'value' | 'onChange'> : Omit<ComponentProps<T>, 'name' | 'value'>;
|
|
389
|
+
type FormInputProps<FormElements extends FormElementTypes = FormElementTypes> = {
|
|
390
|
+
Input?: ComponentType<FormInputElementProps>;
|
|
391
|
+
props?: InferFormInputProps<FormElements['Input']>;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
type FormLabelElementProps<FormElements extends FormElementTypes = FormElementTypes> = {
|
|
387
395
|
name: string;
|
|
388
396
|
rules?: FormRules;
|
|
389
397
|
title?: ReactNode;
|
|
390
398
|
description?: ReactNode;
|
|
391
|
-
Label?:
|
|
392
|
-
input?:
|
|
393
|
-
Input?: ComponentType<FormInputElementProps>;
|
|
394
|
-
props?: FormInputElementProps;
|
|
395
|
-
};
|
|
399
|
+
Label?: FormElements['Label'];
|
|
400
|
+
input?: FormInputProps<FormElements>;
|
|
396
401
|
};
|
|
397
402
|
|
|
398
403
|
type FormButtonElementProps = {
|
|
@@ -409,12 +414,16 @@ type FormElementTypes = {
|
|
|
409
414
|
declare const FormDefaultElements: FormElementTypes;
|
|
410
415
|
|
|
411
416
|
type FormProps<Values extends Record<string, any> = Record<string, any>, FormElements extends FormElementTypes = FormElementTypes> = {
|
|
412
|
-
items: FormLabelElementProps[];
|
|
417
|
+
items: FormLabelElementProps<FormElements>[];
|
|
413
418
|
onSubmit?: (values: Values) => Promise<void>;
|
|
414
|
-
elements?: FormElements
|
|
419
|
+
elements?: Partial<FormElements>;
|
|
415
420
|
defaultValues?: Values;
|
|
416
421
|
};
|
|
417
422
|
declare function FormContainer<Values extends Record<string, any> = Record<string, any>, FormElements extends FormElementTypes = FormElementTypes>({ defaultValues, elements, ...props }: FormProps<Values, FormElements>): react_jsx_runtime.JSX.Element;
|
|
423
|
+
declare namespace FormContainer {
|
|
424
|
+
var displayName: string;
|
|
425
|
+
var whyDidYouRender: boolean;
|
|
426
|
+
}
|
|
418
427
|
|
|
419
428
|
type FormContextProps<Values extends Record<string, any> = Record<string, any>> = {
|
|
420
429
|
items: FormLabelElementProps[];
|
|
@@ -432,4 +441,4 @@ declare const FormContextProvider: <NewT extends FormContextProps<Record<string,
|
|
|
432
441
|
}) => react.ReactNode;
|
|
433
442
|
declare const useFormContext: <NewT extends FormContextProps<Record<string, any>> = FormContextProps<Record<string, any>>>() => Readonly<NewT>;
|
|
434
443
|
|
|
435
|
-
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorChildrenProps, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, FaasReactClient, type FaasReactClientInstance, type FaasReactClientOptions, FormContainer as Form, type FormContextProps, FormContextProvider, FormDefaultElements, type FormElementTypes, type FormProps, type OnError, OptionalWrapper, type OptionalWrapperProps, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, type useFaasOptions, useFormContext, useSplittingState, withFaasData };
|
|
444
|
+
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorChildrenProps, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, FaasReactClient, type FaasReactClientInstance, type FaasReactClientOptions, FormContainer as Form, type FormButtonElementProps, type FormContextProps, FormContextProvider, FormDefaultElements, type FormElementTypes, type FormInputElementProps, type FormLabelElementProps, type FormProps, type OnError, OptionalWrapper, type OptionalWrapperProps, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, type useFaasOptions, useFormContext, useSplittingState, withFaasData };
|
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 } from 'react';
|
|
6
|
+
import { ReactNode, Dispatch, SetStateAction, ReactElement, Component, ComponentType, ComponentProps, JSXElementConstructor } from 'react';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -212,6 +212,7 @@ type FaasDataWrapperProps<PathOrData extends FaasAction> = {
|
|
|
212
212
|
};
|
|
213
213
|
declare function FaasDataWrapper<PathOrData extends FaasAction>(props: FaasDataWrapperProps<PathOrData>): JSX.Element;
|
|
214
214
|
declare namespace FaasDataWrapper {
|
|
215
|
+
var displayName: string;
|
|
215
216
|
var whyDidYouRender: boolean;
|
|
216
217
|
}
|
|
217
218
|
/**
|
|
@@ -336,6 +337,7 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
|
336
337
|
componentStack?: string;
|
|
337
338
|
};
|
|
338
339
|
}> {
|
|
340
|
+
static displayName: string;
|
|
339
341
|
static whyDidYouRender: boolean;
|
|
340
342
|
constructor(props: ErrorBoundaryProps);
|
|
341
343
|
componentDidCatch(error: Error | null, info: any): void;
|
|
@@ -383,16 +385,19 @@ type FormInputElementProps = {
|
|
|
383
385
|
onChange: (value: any) => void;
|
|
384
386
|
};
|
|
385
387
|
|
|
386
|
-
type
|
|
388
|
+
type InferFormInputProps<T extends ComponentType<FormInputElementProps> | JSXElementConstructor<any>> = T extends ComponentType<FormInputElementProps> ? Omit<ComponentProps<T>, 'name' | 'value' | 'onChange'> : Omit<ComponentProps<T>, 'name' | 'value'>;
|
|
389
|
+
type FormInputProps<FormElements extends FormElementTypes = FormElementTypes> = {
|
|
390
|
+
Input?: ComponentType<FormInputElementProps>;
|
|
391
|
+
props?: InferFormInputProps<FormElements['Input']>;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
type FormLabelElementProps<FormElements extends FormElementTypes = FormElementTypes> = {
|
|
387
395
|
name: string;
|
|
388
396
|
rules?: FormRules;
|
|
389
397
|
title?: ReactNode;
|
|
390
398
|
description?: ReactNode;
|
|
391
|
-
Label?:
|
|
392
|
-
input?:
|
|
393
|
-
Input?: ComponentType<FormInputElementProps>;
|
|
394
|
-
props?: FormInputElementProps;
|
|
395
|
-
};
|
|
399
|
+
Label?: FormElements['Label'];
|
|
400
|
+
input?: FormInputProps<FormElements>;
|
|
396
401
|
};
|
|
397
402
|
|
|
398
403
|
type FormButtonElementProps = {
|
|
@@ -409,12 +414,16 @@ type FormElementTypes = {
|
|
|
409
414
|
declare const FormDefaultElements: FormElementTypes;
|
|
410
415
|
|
|
411
416
|
type FormProps<Values extends Record<string, any> = Record<string, any>, FormElements extends FormElementTypes = FormElementTypes> = {
|
|
412
|
-
items: FormLabelElementProps[];
|
|
417
|
+
items: FormLabelElementProps<FormElements>[];
|
|
413
418
|
onSubmit?: (values: Values) => Promise<void>;
|
|
414
|
-
elements?: FormElements
|
|
419
|
+
elements?: Partial<FormElements>;
|
|
415
420
|
defaultValues?: Values;
|
|
416
421
|
};
|
|
417
422
|
declare function FormContainer<Values extends Record<string, any> = Record<string, any>, FormElements extends FormElementTypes = FormElementTypes>({ defaultValues, elements, ...props }: FormProps<Values, FormElements>): react_jsx_runtime.JSX.Element;
|
|
423
|
+
declare namespace FormContainer {
|
|
424
|
+
var displayName: string;
|
|
425
|
+
var whyDidYouRender: boolean;
|
|
426
|
+
}
|
|
418
427
|
|
|
419
428
|
type FormContextProps<Values extends Record<string, any> = Record<string, any>> = {
|
|
420
429
|
items: FormLabelElementProps[];
|
|
@@ -432,4 +441,4 @@ declare const FormContextProvider: <NewT extends FormContextProps<Record<string,
|
|
|
432
441
|
}) => react.ReactNode;
|
|
433
442
|
declare const useFormContext: <NewT extends FormContextProps<Record<string, any>> = FormContextProps<Record<string, any>>>() => Readonly<NewT>;
|
|
434
443
|
|
|
435
|
-
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorChildrenProps, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, FaasReactClient, type FaasReactClientInstance, type FaasReactClientOptions, FormContainer as Form, type FormContextProps, FormContextProvider, FormDefaultElements, type FormElementTypes, type FormProps, type OnError, OptionalWrapper, type OptionalWrapperProps, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, type useFaasOptions, useFormContext, useSplittingState, withFaasData };
|
|
444
|
+
export { ErrorBoundary, type ErrorBoundaryProps, type ErrorChildrenProps, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, FaasReactClient, type FaasReactClientInstance, type FaasReactClientOptions, FormContainer as Form, type FormButtonElementProps, type FormContextProps, FormContextProvider, FormDefaultElements, type FormElementTypes, type FormInputElementProps, type FormLabelElementProps, type FormProps, type OnError, OptionalWrapper, type OptionalWrapperProps, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, type useFaasOptions, useFormContext, useSplittingState, withFaasData };
|
package/dist/index.js
CHANGED
|
@@ -99,6 +99,8 @@ function createSplittingContext(defaultValue) {
|
|
|
99
99
|
}
|
|
100
100
|
return children;
|
|
101
101
|
}
|
|
102
|
+
Provider.displayName = "SplittingContextProvider";
|
|
103
|
+
Provider.whyDidYouRender = true;
|
|
102
104
|
function use() {
|
|
103
105
|
return useConstant(() => {
|
|
104
106
|
const obj = /* @__PURE__ */ Object.create(null);
|
|
@@ -110,6 +112,7 @@ function createSplittingContext(defaultValue) {
|
|
|
110
112
|
return Object.freeze(obj);
|
|
111
113
|
});
|
|
112
114
|
}
|
|
115
|
+
use.whyDidYouRender = true;
|
|
113
116
|
return {
|
|
114
117
|
Provider,
|
|
115
118
|
use
|
|
@@ -155,6 +158,7 @@ function FaasDataWrapper(props) {
|
|
|
155
158
|
]);
|
|
156
159
|
return child;
|
|
157
160
|
}
|
|
161
|
+
FaasDataWrapper.displayName = "FaasDataWrapper";
|
|
158
162
|
FaasDataWrapper.whyDidYouRender = true;
|
|
159
163
|
function withFaasData(Component2, faasProps) {
|
|
160
164
|
return (props) => /* @__PURE__ */ jsxRuntime.jsx(FaasDataWrapper, { ...faasProps, children: /* @__PURE__ */ jsxRuntime.jsx(Component2, { ...props }) });
|
|
@@ -293,6 +297,7 @@ function getClient(host) {
|
|
|
293
297
|
return client;
|
|
294
298
|
}
|
|
295
299
|
var ErrorBoundary = class extends react.Component {
|
|
300
|
+
static displayName = "ErrorBoundary";
|
|
296
301
|
static whyDidYouRender = true;
|
|
297
302
|
constructor(props) {
|
|
298
303
|
super(props);
|
|
@@ -328,10 +333,10 @@ var ErrorBoundary = class extends react.Component {
|
|
|
328
333
|
return this.props.children;
|
|
329
334
|
}
|
|
330
335
|
};
|
|
331
|
-
ErrorBoundary.whyDidYouRender = true;
|
|
332
336
|
var OptionalWrapper = ({ condition, Wrapper, wrapperProps, children }) => {
|
|
333
337
|
return condition ? /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { ...wrapperProps, children }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
334
338
|
};
|
|
339
|
+
OptionalWrapper.displayName = "OptionalWrapper";
|
|
335
340
|
OptionalWrapper.whyDidYouRender = true;
|
|
336
341
|
|
|
337
342
|
// src/Form/context.tsx
|
|
@@ -343,11 +348,17 @@ function FormLabel(props) {
|
|
|
343
348
|
if (props.Label) return /* @__PURE__ */ jsxRuntime.jsx(props.Label, { ...props });
|
|
344
349
|
return /* @__PURE__ */ jsxRuntime.jsx(Elements.Label, { ...props });
|
|
345
350
|
}
|
|
351
|
+
FormLabel.displayName = "FormLabel";
|
|
352
|
+
FormLabel.whyDidYouRender = true;
|
|
346
353
|
function FormBody() {
|
|
347
354
|
const { items } = useFormContext();
|
|
348
355
|
return items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { ...item }, item.name));
|
|
349
356
|
}
|
|
357
|
+
FormBody.displayName = "FormBody";
|
|
358
|
+
FormBody.whyDidYouRender = true;
|
|
350
359
|
var FormInputElement = react.forwardRef(({ onChange, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("input", { ...props, onChange: (e) => onChange(e.target.value), ref }));
|
|
360
|
+
FormInputElement.displayName = "FormInputElement";
|
|
361
|
+
FormInputElement.whyDidYouRender = true;
|
|
351
362
|
var FormLabelElement = ({
|
|
352
363
|
name,
|
|
353
364
|
title,
|
|
@@ -356,7 +367,16 @@ var FormLabelElement = ({
|
|
|
356
367
|
input
|
|
357
368
|
}) => {
|
|
358
369
|
const { values, setValues } = useFormContext();
|
|
359
|
-
if (Label)
|
|
370
|
+
if (Label)
|
|
371
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
372
|
+
Label,
|
|
373
|
+
{
|
|
374
|
+
name,
|
|
375
|
+
title,
|
|
376
|
+
description,
|
|
377
|
+
input
|
|
378
|
+
}
|
|
379
|
+
);
|
|
360
380
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
361
381
|
title ?? name,
|
|
362
382
|
input?.Input ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -383,6 +403,8 @@ var FormLabelElement = ({
|
|
|
383
403
|
description
|
|
384
404
|
] });
|
|
385
405
|
};
|
|
406
|
+
FormLabelElement.displayName = "FormLabelElement";
|
|
407
|
+
FormLabelElement.whyDidYouRender = true;
|
|
386
408
|
var FormButtonElement = react.forwardRef(({ disabled, children, onClick, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
387
409
|
"button",
|
|
388
410
|
{
|
|
@@ -394,6 +416,8 @@ var FormButtonElement = react.forwardRef(({ disabled, children, onClick, ...prop
|
|
|
394
416
|
children
|
|
395
417
|
}
|
|
396
418
|
));
|
|
419
|
+
FormButtonElement.displayName = "FormButtonElement";
|
|
420
|
+
FormButtonElement.whyDidYouRender = true;
|
|
397
421
|
|
|
398
422
|
// src/Form/elements/index.ts
|
|
399
423
|
var FormDefaultElements = {
|
|
@@ -415,6 +439,8 @@ function FormFooter() {
|
|
|
415
439
|
}
|
|
416
440
|
);
|
|
417
441
|
}
|
|
442
|
+
FormFooter.displayName = "FormFooter";
|
|
443
|
+
FormFooter.whyDidYouRender = true;
|
|
418
444
|
function mergeValues(items, defaultValues = {}) {
|
|
419
445
|
const values = {};
|
|
420
446
|
for (const item of items)
|
|
@@ -434,6 +460,7 @@ function FormContainer({ defaultValues, elements, ...props }) {
|
|
|
434
460
|
...states,
|
|
435
461
|
...props
|
|
436
462
|
},
|
|
463
|
+
memo: true,
|
|
437
464
|
children: [
|
|
438
465
|
/* @__PURE__ */ jsxRuntime.jsx(FormBody, {}),
|
|
439
466
|
/* @__PURE__ */ jsxRuntime.jsx(FormFooter, {})
|
|
@@ -441,6 +468,8 @@ function FormContainer({ defaultValues, elements, ...props }) {
|
|
|
441
468
|
}
|
|
442
469
|
);
|
|
443
470
|
}
|
|
471
|
+
FormContainer.displayName = "FormContainer";
|
|
472
|
+
FormContainer.whyDidYouRender = true;
|
|
444
473
|
|
|
445
474
|
exports.ErrorBoundary = ErrorBoundary;
|
|
446
475
|
exports.FaasDataWrapper = FaasDataWrapper;
|
package/dist/index.mjs
CHANGED
|
@@ -97,6 +97,8 @@ function createSplittingContext(defaultValue) {
|
|
|
97
97
|
}
|
|
98
98
|
return children;
|
|
99
99
|
}
|
|
100
|
+
Provider.displayName = "SplittingContextProvider";
|
|
101
|
+
Provider.whyDidYouRender = true;
|
|
100
102
|
function use() {
|
|
101
103
|
return useConstant(() => {
|
|
102
104
|
const obj = /* @__PURE__ */ Object.create(null);
|
|
@@ -108,6 +110,7 @@ function createSplittingContext(defaultValue) {
|
|
|
108
110
|
return Object.freeze(obj);
|
|
109
111
|
});
|
|
110
112
|
}
|
|
113
|
+
use.whyDidYouRender = true;
|
|
111
114
|
return {
|
|
112
115
|
Provider,
|
|
113
116
|
use
|
|
@@ -153,6 +156,7 @@ function FaasDataWrapper(props) {
|
|
|
153
156
|
]);
|
|
154
157
|
return child;
|
|
155
158
|
}
|
|
159
|
+
FaasDataWrapper.displayName = "FaasDataWrapper";
|
|
156
160
|
FaasDataWrapper.whyDidYouRender = true;
|
|
157
161
|
function withFaasData(Component2, faasProps) {
|
|
158
162
|
return (props) => /* @__PURE__ */ jsx(FaasDataWrapper, { ...faasProps, children: /* @__PURE__ */ jsx(Component2, { ...props }) });
|
|
@@ -291,6 +295,7 @@ function getClient(host) {
|
|
|
291
295
|
return client;
|
|
292
296
|
}
|
|
293
297
|
var ErrorBoundary = class extends Component {
|
|
298
|
+
static displayName = "ErrorBoundary";
|
|
294
299
|
static whyDidYouRender = true;
|
|
295
300
|
constructor(props) {
|
|
296
301
|
super(props);
|
|
@@ -326,10 +331,10 @@ var ErrorBoundary = class extends Component {
|
|
|
326
331
|
return this.props.children;
|
|
327
332
|
}
|
|
328
333
|
};
|
|
329
|
-
ErrorBoundary.whyDidYouRender = true;
|
|
330
334
|
var OptionalWrapper = ({ condition, Wrapper, wrapperProps, children }) => {
|
|
331
335
|
return condition ? /* @__PURE__ */ jsx(Wrapper, { ...wrapperProps, children }) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
332
336
|
};
|
|
337
|
+
OptionalWrapper.displayName = "OptionalWrapper";
|
|
333
338
|
OptionalWrapper.whyDidYouRender = true;
|
|
334
339
|
|
|
335
340
|
// src/Form/context.tsx
|
|
@@ -341,11 +346,17 @@ function FormLabel(props) {
|
|
|
341
346
|
if (props.Label) return /* @__PURE__ */ jsx(props.Label, { ...props });
|
|
342
347
|
return /* @__PURE__ */ jsx(Elements.Label, { ...props });
|
|
343
348
|
}
|
|
349
|
+
FormLabel.displayName = "FormLabel";
|
|
350
|
+
FormLabel.whyDidYouRender = true;
|
|
344
351
|
function FormBody() {
|
|
345
352
|
const { items } = useFormContext();
|
|
346
353
|
return items.map((item) => /* @__PURE__ */ jsx(FormLabel, { ...item }, item.name));
|
|
347
354
|
}
|
|
355
|
+
FormBody.displayName = "FormBody";
|
|
356
|
+
FormBody.whyDidYouRender = true;
|
|
348
357
|
var FormInputElement = forwardRef(({ onChange, ...props }, ref) => /* @__PURE__ */ jsx("input", { ...props, onChange: (e) => onChange(e.target.value), ref }));
|
|
358
|
+
FormInputElement.displayName = "FormInputElement";
|
|
359
|
+
FormInputElement.whyDidYouRender = true;
|
|
349
360
|
var FormLabelElement = ({
|
|
350
361
|
name,
|
|
351
362
|
title,
|
|
@@ -354,7 +365,16 @@ var FormLabelElement = ({
|
|
|
354
365
|
input
|
|
355
366
|
}) => {
|
|
356
367
|
const { values, setValues } = useFormContext();
|
|
357
|
-
if (Label)
|
|
368
|
+
if (Label)
|
|
369
|
+
return /* @__PURE__ */ jsx(
|
|
370
|
+
Label,
|
|
371
|
+
{
|
|
372
|
+
name,
|
|
373
|
+
title,
|
|
374
|
+
description,
|
|
375
|
+
input
|
|
376
|
+
}
|
|
377
|
+
);
|
|
358
378
|
return /* @__PURE__ */ jsxs("label", { children: [
|
|
359
379
|
title ?? name,
|
|
360
380
|
input?.Input ? /* @__PURE__ */ jsx(
|
|
@@ -381,6 +401,8 @@ var FormLabelElement = ({
|
|
|
381
401
|
description
|
|
382
402
|
] });
|
|
383
403
|
};
|
|
404
|
+
FormLabelElement.displayName = "FormLabelElement";
|
|
405
|
+
FormLabelElement.whyDidYouRender = true;
|
|
384
406
|
var FormButtonElement = forwardRef(({ disabled, children, onClick, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
385
407
|
"button",
|
|
386
408
|
{
|
|
@@ -392,6 +414,8 @@ var FormButtonElement = forwardRef(({ disabled, children, onClick, ...props }, r
|
|
|
392
414
|
children
|
|
393
415
|
}
|
|
394
416
|
));
|
|
417
|
+
FormButtonElement.displayName = "FormButtonElement";
|
|
418
|
+
FormButtonElement.whyDidYouRender = true;
|
|
395
419
|
|
|
396
420
|
// src/Form/elements/index.ts
|
|
397
421
|
var FormDefaultElements = {
|
|
@@ -413,6 +437,8 @@ function FormFooter() {
|
|
|
413
437
|
}
|
|
414
438
|
);
|
|
415
439
|
}
|
|
440
|
+
FormFooter.displayName = "FormFooter";
|
|
441
|
+
FormFooter.whyDidYouRender = true;
|
|
416
442
|
function mergeValues(items, defaultValues = {}) {
|
|
417
443
|
const values = {};
|
|
418
444
|
for (const item of items)
|
|
@@ -432,6 +458,7 @@ function FormContainer({ defaultValues, elements, ...props }) {
|
|
|
432
458
|
...states,
|
|
433
459
|
...props
|
|
434
460
|
},
|
|
461
|
+
memo: true,
|
|
435
462
|
children: [
|
|
436
463
|
/* @__PURE__ */ jsx(FormBody, {}),
|
|
437
464
|
/* @__PURE__ */ jsx(FormFooter, {})
|
|
@@ -439,5 +466,7 @@ function FormContainer({ defaultValues, elements, ...props }) {
|
|
|
439
466
|
}
|
|
440
467
|
);
|
|
441
468
|
}
|
|
469
|
+
FormContainer.displayName = "FormContainer";
|
|
470
|
+
FormContainer.whyDidYouRender = true;
|
|
442
471
|
|
|
443
472
|
export { ErrorBoundary, FaasDataWrapper, FaasReactClient, FormContainer as Form, FormContextProvider, FormDefaultElements, OptionalWrapper, createSplittingContext, equal, faas, getClient, useConstant, useEqualCallback, useEqualEffect, useEqualMemo, useEqualMemoize, useFaas, useFormContext, useSplittingState, withFaasData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/react",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.3",
|
|
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.0-beta.
|
|
37
|
+
"@faasjs/browser": "3.7.0-beta.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@faasjs/browser": "3.7.0-beta.
|
|
40
|
+
"@faasjs/browser": "3.7.0-beta.3",
|
|
41
41
|
"@types/react": "*",
|
|
42
42
|
"react": "*"
|
|
43
43
|
},
|