@companix/formkit 0.0.4 → 0.0.5

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 CHANGED
@@ -1,26 +1,29 @@
1
- // generics
2
-
3
- // implements form
1
+ ## Create form primitives
4
2
 
3
+ ```tsx
5
4
  const SelectForm = (name: string, x: any) => {}
6
5
  const InputForm = (name: string, x: any) => {}
6
+ ```
7
7
 
8
- // implements layout
8
+ ## Create layouts
9
9
 
10
- const Label = (v: any) => {
11
- return (x: any) => {}
10
+ ```tsx
11
+ const Label = ({ name }) => {
12
+ return ({ children }) => <div></div>
12
13
  }
13
14
 
14
15
  const Double = () => {
15
- return (...x: void[]) => {
16
- // x.
16
+ return () => {
17
+ return <>{children}</>
17
18
  }
18
19
  }
19
20
 
20
21
  const Splitter = () => {}
22
+ ```
21
23
 
22
- // scheme
24
+ ## Define a scheme
23
25
 
26
+ ```ts
24
27
  const scheme = [
25
28
  Label('Имя')(
26
29
  SelectForm('name', {
@@ -42,3 +45,4 @@ const scheme = [
42
45
  )
43
46
  )
44
47
  ]
48
+ ```
@@ -2,6 +2,6 @@ import { SchemeItems } from './core/types';
2
2
  export interface SchemeBuilderProps {
3
3
  scheme: SchemeItems.All[];
4
4
  path: string[];
5
+ className?: string;
5
6
  }
6
- declare const SchemeBuilder: ({ scheme, path }: SchemeBuilderProps) => import("react/jsx-runtime").JSX.Element;
7
- export { SchemeBuilder };
7
+ export declare const SchemeBuilder: ({ scheme, path, className }: SchemeBuilderProps) => import("react/jsx-runtime").JSX.Element;
package/dist/bundle.es.js CHANGED
@@ -1,26 +1,26 @@
1
- import { jsx as g, Fragment as q, jsxs as T } from "react/jsx-runtime";
2
- import { createContext as N, useState as R, useContext as L, useEffect as D, useMemo as A, useCallback as S, useRef as P } from "react";
3
- import w from "fast-deep-equal";
4
- const j = N({}), M = (o) => {
5
- const [, r] = R([]), e = L(j), s = e.getForm(o);
1
+ import { jsx as h, Fragment as B, jsxs as T } from "react/jsx-runtime";
2
+ import { createContext as N, useState as q, useContext as L, useEffect as D, useMemo as A, useCallback as S, useRef as P } from "react";
3
+ import R from "fast-deep-equal";
4
+ const j = N({}), M = (s) => {
5
+ const [, r] = q([]), o = L(j), t = o.getForm(s);
6
6
  return D(() => {
7
- const { unsubscribe: t } = e.subscribeToForm(o, () => {
7
+ const { unsubscribe: e } = o.subscribeToForm(s, () => {
8
8
  r([]);
9
9
  });
10
10
  return () => {
11
- t();
11
+ e();
12
12
  };
13
- }, []), s?.value;
14
- }, _ = ({ canActivate: o, name: r, children: e }) => {
15
- const s = M(r);
16
- return o(s) ? /* @__PURE__ */ g(q, { children: e }) : null;
17
- }, z = ({ item: { Form: o }, name: r }) => {
18
- const [, e] = R([]), s = L(j), { unregistry: t } = A(() => s.registry(r, () => {
19
- e([]);
13
+ }, []), t?.value;
14
+ }, _ = ({ canActivate: s, name: r, children: o }) => {
15
+ const t = M(r);
16
+ return s(t) ? /* @__PURE__ */ h(B, { children: o }) : null;
17
+ }, z = ({ item: { Form: s }, name: r }) => {
18
+ const [, o] = q([]), t = L(j), { unregistry: e } = A(() => t.registry(r, () => {
19
+ o([]);
20
20
  }), []), l = S(
21
21
  (d) => {
22
22
  if (d && d.focus) {
23
- const v = s.getForm(r);
23
+ const v = t.getForm(r);
24
24
  v.focus = () => {
25
25
  d.focus();
26
26
  };
@@ -29,16 +29,16 @@ const j = N({}), M = (o) => {
29
29
  [r]
30
30
  );
31
31
  D(() => () => {
32
- t();
32
+ e();
33
33
  }, []);
34
- const { value: y, error: b } = s.getForm(r);
35
- return /* @__PURE__ */ g(
36
- o,
34
+ const { value: g, error: b } = t.getForm(r);
35
+ return /* @__PURE__ */ h(
36
+ s,
37
37
  {
38
38
  field: {
39
- value: y,
39
+ value: g,
40
40
  onChange: (d) => {
41
- s.onChange(r, d);
41
+ t.onChange(r, d);
42
42
  },
43
43
  onBlur: () => {
44
44
  },
@@ -46,26 +46,26 @@ const j = N({}), M = (o) => {
46
46
  },
47
47
  isDirty: !1,
48
48
  error: b,
49
- disabled: s.disabled
49
+ disabled: t.disabled
50
50
  }
51
51
  );
52
- }, G = ({ item: o, path: r }) => {
53
- const { getController: e, items: s } = o, t = L(j), l = A(() => {
52
+ }, G = ({ item: s, path: r }) => {
53
+ const { getController: o, items: t } = s, e = L(j), l = A(() => {
54
54
  const i = {};
55
- return s.forEach(({ name: f, getForm: F }) => {
55
+ return t.forEach(({ name: f, getForm: F }) => {
56
56
  i[f] = F(f, () => x(f));
57
57
  }), i;
58
- }, []), y = S(() => {
58
+ }, []), g = S(() => {
59
59
  const i = [];
60
- return s.forEach(({ name: f }) => {
61
- t.getForm([...r, f].join(".")).value !== void 0 && i.push(f);
60
+ return t.forEach(({ name: f }) => {
61
+ e.getForm([...r, f].join(".")).value !== void 0 && i.push(f);
62
62
  }), i;
63
- }, []), b = A(() => y(), []), [d, v] = R(b);
63
+ }, []), b = A(() => g(), []), [d, v] = q(b);
64
64
  D(() => {
65
- const { unregistry: i } = t.registryExtraForm(
66
- s.map(({ name: f }) => [...r, f].join(".")),
65
+ const { unregistry: i } = e.registryExtraForm(
66
+ t.map(({ name: f }) => [...r, f].join(".")),
67
67
  () => {
68
- v(y());
68
+ v(g());
69
69
  }
70
70
  );
71
71
  return () => {
@@ -80,92 +80,92 @@ const j = N({}), M = (o) => {
80
80
  ), x = S((i) => {
81
81
  v((f) => f.filter((F) => F !== i));
82
82
  }, []);
83
- return /* @__PURE__ */ T(q, { children: [
83
+ return /* @__PURE__ */ T(B, { children: [
84
84
  d.map((i) => {
85
85
  const f = l[i];
86
- return /* @__PURE__ */ g(V, { path: r, scheme: [f] }, `param-form--${i}`);
86
+ return /* @__PURE__ */ h(E, { path: r, scheme: [f] }, `param-form--${i}`);
87
87
  }),
88
- e(C, d)
88
+ o(C, d)
89
89
  ] });
90
- }, V = ({ scheme: o, path: r }) => /* @__PURE__ */ g(q, { children: o.map((e, s) => e.type === "layout" ? /* @__PURE__ */ g(e.Layout, { children: /* @__PURE__ */ g(V, { path: r, scheme: e.childs }) }, `layout-form--${s}-${r.length}`) : e.type === "context" ? /* @__PURE__ */ g(
91
- V,
90
+ }, E = ({ scheme: s, path: r, className: o }) => /* @__PURE__ */ h("div", { className: o, children: s.map((t, e) => t.type === "layout" ? /* @__PURE__ */ h(t.Layout, { children: /* @__PURE__ */ h(E, { path: r, scheme: t.childs }) }, `layout-form--${e}-${r.length}`) : t.type === "context" ? /* @__PURE__ */ h(
91
+ E,
92
92
  {
93
- path: [...r, e.context],
94
- scheme: e.childs
93
+ path: [...r, t.context],
94
+ scheme: t.childs
95
95
  },
96
- `context-form--${s}-${e.context}-${r.length}`
97
- ) : e.type === "condition" ? /* @__PURE__ */ g(
96
+ `context-form--${e}-${t.context}-${r.length}`
97
+ ) : t.type === "condition" ? /* @__PURE__ */ h(
98
98
  _,
99
99
  {
100
- name: e.depended,
101
- canActivate: e.canActivate,
102
- children: /* @__PURE__ */ g(V, { path: r, scheme: e.childs })
100
+ name: t.depended,
101
+ canActivate: t.canActivate,
102
+ children: /* @__PURE__ */ h(E, { path: r, scheme: t.childs })
103
103
  },
104
- `condition--${s}-${e.depended}-${r.length}`
105
- ) : e.type === "extra" ? /* @__PURE__ */ g(G, { path: r, item: e }, `partial-item--${s}-${r.length}`) : /* @__PURE__ */ g(
104
+ `condition--${e}-${t.depended}-${r.length}`
105
+ ) : t.type === "extra" ? /* @__PURE__ */ h(G, { path: r, item: t }, `partial-item--${e}-${r.length}`) : /* @__PURE__ */ h(
106
106
  z,
107
107
  {
108
- name: [...r, e.name].join("."),
109
- item: e
108
+ name: [...r, t.name].join("."),
109
+ item: t
110
110
  },
111
- `form-item--${s}-${e.name}-${r.length}`
112
- )) }), m = (o, r, e, s) => {
113
- o.forEach((t) => {
114
- if (t.type === "form" && s(t, [...r, t.name].join("."), e[t.name]), t.type === "context") {
115
- m(t.childs, [...r, t.context], e[t.context] ?? {}, s);
111
+ `form-item--${e}-${t.name}-${r.length}`
112
+ )) }), V = (s, r, o, t) => {
113
+ s.forEach((e) => {
114
+ if (e.type === "form" && t(e, [...r, e.name].join("."), o[e.name]), e.type === "context") {
115
+ V(e.childs, [...r, e.context], o[e.context] ?? {}, t);
116
116
  return;
117
117
  }
118
- if (t.type === "layout" || t.type === "condition") {
119
- m(t.childs, r, e, s);
118
+ if (e.type === "layout" || e.type === "condition") {
119
+ V(e.childs, r, o, t);
120
120
  return;
121
121
  }
122
- t.type === "extra" && t.items.forEach(({ getForm: l, name: y }) => {
123
- m([l(y, () => {
124
- })], r, e, s);
122
+ e.type === "extra" && e.items.forEach(({ getForm: l, name: g }) => {
123
+ V([l(g, () => {
124
+ })], r, o, t);
125
125
  });
126
126
  });
127
- }, E = ({ scheme: o, values: r, path: e, forms: s }) => {
128
- o.forEach((t) => {
129
- if (t.type === "form") {
130
- const l = [...e, t.name].join(".");
131
- s[l].value !== void 0 && (r[t.name] = s[l].value);
127
+ }, p = ({ scheme: s, values: r, path: o, forms: t }) => {
128
+ s.forEach((e) => {
129
+ if (e.type === "form") {
130
+ const l = [...o, e.name].join(".");
131
+ t[l].value !== void 0 && (r[e.name] = t[l].value);
132
132
  }
133
- if (t.type === "context") {
134
- r[t.context] = {}, E({
135
- scheme: t.childs,
136
- path: [...e, t.context],
137
- values: r[t.context],
138
- forms: s
133
+ if (e.type === "context") {
134
+ r[e.context] = {}, p({
135
+ scheme: e.childs,
136
+ path: [...o, e.context],
137
+ values: r[e.context],
138
+ forms: t
139
139
  });
140
140
  return;
141
141
  }
142
- if (t.type === "layout") {
143
- E({ scheme: t.childs, path: e, values: r, forms: s });
142
+ if (e.type === "layout") {
143
+ p({ scheme: e.childs, path: o, values: r, forms: t });
144
144
  return;
145
145
  }
146
- if (t.type === "condition") {
147
- const l = s[t.depended]?.value;
148
- if (t.canActivate(l)) {
149
- E({ scheme: t.childs, path: e, values: r, forms: s });
146
+ if (e.type === "condition") {
147
+ const l = t[e.depended]?.value;
148
+ if (e.canActivate(l)) {
149
+ p({ scheme: e.childs, path: o, values: r, forms: t });
150
150
  return;
151
151
  }
152
152
  }
153
- t.type === "extra" && t.items.forEach(({ getForm: l, name: y }) => {
154
- E({ scheme: [l(y, () => {
155
- })], path: e, values: r, forms: s });
153
+ e.type === "extra" && e.items.forEach(({ getForm: l, name: g }) => {
154
+ p({ scheme: [l(g, () => {
155
+ })], path: o, values: r, forms: t });
156
156
  });
157
157
  });
158
- }, B = (o, r) => {
159
- const e = {};
160
- return E({ scheme: o, path: [], values: e, forms: r }), e;
161
- }, H = (o, r) => {
162
- const { onSubmit: e, onEqual: s, disabled: t, onDirty: l, onFormDirty: y, onChangeEvent: b, defaultValues: d } = r;
158
+ }, w = (s, r) => {
159
+ const o = {};
160
+ return p({ scheme: s, path: [], values: o, forms: r }), o;
161
+ }, H = (s, r) => {
162
+ const { onSubmit: o, onEqual: t, disabled: e, onDirty: l, onFormDirty: g, onChangeEvent: b, defaultValues: d } = r;
163
163
  let v = !1, C = !1, x = 0;
164
164
  const i = {}, f = {
165
165
  subscribers: [],
166
166
  names: {}
167
167
  };
168
- m(o, [], d ?? {}, (n, c, u) => {
168
+ V(s, [], d ?? {}, (n, c, u) => {
169
169
  i[c] = {
170
170
  error: null,
171
171
  isDirty: !1,
@@ -179,10 +179,10 @@ const j = N({}), M = (o) => {
179
179
  };
180
180
  });
181
181
  const F = (n, c) => {
182
- l?.({ name: n, isDirty: c }), c && x === 0 && y?.(!0), !c && x === 1 && y?.(!1), x += c ? 1 : -1;
182
+ l?.({ name: n, isDirty: c }), c && x === 0 && g?.(!0), !c && x === 1 && g?.(!1), x += c ? 1 : -1;
183
183
  };
184
184
  return {
185
- disabled: t,
185
+ disabled: e,
186
186
  activate() {
187
187
  v = !0;
188
188
  },
@@ -205,48 +205,48 @@ const j = N({}), M = (o) => {
205
205
  u && u.value !== c && this.onChange(n, c);
206
206
  },
207
207
  getValues() {
208
- return B(o, i);
208
+ return w(s, i);
209
209
  },
210
210
  async handleSubmit() {
211
- if (t)
211
+ if (e)
212
212
  return;
213
213
  C = !0;
214
214
  let n = !1, c = !1;
215
215
  for (const u in i) {
216
216
  const a = i[u];
217
217
  if (a.value !== void 0) {
218
- const h = a.validate(a.value);
219
- h && (c = !0, a.error = h, a.rerender(), !n && a.focus && (a.focus(), n = !0));
218
+ const y = a.validate(a.value);
219
+ y && (c = !0, a.error = y, a.rerender(), !n && a.focus && (a.focus(), n = !0));
220
220
  }
221
221
  }
222
222
  if (!c) {
223
223
  if (x === 0) {
224
- s?.();
224
+ t?.();
225
225
  return;
226
226
  }
227
- const u = B(o, i);
228
- await e(u, {
229
- setError: (a, h) => {
230
- const p = this.getForm(a);
231
- p.error = {
227
+ const u = w(s, i);
228
+ await o(u, {
229
+ setError: (a, y) => {
230
+ const m = this.getForm(a);
231
+ m.error = {
232
232
  error: !0,
233
- messages: [h.message]
234
- }, p.rerender();
233
+ messages: [y.message]
234
+ }, m.rerender();
235
235
  }
236
236
  });
237
237
  }
238
238
  },
239
239
  reset(n) {
240
240
  const c = [];
241
- m(o, [], n, (u, a, h) => {
242
- if (h === void 0 && i[a].value === void 0)
241
+ V(s, [], n, (u, a, y) => {
242
+ if (y === void 0 && i[a].value === void 0)
243
243
  return;
244
- if (f.names[a] && h === void 0) {
245
- c.push(a), i[a].value = h;
244
+ if (f.names[a] && y === void 0) {
245
+ c.push(a), i[a].value = y;
246
246
  return;
247
247
  }
248
- const p = h ?? u.defaultValue;
249
- i[a].value !== p && (c.push(a), this.onChange(a, p));
248
+ const m = y ?? u.defaultValue;
249
+ i[a].value !== m && (c.push(a), this.onChange(a, m));
250
250
  }), c.some((u) => f.names[u]) && f.subscribers.forEach(({ callback: u }) => {
251
251
  u();
252
252
  });
@@ -257,7 +257,7 @@ const j = N({}), M = (o) => {
257
257
  if (i[n].rerender = () => {
258
258
  }, i[n].focus = void 0, v) {
259
259
  i[n].value = void 0;
260
- const u = !w(i[n].defaultValue, i[n].initValue);
260
+ const u = !R(i[n].defaultValue, i[n].initValue);
261
261
  i[n].isDirty !== u && F(n, u), i[n].isDirty = u;
262
262
  }
263
263
  }
@@ -270,7 +270,7 @@ const j = N({}), M = (o) => {
270
270
  const u = { callback: c }, a = this.getForm(n);
271
271
  return a.subscribers.push(u), {
272
272
  unsubscribe: () => {
273
- a.subscribers = a.subscribers.filter((h) => h !== u);
273
+ a.subscribers = a.subscribers.filter((y) => y !== u);
274
274
  }
275
275
  };
276
276
  },
@@ -285,110 +285,111 @@ const j = N({}), M = (o) => {
285
285
  };
286
286
  },
287
287
  onChange(n, c) {
288
- const u = this.getForm(n), a = !w(c, u.initValue);
289
- u.isDirty !== a && F(n, a), u.isDirty = a, b?.({ name: n, value: c }), (u.error || C) && (u.error = u.validate(c) || null), u.value = c, u.rerender(), u.subscribers.forEach(({ callback: h }) => {
290
- h();
288
+ const u = this.getForm(n), a = !R(c, u.initValue);
289
+ u.isDirty !== a && F(n, a), u.isDirty = a, b?.({ name: n, value: c }), (u.error || C) && (u.error = u.validate(c) || null), u.value = c, u.rerender(), u.subscribers.forEach(({ callback: y }) => {
290
+ y();
291
291
  });
292
292
  }
293
293
  };
294
- }, U = (o, r) => {
295
- const e = P(null);
296
- e.current === null && (e.current = H(o, r));
297
- const s = e.current;
294
+ }, Q = (s, r) => {
295
+ const o = P(null);
296
+ o.current === null && (o.current = H(s, r));
297
+ const t = o.current;
298
298
  return {
299
- useValue: (t) => M(t),
300
- reset: (t) => {
301
- s.reset(t);
299
+ useValue: (e) => M(e),
300
+ reset: (e) => {
301
+ t.reset(e);
302
302
  },
303
- setFocus: (t) => {
304
- s.setFocus(t);
303
+ setFocus: (e) => {
304
+ t.setFocus(e);
305
305
  },
306
- setError: (t, l) => {
307
- s.setError(t, l);
306
+ setError: (e, l) => {
307
+ t.setError(e, l);
308
308
  },
309
- setValue: (t, l) => {
310
- s.setValue(t, l);
309
+ setValue: (e, l) => {
310
+ t.setValue(e, l);
311
311
  },
312
- getValues: () => s.getValues(),
312
+ getValues: () => t.getValues(),
313
313
  handleSubmit: async () => {
314
- await s.handleSubmit();
314
+ await t.handleSubmit();
315
315
  },
316
- Form: /* @__PURE__ */ g(J, { manager: s, scheme: o })
316
+ control: { manager: t, scheme: s }
317
317
  };
318
- }, J = ({ manager: o, scheme: r }) => (A(() => {
319
- o.activate();
318
+ }, U = ({ control: s, className: r }) => (A(() => {
319
+ s.manager.activate();
320
320
  }, []), D(() => () => {
321
- o.disactivate();
322
- }, []), /* @__PURE__ */ g(j.Provider, { value: o, children: /* @__PURE__ */ g(V, { scheme: r, path: [] }) })), $ = (o) => {
321
+ s.manager.disactivate();
322
+ }, []), /* @__PURE__ */ h(j.Provider, { value: s.manager, children: /* @__PURE__ */ h(E, { className: r, scheme: s.scheme, path: [] }) })), $ = (s) => {
323
323
  try {
324
- o();
324
+ s();
325
325
  } catch (r) {
326
326
  return r && typeof r == "string" ? {
327
327
  error: !0,
328
328
  messages: [r]
329
- } : r instanceof Array && r.every((e) => e && typeof e == "string") ? {
329
+ } : r instanceof Array && r.every((o) => o && typeof o == "string") ? {
330
330
  error: !0,
331
331
  messages: r
332
332
  } : {
333
333
  error: !0
334
334
  };
335
335
  }
336
- }, W = (o) => (r, e) => {
337
- const s = o.getRequireCheck(e), { validate: t, required: l } = e.$rules ?? {};
336
+ }, W = (s) => (r, o) => {
337
+ const t = s.getRequireCheck(o), { validate: e, required: l } = o.$rules ?? {};
338
338
  return {
339
339
  type: "form",
340
340
  name: r,
341
- defaultValue: o.defaultValue,
342
- Form: o.getForm(e),
343
- validate: (y) => {
341
+ defaultValue: s.defaultValue,
342
+ Form: s.getForm(o),
343
+ validate: (g) => {
344
344
  if (l) {
345
- const b = $(() => s(y));
345
+ const b = $(() => t(g));
346
346
  if (b)
347
347
  return b;
348
- if (t) {
349
- const d = $(() => t(y));
348
+ if (e) {
349
+ const d = $(() => e(g));
350
350
  if (d)
351
351
  return d;
352
352
  }
353
353
  return;
354
354
  }
355
- if (t && !$(() => s(y))) {
356
- const d = $(() => t(y));
355
+ if (e && !$(() => t(g))) {
356
+ const d = $(() => e(g));
357
357
  if (d)
358
358
  return d;
359
359
  }
360
360
  }
361
361
  };
362
- }, X = (o) => (r) => (...e) => ({
362
+ }, X = (s) => (r) => (...o) => ({
363
363
  type: "layout",
364
- Layout: o(r),
365
- childs: e
364
+ Layout: s(r),
365
+ childs: o
366
366
  }), Y = ({
367
- getItems: o,
367
+ getItems: s,
368
368
  getController: r
369
369
  }) => ({
370
370
  type: "extra",
371
- items: o((e) => (s) => ({
371
+ items: s((o) => (t) => ({
372
372
  type: "registry",
373
- name: e,
374
- getForm: s
373
+ name: o,
374
+ getForm: t
375
375
  })),
376
376
  getController: r
377
- }), Z = (o) => (...r) => ({
377
+ }), Z = (s) => (...r) => ({
378
378
  type: "context",
379
- context: o,
379
+ context: s,
380
380
  childs: r
381
- }), k = (o, r) => (...e) => ({
381
+ }), k = (s, r) => (...o) => ({
382
382
  type: "condition",
383
- depended: o,
383
+ depended: s,
384
384
  canActivate: r.canActivate,
385
- childs: e
385
+ childs: o
386
386
  });
387
387
  export {
388
388
  k as Condition,
389
389
  Z as Context,
390
+ U as FormLayout,
390
391
  Y as createExtraForm,
391
392
  W as createForm,
392
393
  X as createLayout,
393
- U as useForm
394
+ Q as useForm
394
395
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { useForm } from './useForm';
1
+ export { useForm, FormLayout } from './useForm';
2
2
  export { createForm } from './core/builders/create-form';
3
3
  export { createLayout } from './core/builders/create-layout';
4
4
  export { createExtraForm } from './core/builders/create-extra-form';
package/dist/useForm.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ExtractValues, ExtractFlatValues } from './core/extract';
2
2
  import { SchemeItems } from './core/types';
3
+ import { FormManager } from './manager/manager';
3
4
  import { DeepPartial, FieldValues } from './types';
4
5
  export type Copy<T> = {
5
6
  [K in keyof T]: T[K];
@@ -44,7 +45,10 @@ declare const useDynamicForm: (scheme: SchemeItems.All[], opts: MainOptions<Fiel
44
45
  [x: string]: any;
45
46
  };
46
47
  handleSubmit: () => Promise<void>;
47
- Form: import("react/jsx-runtime").JSX.Element;
48
+ control: {
49
+ manager: FormManager<FieldValues, FieldValues>;
50
+ scheme: [];
51
+ };
48
52
  };
49
53
  declare const useForm: <Items extends SchemeItems.All[], Values extends ExtractValues<Items[number]>, FlattenValues extends ExtractFlatValues<Items[number]>, Cloned extends Copy<Values>>(scheme: Items, opts: MainOptions<Values, FlattenValues, Cloned>) => {
50
54
  useValue: <K extends keyof FlattenValues>(name: K) => FlattenValues[K];
@@ -56,6 +60,17 @@ declare const useForm: <Items extends SchemeItems.All[], Values extends ExtractV
56
60
  setValue: <K extends keyof FlattenValues>(name: K, value: FlattenValues[K]) => void;
57
61
  getValues: () => DeepPartial<Cloned>;
58
62
  handleSubmit: () => Promise<void>;
59
- Form: import("react/jsx-runtime").JSX.Element;
63
+ control: {
64
+ manager: FormManager<FlattenValues, Cloned>;
65
+ scheme: Items;
66
+ };
60
67
  };
68
+ interface Props {
69
+ className?: string;
70
+ control: {
71
+ manager: FormManager<any, any>;
72
+ scheme: SchemeItems.All[];
73
+ };
74
+ }
75
+ export declare const FormLayout: ({ control, className }: Props) => import("react/jsx-runtime").JSX.Element;
61
76
  export { useForm, useDynamicForm };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@companix/formkit",
3
- "version": "0.0.04",
3
+ "version": "0.0.05",
4
4
  "module": "./dist/bundle.es.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
7
- "author": "Pavel Victorov",
7
+ "author": "Pavel Victorov.",
8
8
  "files": [
9
9
  "dist"
10
10
  ],