@mittwald/flow-react-components 0.1.0-alpha.76 → 0.1.0-alpha.77
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,50 +1,50 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
var S = Object.defineProperty;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import
|
|
4
|
+
var A = (e, t, o) => t in e ? S(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
5
|
+
var d = (e, t, o) => (A(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
6
|
+
import b, { useRef as M } from "react";
|
|
7
7
|
import "./propsContext-CauylOgH.js";
|
|
8
|
-
import { P } from "./PropsContextProvider-DZvwqHLP.js";
|
|
8
|
+
import { P as y } from "./PropsContextProvider-DZvwqHLP.js";
|
|
9
9
|
import "@react-aria/utils";
|
|
10
10
|
import "remeda";
|
|
11
11
|
import "dot-prop";
|
|
12
|
-
import { u as
|
|
13
|
-
import { u as
|
|
14
|
-
import { makeObservable as
|
|
12
|
+
import { u as P } from "./useProps-Dx3m8kCJ.js";
|
|
13
|
+
import { u as C } from "./index-ViVxK7d1.js";
|
|
14
|
+
import { makeObservable as F, observable as k, runInAction as x } from "mobx";
|
|
15
15
|
import { u as I } from "./useSelector-DpU7_HMO.js";
|
|
16
16
|
const v = () => {
|
|
17
17
|
}, w = (e) => {
|
|
18
|
-
const t =
|
|
18
|
+
const t = C();
|
|
19
19
|
return (e == null ? void 0 : e.type) === "function" ? e.fn : (e == null ? void 0 : e.type) === "toggleModal" ? t.toggle : (e == null ? void 0 : e.type) === "openModal" ? t.open : (e == null ? void 0 : e.type) === "closeModal" ? t.close : v;
|
|
20
|
-
},
|
|
20
|
+
}, g = (e, t) => {
|
|
21
21
|
const o = [...t];
|
|
22
22
|
let s;
|
|
23
23
|
for (; o.length > 0; )
|
|
24
24
|
if (s = o.shift(), s) {
|
|
25
25
|
const i = s(...e);
|
|
26
26
|
if (i instanceof Promise)
|
|
27
|
-
return i.then(() =>
|
|
27
|
+
return i.then(() => g(e, o));
|
|
28
28
|
}
|
|
29
29
|
}, p = {
|
|
30
30
|
pending: 1e3,
|
|
31
31
|
succeeded: 1500,
|
|
32
32
|
failed: 2e3
|
|
33
33
|
};
|
|
34
|
-
class
|
|
34
|
+
class f {
|
|
35
35
|
constructor(t = {}) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
d(this, "feedback");
|
|
37
|
+
d(this, "executionCount", 0);
|
|
38
|
+
d(this, "state", "isIdle");
|
|
39
39
|
const { feedback: o = !1 } = t;
|
|
40
|
-
this.feedback = o,
|
|
41
|
-
state:
|
|
40
|
+
this.feedback = o, F(this, {
|
|
41
|
+
state: k
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
static useNew(t) {
|
|
45
|
-
return M(new
|
|
45
|
+
return M(new f(t)).current;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
onAsyncStart() {
|
|
48
48
|
const t = ++this.executionCount;
|
|
49
49
|
this.updateState("isExecuting"), setTimeout(() => this.startPending(t), p.pending);
|
|
50
50
|
}
|
|
@@ -60,31 +60,34 @@ class h {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
startFailedFeedback() {
|
|
63
|
-
this.
|
|
63
|
+
this.updateState("isFailed"), setTimeout(() => this.updateState("isIdle"), p.failed);
|
|
64
64
|
}
|
|
65
65
|
startSucceededFeedback() {
|
|
66
|
-
this.
|
|
66
|
+
this.updateState("isSucceeded"), setTimeout(() => this.updateState("isIdle"), p.succeeded);
|
|
67
67
|
}
|
|
68
68
|
onDone(t) {
|
|
69
|
+
if (!this.feedback) {
|
|
70
|
+
this.updateState("isIdle");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
69
73
|
t ? this.startSucceededFeedback() : this.startFailedFeedback();
|
|
70
74
|
}
|
|
71
75
|
startPending(t) {
|
|
72
|
-
this.state
|
|
76
|
+
this.state === "isExecuting" && t === this.executionCount && this.updateState("isPending");
|
|
73
77
|
}
|
|
74
78
|
useState() {
|
|
75
79
|
return I(() => this.state, [this]);
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
const W = (e, t) => {
|
|
79
|
-
const { action: o } =
|
|
83
|
+
const { action: o } = P("Action", {}), s = w(e), i = (...c) => g(c, [s, o]), n = f.useNew(t);
|
|
80
84
|
return {
|
|
81
85
|
callAction: i,
|
|
82
86
|
callActionWithStateHandling: (...c) => {
|
|
83
87
|
try {
|
|
84
|
-
n.onStart();
|
|
85
88
|
const a = i(...c);
|
|
86
89
|
if (a instanceof Promise)
|
|
87
|
-
return a.then(() => n.onSucceeded()).catch(() => n.onFailed());
|
|
90
|
+
return n.onAsyncStart(), a.then(() => n.onSucceeded()).catch(() => n.onFailed());
|
|
88
91
|
n.onSucceeded();
|
|
89
92
|
} catch {
|
|
90
93
|
n.onFailed();
|
|
@@ -93,25 +96,25 @@ const W = (e, t) => {
|
|
|
93
96
|
state: n
|
|
94
97
|
};
|
|
95
98
|
};
|
|
96
|
-
function
|
|
99
|
+
function h(e) {
|
|
97
100
|
return typeof e == "boolean" ? void 0 : e;
|
|
98
101
|
}
|
|
99
|
-
const
|
|
102
|
+
const r = {
|
|
100
103
|
fn: (e) => ({
|
|
101
104
|
type: "function",
|
|
102
105
|
fn: e
|
|
103
106
|
}),
|
|
104
107
|
openModal: (e) => ({
|
|
105
108
|
type: "openModal",
|
|
106
|
-
controller:
|
|
109
|
+
controller: h(e)
|
|
107
110
|
}),
|
|
108
111
|
closeModal: (e) => ({
|
|
109
112
|
type: "closeModal",
|
|
110
|
-
controller:
|
|
113
|
+
controller: h(e)
|
|
111
114
|
}),
|
|
112
115
|
toggleModal: (e) => ({
|
|
113
116
|
type: "toggleModal",
|
|
114
|
-
controller:
|
|
117
|
+
controller: h(e)
|
|
115
118
|
})
|
|
116
119
|
}, G = (e) => {
|
|
117
120
|
const {
|
|
@@ -121,9 +124,9 @@ const d = {
|
|
|
121
124
|
toggleModal: i,
|
|
122
125
|
openModal: n,
|
|
123
126
|
closeModal: u
|
|
124
|
-
} = e, c = s ?
|
|
127
|
+
} = e, c = s ? r.fn(s) : i ? r.toggleModal(i) : n ? r.openModal(n) : u ? r.closeModal(u) : void 0, a = W(c, {
|
|
125
128
|
feedback: o
|
|
126
|
-
}), l = a.state.useState(),
|
|
129
|
+
}), l = a.state.useState(), m = {
|
|
127
130
|
Button: {
|
|
128
131
|
onPress: a.callActionWithStateHandling,
|
|
129
132
|
isPending: l === "isPending",
|
|
@@ -135,11 +138,11 @@ const d = {
|
|
|
135
138
|
action: a.callAction
|
|
136
139
|
}
|
|
137
140
|
};
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
|
|
141
|
+
return /* @__PURE__ */ b.createElement(
|
|
142
|
+
y,
|
|
140
143
|
{
|
|
141
144
|
mergeInParentContext: !0,
|
|
142
|
-
props:
|
|
145
|
+
props: m,
|
|
143
146
|
dependencies: [l]
|
|
144
147
|
},
|
|
145
148
|
t
|
package/dist/Action.js
CHANGED
package/dist/CopyButton.js
CHANGED
|
@@ -15,7 +15,7 @@ import "@react-aria/utils";
|
|
|
15
15
|
import "remeda";
|
|
16
16
|
import "dot-prop";
|
|
17
17
|
import { f as C } from "./flowComponent-BuF0s2uG.js";
|
|
18
|
-
import { A as E } from "./Action-
|
|
18
|
+
import { A as E } from "./Action-DdvvHPkT.js";
|
|
19
19
|
const B = {
|
|
20
20
|
"de-DE": {
|
|
21
21
|
"copyButton.copy": "Kopieren"
|