@gurpreetmahi/easy.ui 0.0.0-stage → 0.2.0
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 +72 -2
- package/dist/easy.ui.css +2 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.cjs +6 -0
- package/dist/index.js +1333 -0
- package/package.json +55 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1333 @@
|
|
|
1
|
+
import { createContext as e, useCallback as t, useContext as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
2
|
+
import { createPortal as c } from "react-dom";
|
|
3
|
+
// \0rolldown/runtime.js
|
|
4
|
+
var l = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
5
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
6
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
7
|
+
}), d = /* @__PURE__ */ l(((e) => {
|
|
8
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
9
|
+
function r(e, n, r) {
|
|
10
|
+
var i = null;
|
|
11
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
12
|
+
else r = n;
|
|
13
|
+
return n = r.ref, {
|
|
14
|
+
$$typeof: t,
|
|
15
|
+
type: e,
|
|
16
|
+
key: i,
|
|
17
|
+
ref: n === void 0 ? null : n,
|
|
18
|
+
props: r
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
22
|
+
})), f = /* @__PURE__ */ l(((e) => {
|
|
23
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
24
|
+
function t(e) {
|
|
25
|
+
if (e == null) return null;
|
|
26
|
+
if (typeof e == "function") return e.$$typeof === A ? null : e.displayName || e.name || null;
|
|
27
|
+
if (typeof e == "string") return e;
|
|
28
|
+
switch (e) {
|
|
29
|
+
case v: return "Fragment";
|
|
30
|
+
case b: return "Profiler";
|
|
31
|
+
case y: return "StrictMode";
|
|
32
|
+
case w: return "Suspense";
|
|
33
|
+
case T: return "SuspenseList";
|
|
34
|
+
case O: return "Activity";
|
|
35
|
+
case k: return "ViewTransition";
|
|
36
|
+
}
|
|
37
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
38
|
+
case _: return "Portal";
|
|
39
|
+
case S: return e.displayName || "Context";
|
|
40
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
41
|
+
case C:
|
|
42
|
+
var n = e.render;
|
|
43
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
44
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
45
|
+
case D:
|
|
46
|
+
n = e._payload, e = e._init;
|
|
47
|
+
try {
|
|
48
|
+
return t(e(n));
|
|
49
|
+
} catch {}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function n(e) {
|
|
54
|
+
return "" + e;
|
|
55
|
+
}
|
|
56
|
+
function r(e) {
|
|
57
|
+
try {
|
|
58
|
+
n(e);
|
|
59
|
+
var t = !1;
|
|
60
|
+
} catch {
|
|
61
|
+
t = !0;
|
|
62
|
+
}
|
|
63
|
+
if (t) {
|
|
64
|
+
t = console;
|
|
65
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
66
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function i(e) {
|
|
70
|
+
if (e === v) return "<>";
|
|
71
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
72
|
+
try {
|
|
73
|
+
var n = t(e);
|
|
74
|
+
return n ? "<" + n + ">" : "<...>";
|
|
75
|
+
} catch {
|
|
76
|
+
return "<...>";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function a() {
|
|
80
|
+
var e = j.A;
|
|
81
|
+
return e === null ? null : e.getOwner();
|
|
82
|
+
}
|
|
83
|
+
function o() {
|
|
84
|
+
return Error("react-stack-top-frame");
|
|
85
|
+
}
|
|
86
|
+
function s(e) {
|
|
87
|
+
if (M.call(e, "key")) {
|
|
88
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
89
|
+
if (t && t.isReactWarning) return !1;
|
|
90
|
+
}
|
|
91
|
+
return e.key !== void 0;
|
|
92
|
+
}
|
|
93
|
+
function c(e, t) {
|
|
94
|
+
function n() {
|
|
95
|
+
F || (F = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
96
|
+
}
|
|
97
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
98
|
+
get: n,
|
|
99
|
+
configurable: !0
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function l() {
|
|
103
|
+
var e = t(this.type);
|
|
104
|
+
return I[e] || (I[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
105
|
+
}
|
|
106
|
+
function d(e, t, n, r, i, a) {
|
|
107
|
+
var o = n.ref;
|
|
108
|
+
return e = {
|
|
109
|
+
$$typeof: g,
|
|
110
|
+
type: e,
|
|
111
|
+
key: t,
|
|
112
|
+
props: n,
|
|
113
|
+
_owner: r
|
|
114
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
115
|
+
enumerable: !1,
|
|
116
|
+
value: null
|
|
117
|
+
}) : Object.defineProperty(e, "ref", {
|
|
118
|
+
enumerable: !1,
|
|
119
|
+
get: l
|
|
120
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
121
|
+
configurable: !1,
|
|
122
|
+
enumerable: !1,
|
|
123
|
+
writable: !0,
|
|
124
|
+
value: 0
|
|
125
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
126
|
+
configurable: !1,
|
|
127
|
+
enumerable: !1,
|
|
128
|
+
writable: !0,
|
|
129
|
+
value: null
|
|
130
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
131
|
+
configurable: !1,
|
|
132
|
+
enumerable: !1,
|
|
133
|
+
writable: !0,
|
|
134
|
+
value: i
|
|
135
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
136
|
+
configurable: !1,
|
|
137
|
+
enumerable: !1,
|
|
138
|
+
writable: !0,
|
|
139
|
+
value: a
|
|
140
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
141
|
+
}
|
|
142
|
+
function f(e, n, i, o, l, u) {
|
|
143
|
+
var f = n.children;
|
|
144
|
+
if (f !== void 0) {
|
|
145
|
+
if (o) {
|
|
146
|
+
if (N(f)) {
|
|
147
|
+
for (o = 0; o < f.length; o++) p(f[o]);
|
|
148
|
+
Object.freeze && Object.freeze(f);
|
|
149
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
150
|
+
} else p(f);
|
|
151
|
+
}
|
|
152
|
+
if (M.call(n, "key")) {
|
|
153
|
+
f = t(e);
|
|
154
|
+
var m = Object.keys(n).filter(function(e) {
|
|
155
|
+
return e !== "key";
|
|
156
|
+
});
|
|
157
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", z[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), z[f + o] = !0);
|
|
158
|
+
}
|
|
159
|
+
if (f = null, i !== void 0 && (r(i), f = "" + i), s(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
160
|
+
else i = n;
|
|
161
|
+
return f && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), l, u);
|
|
162
|
+
}
|
|
163
|
+
function p(e) {
|
|
164
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
165
|
+
}
|
|
166
|
+
function m(e) {
|
|
167
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
168
|
+
}
|
|
169
|
+
var h = u("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.view_transition"), A = Symbol.for("react.client.reference"), j = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, N = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
170
|
+
return null;
|
|
171
|
+
};
|
|
172
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
173
|
+
return e();
|
|
174
|
+
} };
|
|
175
|
+
var F, I = {}, L = h.react_stack_bottom_frame.bind(h, o)(), R = P(i(o)), z = {};
|
|
176
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
177
|
+
var r = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
178
|
+
if (r) {
|
|
179
|
+
var a = Error.stackTraceLimit;
|
|
180
|
+
Error.stackTraceLimit = 10;
|
|
181
|
+
var o = Error("react-stack-top-frame");
|
|
182
|
+
Error.stackTraceLimit = a;
|
|
183
|
+
} else o = L;
|
|
184
|
+
return f(e, t, n, !1, o, r ? P(i(e)) : R);
|
|
185
|
+
}, e.jsxs = function(e, t, n) {
|
|
186
|
+
var r = 1e4 > j.recentlyCreatedOwnerStacks++;
|
|
187
|
+
if (r) {
|
|
188
|
+
var a = Error.stackTraceLimit;
|
|
189
|
+
Error.stackTraceLimit = 10;
|
|
190
|
+
var o = Error("react-stack-top-frame");
|
|
191
|
+
Error.stackTraceLimit = a;
|
|
192
|
+
} else o = L;
|
|
193
|
+
return f(e, t, n, !0, o, r ? P(i(e)) : R);
|
|
194
|
+
};
|
|
195
|
+
})();
|
|
196
|
+
})), p = (/* @__PURE__ */ l(((e, t) => {
|
|
197
|
+
t.exports = process.env.NODE_ENV === "production" ? d() : f();
|
|
198
|
+
})))();
|
|
199
|
+
function m({ label: e, icon: t, size: n = "regular", className: r, ...i }) {
|
|
200
|
+
return /* @__PURE__ */ (0, p.jsxs)("button", {
|
|
201
|
+
type: "button",
|
|
202
|
+
className: [
|
|
203
|
+
"ribbon-button",
|
|
204
|
+
`ribbon-button--${n}`,
|
|
205
|
+
r
|
|
206
|
+
].filter(Boolean).join(" "),
|
|
207
|
+
...i,
|
|
208
|
+
children: [t ? /* @__PURE__ */ (0, p.jsx)("span", {
|
|
209
|
+
className: "ribbon-button__icon",
|
|
210
|
+
"aria-hidden": "true",
|
|
211
|
+
children: t
|
|
212
|
+
}) : null, /* @__PURE__ */ (0, p.jsx)("span", {
|
|
213
|
+
className: "ribbon-button__label",
|
|
214
|
+
children: e
|
|
215
|
+
})]
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
// src/ribbon/RibbonCarousel.tsx
|
|
219
|
+
function h({ parents: e, activeParentId: t, defaultParentId: n, visibleItems: r = 3, onParentChange: i, onItemClick: a }) {
|
|
220
|
+
let o = Math.max(1, Math.floor(r)), c = e.filter((e) => !e.disabled), l = e.find((e) => !e.disabled), u = e.some((e) => e.id === n && !e.disabled) ? n : l?.id, [d, f] = s(u), [h, g] = s({
|
|
221
|
+
parentId: u,
|
|
222
|
+
index: 0
|
|
223
|
+
}), _ = t ?? d, v = e.find((e) => e.id === _ && !e.disabled) ?? l, y = c.findIndex((e) => e.id === v?.id), b = c.length > 1, x = v?.children ?? [], S = Math.max(1, Math.ceil(x.length / o)), C = h.parentId === v?.id ? Math.min(h.index, S - 1) : 0, w = x.slice(C * o, (C + 1) * o);
|
|
224
|
+
function T(e) {
|
|
225
|
+
t === void 0 && f(e.id), g({
|
|
226
|
+
parentId: e.id,
|
|
227
|
+
index: 0
|
|
228
|
+
}), i?.(e.id);
|
|
229
|
+
}
|
|
230
|
+
function E(e) {
|
|
231
|
+
if (!b || y < 0) return;
|
|
232
|
+
let t = Math.min(c.length - 1, Math.max(0, y + e)), n = c[t];
|
|
233
|
+
n && n.id !== v?.id && T(n);
|
|
234
|
+
}
|
|
235
|
+
return e.length === 0 ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
236
|
+
className: "ribbon-carousel__empty",
|
|
237
|
+
children: "No carousel parents available."
|
|
238
|
+
}) : /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
239
|
+
className: "ribbon-carousel",
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ (0, p.jsxs)("div", {
|
|
242
|
+
className: "ribbon-carousel__parent-nav",
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ (0, p.jsx)("button", {
|
|
245
|
+
type: "button",
|
|
246
|
+
className: "ribbon-carousel__parent-arrow",
|
|
247
|
+
disabled: !b || y <= 0,
|
|
248
|
+
"aria-label": "Previous parent group",
|
|
249
|
+
onClick: () => E(-1),
|
|
250
|
+
children: "‹"
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ (0, p.jsx)("div", {
|
|
253
|
+
className: "ribbon-carousel__parents",
|
|
254
|
+
role: "tablist",
|
|
255
|
+
"aria-label": "Carousel parents",
|
|
256
|
+
children: e.map((e) => /* @__PURE__ */ (0, p.jsxs)("button", {
|
|
257
|
+
type: "button",
|
|
258
|
+
role: "tab",
|
|
259
|
+
className: ["ribbon-carousel__parent", e.id === v?.id ? "is-active" : ""].filter(Boolean).join(" "),
|
|
260
|
+
disabled: e.disabled,
|
|
261
|
+
"aria-selected": e.id === v?.id,
|
|
262
|
+
onClick: () => T(e),
|
|
263
|
+
children: [e.icon ? /* @__PURE__ */ (0, p.jsx)("span", {
|
|
264
|
+
"aria-hidden": "true",
|
|
265
|
+
children: e.icon
|
|
266
|
+
}) : null, /* @__PURE__ */ (0, p.jsx)("span", { children: e.label })]
|
|
267
|
+
}, e.id))
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ (0, p.jsx)("button", {
|
|
270
|
+
type: "button",
|
|
271
|
+
className: "ribbon-carousel__parent-arrow",
|
|
272
|
+
disabled: !b || y < 0 || y >= c.length - 1,
|
|
273
|
+
"aria-label": "Next parent group",
|
|
274
|
+
onClick: () => E(1),
|
|
275
|
+
children: "›"
|
|
276
|
+
})
|
|
277
|
+
]
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ (0, p.jsxs)("div", {
|
|
280
|
+
className: "ribbon-carousel__items-row",
|
|
281
|
+
children: [
|
|
282
|
+
/* @__PURE__ */ (0, p.jsx)("button", {
|
|
283
|
+
type: "button",
|
|
284
|
+
className: "ribbon-carousel__arrow",
|
|
285
|
+
disabled: C === 0,
|
|
286
|
+
"aria-label": "Previous carousel items",
|
|
287
|
+
onClick: () => g({
|
|
288
|
+
parentId: v?.id,
|
|
289
|
+
index: Math.max(0, C - 1)
|
|
290
|
+
}),
|
|
291
|
+
children: "‹"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ (0, p.jsxs)("div", {
|
|
294
|
+
className: "ribbon-carousel__items",
|
|
295
|
+
role: "tabpanel",
|
|
296
|
+
"aria-live": "polite",
|
|
297
|
+
children: [w.map((e) => /* @__PURE__ */ (0, p.jsx)(m, {
|
|
298
|
+
className: "ribbon-carousel__item",
|
|
299
|
+
label: e.label,
|
|
300
|
+
icon: e.icon,
|
|
301
|
+
size: e.size ?? "compact",
|
|
302
|
+
disabled: e.disabled,
|
|
303
|
+
onClick: () => {
|
|
304
|
+
e.onClick?.(e.id), v && a?.(e, v.id);
|
|
305
|
+
}
|
|
306
|
+
}, `${v?.id ?? "parent"}-${e.id}`)), w.length === 0 ? /* @__PURE__ */ (0, p.jsx)("span", {
|
|
307
|
+
className: "ribbon-carousel__empty",
|
|
308
|
+
children: "No items for this parent."
|
|
309
|
+
}) : null]
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ (0, p.jsx)("button", {
|
|
312
|
+
type: "button",
|
|
313
|
+
className: "ribbon-carousel__arrow",
|
|
314
|
+
disabled: C >= S - 1,
|
|
315
|
+
"aria-label": "Next carousel items",
|
|
316
|
+
onClick: () => g({
|
|
317
|
+
parentId: v?.id,
|
|
318
|
+
index: Math.min(S - 1, C + 1)
|
|
319
|
+
}),
|
|
320
|
+
children: "›"
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ (0, p.jsxs)("div", {
|
|
325
|
+
className: "ribbon-carousel__status",
|
|
326
|
+
"aria-hidden": "true",
|
|
327
|
+
children: [
|
|
328
|
+
C + 1,
|
|
329
|
+
" / ",
|
|
330
|
+
S
|
|
331
|
+
]
|
|
332
|
+
})
|
|
333
|
+
]
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
// src/ribbon/RibbonDropdown.tsx
|
|
337
|
+
function g({ label: e, icon: t, size: n = "regular", disabled: a, options: l, onSelect: u }) {
|
|
338
|
+
let [d, f] = s(!1), m = o(null), h = o(null), g = o(null), [_, v] = s({
|
|
339
|
+
top: 0,
|
|
340
|
+
left: 0,
|
|
341
|
+
width: 170
|
|
342
|
+
}), y = i();
|
|
343
|
+
function b() {
|
|
344
|
+
if (!h.current) return;
|
|
345
|
+
let e = h.current.getBoundingClientRect(), t = Math.max(e.width, 170), n = Math.max(44, l.length * 38 + 12), r = window.innerHeight - e.bottom < n && e.top > n ? e.top - n - 4 : e.bottom + 4;
|
|
346
|
+
v({
|
|
347
|
+
top: Math.max(8, r),
|
|
348
|
+
left: Math.max(8, Math.min(e.left, window.innerWidth - t - 8)),
|
|
349
|
+
width: t
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
return r(() => {
|
|
353
|
+
function e(e) {
|
|
354
|
+
if (!m.current) return;
|
|
355
|
+
let t = e.target, n = m.current.contains(t), r = g.current?.contains(t);
|
|
356
|
+
!n && !r && f(!1);
|
|
357
|
+
}
|
|
358
|
+
function t(e) {
|
|
359
|
+
e.key === "Escape" && f(!1);
|
|
360
|
+
}
|
|
361
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
362
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
363
|
+
};
|
|
364
|
+
}, []), r(() => {
|
|
365
|
+
if (!d) return;
|
|
366
|
+
b();
|
|
367
|
+
function e() {
|
|
368
|
+
b();
|
|
369
|
+
}
|
|
370
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
371
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
372
|
+
};
|
|
373
|
+
}, [d, l.length]), /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
374
|
+
ref: m,
|
|
375
|
+
className: [
|
|
376
|
+
"ribbon-dropdown",
|
|
377
|
+
`ribbon-dropdown--${n}`,
|
|
378
|
+
d ? "is-open" : ""
|
|
379
|
+
].filter(Boolean).join(" "),
|
|
380
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("button", {
|
|
381
|
+
ref: h,
|
|
382
|
+
type: "button",
|
|
383
|
+
className: [
|
|
384
|
+
"ribbon-button",
|
|
385
|
+
`ribbon-button--${n}`,
|
|
386
|
+
"ribbon-dropdown__trigger"
|
|
387
|
+
].filter(Boolean).join(" "),
|
|
388
|
+
disabled: a,
|
|
389
|
+
"aria-haspopup": "menu",
|
|
390
|
+
"aria-expanded": d,
|
|
391
|
+
"aria-controls": y,
|
|
392
|
+
onClick: () => f((e) => !e),
|
|
393
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
394
|
+
className: "ribbon-dropdown__head",
|
|
395
|
+
children: [t ? /* @__PURE__ */ (0, p.jsx)("span", {
|
|
396
|
+
className: "ribbon-button__icon",
|
|
397
|
+
"aria-hidden": "true",
|
|
398
|
+
children: t
|
|
399
|
+
}) : null, /* @__PURE__ */ (0, p.jsx)("span", {
|
|
400
|
+
className: "ribbon-button__label",
|
|
401
|
+
children: e
|
|
402
|
+
})]
|
|
403
|
+
}), /* @__PURE__ */ (0, p.jsx)("span", {
|
|
404
|
+
className: "ribbon-dropdown__caret",
|
|
405
|
+
"aria-hidden": "true",
|
|
406
|
+
children: "▾"
|
|
407
|
+
})]
|
|
408
|
+
}), d ? c(/* @__PURE__ */ (0, p.jsx)("ul", {
|
|
409
|
+
id: y,
|
|
410
|
+
ref: g,
|
|
411
|
+
role: "menu",
|
|
412
|
+
className: "ribbon-dropdown__menu ribbon-dropdown__menu--portal",
|
|
413
|
+
"aria-label": `${e} options`,
|
|
414
|
+
style: {
|
|
415
|
+
top: `${_.top}px`,
|
|
416
|
+
left: `${_.left}px`,
|
|
417
|
+
width: `${_.width}px`
|
|
418
|
+
},
|
|
419
|
+
children: l.map((e) => /* @__PURE__ */ (0, p.jsx)("li", {
|
|
420
|
+
role: "none",
|
|
421
|
+
className: "ribbon-dropdown__menu-item",
|
|
422
|
+
children: /* @__PURE__ */ (0, p.jsxs)("button", {
|
|
423
|
+
type: "button",
|
|
424
|
+
role: "menuitem",
|
|
425
|
+
className: "ribbon-dropdown__option-button",
|
|
426
|
+
onClick: () => {
|
|
427
|
+
u(e.id), f(!1);
|
|
428
|
+
},
|
|
429
|
+
children: [/* @__PURE__ */ (0, p.jsx)("span", {
|
|
430
|
+
className: "ribbon-dropdown__option-icon",
|
|
431
|
+
"aria-hidden": "true",
|
|
432
|
+
children: e.icon ?? "•"
|
|
433
|
+
}), /* @__PURE__ */ (0, p.jsx)("span", {
|
|
434
|
+
className: "ribbon-dropdown__option-label",
|
|
435
|
+
children: e.label
|
|
436
|
+
})]
|
|
437
|
+
})
|
|
438
|
+
}, e.id))
|
|
439
|
+
}), document.body) : null]
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
// src/ribbon/Ribbon.tsx
|
|
443
|
+
function _({ tabs: e, groups: t, activeTabId: n, onTabChange: r, onItemClick: i, className: a, ariaLabel: o = "Application ribbon" }) {
|
|
444
|
+
return /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
445
|
+
className: ["ribbon", a].filter(Boolean).join(" "),
|
|
446
|
+
"aria-label": o,
|
|
447
|
+
children: [/* @__PURE__ */ (0, p.jsx)("nav", {
|
|
448
|
+
className: "ribbon__tabbar",
|
|
449
|
+
"aria-label": "Ribbon tabs",
|
|
450
|
+
children: e.map((e) => /* @__PURE__ */ (0, p.jsx)("button", {
|
|
451
|
+
type: "button",
|
|
452
|
+
className: e.id === n ? "ribbon__tab is-active" : "ribbon__tab",
|
|
453
|
+
onClick: () => r(e.id),
|
|
454
|
+
"aria-selected": e.id === n,
|
|
455
|
+
role: "tab",
|
|
456
|
+
children: e.label
|
|
457
|
+
}, e.id))
|
|
458
|
+
}), /* @__PURE__ */ (0, p.jsx)("div", {
|
|
459
|
+
className: "ribbon__surface",
|
|
460
|
+
role: "tabpanel",
|
|
461
|
+
"aria-label": `${n} commands`,
|
|
462
|
+
children: t.map((e) => /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
463
|
+
className: "ribbon__group",
|
|
464
|
+
"aria-label": e.title,
|
|
465
|
+
children: [
|
|
466
|
+
/* @__PURE__ */ (0, p.jsx)("div", {
|
|
467
|
+
className: "ribbon__group-items",
|
|
468
|
+
children: (e.items ?? []).map((e) => e.options && e.options.length > 0 ? /* @__PURE__ */ (0, p.jsx)(g, {
|
|
469
|
+
label: e.label,
|
|
470
|
+
icon: e.icon,
|
|
471
|
+
size: e.size,
|
|
472
|
+
disabled: e.disabled,
|
|
473
|
+
options: e.options,
|
|
474
|
+
onSelect: (t) => {
|
|
475
|
+
e.onClick?.(e.id), i?.(e, t);
|
|
476
|
+
}
|
|
477
|
+
}, e.id) : /* @__PURE__ */ (0, p.jsx)(m, {
|
|
478
|
+
label: e.label,
|
|
479
|
+
icon: e.icon,
|
|
480
|
+
size: e.size,
|
|
481
|
+
disabled: e.disabled,
|
|
482
|
+
onClick: () => {
|
|
483
|
+
e.onClick?.(e.id), i?.(e);
|
|
484
|
+
}
|
|
485
|
+
}, e.id))
|
|
486
|
+
}),
|
|
487
|
+
e.carousel ? /* @__PURE__ */ (0, p.jsx)(h, {
|
|
488
|
+
...e.carousel,
|
|
489
|
+
onItemClick: (e, t) => i?.(e, void 0, t)
|
|
490
|
+
}) : null,
|
|
491
|
+
/* @__PURE__ */ (0, p.jsx)("h3", {
|
|
492
|
+
className: "ribbon__group-title",
|
|
493
|
+
children: e.title
|
|
494
|
+
})
|
|
495
|
+
]
|
|
496
|
+
}, e.id))
|
|
497
|
+
})]
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
// src/ribbon/RibbonSplitButton.tsx
|
|
501
|
+
function v({ size: e = "regular", className: t, upperLabel: n, upperIcon: r, upperButtonProps: i, lowerLabel: a, lowerIcon: o, lowerButtonProps: s }) {
|
|
502
|
+
return /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
503
|
+
className: [
|
|
504
|
+
"ribbon-split-button",
|
|
505
|
+
`ribbon-split-button--${e}`,
|
|
506
|
+
t
|
|
507
|
+
].filter(Boolean).join(" "),
|
|
508
|
+
role: "group",
|
|
509
|
+
"aria-label": `${n} and ${a}`,
|
|
510
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("button", {
|
|
511
|
+
type: "button",
|
|
512
|
+
className: "ribbon-split-button__half ribbon-split-button__half--upper",
|
|
513
|
+
...i,
|
|
514
|
+
children: [r ? /* @__PURE__ */ (0, p.jsx)("span", {
|
|
515
|
+
className: "ribbon-split-button__icon",
|
|
516
|
+
"aria-hidden": "true",
|
|
517
|
+
children: r
|
|
518
|
+
}) : null, /* @__PURE__ */ (0, p.jsx)("span", {
|
|
519
|
+
className: "ribbon-split-button__label",
|
|
520
|
+
children: n
|
|
521
|
+
})]
|
|
522
|
+
}), /* @__PURE__ */ (0, p.jsxs)("button", {
|
|
523
|
+
type: "button",
|
|
524
|
+
className: "ribbon-split-button__half ribbon-split-button__half--lower",
|
|
525
|
+
...s,
|
|
526
|
+
children: [o ? /* @__PURE__ */ (0, p.jsx)("span", {
|
|
527
|
+
className: "ribbon-split-button__icon",
|
|
528
|
+
"aria-hidden": "true",
|
|
529
|
+
children: o
|
|
530
|
+
}) : null, /* @__PURE__ */ (0, p.jsx)("span", {
|
|
531
|
+
className: "ribbon-split-button__label",
|
|
532
|
+
children: a
|
|
533
|
+
})]
|
|
534
|
+
})]
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
// src/easy-connectors/client.ts
|
|
538
|
+
var y = class {
|
|
539
|
+
baseUrl;
|
|
540
|
+
apiKey;
|
|
541
|
+
constructor(e, t) {
|
|
542
|
+
this.baseUrl = e, this.apiKey = t;
|
|
543
|
+
}
|
|
544
|
+
async listConnectors() {
|
|
545
|
+
return this.request("/api/connectors");
|
|
546
|
+
}
|
|
547
|
+
async getConnector(e) {
|
|
548
|
+
return this.request(`/api/connectors/${encodeURIComponent(e)}`);
|
|
549
|
+
}
|
|
550
|
+
async createConnector(e) {
|
|
551
|
+
return this.request("/api/connectors", {
|
|
552
|
+
method: "POST",
|
|
553
|
+
body: JSON.stringify(e)
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
async updateConnector(e, t) {
|
|
557
|
+
return this.request(`/api/connectors/${encodeURIComponent(e)}`, {
|
|
558
|
+
method: "PUT",
|
|
559
|
+
body: JSON.stringify(t)
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
async deleteConnector(e) {
|
|
563
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}`, { method: "DELETE" });
|
|
564
|
+
}
|
|
565
|
+
async enableConnector(e) {
|
|
566
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}/enable`, { method: "POST" });
|
|
567
|
+
}
|
|
568
|
+
async disableConnector(e) {
|
|
569
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}/disable`, { method: "POST" });
|
|
570
|
+
}
|
|
571
|
+
async runConnector(e) {
|
|
572
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}/run`, { method: "POST" });
|
|
573
|
+
}
|
|
574
|
+
async getRuns(e, t = 20) {
|
|
575
|
+
return this.request(`/api/connectors/${encodeURIComponent(e)}/runs?take=${Math.min(100, Math.max(1, t))}`);
|
|
576
|
+
}
|
|
577
|
+
async request(e, t) {
|
|
578
|
+
let n = new Headers(t?.headers);
|
|
579
|
+
n.set("Accept", "application/json"), t?.body && n.set("Content-Type", "application/json"), this.apiKey && n.set("X-Api-Key", this.apiKey);
|
|
580
|
+
let r = await fetch(new URL(e, this.baseUrl), {
|
|
581
|
+
...t,
|
|
582
|
+
headers: n
|
|
583
|
+
});
|
|
584
|
+
if (!r.ok) {
|
|
585
|
+
let e = `${r.status} ${r.statusText}`;
|
|
586
|
+
try {
|
|
587
|
+
let t = await r.json();
|
|
588
|
+
t.errors && t.errors.length > 0 && (e = t.errors.join("; "));
|
|
589
|
+
} catch {}
|
|
590
|
+
throw Error(e);
|
|
591
|
+
}
|
|
592
|
+
if (r.status !== 204) return await r.json();
|
|
593
|
+
}
|
|
594
|
+
}, b = e(null);
|
|
595
|
+
function x({ baseUrl: e = "http://localhost:5088", apiKey: t, client: n, children: r }) {
|
|
596
|
+
let i = a(() => ({ client: n ?? new y(e, t) }), [
|
|
597
|
+
t,
|
|
598
|
+
e,
|
|
599
|
+
n
|
|
600
|
+
]);
|
|
601
|
+
return /* @__PURE__ */ (0, p.jsx)(b.Provider, {
|
|
602
|
+
value: i,
|
|
603
|
+
children: r
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
function S() {
|
|
607
|
+
let e = n(b);
|
|
608
|
+
if (!e) throw Error("useEasyConnectors must be used within EasyConnectorsProvider.");
|
|
609
|
+
return e;
|
|
610
|
+
}
|
|
611
|
+
// src/easy-connectors/ConnectorKindIcon.tsx
|
|
612
|
+
function C(e) {
|
|
613
|
+
return /* @__PURE__ */ (0, p.jsx)("svg", {
|
|
614
|
+
viewBox: "0 0 24 24",
|
|
615
|
+
fill: "none",
|
|
616
|
+
stroke: "currentColor",
|
|
617
|
+
strokeWidth: "1.8",
|
|
618
|
+
strokeLinecap: "round",
|
|
619
|
+
strokeLinejoin: "round",
|
|
620
|
+
"aria-hidden": "true",
|
|
621
|
+
...e
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
function w() {
|
|
625
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)("path", { d: "M3.5 8.2h6.1l1.5 1.8h9.4" }), /* @__PURE__ */ (0, p.jsx)("path", { d: "M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z" })] });
|
|
626
|
+
}
|
|
627
|
+
function T() {
|
|
628
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)("rect", {
|
|
629
|
+
x: "4",
|
|
630
|
+
y: "5",
|
|
631
|
+
width: "16",
|
|
632
|
+
height: "14",
|
|
633
|
+
rx: "1.5"
|
|
634
|
+
}), /* @__PURE__ */ (0, p.jsx)("path", { d: "M4 10h16M9.5 5v14M14.5 5v14" })] });
|
|
635
|
+
}
|
|
636
|
+
function E() {
|
|
637
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)("path", { d: "M9 12h6" }), /* @__PURE__ */ (0, p.jsx)("path", { d: "m13 9 3 3-3 3" })] });
|
|
638
|
+
}
|
|
639
|
+
function D() {
|
|
640
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)("rect", {
|
|
641
|
+
x: "8",
|
|
642
|
+
y: "11",
|
|
643
|
+
width: "8",
|
|
644
|
+
height: "7",
|
|
645
|
+
rx: "1.2"
|
|
646
|
+
}), /* @__PURE__ */ (0, p.jsx)("path", { d: "M10 11V9a2 2 0 1 1 4 0v2" })] });
|
|
647
|
+
}
|
|
648
|
+
function O({ kind: e, className: t, ...n }) {
|
|
649
|
+
return /* @__PURE__ */ (0, p.jsxs)(C, {
|
|
650
|
+
className: ["ec-kind-icon", t].filter(Boolean).join(" "),
|
|
651
|
+
...n,
|
|
652
|
+
children: [
|
|
653
|
+
e === "FolderToFolder" ? /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)(w, {}), /* @__PURE__ */ (0, p.jsx)(E, {})] }) : null,
|
|
654
|
+
e === "FolderToTable" ? /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
655
|
+
/* @__PURE__ */ (0, p.jsx)(w, {}),
|
|
656
|
+
/* @__PURE__ */ (0, p.jsx)(E, {}),
|
|
657
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M17 6.5h3" }),
|
|
658
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M18.5 5v3" })
|
|
659
|
+
] }) : null,
|
|
660
|
+
e === "TableToFolder" ? /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
661
|
+
/* @__PURE__ */ (0, p.jsx)(T, {}),
|
|
662
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M7 12h10" }),
|
|
663
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "m11 9-3 3 3 3" }),
|
|
664
|
+
/* @__PURE__ */ (0, p.jsx)(w, {})
|
|
665
|
+
] }) : null,
|
|
666
|
+
e === "FolderToSftp" ? /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
667
|
+
/* @__PURE__ */ (0, p.jsx)(w, {}),
|
|
668
|
+
/* @__PURE__ */ (0, p.jsx)(E, {}),
|
|
669
|
+
/* @__PURE__ */ (0, p.jsx)(D, {})
|
|
670
|
+
] }) : null,
|
|
671
|
+
e === "SftpToFolder" ? /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
672
|
+
/* @__PURE__ */ (0, p.jsx)(D, {}),
|
|
673
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M8 12h6" }),
|
|
674
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "m11 9-3 3 3 3" }),
|
|
675
|
+
/* @__PURE__ */ (0, p.jsx)(w, {})
|
|
676
|
+
] }) : null
|
|
677
|
+
]
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
// src/easy-connectors/EndpointKindIcon.tsx
|
|
681
|
+
function k(e) {
|
|
682
|
+
return /* @__PURE__ */ (0, p.jsx)("svg", {
|
|
683
|
+
viewBox: "0 0 24 24",
|
|
684
|
+
fill: "none",
|
|
685
|
+
stroke: "currentColor",
|
|
686
|
+
strokeWidth: "1.8",
|
|
687
|
+
strokeLinecap: "round",
|
|
688
|
+
strokeLinejoin: "round",
|
|
689
|
+
"aria-hidden": "true",
|
|
690
|
+
...e
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
function A() {
|
|
694
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)("path", { d: "M3.5 8.2h6.1l1.5 1.8h9.4" }), /* @__PURE__ */ (0, p.jsx)("path", { d: "M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z" })] });
|
|
695
|
+
}
|
|
696
|
+
function j() {
|
|
697
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsx)("rect", {
|
|
698
|
+
x: "4",
|
|
699
|
+
y: "5",
|
|
700
|
+
width: "16",
|
|
701
|
+
height: "14",
|
|
702
|
+
rx: "1.5"
|
|
703
|
+
}), /* @__PURE__ */ (0, p.jsx)("path", { d: "M4 10h16M9.5 5v14M14.5 5v14" })] });
|
|
704
|
+
}
|
|
705
|
+
function M() {
|
|
706
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
707
|
+
/* @__PURE__ */ (0, p.jsx)("rect", {
|
|
708
|
+
x: "8",
|
|
709
|
+
y: "11",
|
|
710
|
+
width: "8",
|
|
711
|
+
height: "7",
|
|
712
|
+
rx: "1.2"
|
|
713
|
+
}),
|
|
714
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M10 11V9a2 2 0 1 1 4 0v2" }),
|
|
715
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M3 17h3" }),
|
|
716
|
+
/* @__PURE__ */ (0, p.jsx)("path", { d: "M18 17h3" })
|
|
717
|
+
] });
|
|
718
|
+
}
|
|
719
|
+
function N({ endpoint: e, className: t, ...n }) {
|
|
720
|
+
return /* @__PURE__ */ (0, p.jsxs)(k, {
|
|
721
|
+
className: ["ec-endpoint-icon", t].filter(Boolean).join(" "),
|
|
722
|
+
...n,
|
|
723
|
+
children: [
|
|
724
|
+
e === "Folder" ? /* @__PURE__ */ (0, p.jsx)(A, {}) : null,
|
|
725
|
+
e === "Table" ? /* @__PURE__ */ (0, p.jsx)(j, {}) : null,
|
|
726
|
+
e === "Sftp" ? /* @__PURE__ */ (0, p.jsx)(M, {}) : null
|
|
727
|
+
]
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
// src/easy-connectors/connector-flow.ts
|
|
731
|
+
function P(e) {
|
|
732
|
+
switch (e) {
|
|
733
|
+
case "FolderToFolder": return {
|
|
734
|
+
source: "Folder",
|
|
735
|
+
destination: "Folder"
|
|
736
|
+
};
|
|
737
|
+
case "FolderToTable": return {
|
|
738
|
+
source: "Folder",
|
|
739
|
+
destination: "Table"
|
|
740
|
+
};
|
|
741
|
+
case "TableToFolder": return {
|
|
742
|
+
source: "Table",
|
|
743
|
+
destination: "Folder"
|
|
744
|
+
};
|
|
745
|
+
case "FolderToSftp": return {
|
|
746
|
+
source: "Folder",
|
|
747
|
+
destination: "Sftp"
|
|
748
|
+
};
|
|
749
|
+
case "SftpToFolder": return {
|
|
750
|
+
source: "Sftp",
|
|
751
|
+
destination: "Folder"
|
|
752
|
+
};
|
|
753
|
+
default: return {
|
|
754
|
+
source: "Folder",
|
|
755
|
+
destination: "Folder"
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
// src/easy-connectors/ConnectorBoard.tsx
|
|
760
|
+
function F({ selectedConnectorId: e, refreshToken: n, onSelect: i, onCreate: a }) {
|
|
761
|
+
let { client: o } = S(), [c, l] = s([]), [u, d] = s(!1), [f, m] = s(null), h = t(async () => {
|
|
762
|
+
d(!0), m(null);
|
|
763
|
+
try {
|
|
764
|
+
l(await o.listConnectors());
|
|
765
|
+
} catch (e) {
|
|
766
|
+
m(e instanceof Error ? e.message : "Failed to load connectors.");
|
|
767
|
+
} finally {
|
|
768
|
+
d(!1);
|
|
769
|
+
}
|
|
770
|
+
}, [o]);
|
|
771
|
+
r(() => {
|
|
772
|
+
h();
|
|
773
|
+
}, [h, n]);
|
|
774
|
+
async function g(e) {
|
|
775
|
+
m(null);
|
|
776
|
+
try {
|
|
777
|
+
await e(), await h();
|
|
778
|
+
} catch (e) {
|
|
779
|
+
m(e instanceof Error ? e.message : "Action failed.");
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
783
|
+
className: "ec-board",
|
|
784
|
+
children: [
|
|
785
|
+
/* @__PURE__ */ (0, p.jsxs)("header", {
|
|
786
|
+
className: "ec-board__header",
|
|
787
|
+
children: [/* @__PURE__ */ (0, p.jsx)("h2", { children: "Connectors" }), /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
788
|
+
className: "ec-board__header-actions",
|
|
789
|
+
children: [/* @__PURE__ */ (0, p.jsx)("button", {
|
|
790
|
+
type: "button",
|
|
791
|
+
onClick: h,
|
|
792
|
+
children: "Refresh"
|
|
793
|
+
}), /* @__PURE__ */ (0, p.jsx)("button", {
|
|
794
|
+
type: "button",
|
|
795
|
+
className: "ec-primary",
|
|
796
|
+
onClick: a,
|
|
797
|
+
children: "New"
|
|
798
|
+
})]
|
|
799
|
+
})]
|
|
800
|
+
}),
|
|
801
|
+
f ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
802
|
+
className: "ec-error",
|
|
803
|
+
children: f
|
|
804
|
+
}) : null,
|
|
805
|
+
u ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
806
|
+
className: "ec-muted",
|
|
807
|
+
children: "Loading..."
|
|
808
|
+
}) : null,
|
|
809
|
+
/* @__PURE__ */ (0, p.jsx)("ul", {
|
|
810
|
+
className: "ec-board__list",
|
|
811
|
+
children: c.map((t) => (() => {
|
|
812
|
+
let n = P(t.kind);
|
|
813
|
+
return /* @__PURE__ */ (0, p.jsxs)("li", {
|
|
814
|
+
className: ["ec-board__item", e === t.id ? "is-selected" : ""].filter(Boolean).join(" "),
|
|
815
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("button", {
|
|
816
|
+
type: "button",
|
|
817
|
+
className: "ec-board__item-main",
|
|
818
|
+
onClick: () => t.id && i?.(t.id),
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
821
|
+
className: "ec-board__name-row",
|
|
822
|
+
children: [/* @__PURE__ */ (0, p.jsx)(O, { kind: t.kind }), /* @__PURE__ */ (0, p.jsx)("span", {
|
|
823
|
+
className: "ec-board__name",
|
|
824
|
+
children: t.name
|
|
825
|
+
})]
|
|
826
|
+
}),
|
|
827
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
828
|
+
className: "ec-flow",
|
|
829
|
+
"aria-label": `Flow ${n.source} to ${n.destination}`,
|
|
830
|
+
children: [
|
|
831
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
832
|
+
className: "ec-flow__node",
|
|
833
|
+
children: [/* @__PURE__ */ (0, p.jsx)(N, { endpoint: n.source }), /* @__PURE__ */ (0, p.jsx)("span", { children: n.source })]
|
|
834
|
+
}),
|
|
835
|
+
/* @__PURE__ */ (0, p.jsx)("span", {
|
|
836
|
+
className: "ec-flow__arrow",
|
|
837
|
+
"aria-hidden": "true",
|
|
838
|
+
children: "->"
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
841
|
+
className: "ec-flow__connector",
|
|
842
|
+
children: [/* @__PURE__ */ (0, p.jsx)(O, {
|
|
843
|
+
kind: t.kind,
|
|
844
|
+
className: "ec-kind-icon--chip"
|
|
845
|
+
}), /* @__PURE__ */ (0, p.jsx)("span", { children: "Connector" })]
|
|
846
|
+
}),
|
|
847
|
+
/* @__PURE__ */ (0, p.jsx)("span", {
|
|
848
|
+
className: "ec-flow__arrow",
|
|
849
|
+
"aria-hidden": "true",
|
|
850
|
+
children: "->"
|
|
851
|
+
}),
|
|
852
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
853
|
+
className: "ec-flow__node",
|
|
854
|
+
children: [/* @__PURE__ */ (0, p.jsx)(N, { endpoint: n.destination }), /* @__PURE__ */ (0, p.jsx)("span", { children: n.destination })]
|
|
855
|
+
})
|
|
856
|
+
]
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ (0, p.jsx)("span", {
|
|
859
|
+
className: `ec-status ec-status--${(t.status ?? "Idle").toLowerCase()}`,
|
|
860
|
+
children: t.status ?? "Idle"
|
|
861
|
+
})
|
|
862
|
+
]
|
|
863
|
+
}), /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
864
|
+
className: "ec-board__item-actions",
|
|
865
|
+
children: [/* @__PURE__ */ (0, p.jsx)("button", {
|
|
866
|
+
type: "button",
|
|
867
|
+
onClick: () => t.id && g(() => o.runConnector(t.id)),
|
|
868
|
+
children: "Run now"
|
|
869
|
+
}), /* @__PURE__ */ (0, p.jsx)("button", {
|
|
870
|
+
type: "button",
|
|
871
|
+
onClick: () => t.id && g(() => t.status === "Disabled" ? o.enableConnector(t.id) : o.disableConnector(t.id)),
|
|
872
|
+
children: t.status === "Disabled" ? "Enable" : "Disable"
|
|
873
|
+
})]
|
|
874
|
+
})]
|
|
875
|
+
}, t.id);
|
|
876
|
+
})())
|
|
877
|
+
}),
|
|
878
|
+
c.length === 0 && !u ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
879
|
+
className: "ec-muted",
|
|
880
|
+
children: "No connectors yet. Create one to start transferring."
|
|
881
|
+
}) : null
|
|
882
|
+
]
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
// src/easy-connectors/ConnectorForm.tsx
|
|
886
|
+
var I = [
|
|
887
|
+
"FolderToFolder",
|
|
888
|
+
"FolderToTable",
|
|
889
|
+
"TableToFolder",
|
|
890
|
+
"FolderToSftp",
|
|
891
|
+
"SftpToFolder"
|
|
892
|
+
], L = ["Copy", "Move"], R = [
|
|
893
|
+
"Manual",
|
|
894
|
+
"Interval",
|
|
895
|
+
"Daily",
|
|
896
|
+
"OnCreated",
|
|
897
|
+
"OnUpdated"
|
|
898
|
+
], z = ["Sqlite", "SqlServer"];
|
|
899
|
+
function B() {
|
|
900
|
+
return {
|
|
901
|
+
name: "New connector",
|
|
902
|
+
kind: "FolderToFolder",
|
|
903
|
+
mode: "Copy",
|
|
904
|
+
triggers: ["Manual"],
|
|
905
|
+
sourcePath: "",
|
|
906
|
+
destinationPath: "",
|
|
907
|
+
recursive: !0,
|
|
908
|
+
overwrite: !0,
|
|
909
|
+
skipEmptyFiles: !0,
|
|
910
|
+
continueOnError: !0,
|
|
911
|
+
intervalMinutes: 15,
|
|
912
|
+
provider: "SqlServer",
|
|
913
|
+
tableName: ""
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function V({ connectorId: e, onSaved: t }) {
|
|
917
|
+
let { client: n } = S(), [i, o] = s(B()), [c, l] = s(""), [u, d] = s(!1), [f, m] = s(!1), [h, g] = s(null), [_, v] = s(null);
|
|
918
|
+
r(() => {
|
|
919
|
+
if (!e) {
|
|
920
|
+
o(B()), l(""), g(null), v(null);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
let t = !1;
|
|
924
|
+
return d(!0), g(null), n.getConnector(e).then((e) => {
|
|
925
|
+
t || (o(e), l((e.keyColumns ?? []).join(", ")));
|
|
926
|
+
}).catch((e) => {
|
|
927
|
+
t || g(e instanceof Error ? e.message : "Failed to load connector.");
|
|
928
|
+
}).finally(() => {
|
|
929
|
+
t || d(!1);
|
|
930
|
+
}), () => {
|
|
931
|
+
t = !0;
|
|
932
|
+
};
|
|
933
|
+
}, [n, e]);
|
|
934
|
+
let y = a(() => P(i.kind), [i.kind]);
|
|
935
|
+
function b(e, t) {
|
|
936
|
+
o((n) => ({
|
|
937
|
+
...n,
|
|
938
|
+
[e]: t
|
|
939
|
+
}));
|
|
940
|
+
}
|
|
941
|
+
function x(e) {
|
|
942
|
+
o((t) => {
|
|
943
|
+
let n = t.triggers.includes(e) ? t.triggers.filter((t) => t !== e) : [...t.triggers, e];
|
|
944
|
+
return {
|
|
945
|
+
...t,
|
|
946
|
+
triggers: n
|
|
947
|
+
};
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
async function C() {
|
|
951
|
+
m(!0), g(null), v(null);
|
|
952
|
+
let r = {
|
|
953
|
+
...i,
|
|
954
|
+
keyColumns: c.split(",").map((e) => e.trim()).filter(Boolean)
|
|
955
|
+
};
|
|
956
|
+
try {
|
|
957
|
+
let i = e ? await n.updateConnector(e, r) : await n.createConnector(r);
|
|
958
|
+
o(i), l((i.keyColumns ?? []).join(", ")), v("Connector saved."), t?.(i);
|
|
959
|
+
} catch (e) {
|
|
960
|
+
g(e instanceof Error ? e.message : "Save failed.");
|
|
961
|
+
} finally {
|
|
962
|
+
m(!1);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
function w(e) {
|
|
966
|
+
return e === "source" ? /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
967
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Source path", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
968
|
+
value: i.sourcePath ?? "",
|
|
969
|
+
onChange: (e) => b("sourcePath", e.target.value)
|
|
970
|
+
})] }),
|
|
971
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Pattern", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
972
|
+
value: i.pattern ?? "",
|
|
973
|
+
onChange: (e) => b("pattern", e.target.value)
|
|
974
|
+
})] }),
|
|
975
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("span", { children: "Recursive" }), /* @__PURE__ */ (0, p.jsx)("input", {
|
|
976
|
+
type: "checkbox",
|
|
977
|
+
checked: i.recursive ?? !1,
|
|
978
|
+
onChange: (e) => b("recursive", e.target.checked)
|
|
979
|
+
})] })
|
|
980
|
+
] }) : /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Destination path", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
981
|
+
value: i.destinationPath ?? "",
|
|
982
|
+
onChange: (e) => b("destinationPath", e.target.value)
|
|
983
|
+
})] }), /* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("span", { children: "Overwrite" }), /* @__PURE__ */ (0, p.jsx)("input", {
|
|
984
|
+
type: "checkbox",
|
|
985
|
+
checked: i.overwrite ?? !1,
|
|
986
|
+
onChange: (e) => b("overwrite", e.target.checked)
|
|
987
|
+
})] })] });
|
|
988
|
+
}
|
|
989
|
+
function T() {
|
|
990
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
991
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Provider", /* @__PURE__ */ (0, p.jsx)("select", {
|
|
992
|
+
value: i.provider ?? "SqlServer",
|
|
993
|
+
onChange: (e) => b("provider", e.target.value),
|
|
994
|
+
children: z.map((e) => /* @__PURE__ */ (0, p.jsx)("option", {
|
|
995
|
+
value: e,
|
|
996
|
+
children: e
|
|
997
|
+
}, e))
|
|
998
|
+
})] }),
|
|
999
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Table name", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1000
|
+
value: i.tableName ?? "",
|
|
1001
|
+
onChange: (e) => b("tableName", e.target.value)
|
|
1002
|
+
})] }),
|
|
1003
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Schema", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1004
|
+
value: i.schema ?? "",
|
|
1005
|
+
onChange: (e) => b("schema", e.target.value)
|
|
1006
|
+
})] }),
|
|
1007
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Key columns (comma separated)", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1008
|
+
value: c,
|
|
1009
|
+
onChange: (e) => l(e.target.value)
|
|
1010
|
+
})] }),
|
|
1011
|
+
/* @__PURE__ */ (0, p.jsxs)("label", {
|
|
1012
|
+
className: "ec-grid__wide",
|
|
1013
|
+
children: ["Connection string", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1014
|
+
value: i.connectionString ?? "",
|
|
1015
|
+
onChange: (e) => b("connectionString", e.target.value)
|
|
1016
|
+
})]
|
|
1017
|
+
}),
|
|
1018
|
+
/* @__PURE__ */ (0, p.jsxs)("label", {
|
|
1019
|
+
className: "ec-grid__wide",
|
|
1020
|
+
children: ["Where clause", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1021
|
+
value: i.whereClause ?? "",
|
|
1022
|
+
onChange: (e) => b("whereClause", e.target.value)
|
|
1023
|
+
})]
|
|
1024
|
+
})
|
|
1025
|
+
] });
|
|
1026
|
+
}
|
|
1027
|
+
function E(e) {
|
|
1028
|
+
return /* @__PURE__ */ (0, p.jsxs)(p.Fragment, { children: [
|
|
1029
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["SFTP host", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1030
|
+
value: i.sftpHost ?? "",
|
|
1031
|
+
onChange: (e) => b("sftpHost", e.target.value)
|
|
1032
|
+
})] }),
|
|
1033
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Port", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1034
|
+
type: "number",
|
|
1035
|
+
min: 1,
|
|
1036
|
+
value: i.sftpPort ?? 22,
|
|
1037
|
+
onChange: (e) => b("sftpPort", Number(e.target.value) || 22)
|
|
1038
|
+
})] }),
|
|
1039
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Remote path", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1040
|
+
value: i.remotePath ?? "",
|
|
1041
|
+
onChange: (e) => b("remotePath", e.target.value)
|
|
1042
|
+
})] }),
|
|
1043
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Username", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1044
|
+
value: i.sftpUsername ?? "",
|
|
1045
|
+
onChange: (e) => b("sftpUsername", e.target.value)
|
|
1046
|
+
})] }),
|
|
1047
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Password", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1048
|
+
type: "password",
|
|
1049
|
+
value: i.sftpPassword ?? "",
|
|
1050
|
+
onChange: (e) => b("sftpPassword", e.target.value)
|
|
1051
|
+
})] }),
|
|
1052
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Private key path", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1053
|
+
value: i.privateKeyPath ?? "",
|
|
1054
|
+
onChange: (e) => b("privateKeyPath", e.target.value)
|
|
1055
|
+
})] }),
|
|
1056
|
+
/* @__PURE__ */ (0, p.jsxs)("label", {
|
|
1057
|
+
className: "ec-grid__wide",
|
|
1058
|
+
children: ["Host key SHA256", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1059
|
+
value: i.hostKeySha256 ?? "",
|
|
1060
|
+
onChange: (e) => b("hostKeySha256", e.target.value)
|
|
1061
|
+
})]
|
|
1062
|
+
}),
|
|
1063
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("span", { children: "Accept any host key" }), /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1064
|
+
type: "checkbox",
|
|
1065
|
+
checked: i.acceptAnyHostKey ?? !1,
|
|
1066
|
+
onChange: (e) => b("acceptAnyHostKey", e.target.checked)
|
|
1067
|
+
})] }),
|
|
1068
|
+
e === "destination" ? /* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("span", { children: "Overwrite" }), /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1069
|
+
type: "checkbox",
|
|
1070
|
+
checked: i.overwrite ?? !1,
|
|
1071
|
+
onChange: (e) => b("overwrite", e.target.checked)
|
|
1072
|
+
})] }) : null
|
|
1073
|
+
] });
|
|
1074
|
+
}
|
|
1075
|
+
function D(e, t) {
|
|
1076
|
+
return e === "Folder" ? w(t) : e === "Table" ? T() : E(t);
|
|
1077
|
+
}
|
|
1078
|
+
function k(e) {
|
|
1079
|
+
return e === "Sftp" ? "SFTP" : e;
|
|
1080
|
+
}
|
|
1081
|
+
return /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
1082
|
+
className: "ec-form",
|
|
1083
|
+
children: [
|
|
1084
|
+
/* @__PURE__ */ (0, p.jsx)("header", {
|
|
1085
|
+
className: "ec-form__header",
|
|
1086
|
+
children: /* @__PURE__ */ (0, p.jsx)("h3", { children: e ? "Edit connector" : "Create connector" })
|
|
1087
|
+
}),
|
|
1088
|
+
u ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
1089
|
+
className: "ec-muted",
|
|
1090
|
+
children: "Loading connector..."
|
|
1091
|
+
}) : null,
|
|
1092
|
+
h ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
1093
|
+
className: "ec-error",
|
|
1094
|
+
children: h
|
|
1095
|
+
}) : null,
|
|
1096
|
+
_ ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
1097
|
+
className: "ec-success",
|
|
1098
|
+
children: _
|
|
1099
|
+
}) : null,
|
|
1100
|
+
/* @__PURE__ */ (0, p.jsxs)("div", {
|
|
1101
|
+
className: "ec-grid ec-grid--meta",
|
|
1102
|
+
children: [
|
|
1103
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Name", /* @__PURE__ */ (0, p.jsx)("input", {
|
|
1104
|
+
value: i.name,
|
|
1105
|
+
onChange: (e) => b("name", e.target.value)
|
|
1106
|
+
})] }),
|
|
1107
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [
|
|
1108
|
+
"Kind",
|
|
1109
|
+
/* @__PURE__ */ (0, p.jsx)("select", {
|
|
1110
|
+
value: i.kind,
|
|
1111
|
+
onChange: (e) => b("kind", e.target.value),
|
|
1112
|
+
children: I.map((e) => /* @__PURE__ */ (0, p.jsx)("option", {
|
|
1113
|
+
value: e,
|
|
1114
|
+
children: e
|
|
1115
|
+
}, e))
|
|
1116
|
+
}),
|
|
1117
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
1118
|
+
className: "ec-kind-preview",
|
|
1119
|
+
children: [/* @__PURE__ */ (0, p.jsx)(O, { kind: i.kind }), i.kind]
|
|
1120
|
+
}),
|
|
1121
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
1122
|
+
className: "ec-flow ec-flow--compact",
|
|
1123
|
+
"aria-label": `Flow ${y.source} to ${y.destination}`,
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
1126
|
+
className: "ec-flow__node",
|
|
1127
|
+
children: [/* @__PURE__ */ (0, p.jsx)(N, { endpoint: y.source }), /* @__PURE__ */ (0, p.jsx)("span", { children: y.source })]
|
|
1128
|
+
}),
|
|
1129
|
+
/* @__PURE__ */ (0, p.jsx)("span", {
|
|
1130
|
+
className: "ec-flow__arrow",
|
|
1131
|
+
"aria-hidden": "true",
|
|
1132
|
+
children: "->"
|
|
1133
|
+
}),
|
|
1134
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
1135
|
+
className: "ec-flow__connector",
|
|
1136
|
+
children: [/* @__PURE__ */ (0, p.jsx)(O, {
|
|
1137
|
+
kind: i.kind,
|
|
1138
|
+
className: "ec-kind-icon--chip"
|
|
1139
|
+
}), /* @__PURE__ */ (0, p.jsx)("span", { children: "Connector" })]
|
|
1140
|
+
}),
|
|
1141
|
+
/* @__PURE__ */ (0, p.jsx)("span", {
|
|
1142
|
+
className: "ec-flow__arrow",
|
|
1143
|
+
"aria-hidden": "true",
|
|
1144
|
+
children: "->"
|
|
1145
|
+
}),
|
|
1146
|
+
/* @__PURE__ */ (0, p.jsxs)("span", {
|
|
1147
|
+
className: "ec-flow__node",
|
|
1148
|
+
children: [/* @__PURE__ */ (0, p.jsx)(N, { endpoint: y.destination }), /* @__PURE__ */ (0, p.jsx)("span", { children: y.destination })]
|
|
1149
|
+
})
|
|
1150
|
+
]
|
|
1151
|
+
})
|
|
1152
|
+
] }),
|
|
1153
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: ["Mode", /* @__PURE__ */ (0, p.jsx)("select", {
|
|
1154
|
+
value: i.mode,
|
|
1155
|
+
onChange: (e) => b("mode", e.target.value),
|
|
1156
|
+
children: L.map((e) => /* @__PURE__ */ (0, p.jsx)("option", {
|
|
1157
|
+
value: e,
|
|
1158
|
+
children: e
|
|
1159
|
+
}, e))
|
|
1160
|
+
})] })
|
|
1161
|
+
]
|
|
1162
|
+
}),
|
|
1163
|
+
/* @__PURE__ */ (0, p.jsxs)("div", {
|
|
1164
|
+
className: "ec-endpoint-grid",
|
|
1165
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("section", {
|
|
1166
|
+
className: "ec-endpoint-panel",
|
|
1167
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("header", {
|
|
1168
|
+
className: "ec-endpoint-panel__header",
|
|
1169
|
+
children: [/* @__PURE__ */ (0, p.jsx)(N, { endpoint: y.source }), /* @__PURE__ */ (0, p.jsxs)("h4", { children: [
|
|
1170
|
+
"Source config (",
|
|
1171
|
+
k(y.source),
|
|
1172
|
+
")"
|
|
1173
|
+
] })]
|
|
1174
|
+
}), /* @__PURE__ */ (0, p.jsx)("div", {
|
|
1175
|
+
className: "ec-grid ec-grid--endpoint",
|
|
1176
|
+
children: D(y.source, "source")
|
|
1177
|
+
})]
|
|
1178
|
+
}), /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
1179
|
+
className: "ec-endpoint-panel",
|
|
1180
|
+
children: [/* @__PURE__ */ (0, p.jsxs)("header", {
|
|
1181
|
+
className: "ec-endpoint-panel__header",
|
|
1182
|
+
children: [/* @__PURE__ */ (0, p.jsx)(N, { endpoint: y.destination }), /* @__PURE__ */ (0, p.jsxs)("h4", { children: [
|
|
1183
|
+
"Destination config (",
|
|
1184
|
+
k(y.destination),
|
|
1185
|
+
")"
|
|
1186
|
+
] })]
|
|
1187
|
+
}), /* @__PURE__ */ (0, p.jsx)("div", {
|
|
1188
|
+
className: "ec-grid ec-grid--endpoint",
|
|
1189
|
+
children: D(y.destination, "destination")
|
|
1190
|
+
})]
|
|
1191
|
+
})]
|
|
1192
|
+
}),
|
|
1193
|
+
/* @__PURE__ */ (0, p.jsxs)("fieldset", {
|
|
1194
|
+
className: "ec-form__fieldset",
|
|
1195
|
+
children: [/* @__PURE__ */ (0, p.jsx)("legend", { children: "Triggers" }), /* @__PURE__ */ (0, p.jsx)("div", {
|
|
1196
|
+
className: "ec-check-row",
|
|
1197
|
+
children: R.map((e) => /* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("input", {
|
|
1198
|
+
type: "checkbox",
|
|
1199
|
+
checked: i.triggers.includes(e),
|
|
1200
|
+
onChange: () => x(e)
|
|
1201
|
+
}), e] }, e))
|
|
1202
|
+
})]
|
|
1203
|
+
}),
|
|
1204
|
+
/* @__PURE__ */ (0, p.jsxs)("fieldset", {
|
|
1205
|
+
className: "ec-form__fieldset",
|
|
1206
|
+
children: [/* @__PURE__ */ (0, p.jsx)("legend", { children: "Options" }), /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
1207
|
+
className: "ec-check-row",
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("input", {
|
|
1210
|
+
type: "checkbox",
|
|
1211
|
+
checked: i.skipEmptyFiles ?? !1,
|
|
1212
|
+
onChange: (e) => b("skipEmptyFiles", e.target.checked)
|
|
1213
|
+
}), "Skip empty files"] }),
|
|
1214
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("input", {
|
|
1215
|
+
type: "checkbox",
|
|
1216
|
+
checked: i.continueOnError ?? !1,
|
|
1217
|
+
onChange: (e) => b("continueOnError", e.target.checked)
|
|
1218
|
+
}), "Continue on error"] }),
|
|
1219
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("input", {
|
|
1220
|
+
type: "number",
|
|
1221
|
+
min: 1,
|
|
1222
|
+
value: i.intervalMinutes ?? 15,
|
|
1223
|
+
onChange: (e) => b("intervalMinutes", Number(e.target.value) || 1)
|
|
1224
|
+
}), "Interval minutes"] }),
|
|
1225
|
+
/* @__PURE__ */ (0, p.jsxs)("label", { children: [/* @__PURE__ */ (0, p.jsx)("input", {
|
|
1226
|
+
type: "time",
|
|
1227
|
+
value: i.dailyTimeLocal ?? "",
|
|
1228
|
+
onChange: (e) => b("dailyTimeLocal", e.target.value)
|
|
1229
|
+
}), "Daily time (local)"] })
|
|
1230
|
+
]
|
|
1231
|
+
})]
|
|
1232
|
+
}),
|
|
1233
|
+
/* @__PURE__ */ (0, p.jsx)("footer", {
|
|
1234
|
+
className: "ec-form__footer",
|
|
1235
|
+
children: /* @__PURE__ */ (0, p.jsx)("button", {
|
|
1236
|
+
type: "button",
|
|
1237
|
+
className: "ec-primary",
|
|
1238
|
+
onClick: C,
|
|
1239
|
+
disabled: f,
|
|
1240
|
+
children: f ? "Saving..." : "Save connector"
|
|
1241
|
+
})
|
|
1242
|
+
})
|
|
1243
|
+
]
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
// src/easy-connectors/ConnectorRuns.tsx
|
|
1247
|
+
function H({ connectorId: e, take: t = 20 }) {
|
|
1248
|
+
let { client: n } = S(), [i, a] = s([]), [o, c] = s(null), [l, u] = s(!1);
|
|
1249
|
+
return r(() => {
|
|
1250
|
+
if (!e) {
|
|
1251
|
+
a([]);
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
let r = !1;
|
|
1255
|
+
return u(!0), c(null), n.getRuns(e, t).then((e) => {
|
|
1256
|
+
r || a(e);
|
|
1257
|
+
}).catch((e) => {
|
|
1258
|
+
r || c(e instanceof Error ? e.message : "Failed to load runs.");
|
|
1259
|
+
}).finally(() => {
|
|
1260
|
+
r || u(!1);
|
|
1261
|
+
}), () => {
|
|
1262
|
+
r = !0;
|
|
1263
|
+
};
|
|
1264
|
+
}, [
|
|
1265
|
+
n,
|
|
1266
|
+
e,
|
|
1267
|
+
t
|
|
1268
|
+
]), /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
1269
|
+
className: "ec-runs",
|
|
1270
|
+
children: [
|
|
1271
|
+
/* @__PURE__ */ (0, p.jsx)("header", {
|
|
1272
|
+
className: "ec-runs__header",
|
|
1273
|
+
children: /* @__PURE__ */ (0, p.jsx)("h3", { children: "Recent runs" })
|
|
1274
|
+
}),
|
|
1275
|
+
e ? null : /* @__PURE__ */ (0, p.jsx)("p", {
|
|
1276
|
+
className: "ec-muted",
|
|
1277
|
+
children: "Select a connector to view run history."
|
|
1278
|
+
}),
|
|
1279
|
+
l ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
1280
|
+
className: "ec-muted",
|
|
1281
|
+
children: "Loading runs..."
|
|
1282
|
+
}) : null,
|
|
1283
|
+
o ? /* @__PURE__ */ (0, p.jsx)("p", {
|
|
1284
|
+
className: "ec-error",
|
|
1285
|
+
children: o
|
|
1286
|
+
}) : null,
|
|
1287
|
+
e && i.length > 0 ? /* @__PURE__ */ (0, p.jsx)("div", {
|
|
1288
|
+
className: "ec-table-wrap",
|
|
1289
|
+
children: /* @__PURE__ */ (0, p.jsxs)("table", {
|
|
1290
|
+
className: "ec-table",
|
|
1291
|
+
children: [/* @__PURE__ */ (0, p.jsx)("thead", { children: /* @__PURE__ */ (0, p.jsxs)("tr", { children: [
|
|
1292
|
+
/* @__PURE__ */ (0, p.jsx)("th", { children: "Status" }),
|
|
1293
|
+
/* @__PURE__ */ (0, p.jsx)("th", { children: "Started" }),
|
|
1294
|
+
/* @__PURE__ */ (0, p.jsx)("th", { children: "Transferred" }),
|
|
1295
|
+
/* @__PURE__ */ (0, p.jsx)("th", { children: "Skipped" }),
|
|
1296
|
+
/* @__PURE__ */ (0, p.jsx)("th", { children: "Failed" })
|
|
1297
|
+
] }) }), /* @__PURE__ */ (0, p.jsx)("tbody", { children: i.map((e) => /* @__PURE__ */ (0, p.jsxs)("tr", { children: [
|
|
1298
|
+
/* @__PURE__ */ (0, p.jsx)("td", { children: e.status }),
|
|
1299
|
+
/* @__PURE__ */ (0, p.jsx)("td", { children: new Date(e.startedUtc).toLocaleString() }),
|
|
1300
|
+
/* @__PURE__ */ (0, p.jsx)("td", { children: e.transferred }),
|
|
1301
|
+
/* @__PURE__ */ (0, p.jsx)("td", { children: e.skipped }),
|
|
1302
|
+
/* @__PURE__ */ (0, p.jsx)("td", { children: e.failed })
|
|
1303
|
+
] }, e.id)) })]
|
|
1304
|
+
})
|
|
1305
|
+
}) : null
|
|
1306
|
+
]
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
// src/easy-connectors/EasyConnectorsApp.tsx
|
|
1310
|
+
function U({ className: e }) {
|
|
1311
|
+
let [t, n] = s(void 0), [r, i] = s(0);
|
|
1312
|
+
return /* @__PURE__ */ (0, p.jsxs)("section", {
|
|
1313
|
+
className: ["ec-app", e].filter(Boolean).join(" "),
|
|
1314
|
+
children: [/* @__PURE__ */ (0, p.jsx)("div", {
|
|
1315
|
+
className: "ec-app__left",
|
|
1316
|
+
children: /* @__PURE__ */ (0, p.jsx)(F, {
|
|
1317
|
+
selectedConnectorId: t,
|
|
1318
|
+
onSelect: n,
|
|
1319
|
+
onCreate: () => n(void 0),
|
|
1320
|
+
refreshToken: r
|
|
1321
|
+
})
|
|
1322
|
+
}), /* @__PURE__ */ (0, p.jsxs)("div", {
|
|
1323
|
+
className: "ec-app__right",
|
|
1324
|
+
children: [/* @__PURE__ */ (0, p.jsx)(V, {
|
|
1325
|
+
connectorId: t,
|
|
1326
|
+
onSaved: (e) => {
|
|
1327
|
+
n(e.id), i((e) => e + 1);
|
|
1328
|
+
}
|
|
1329
|
+
}), /* @__PURE__ */ (0, p.jsx)(H, { connectorId: t })]
|
|
1330
|
+
})]
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
export { F as ConnectorBoard, V as ConnectorForm, O as ConnectorKindIcon, H as ConnectorRuns, U as EasyConnectorsApp, y as EasyConnectorsClient, x as EasyConnectorsProvider, N as EndpointKindIcon, _ as Ribbon, m as RibbonButton, h as RibbonCarousel, g as RibbonDropdown, v as RibbonSplitButton, P as getConnectorFlow, S as useEasyConnectors };
|