@panneau/forms 4.0.74 → 4.0.78

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.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ElementType, ReactNode } from 'react';
3
+ import { FormDefinition } from '@panneau/core';
3
4
 
4
5
  interface FormsProviderProps {
5
- components?: Record<string, unknown> | null;
6
- children?: ReactNode;
6
+ definitions?: FormDefinition[];
7
+ components?: Record<string, ElementType>;
8
+ children: ReactNode;
7
9
  }
8
- declare function FormsProvider({ components: injectedComponents, children, ...props }: FormsProviderProps): react.JSX.Element;
10
+ declare function FormsProvider({ definitions: injectedDefinitions, components: injectedComponents, children, }: FormsProviderProps): react.JSX.Element;
9
11
 
10
12
  export { FormsProvider as default };
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import { ComponentsProvider, FORMS_NAMESPACE } from '@panneau/core/contexts';
2
+ import { ComponentsProvider, FORMS_NAMESPACE, FormsProvider as FormsProvider$1 } from '@panneau/core/contexts';
3
3
  import formHorizontal from '@panneau/form-horizontal';
4
4
  import formInline from '@panneau/form-inline';
5
5
  import formNormal from '@panneau/form-normal';
6
6
  import formTwoPane from '@panneau/form-two-pane';
7
- import { ChangePassword, ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable } from '@panneau/form-auth';
7
+ import { ChangePassword, ConfirmPassword, ForgotPassword, Login, Register, ResetPassword, TwoFactorChallenge, TwoFactorDisable, TwoFactorEnable, definition } from '@panneau/form-auth';
8
+ import isArray from 'lodash-es/isArray';
8
9
  import { jsx } from 'react/jsx-runtime';
9
10
 
10
11
  // Import forms
@@ -26,55 +27,64 @@ var components = /*#__PURE__*/Object.freeze({
26
27
  TwoPane: formTwoPane
27
28
  });
28
29
 
30
+ var definitions = [definition].reduce((allDefinition, definition) => [...allDefinition, ...(isArray(definition) ? definition : [definition])], []);
31
+
32
+ const DEFAULT_DEFINITIONS = [];
33
+ const DEFAULT_COMPONENTS = {};
29
34
  function FormsProvider(t0) {
30
35
  const $ = c(10);
31
- let props;
32
- let t1;
33
- let t2;
34
- if ($[0] !== t0) {
35
- ({
36
- components: t1,
37
- children: t2,
38
- ...props
39
- } = t0);
40
- $[0] = t0;
41
- $[1] = props;
42
- $[2] = t1;
43
- $[3] = t2;
36
+ const {
37
+ definitions: t1,
38
+ components: t2,
39
+ children
40
+ } = t0;
41
+ const injectedDefinitions = t1 === undefined ? DEFAULT_DEFINITIONS : t1;
42
+ const injectedComponents = t2 === undefined ? DEFAULT_COMPONENTS : t2;
43
+ let t3;
44
+ if ($[0] !== injectedDefinitions) {
45
+ t3 = [...definitions, ...injectedDefinitions];
46
+ $[0] = injectedDefinitions;
47
+ $[1] = t3;
44
48
  } else {
45
- props = $[1];
46
- t1 = $[2];
47
- t2 = $[3];
49
+ t3 = $[1];
48
50
  }
49
- const injectedComponents = t1 === undefined ? null : t1;
50
- const children = t2 === undefined ? null : t2;
51
- let t3;
52
- if ($[4] !== injectedComponents) {
53
- t3 = {
51
+ let t4;
52
+ if ($[2] !== injectedComponents) {
53
+ t4 = {
54
54
  ...components,
55
55
  ...injectedComponents
56
56
  };
57
- $[4] = injectedComponents;
58
- $[5] = t3;
57
+ $[2] = injectedComponents;
58
+ $[3] = t4;
59
59
  } else {
60
- t3 = $[5];
60
+ t4 = $[3];
61
61
  }
62
- let t4;
63
- if ($[6] !== children || $[7] !== props || $[8] !== t3) {
64
- t4 = /*#__PURE__*/jsx(ComponentsProvider, {
62
+ let t5;
63
+ if ($[4] !== children || $[5] !== t4) {
64
+ t5 = /*#__PURE__*/jsx(ComponentsProvider, {
65
65
  namespace: FORMS_NAMESPACE,
66
- components: t3,
67
- ...props,
66
+ components: t4,
68
67
  children: children
69
68
  });
70
- $[6] = children;
71
- $[7] = props;
72
- $[8] = t3;
73
- $[9] = t4;
69
+ $[4] = children;
70
+ $[5] = t4;
71
+ $[6] = t5;
72
+ } else {
73
+ t5 = $[6];
74
+ }
75
+ let t6;
76
+ if ($[7] !== t3 || $[8] !== t5) {
77
+ t6 = /*#__PURE__*/jsx(FormsProvider$1, {
78
+ forms: t3,
79
+ children: t5
80
+ });
81
+ $[7] = t3;
82
+ $[8] = t5;
83
+ $[9] = t6;
74
84
  } else {
75
- t4 = $[9];
85
+ t6 = $[9];
76
86
  }
77
- return t4;
87
+ return t6;
78
88
  }
79
89
 
80
90
  export { FormsProvider as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/forms",
3
- "version": "4.0.74",
3
+ "version": "4.0.78",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -60,12 +60,12 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@babel/runtime": "^7.28.6",
63
- "@panneau/core": "^4.0.74",
64
- "@panneau/form-auth": "^4.0.74",
65
- "@panneau/form-horizontal": "^4.0.74",
66
- "@panneau/form-inline": "^4.0.74",
67
- "@panneau/form-normal": "^4.0.74",
68
- "@panneau/form-two-pane": "^4.0.74"
63
+ "@panneau/core": "^4.0.78",
64
+ "@panneau/form-auth": "^4.0.78",
65
+ "@panneau/form-horizontal": "^4.0.78",
66
+ "@panneau/form-inline": "^4.0.78",
67
+ "@panneau/form-normal": "^4.0.78",
68
+ "@panneau/form-two-pane": "^4.0.78"
69
69
  },
70
70
  "devDependencies": {
71
71
  "react": "^19.2.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "122cadcf8ea5faacc035e7fe911fbdfb9fb87d26"
81
+ "gitHead": "669f20a39ca9545acbe0f2279c6d1af23e43ae6e"
82
82
  }