@janbox/storefront-builder 2.0.1 → 2.0.2
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 +2 -2
- package/dist/anchor-target-CtXzdkBu.js +2918 -0
- package/dist/{color-picker-popover-B3AVFuei.js → color-picker-popover-XeaVfYS8.js} +104 -80
- package/dist/countdown-timer.node-Bh5fTSJ8.js +913 -0
- package/dist/date-picker-D9K6HWl-.js +157 -0
- package/dist/{dialog-header-DPLOS7TT.js → dialog-header-Bh3Dkw2q.js} +2440 -2122
- package/dist/dropzone-CF4CWXth.js +546 -0
- package/dist/editor/toolbars.js +171 -161
- package/dist/editor/ui/button-group/button-group.d.ts +1 -1
- package/dist/editor/ui/dialog/dialog-body/dialog-body.d.ts +1 -1
- package/dist/editor/ui/form-label/form-label.d.ts +1 -1
- package/dist/editor/ui/input/input.d.ts +1 -2
- package/dist/editor/ui/loading-overlay/loading-overlay.d.ts +1 -1
- package/dist/editor/ui/popover/popover-close.d.ts +1 -1
- package/dist/editor/ui/tabs/tab-content.d.ts +1 -1
- package/dist/editor/ui/tabs/tab-list.d.ts +2 -4
- package/dist/editor/ui/tabs/tab-panel.d.ts +1 -1
- package/dist/editor/ui/tabs/tab.d.ts +2 -5
- package/dist/editor/ui/tabs/tabs.d.ts +1 -1
- package/dist/editor/ui.js +82 -72
- package/dist/editor.js +822 -586
- package/dist/index-800HnUOi.js +4 -0
- package/dist/{index-CwrFnubn.js → index-CXyljfMv.js} +1729 -1584
- package/dist/index.js +287 -247
- package/dist/style.css +1 -1
- package/dist/templates.js +10 -12
- package/dist/theme/index.d.ts +293 -0
- package/dist/tooltip-CXOlTkGg.js +75 -0
- package/dist/utils/common.d.ts +0 -2
- package/package.json +1 -2
- package/dist/anchor-target-BlOvysAr.js +0 -2329
- package/dist/countdown-timer.node-OmDiT-pz.js +0 -825
- package/dist/date-picker-B4Rju7gG.js +0 -115
- package/dist/dropzone-Dbfed3jK.js +0 -490
- package/dist/index-BbiQ0n_-.js +0 -4
- package/dist/tooltip-KbIHELP2.js +0 -65
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { isString as
|
|
2
|
-
import { useCallback as v, useMemo as P, useSyncExternalStore as
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import { q as M, s as F, r as V, m as j, W as R, c as T, f as U } from "./dialog-header-DPLOS7TT.js";
|
|
6
|
-
import { useEditor as q } from "@craftjs/core";
|
|
1
|
+
import { isString as b } from "lodash-es";
|
|
2
|
+
import { useCallback as v, useMemo as P, useSyncExternalStore as z, Fragment as M } from "react";
|
|
3
|
+
import { t as g, q as F, s as R, r as V, l as j, W as T, e as U, z as q } from "./dialog-header-Bh3Dkw2q.js";
|
|
4
|
+
import { useEditor as B } from "@craftjs/core";
|
|
7
5
|
import { jsxs as c, jsx as r } from "@emotion/react/jsx-runtime";
|
|
8
|
-
import { parseColor as
|
|
9
|
-
import { flatten as
|
|
6
|
+
import { parseColor as k, paletteVars as D, groupedColors as G } from "@janbox/storefront-ui/theme";
|
|
7
|
+
import { flatten as O } from "flat";
|
|
10
8
|
import "@janbox/storefront-ui/hooks";
|
|
11
9
|
import "@janbox/storefront-ui/utils";
|
|
10
|
+
import "@emotion/react";
|
|
12
11
|
import "@floating-ui/react";
|
|
13
12
|
import "react-use";
|
|
14
13
|
import "overlayscrollbars-react";
|
|
@@ -16,13 +15,13 @@ import "@tanstack/react-virtual";
|
|
|
16
15
|
import "react-dropzone";
|
|
17
16
|
import "react-datepicker/dist/react-datepicker.css";
|
|
18
17
|
import "react-datepicker";
|
|
19
|
-
const
|
|
20
|
-
const t =
|
|
21
|
-
if (
|
|
18
|
+
const N = (e) => e.info ?? {}, I = (e) => e.data?.custom ?? {}, de = (e) => {
|
|
19
|
+
const t = I(e);
|
|
20
|
+
if (b(t.displayName))
|
|
22
21
|
return t.displayName;
|
|
23
|
-
const o =
|
|
24
|
-
return
|
|
25
|
-
}, le = (e) => e.data.displayName, ce = (e) => e.related ?? {}, he = (e) =>
|
|
22
|
+
const o = N(e);
|
|
23
|
+
return b(o.displayName) ? o.displayName : o.displayName?.(e.data.props) ?? e.data.displayName;
|
|
24
|
+
}, le = (e) => e.data.displayName, ce = (e) => e.related ?? {}, he = (e) => I(e).selectable ?? N(e).selectable ?? !0, pe = (e, t) => {
|
|
26
25
|
try {
|
|
27
26
|
e.craft && (e.craft = {
|
|
28
27
|
...e.craft,
|
|
@@ -34,55 +33,55 @@ const k = (e) => e.info ?? {}, y = (e) => e.data?.custom ?? {}, de = (e) => {
|
|
|
34
33
|
} catch (o) {
|
|
35
34
|
console.error(`Error setting related for ${e.craft?.displayName}`, o);
|
|
36
35
|
}
|
|
37
|
-
},
|
|
38
|
-
const { resolved: o, ...
|
|
36
|
+
}, ue = (e, t = "xs") => t === "xs" ? e : { [t]: e }, me = (e, t) => {
|
|
37
|
+
const { resolved: o, ...n } = t;
|
|
39
38
|
return e.craft = {
|
|
40
39
|
displayName: o,
|
|
41
|
-
...
|
|
42
|
-
related:
|
|
40
|
+
...n,
|
|
41
|
+
related: n.related ?? {}
|
|
43
42
|
}, e;
|
|
44
|
-
},
|
|
45
|
-
const t =
|
|
43
|
+
}, fe = (e = () => ({})) => {
|
|
44
|
+
const t = B(e), { query: o, actions: n } = t, h = v(
|
|
46
45
|
(s, a, d) => {
|
|
47
|
-
const l = o.node(s).get(),
|
|
48
|
-
if (!
|
|
46
|
+
const l = o.node(s).get(), i = a ?? l.data.parent, m = i ? o.node(i).get() : null;
|
|
47
|
+
if (!m)
|
|
49
48
|
throw new Error("Parent node not found");
|
|
50
|
-
const
|
|
49
|
+
const p = {
|
|
51
50
|
data: {
|
|
52
51
|
...l.data,
|
|
53
52
|
nodes: [],
|
|
54
53
|
linkedNodes: {}
|
|
55
54
|
}
|
|
56
|
-
},
|
|
57
|
-
return
|
|
58
|
-
h(
|
|
59
|
-
}), o.node(
|
|
55
|
+
}, w = o.parseFreshNode(p).toNode();
|
|
56
|
+
return n.add(w, m.id, d ?? m.data.nodes.length), l.data.nodes.forEach((E, W) => {
|
|
57
|
+
h(E, w.id, W);
|
|
58
|
+
}), o.node(w.id).get();
|
|
60
59
|
},
|
|
61
|
-
[
|
|
62
|
-
),
|
|
60
|
+
[n, o]
|
|
61
|
+
), u = v(
|
|
63
62
|
(s) => {
|
|
64
63
|
const a = s.parentId ?? o.node(s.nodeId).get().data.parent;
|
|
65
64
|
if (!a)
|
|
66
65
|
throw new Error("Parent node not found");
|
|
67
66
|
let d;
|
|
68
67
|
if ("sourceIndex" in s) {
|
|
69
|
-
const { sourceIndex: l, destinationIndex:
|
|
70
|
-
d =
|
|
68
|
+
const { sourceIndex: l, destinationIndex: i } = s;
|
|
69
|
+
d = i > l ? i + 1 : i;
|
|
71
70
|
} else
|
|
72
71
|
d = s.moveIndex;
|
|
73
|
-
|
|
72
|
+
n.move(s.nodeId, a, d);
|
|
74
73
|
},
|
|
75
|
-
[
|
|
74
|
+
[n, o]
|
|
76
75
|
);
|
|
77
76
|
return P(() => ({
|
|
78
77
|
...t,
|
|
79
78
|
actions: {
|
|
80
79
|
...t.actions,
|
|
81
|
-
move:
|
|
80
|
+
move: u,
|
|
82
81
|
duplicate: h
|
|
83
82
|
}
|
|
84
|
-
}), [h, t,
|
|
85
|
-
},
|
|
83
|
+
}), [h, t, u]);
|
|
84
|
+
}, $ = () => {
|
|
86
85
|
let e;
|
|
87
86
|
const t = /* @__PURE__ */ new Set();
|
|
88
87
|
return { getSnapshot: () => {
|
|
@@ -96,25 +95,25 @@ const k = (e) => e.info ?? {}, y = (e) => e.data?.custom ?? {}, de = (e) => {
|
|
|
96
95
|
throw new Error("useEditor must be initialized before setState.");
|
|
97
96
|
e = { ...e, ...s }, t.forEach((a) => a());
|
|
98
97
|
} };
|
|
99
|
-
},
|
|
100
|
-
let
|
|
101
|
-
const
|
|
102
|
-
...
|
|
103
|
-
setState:
|
|
104
|
-
}),
|
|
105
|
-
const o =
|
|
98
|
+
}, f = $();
|
|
99
|
+
let C = !1;
|
|
100
|
+
const S = (e) => (e && !C && (C = !0, f.initialize(e)), {
|
|
101
|
+
...z(f.subscribe, f.getSnapshot),
|
|
102
|
+
setState: f.setState
|
|
103
|
+
}), x = ({ color: e, size: t = 24 }) => {
|
|
104
|
+
const o = S(), n = k(e, o.theme.palette);
|
|
106
105
|
return /* @__PURE__ */ c(
|
|
107
106
|
"div",
|
|
108
107
|
{
|
|
109
108
|
title: e,
|
|
110
|
-
|
|
111
|
-
style: { backgroundColor:
|
|
109
|
+
css: { borderRadius: 9999, overflow: "hidden", borderWidth: 1, borderStyle: "solid", borderColor: g.palette.white["3s"] },
|
|
110
|
+
style: { backgroundColor: n?.toString(), width: t, height: t },
|
|
112
111
|
children: [
|
|
113
|
-
!
|
|
112
|
+
!n && /* @__PURE__ */ c("svg", { css: { width: "100%", height: "100%", color: g.palette.white["5s"] }, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
114
113
|
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ r("pattern", { id: "diagonal-stripes", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: /* @__PURE__ */ r("path", { d: "M-2,2 l4,-4 M0,8 l8,-8 M6,10 l4,-4", stroke: "currentColor", strokeWidth: "1.5" }) }) }),
|
|
115
114
|
/* @__PURE__ */ r("rect", { width: "32", height: "32", fill: "url(#diagonal-stripes)" })
|
|
116
115
|
] }),
|
|
117
|
-
|
|
116
|
+
n?.alpha() === 0 && /* @__PURE__ */ c("svg", { css: { width: "100%", height: "100%" }, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
118
117
|
/* @__PURE__ */ r("defs", { children: /* @__PURE__ */ c("pattern", { id: "checkerboard", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: [
|
|
119
118
|
/* @__PURE__ */ r("rect", { width: "8", height: "8", fill: "white" }),
|
|
120
119
|
/* @__PURE__ */ r("rect", { width: "4", height: "4", fill: "lightgray" }),
|
|
@@ -125,40 +124,57 @@ const I = (e) => (e && !N && (N = !0, m.initialize(e)), {
|
|
|
125
124
|
]
|
|
126
125
|
}
|
|
127
126
|
);
|
|
128
|
-
},
|
|
127
|
+
}, A = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
128
|
<path d="M11.999 8C11.861 8 11.749 8.112 11.75 8.25C11.75 8.388 11.862 8.5 12 8.5C12.138 8.5 12.25 8.388 12.25 8.25C12.25 8.112 12.138 8 11.999 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
130
129
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 21V21C7.029 21 3 16.971 3 12V12C3 7.029 7.029 3 12 3V3C16.971 3 21 7.029 21 12V12C21 16.971 16.971 21 12 21Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
131
130
|
<path d="M12 12V17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
132
131
|
</svg>
|
|
133
|
-
`,
|
|
132
|
+
`, y = O(D), ge = ({
|
|
134
133
|
color: e,
|
|
135
134
|
onChange: t,
|
|
136
135
|
children: o,
|
|
137
|
-
placement:
|
|
136
|
+
placement: n = "right-start",
|
|
138
137
|
...h
|
|
139
138
|
}) => {
|
|
140
|
-
const
|
|
141
|
-
t?.(
|
|
142
|
-
}, s =
|
|
143
|
-
|
|
144
|
-
}, l = (
|
|
145
|
-
t?.(
|
|
139
|
+
const u = (i) => {
|
|
140
|
+
t?.(y[i.currentTarget.value]);
|
|
141
|
+
}, s = S(), a = k(e, s.theme.palette)?.hex(), d = (i) => {
|
|
142
|
+
i.target.select();
|
|
143
|
+
}, l = (i) => {
|
|
144
|
+
t?.(i.target.value);
|
|
146
145
|
};
|
|
147
|
-
return /* @__PURE__ */ c(
|
|
148
|
-
/* @__PURE__ */ r(
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
return /* @__PURE__ */ c(F, { placement: n, ...h, children: [
|
|
147
|
+
/* @__PURE__ */ r(R, { children: o ?? /* @__PURE__ */ r(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
css: {
|
|
151
|
+
padding: 2,
|
|
152
|
+
borderRadius: 9999,
|
|
153
|
+
borderWidth: 1,
|
|
154
|
+
borderStyle: "solid",
|
|
155
|
+
borderColor: g.palette.white["1s"],
|
|
156
|
+
":hover": {
|
|
157
|
+
borderColor: g.palette.white["3s"]
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
children: /* @__PURE__ */ r(x, { color: e })
|
|
161
|
+
}
|
|
162
|
+
) }),
|
|
163
|
+
/* @__PURE__ */ r(V, { children: /* @__PURE__ */ c("div", { css: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
164
|
+
/* @__PURE__ */ r("div", { css: { display: "flex", alignItems: "center", gap: 8 }, children: /* @__PURE__ */ r("div", { css: { flex: 1 }, children: /* @__PURE__ */ r(
|
|
151
165
|
j,
|
|
152
166
|
{
|
|
153
167
|
fullWidth: !0,
|
|
154
168
|
suffix: /* @__PURE__ */ r(
|
|
155
|
-
|
|
169
|
+
T,
|
|
156
170
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
css: [
|
|
172
|
+
e === a && {
|
|
173
|
+
display: "none"
|
|
174
|
+
}
|
|
175
|
+
],
|
|
160
176
|
size: 16,
|
|
161
|
-
source:
|
|
177
|
+
source: A
|
|
162
178
|
}
|
|
163
179
|
),
|
|
164
180
|
onChange: l,
|
|
@@ -167,35 +183,43 @@ const I = (e) => (e && !N && (N = !0, m.initialize(e)), {
|
|
|
167
183
|
size: "32"
|
|
168
184
|
}
|
|
169
185
|
) }) }),
|
|
170
|
-
/* @__PURE__ */ r(U, {
|
|
186
|
+
/* @__PURE__ */ r(U, { css: { minWidth: 288 }, color: a, onChange: t }),
|
|
171
187
|
/* @__PURE__ */ r(
|
|
172
188
|
"div",
|
|
173
189
|
{
|
|
174
190
|
style: {
|
|
175
191
|
gridTemplateColumns: "max-content 1fr"
|
|
176
192
|
},
|
|
177
|
-
|
|
178
|
-
children:
|
|
179
|
-
/* @__PURE__ */ r(
|
|
180
|
-
|
|
181
|
-
|
|
193
|
+
css: { display: "grid", alignItems: "center", columnGap: 16, rowGap: 8 },
|
|
194
|
+
children: G.map((i, m) => /* @__PURE__ */ c(M, { children: [
|
|
195
|
+
/* @__PURE__ */ r(
|
|
196
|
+
"p",
|
|
197
|
+
{
|
|
198
|
+
css: {
|
|
199
|
+
...q.xs
|
|
200
|
+
},
|
|
201
|
+
children: i.name
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ r("div", { css: { display: "inline-flex", alignItems: "center", gap: 8 }, children: i.colors.map((p) => /* @__PURE__ */ r("div", { css: { display: "inline-flex" }, children: /* @__PURE__ */ r("button", { title: p, onClick: u, type: "button", value: p, children: /* @__PURE__ */ r(x, { color: y[p] }) }) }, p)) })
|
|
205
|
+
] }, m))
|
|
182
206
|
}
|
|
183
207
|
)
|
|
184
208
|
] }) })
|
|
185
209
|
] });
|
|
186
210
|
};
|
|
187
211
|
export {
|
|
188
|
-
|
|
189
|
-
|
|
212
|
+
ge as C,
|
|
213
|
+
A as I,
|
|
190
214
|
de as a,
|
|
191
|
-
|
|
215
|
+
N as b,
|
|
192
216
|
ce as c,
|
|
193
|
-
|
|
217
|
+
me as d,
|
|
194
218
|
le as e,
|
|
195
|
-
|
|
196
|
-
|
|
219
|
+
S as f,
|
|
220
|
+
I as g,
|
|
197
221
|
he as i,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
222
|
+
pe as r,
|
|
223
|
+
ue as t,
|
|
224
|
+
fe as u
|
|
201
225
|
};
|