@mittwald/flow-react-components 0.1.0-alpha.186 → 0.1.0-alpha.187

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.
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
  /* */
3
- import o, { createContext as F, useContext as v, useEffect as S, useRef as k } from "react";
3
+ import n, { createContext as v, useContext as F, useEffect as S, useRef as k } from "react";
4
4
  import { Controller as A, useFormState as h } from "react-hook-form";
5
5
  import "./propsContext-DzAKlmhS.js";
6
6
  import { P as b } from "./PropsContextProvider-C6Z4XGp6.js";
@@ -9,11 +9,11 @@ import "remeda";
9
9
  import { d as E } from "./dynamic-ClpUSmEt.js";
10
10
  import { F as P } from "./FieldError-BZeDqyag.js";
11
11
  import { a as g, A as y } from "./Action-DZ-dUjY_.js";
12
- const x = F({}), V = x.Provider, f = () => v(x);
12
+ const x = v({}), V = x.Provider, f = () => F(x);
13
13
  function I(e) {
14
- var n;
15
- const { children: t, control: r, ...s } = e, c = (n = f().form) == null ? void 0 : n.control;
16
- return /* @__PURE__ */ o.createElement(
14
+ var i;
15
+ const { children: t, control: r, ...s } = e, c = (i = f().form) == null ? void 0 : i.control;
16
+ return /* @__PURE__ */ n.createElement(
17
17
  A,
18
18
  {
19
19
  ...s,
@@ -23,27 +23,30 @@ function I(e) {
23
23
  const {
24
24
  field: u,
25
25
  fieldState: { error: l, invalid: m }
26
- } = a, i = {
26
+ } = a, o = {
27
27
  ...u,
28
28
  isRequired: !!((p = s.rules) != null && p.required),
29
29
  isInvalid: m,
30
30
  validationBehavior: "aria",
31
- children: E((C) => /* @__PURE__ */ o.createElement(o.Fragment, null, C.children, /* @__PURE__ */ o.createElement(P, null, l == null ? void 0 : l.message))),
31
+ children: E((C) => /* @__PURE__ */ n.createElement(n.Fragment, null, C.children, /* @__PURE__ */ n.createElement(P, null, l == null ? void 0 : l.message))),
32
32
  ref: void 0,
33
33
  refProp: u.ref
34
34
  }, d = {
35
- Checkbox: i,
36
- CheckboxGroup: i,
37
- CheckboxButton: i,
38
- NumberField: i,
39
- RadioGroup: i,
40
- Switch: i,
41
- TextArea: i,
42
- TextField: i,
43
- Select: i,
44
- Slider: i
35
+ Checkbox: o,
36
+ CheckboxGroup: o,
37
+ CheckboxButton: o,
38
+ NumberField: o,
39
+ RadioGroup: o,
40
+ Switch: o,
41
+ TextArea: o,
42
+ TextField: o,
43
+ Select: {
44
+ ...o,
45
+ defaultSelectedKey: o.value
46
+ },
47
+ Slider: o
45
48
  };
46
- return /* @__PURE__ */ o.createElement(
49
+ return /* @__PURE__ */ n.createElement(
47
50
  b,
48
51
  {
49
52
  props: d,
@@ -55,17 +58,17 @@ function I(e) {
55
58
  }
56
59
  );
57
60
  }
58
- const z = (e) => I, R = (e) => {
59
- const { isStarted: t, hasFailedWithError: r, hasSucceeded: s, children: c } = e, n = g.useNew({});
61
+ const _ = (e) => I, R = (e) => {
62
+ const { isStarted: t, hasFailedWithError: r, hasSucceeded: s, children: c } = e, i = g.useNew({});
60
63
  return S(() => {
61
- s ? n.state.onSucceeded() : r ? n.state.onFailed(r) : t && n.state.onAsyncStart();
62
- }, [t, r, s]), /* @__PURE__ */ o.createElement(y, { actionModel: n }, c);
64
+ s ? i.state.onSucceeded() : r ? i.state.onFailed(r) : t && i.state.onAsyncStart();
65
+ }, [t, r, s]), /* @__PURE__ */ n.createElement(y, { actionModel: i }, c);
63
66
  }, D = (e) => {
64
- const { children: t, isAsyncSubmit: r } = e, s = f().form, { isSubmitted: c, isSubmitting: n, isSubmitSuccessful: a, errors: u } = h(s), l = c && u && Object.entries(u).length > 0 ? u : void 0, m = c && a;
65
- return /* @__PURE__ */ o.createElement(
67
+ const { children: t, isAsyncSubmit: r } = e, s = f().form, { isSubmitted: c, isSubmitting: i, isSubmitSuccessful: a, errors: u } = h(s), l = c && u && Object.entries(u).length > 0 ? u : void 0, m = c && a;
68
+ return /* @__PURE__ */ n.createElement(
66
69
  R,
67
70
  {
68
- isStarted: n && r.current,
71
+ isStarted: i && r.current,
69
72
  hasFailedWithError: l,
70
73
  hasSucceeded: m
71
74
  },
@@ -74,10 +77,10 @@ const z = (e) => I, R = (e) => {
74
77
  }, B = (e) => {
75
78
  const { children: t, isAsyncSubmit: r } = e, s = {
76
79
  ActionGroup: {
77
- children: E((c) => /* @__PURE__ */ o.createElement(D, { isAsyncSubmit: r }, c.children))
80
+ children: E((c) => /* @__PURE__ */ n.createElement(D, { isAsyncSubmit: r }, c.children))
78
81
  }
79
82
  };
80
- return /* @__PURE__ */ o.createElement(b, { props: s, mergeInParentContext: !0 }, t);
83
+ return /* @__PURE__ */ n.createElement(b, { props: s, mergeInParentContext: !0 }, t);
81
84
  }, G = () => {
82
85
  const e = f().form, { isValid: t, isSubmitted: r } = h(e);
83
86
  return S(() => {
@@ -96,22 +99,22 @@ const z = (e) => I, R = (e) => {
96
99
  });
97
100
  }, [r, t, e]), null;
98
101
  };
99
- function H(e) {
100
- const { form: t, children: r, onSubmit: s, ...c } = e, n = k(!1), a = (u) => {
102
+ function z(e) {
103
+ const { form: t, children: r, onSubmit: s, ...c } = e, i = k(!1), a = (u) => {
101
104
  const { isSubmitting: l, isValidating: m } = t.control._formState;
102
105
  if (l || m) {
103
106
  u.preventDefault();
104
107
  return;
105
108
  }
106
- t.handleSubmit((i) => {
107
- const d = s(i);
108
- return n.current = d instanceof Promise, d;
109
+ t.handleSubmit((o) => {
110
+ const d = s(o);
111
+ return i.current = d instanceof Promise, d;
109
112
  })(u);
110
113
  };
111
- return /* @__PURE__ */ o.createElement(V, { value: { form: t } }, /* @__PURE__ */ o.createElement(B, { isAsyncSubmit: n }, /* @__PURE__ */ o.createElement("form", { ...c, onSubmit: a }, r), /* @__PURE__ */ o.createElement(G, null)));
114
+ return /* @__PURE__ */ n.createElement(V, { value: { form: t } }, /* @__PURE__ */ n.createElement(B, { isAsyncSubmit: i }, /* @__PURE__ */ n.createElement("form", { ...c, onSubmit: a }, r), /* @__PURE__ */ n.createElement(G, null)));
112
115
  }
113
116
  export {
114
117
  I as Field,
115
- H as Form,
116
- z as typedField
118
+ z as Form,
119
+ _ as typedField
117
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.1.0-alpha.186",
3
+ "version": "0.1.0-alpha.187",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -280,7 +280,7 @@
280
280
  "dependencies": {
281
281
  "@chakra-ui/live-region": "^2.1.0",
282
282
  "@internationalized/string-compiler": "^3.2.4",
283
- "@mittwald/react-tunnel": "^0.1.0-alpha.186",
283
+ "@mittwald/react-tunnel": "^0.1.0-alpha.187",
284
284
  "@mittwald/react-use-promise": "^2.3.13",
285
285
  "@react-aria/utils": "^3.24.1",
286
286
  "@react-types/shared": "^3.23.1",
@@ -307,7 +307,7 @@
307
307
  },
308
308
  "devDependencies": {
309
309
  "@faker-js/faker": "^8.4.1",
310
- "@mittwald/flow-design-tokens": "^0.1.0-alpha.186",
310
+ "@mittwald/flow-design-tokens": "^0.1.0-alpha.187",
311
311
  "@mittwald/react-use-promise": "^2.3.13",
312
312
  "@nx/storybook": "^19.5.0",
313
313
  "@storybook/addon-a11y": "^8.2.4",
@@ -384,5 +384,5 @@
384
384
  "optional": true
385
385
  }
386
386
  },
387
- "gitHead": "43eddb40b2f6e8bd0ae1fc18f260a0a30487d6f2"
387
+ "gitHead": "795ad42dfe0c4e70d617200bdad92c3bdf3cce9b"
388
388
  }