@mittwald/flow-react-components 0.1.0-alpha.200 → 0.1.0-alpha.202
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/react-hook-form.js +15 -15
- package/package.json +4 -4
package/dist/react-hook-form.js
CHANGED
|
@@ -12,25 +12,25 @@ import { a as g, A as y } from "./Action-B9iiMUXq.js";
|
|
|
12
12
|
const x = v({}), V = x.Provider, f = () => F(x);
|
|
13
13
|
function I(e) {
|
|
14
14
|
var i;
|
|
15
|
-
const { children: t, control: r, ...s } = e,
|
|
15
|
+
const { children: t, control: r, ...s } = e, u = (i = f().form) == null ? void 0 : i.control;
|
|
16
16
|
return /* @__PURE__ */ n.createElement(
|
|
17
17
|
A,
|
|
18
18
|
{
|
|
19
19
|
...s,
|
|
20
|
-
control: r ??
|
|
20
|
+
control: r ?? u,
|
|
21
21
|
render: (a) => {
|
|
22
22
|
var p;
|
|
23
23
|
const {
|
|
24
|
-
field:
|
|
24
|
+
field: c,
|
|
25
25
|
fieldState: { error: l, invalid: m }
|
|
26
26
|
} = a, o = {
|
|
27
|
-
...
|
|
27
|
+
...c,
|
|
28
28
|
isRequired: !!((p = s.rules) != null && p.required),
|
|
29
29
|
isInvalid: m,
|
|
30
30
|
validationBehavior: "aria",
|
|
31
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
|
-
refProp:
|
|
33
|
+
refProp: c.ref
|
|
34
34
|
}, d = {
|
|
35
35
|
Checkbox: o,
|
|
36
36
|
CheckboxGroup: o,
|
|
@@ -59,12 +59,12 @@ function I(e) {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
const _ = (e) => I, R = (e) => {
|
|
62
|
-
const { isStarted: t, hasFailedWithError: r, hasSucceeded: s, children:
|
|
62
|
+
const { isStarted: t, hasFailedWithError: r, hasSucceeded: s, children: u } = e, i = g.useNew({});
|
|
63
63
|
return S(() => {
|
|
64
64
|
s ? i.state.onSucceeded() : r ? i.state.onFailed(r) : t && i.state.onAsyncStart();
|
|
65
|
-
}, [t, r, s]), /* @__PURE__ */ n.createElement(y, { actionModel: i },
|
|
65
|
+
}, [t, r, s]), /* @__PURE__ */ n.createElement(y, { actionModel: i }, u);
|
|
66
66
|
}, D = (e) => {
|
|
67
|
-
const { children: t, isAsyncSubmit: r } = e, s = f().form, { isSubmitted:
|
|
67
|
+
const { children: t, isAsyncSubmit: r } = e, s = f().form, { isSubmitted: u, isSubmitting: i, isSubmitSuccessful: a, errors: c } = h(s), l = u && c && Object.entries(c).length > 0 ? c : void 0, m = u && a;
|
|
68
68
|
return /* @__PURE__ */ n.createElement(
|
|
69
69
|
R,
|
|
70
70
|
{
|
|
@@ -77,7 +77,7 @@ const _ = (e) => I, R = (e) => {
|
|
|
77
77
|
}, B = (e) => {
|
|
78
78
|
const { children: t, isAsyncSubmit: r } = e, s = {
|
|
79
79
|
ActionGroup: {
|
|
80
|
-
children: E((
|
|
80
|
+
children: E((u) => /* @__PURE__ */ n.createElement(D, { isAsyncSubmit: r }, u.children))
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
return /* @__PURE__ */ n.createElement(b, { props: s, mergeInParentContext: !0 }, t);
|
|
@@ -100,18 +100,18 @@ const _ = (e) => I, R = (e) => {
|
|
|
100
100
|
}, [r, t, e]), null;
|
|
101
101
|
};
|
|
102
102
|
function z(e) {
|
|
103
|
-
const { form: t, children: r, onSubmit: s, ...
|
|
103
|
+
const { form: t, children: r, onSubmit: s, ...u } = e, i = k(!1), a = (c) => {
|
|
104
104
|
const { isSubmitting: l, isValidating: m } = t.control._formState;
|
|
105
|
-
if (l || m) {
|
|
106
|
-
|
|
105
|
+
if (c.stopPropagation(), l || m) {
|
|
106
|
+
c.preventDefault();
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
t.handleSubmit((o) => {
|
|
110
|
-
const d = s(o);
|
|
110
|
+
const d = s(o, c);
|
|
111
111
|
return i.current = d instanceof Promise, d;
|
|
112
|
-
})(
|
|
112
|
+
})(c);
|
|
113
113
|
};
|
|
114
|
-
return /* @__PURE__ */ n.createElement(V, { value: { form: t } }, /* @__PURE__ */ n.createElement(B, { isAsyncSubmit: i }, /* @__PURE__ */ n.createElement("form", { ...
|
|
114
|
+
return /* @__PURE__ */ n.createElement(V, { value: { form: t } }, /* @__PURE__ */ n.createElement(B, { isAsyncSubmit: i }, /* @__PURE__ */ n.createElement("form", { ...u, onSubmit: a }, r), /* @__PURE__ */ n.createElement(G, null)));
|
|
115
115
|
}
|
|
116
116
|
export {
|
|
117
117
|
I as Field,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.202",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
"dependencies": {
|
|
285
285
|
"@chakra-ui/live-region": "^2.1.0",
|
|
286
286
|
"@internationalized/string-compiler": "^3.2.4",
|
|
287
|
-
"@mittwald/react-tunnel": "^0.1.0-alpha.
|
|
287
|
+
"@mittwald/react-tunnel": "^0.1.0-alpha.202",
|
|
288
288
|
"@mittwald/react-use-promise": "^2.3.13",
|
|
289
289
|
"@react-aria/utils": "^3.25.1",
|
|
290
290
|
"@react-types/shared": "^3.24.1",
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
},
|
|
311
311
|
"devDependencies": {
|
|
312
312
|
"@faker-js/faker": "^8.4.1",
|
|
313
|
-
"@mittwald/flow-design-tokens": "^0.1.0-alpha.
|
|
313
|
+
"@mittwald/flow-design-tokens": "^0.1.0-alpha.202",
|
|
314
314
|
"@mittwald/react-use-promise": "^2.3.13",
|
|
315
315
|
"@nx/storybook": "^19.5.6",
|
|
316
316
|
"@storybook/addon-a11y": "^8.2.7",
|
|
@@ -388,5 +388,5 @@
|
|
|
388
388
|
"optional": true
|
|
389
389
|
}
|
|
390
390
|
},
|
|
391
|
-
"gitHead": "
|
|
391
|
+
"gitHead": "17652a2cdb4d40d8efcfbd13f0e43f597339a1fd"
|
|
392
392
|
}
|