@janbox/storefront-builder 1.0.8 → 2.0.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 +83 -110
- package/dist/anchor-target-BlOvysAr.js +2329 -0
- package/dist/color-picker-popover-B3AVFuei.js +201 -0
- package/dist/components/composer/dataset.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/countdown-timer.node-OmDiT-pz.js +825 -0
- package/dist/date-picker-B4Rju7gG.js +115 -0
- package/dist/{countdown-timer.node-BwrDThFq.js → dialog-header-DPLOS7TT.js} +2209 -3174
- package/dist/dropzone-Dbfed3jK.js +490 -0
- package/dist/editor/hooks/index.d.ts +1 -1
- package/dist/editor/lib/index.d.ts +3 -3
- package/dist/editor/lib/sidebar/insert-action.d.ts +15 -22
- package/dist/editor/toolbars.js +336 -0
- package/dist/editor/types/index.d.ts +0 -2
- package/dist/editor/ui/button/button.d.ts +2 -3
- package/dist/editor/ui/icon-button/icon-button.d.ts +1 -2
- package/dist/editor/ui.js +110 -0
- package/dist/editor.js +1024 -522
- package/dist/index-BbiQ0n_-.js +4 -0
- package/dist/index-CwrFnubn.js +4448 -0
- package/dist/index.js +369 -107
- package/dist/lib/container/container.inspector/container.inspector.d.ts +1 -0
- package/dist/lib/container/container.inspector/index.d.ts +1 -0
- package/dist/lib/container/container.node/container.node.d.ts +2 -0
- package/dist/lib/container/container.node/index.d.ts +3 -0
- package/dist/lib/container/container.node/types.d.ts +2 -0
- package/dist/lib/container/index.d.ts +2 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/templates/elements/carousel/index.d.ts +2 -2
- package/dist/templates/elements/content-list/index.d.ts +2 -2
- package/dist/templates/elements/interactive/index.d.ts +2 -2
- package/dist/templates/elements/layout/index.d.ts +2 -2
- package/dist/templates/elements/media/index.d.ts +2 -2
- package/dist/templates/elements/text/index.d.ts +2 -2
- package/dist/templates/elements/utilities/index.d.ts +2 -2
- package/dist/templates/index.d.ts +0 -1
- package/dist/templates/sections/faqs/index.d.ts +2 -2
- package/dist/templates/sections/guarantee/index.d.ts +2 -2
- package/dist/templates/sections/hero/index.d.ts +2 -2
- package/dist/templates.js +153 -656
- package/dist/{tooltip-W55T4oR8.js → tooltip-KbIHELP2.js} +1 -1
- package/package.json +11 -3
- package/dist/index-Br_MUhzZ.js +0 -6015
- package/dist/index-DGKFfr43.js +0 -4
- /package/dist/editor/hooks/{use-editor-state.d.ts → use-editor.d.ts} +0 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
import { jsx as n, jsxs as k, Fragment as q } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Children as R, isValidElement as z, cloneElement as J, useRef as j, useEffect as Ce, useMemo as B, useCallback as X, Fragment as ye } from "react";
|
|
3
|
+
import { isNumber as ke, isNil as F, merge as Ie, isUndefined as Q, get as _ } from "lodash-es";
|
|
4
|
+
import { c as g, m as ee, l as K, W as O, P as Ve, M as We, A as Ee, B as Se, D as te, E as Ae, F as Oe, L as Te } from "./dialog-header-DPLOS7TT.js";
|
|
5
|
+
import { useControllableState as V } from "@janbox/storefront-ui/hooks";
|
|
6
|
+
import { useMergeRefs as H, useFloating as ne, autoUpdate as se, offset as re, flip as oe, size as ae, useClick as ie, useHover as Pe, safePolygon as Me, useDismiss as le, useRole as ce, useInteractions as ue, useFloatingParentNodeId as Fe, FloatingTree as Re, FloatingPortal as ze } from "@floating-ui/react";
|
|
7
|
+
import { useUpdateEffect as Le } from "react-use";
|
|
8
|
+
import { FLOATING_Z_INDEX as $ } from "@janbox/storefront-ui/theme";
|
|
9
|
+
import { useVirtualizer as De } from "@tanstack/react-virtual";
|
|
10
|
+
import { OverlayScrollbarsComponent as _e } from "overlayscrollbars-react";
|
|
11
|
+
import { useDropzone as $e } from "react-dropzone";
|
|
12
|
+
const ct = ({
|
|
13
|
+
children: e,
|
|
14
|
+
defaultValue: o,
|
|
15
|
+
value: s,
|
|
16
|
+
onSelectionChange: i,
|
|
17
|
+
className: u,
|
|
18
|
+
...t
|
|
19
|
+
}) => {
|
|
20
|
+
const [a, d] = V({
|
|
21
|
+
defaultValue: o ?? null,
|
|
22
|
+
value: s
|
|
23
|
+
}), l = R.toArray(e).filter(
|
|
24
|
+
(m) => z(m)
|
|
25
|
+
), c = (m) => {
|
|
26
|
+
const f = m.currentTarget.value;
|
|
27
|
+
f !== a && (d(f), i?.(f, m));
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ n("div", { className: g("tw:p-1 tw:flex tw:items-center tw:gap-2 tw:bg-ic-white-1s tw:rounded-lg", u), ...t, children: l.map(
|
|
30
|
+
(m) => J(m, {
|
|
31
|
+
onClick(f) {
|
|
32
|
+
c(f), m.props.onClick?.(f);
|
|
33
|
+
},
|
|
34
|
+
className: g(
|
|
35
|
+
"tw:text-ic-white-4s",
|
|
36
|
+
{
|
|
37
|
+
"tw:bg-ic-black-7s tw:hover:bg-ic-black-7s tw:text-ic-white-6s": m.props.value?.toString() === a
|
|
38
|
+
},
|
|
39
|
+
m.props.className
|
|
40
|
+
)
|
|
41
|
+
})
|
|
42
|
+
) });
|
|
43
|
+
}, Z = 10, ut = ({
|
|
44
|
+
min: e = 0,
|
|
45
|
+
max: o = Number.MAX_SAFE_INTEGER,
|
|
46
|
+
fractionDigits: s = 0,
|
|
47
|
+
value: i,
|
|
48
|
+
defaultValue: u,
|
|
49
|
+
step: t = 0,
|
|
50
|
+
ref: a,
|
|
51
|
+
...d
|
|
52
|
+
}) => {
|
|
53
|
+
const l = j(null), [c, m] = V({
|
|
54
|
+
value: i?.toString(),
|
|
55
|
+
defaultValue: u?.toString() ?? ""
|
|
56
|
+
}), f = parseFloat(c), v = H([a, l]), h = typeof s == "number" ? s : Z, W = (r) => {
|
|
57
|
+
if (r = r.replace(/e|E/g, ""), e >= 0 && (r = r.replace(/^-/, "")), s === 0)
|
|
58
|
+
r = r.replace(/\.\d+$/, "");
|
|
59
|
+
else {
|
|
60
|
+
const b = r.split(".");
|
|
61
|
+
if (b.length > 1) {
|
|
62
|
+
const p = b.at(1)?.slice(0, Math.min(h, Z));
|
|
63
|
+
r = `${b.at(0)}.${p}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return d.transform?.(r) ?? r;
|
|
67
|
+
}, E = (r) => {
|
|
68
|
+
d.mode === "onBlur" && r.target.valueAsNumber < e && (r.target.value = e.toString()), m(r.target.value), d.onChange?.(r);
|
|
69
|
+
}, S = (r) => {
|
|
70
|
+
(r.key === "e" || r.key === "E") && r.preventDefault(), d.onKeyDown?.(r);
|
|
71
|
+
}, I = (r) => {
|
|
72
|
+
if (!l.current) return;
|
|
73
|
+
Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set?.call(l.current, r);
|
|
74
|
+
const p = new Event("input", { bubbles: !0 });
|
|
75
|
+
l.current.dispatchEvent(p);
|
|
76
|
+
}, N = (r) => {
|
|
77
|
+
const b = l.current;
|
|
78
|
+
if (F(b)) return;
|
|
79
|
+
const p = b.valueAsNumber, y = Math.min(isNaN(p) ? e + t : p + t, o);
|
|
80
|
+
p !== y && I(y.toString());
|
|
81
|
+
}, A = (r) => {
|
|
82
|
+
const b = l.current;
|
|
83
|
+
if (F(b)) return;
|
|
84
|
+
const p = b.valueAsNumber, y = Math.max(isNaN(p) ? e : p - t, e);
|
|
85
|
+
p !== y && I(y.toString());
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */ n(
|
|
88
|
+
ee,
|
|
89
|
+
{
|
|
90
|
+
...d,
|
|
91
|
+
css: {
|
|
92
|
+
"::-webkit-outer-spin-button": {
|
|
93
|
+
margin: 0,
|
|
94
|
+
WebkitAppearance: "none"
|
|
95
|
+
},
|
|
96
|
+
"::-webkit-inner-spin-button": {
|
|
97
|
+
WebkitAppearance: "none",
|
|
98
|
+
margin: 0
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
prefix: d.prefix ?? (t > 0 ? /* @__PURE__ */ n(
|
|
102
|
+
K,
|
|
103
|
+
{
|
|
104
|
+
disabled: ke(i) && i <= e,
|
|
105
|
+
onClick: A,
|
|
106
|
+
"aria-disabled": isNaN(f) ? !1 : f >= o,
|
|
107
|
+
children: /* @__PURE__ */ n(O, { source: We })
|
|
108
|
+
}
|
|
109
|
+
) : null),
|
|
110
|
+
suffix: d.suffix ?? (t > 0 ? /* @__PURE__ */ n(K, { onClick: N, "aria-disabled": isNaN(f) ? !1 : f <= e, children: /* @__PURE__ */ n(O, { source: Ve }) }) : null),
|
|
111
|
+
type: "number",
|
|
112
|
+
value: c,
|
|
113
|
+
onChange: E,
|
|
114
|
+
transform: W,
|
|
115
|
+
ref: v,
|
|
116
|
+
onKeyDown: S
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}, dt = ({ event: e = "click", reason: o, className: s, ref: i, ...u }) => {
|
|
120
|
+
const t = j(null), {
|
|
121
|
+
context: { onOpenChange: a }
|
|
122
|
+
} = Ee(), d = H([i, t]);
|
|
123
|
+
return Ce(() => {
|
|
124
|
+
const l = t.current;
|
|
125
|
+
if (!l) return;
|
|
126
|
+
const c = function(m) {
|
|
127
|
+
a?.(!1, m, o);
|
|
128
|
+
};
|
|
129
|
+
return l.addEventListener(e, c), () => {
|
|
130
|
+
l.removeEventListener(e, c);
|
|
131
|
+
};
|
|
132
|
+
}, [e, a, o]), /* @__PURE__ */ n("div", { className: g("tw:contents", s), ...u, ref: d });
|
|
133
|
+
}, Y = ({
|
|
134
|
+
open: e,
|
|
135
|
+
placement: o = "bottom",
|
|
136
|
+
onOpenChange: s,
|
|
137
|
+
dissmiss: i,
|
|
138
|
+
children: u,
|
|
139
|
+
reference: t,
|
|
140
|
+
trigger: a = "click",
|
|
141
|
+
offset: d = 4
|
|
142
|
+
}) => {
|
|
143
|
+
const [l, c] = V({
|
|
144
|
+
defaultValue: !1,
|
|
145
|
+
value: e
|
|
146
|
+
}), f = ne({
|
|
147
|
+
open: l,
|
|
148
|
+
onOpenChange: (r, b, p) => {
|
|
149
|
+
c(r), s?.(r, b, p);
|
|
150
|
+
},
|
|
151
|
+
placement: o,
|
|
152
|
+
middleware: [
|
|
153
|
+
re(d),
|
|
154
|
+
oe(),
|
|
155
|
+
ae({
|
|
156
|
+
apply({ elements: r }) {
|
|
157
|
+
const b = {
|
|
158
|
+
zIndex: `${$}`,
|
|
159
|
+
minWidth: `${r.reference.getBoundingClientRect().width}px`
|
|
160
|
+
};
|
|
161
|
+
Object.assign(r.floating.style, b);
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
],
|
|
165
|
+
whileElementsMounted: se
|
|
166
|
+
}), { context: v, refs: h } = f, W = ie(v, {
|
|
167
|
+
enabled: a === "click"
|
|
168
|
+
}), E = Pe(v, {
|
|
169
|
+
enabled: a === "hover",
|
|
170
|
+
handleClose: Me()
|
|
171
|
+
}), S = le(
|
|
172
|
+
v,
|
|
173
|
+
Ie(
|
|
174
|
+
{
|
|
175
|
+
ancestorScroll: !0
|
|
176
|
+
},
|
|
177
|
+
i
|
|
178
|
+
)
|
|
179
|
+
), I = ce(v), N = ue([W, S, I, E]), A = B(
|
|
180
|
+
() => ({
|
|
181
|
+
...f,
|
|
182
|
+
...N
|
|
183
|
+
}),
|
|
184
|
+
[f, N]
|
|
185
|
+
);
|
|
186
|
+
return Le(() => {
|
|
187
|
+
Q(t) || (h.setReference?.(t), v.onOpenChange(!F(t)));
|
|
188
|
+
}, [t]), /* @__PURE__ */ n(Se.Provider, { value: A, children: u });
|
|
189
|
+
}, ft = (e) => Fe() ? /* @__PURE__ */ n(Y, { ...e }) : /* @__PURE__ */ n(Re, { children: /* @__PURE__ */ n(Y, { ...e }) }), je = ({ className: e, ...o }) => /* @__PURE__ */ n("div", { className: g("tw:animate-fade-down", e), ...o }), Be = ({ children: e, className: o, ...s }) => {
|
|
190
|
+
const { activeIndex: i } = te(), u = R.toArray(e).filter((t) => z(t) && t.type === je).find((t, a) => a === i);
|
|
191
|
+
return /* @__PURE__ */ n("div", { className: g("tw:relative tw:border-t tw:border-ic-white-1s", o), ...s, children: u });
|
|
192
|
+
}, He = ({ className: e, classes: o, ...s }) => {
|
|
193
|
+
const { activeIndex: i, focusTab: u } = te(), t = Number(_(s, "data-tab-index")), a = (d) => {
|
|
194
|
+
u(t), s.onClick?.(d);
|
|
195
|
+
};
|
|
196
|
+
return /* @__PURE__ */ n(
|
|
197
|
+
"li",
|
|
198
|
+
{
|
|
199
|
+
"aria-hidden": !0,
|
|
200
|
+
className: g(
|
|
201
|
+
"tw:px-3 tw:py-2 tw:rounded-t-lg tw:text-ic-white-5s tw:text-center tw:cursor-pointer",
|
|
202
|
+
{
|
|
203
|
+
[g("tw:text-ic-white-6s tw:bg-ic-black-7s", o?.active)]: i === t
|
|
204
|
+
},
|
|
205
|
+
e
|
|
206
|
+
),
|
|
207
|
+
...s,
|
|
208
|
+
onClick: a
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}, Ge = ({ className: e, children: o, layout: s = "auto-fit", ...i }) => {
|
|
212
|
+
const u = R.toArray(o).filter(
|
|
213
|
+
(t) => z(t) && t.type === He
|
|
214
|
+
);
|
|
215
|
+
return /* @__PURE__ */ n(
|
|
216
|
+
"ul",
|
|
217
|
+
{
|
|
218
|
+
className: g(
|
|
219
|
+
"tw:flex tw:items-center",
|
|
220
|
+
{
|
|
221
|
+
"tw:*:flex-1": s === "auto-fill"
|
|
222
|
+
},
|
|
223
|
+
e
|
|
224
|
+
),
|
|
225
|
+
...i,
|
|
226
|
+
children: u.map(
|
|
227
|
+
(t, a) => J(t, {
|
|
228
|
+
"data-tab-index": a
|
|
229
|
+
})
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
}, wt = ({ defaultIndex: e, activeIndex: o, children: s, onTabChange: i, className: u, ...t }) => {
|
|
234
|
+
const a = R.toArray(s).filter((h) => z(h)), d = a.find((h) => h.type === Ge), [l, c] = V({
|
|
235
|
+
defaultValue: e ?? 0,
|
|
236
|
+
value: o
|
|
237
|
+
}), m = a.find((h) => h.type === Be), f = (h) => {
|
|
238
|
+
c(h), i?.(h);
|
|
239
|
+
}, v = B(() => ({
|
|
240
|
+
activeIndex: l,
|
|
241
|
+
focusTab: f
|
|
242
|
+
}), [l]);
|
|
243
|
+
return /* @__PURE__ */ n(Ae.Provider, { value: v, children: /* @__PURE__ */ k("div", { className: g("tw:flex tw:flex-col", u), ...t, children: [
|
|
244
|
+
d,
|
|
245
|
+
m
|
|
246
|
+
] }) });
|
|
247
|
+
}, Ue = ({ children: e, options: o, ...s }) => /* @__PURE__ */ n(
|
|
248
|
+
_e,
|
|
249
|
+
{
|
|
250
|
+
options: {
|
|
251
|
+
scrollbars: {
|
|
252
|
+
autoHide: "leave"
|
|
253
|
+
},
|
|
254
|
+
...o
|
|
255
|
+
},
|
|
256
|
+
...s,
|
|
257
|
+
children: e
|
|
258
|
+
}
|
|
259
|
+
), Xe = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
260
|
+
<path d="M6 9L12 15L18 9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
261
|
+
</svg>
|
|
262
|
+
`, Ke = `<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
263
|
+
<path d="M10,18a1,1,0,0,1-.71-.29l-5-5a1,1,0,0,1,1.42-1.42L10,15.59l8.29-8.3a1,1,0,1,1,1.42,1.42l-9,9A1,1,0,0,1,10,18Z"></path>
|
|
264
|
+
</svg>`, Ze = ({ RowComponent: e, options: o, ref: s, ...i }) => {
|
|
265
|
+
const u = j(null), t = H([u, s]), a = De({
|
|
266
|
+
...o,
|
|
267
|
+
getScrollElement: () => {
|
|
268
|
+
const c = u.current?.getElement()?.firstElementChild;
|
|
269
|
+
return c instanceof HTMLDivElement ? c : null;
|
|
270
|
+
}
|
|
271
|
+
}), d = a.getVirtualItems(), l = a.getTotalSize();
|
|
272
|
+
return /* @__PURE__ */ n(Ue, { ...i, ref: t, children: /* @__PURE__ */ n(
|
|
273
|
+
Oe.div,
|
|
274
|
+
{
|
|
275
|
+
initial: { opacity: 0 },
|
|
276
|
+
animate: { opacity: 1 },
|
|
277
|
+
style: {
|
|
278
|
+
height: l
|
|
279
|
+
},
|
|
280
|
+
children: /* @__PURE__ */ n(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
style: {
|
|
284
|
+
transform: `translateY(${d.at(0)?.start ?? 0}px)`
|
|
285
|
+
},
|
|
286
|
+
children: d.map((c) => /* @__PURE__ */ n("div", { "data-index": c.index, ref: a.measureElement, children: /* @__PURE__ */ n(e, { row: c }) }, c.key))
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
) });
|
|
291
|
+
}, mt = (e) => {
|
|
292
|
+
const {
|
|
293
|
+
placement: o = "bottom-start",
|
|
294
|
+
contentWidth: s,
|
|
295
|
+
visible: i,
|
|
296
|
+
onOpenChange: u,
|
|
297
|
+
dissmiss: t,
|
|
298
|
+
searchable: a,
|
|
299
|
+
value: d,
|
|
300
|
+
optionValue: l,
|
|
301
|
+
optionLabel: c,
|
|
302
|
+
defaultValue: m,
|
|
303
|
+
options: f,
|
|
304
|
+
onChange: v,
|
|
305
|
+
placeholder: h,
|
|
306
|
+
prefix: W,
|
|
307
|
+
suffix: E,
|
|
308
|
+
className: S,
|
|
309
|
+
size: I = "32",
|
|
310
|
+
listProps: N,
|
|
311
|
+
selectedRenderer: A,
|
|
312
|
+
checkedIcon: r,
|
|
313
|
+
...b
|
|
314
|
+
} = e, [p, y] = V({
|
|
315
|
+
defaultValue: !1,
|
|
316
|
+
value: i
|
|
317
|
+
}), [T, de] = V({
|
|
318
|
+
defaultValue: m,
|
|
319
|
+
value: d
|
|
320
|
+
}), fe = (w, x, C) => {
|
|
321
|
+
!w && !C || (y(w), u?.(w, x, C));
|
|
322
|
+
}, { refs: G, floatingStyles: we, context: L } = ne({
|
|
323
|
+
open: p,
|
|
324
|
+
onOpenChange: fe,
|
|
325
|
+
placement: o,
|
|
326
|
+
middleware: [
|
|
327
|
+
oe(),
|
|
328
|
+
re(4),
|
|
329
|
+
ae({
|
|
330
|
+
apply({ elements: w }) {
|
|
331
|
+
const { width: x } = w.reference.getBoundingClientRect(), C = s === "fit-parent" ? x : s, M = {
|
|
332
|
+
minWidth: `${C ?? x}px`,
|
|
333
|
+
width: Q(C) ? C : `${C}px`,
|
|
334
|
+
zIndex: $
|
|
335
|
+
};
|
|
336
|
+
Object.assign(w.floating.style, M);
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
],
|
|
340
|
+
whileElementsMounted: se
|
|
341
|
+
}), me = ie(L), pe = le(L, t), be = ce(L), { getReferenceProps: he, getFloatingProps: ge } = ue([me, pe, be]), P = X(
|
|
342
|
+
(w) => typeof l == "function" ? l(w) : _(w, l ?? "value"),
|
|
343
|
+
[l]
|
|
344
|
+
), U = X(
|
|
345
|
+
(w) => typeof c == "function" ? c(w) : _(w, c ?? "label"),
|
|
346
|
+
[c]
|
|
347
|
+
), xe = (w) => {
|
|
348
|
+
const x = P(w);
|
|
349
|
+
x !== T && (de(x), v?.(x, w), y(!1));
|
|
350
|
+
}, D = B(
|
|
351
|
+
() => f.find((w) => T === P(w)),
|
|
352
|
+
[P, f, T]
|
|
353
|
+
), ve = ({ row: w }) => {
|
|
354
|
+
const x = f.at(w.index);
|
|
355
|
+
if (F(x)) return /* @__PURE__ */ n(q, {});
|
|
356
|
+
const C = P(x), M = T === C;
|
|
357
|
+
return /* @__PURE__ */ k(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
onClick: (qe) => {
|
|
361
|
+
xe(x);
|
|
362
|
+
},
|
|
363
|
+
"aria-hidden": !0,
|
|
364
|
+
className: g(
|
|
365
|
+
"tw:p-2 tw:flex tw:items-center tw:gap-2 tw:cursor-pointer tw:rounded-lg tw:hover:bg-ic-white-1s",
|
|
366
|
+
{
|
|
367
|
+
"tw:bg-ic-black-7s": M
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
children: [
|
|
371
|
+
/* @__PURE__ */ n("div", { className: "tw:flex-1 tw:truncate", children: U(x) }),
|
|
372
|
+
M && (r ?? /* @__PURE__ */ n(O, { size: 16, source: Ke }))
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
}, Ne = {
|
|
377
|
+
height: Number(I)
|
|
378
|
+
};
|
|
379
|
+
return /* @__PURE__ */ k(ye, { children: [
|
|
380
|
+
/* @__PURE__ */ k(
|
|
381
|
+
"button",
|
|
382
|
+
{
|
|
383
|
+
className: g(
|
|
384
|
+
"tw:rounded-lg tw:overflow-hidden tw:bg-ic-white-1s tw:inline-flex tw:items-center tw:gap-2 tw:relative tw:text-xs tw:px-2 tw:text-ic-white-6s",
|
|
385
|
+
"tw:after:absolute tw:after:content-empty tw:after:inset-0 tw:after:pointer-events-none tw:after:rounded-lg tw:after:border tw:after:border-transparent",
|
|
386
|
+
{
|
|
387
|
+
"tw:after:border-ic-white-1s tw:bg-ic-black-7s": p
|
|
388
|
+
},
|
|
389
|
+
S
|
|
390
|
+
),
|
|
391
|
+
css: Ne,
|
|
392
|
+
...b,
|
|
393
|
+
...he(),
|
|
394
|
+
ref: G.setReference,
|
|
395
|
+
children: [
|
|
396
|
+
W,
|
|
397
|
+
/* @__PURE__ */ n("div", { className: "tw:flex-1 tw:text-left tw:truncate", children: D ? A?.(D) ?? U(D) : /* @__PURE__ */ n("span", { className: "tw:text-ic-white-3s", children: h }) }),
|
|
398
|
+
E ?? /* @__PURE__ */ n(
|
|
399
|
+
O,
|
|
400
|
+
{
|
|
401
|
+
source: Xe,
|
|
402
|
+
className: g("tw:transition-transform", {
|
|
403
|
+
"tw:-rotate-180": p
|
|
404
|
+
}),
|
|
405
|
+
size: 16
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
p && /* @__PURE__ */ n(ze, { root: document.body, children: /* @__PURE__ */ n(
|
|
412
|
+
"div",
|
|
413
|
+
{
|
|
414
|
+
ref: G.setFloating,
|
|
415
|
+
className: "tw:bg-ic-ink-6s tw:rounded-lg",
|
|
416
|
+
style: {
|
|
417
|
+
...we,
|
|
418
|
+
zIndex: $
|
|
419
|
+
},
|
|
420
|
+
...ge(),
|
|
421
|
+
children: /* @__PURE__ */ k("div", { className: "tw:focus-visible:outline-none tw:rounded-lg tw:py-1 tw:shadow tw:animate-fade tw:animate-duration-300 tw:bg-ic-white-1s tw:text-ic-white-6s tw:text-xs", children: [
|
|
422
|
+
a && /* @__PURE__ */ n("div", { className: "tw:px-2 tw:mb-2", children: /* @__PURE__ */ n(ee, { fullWidth: !0, autoFocus: !0 }) }),
|
|
423
|
+
/* @__PURE__ */ n(
|
|
424
|
+
Ze,
|
|
425
|
+
{
|
|
426
|
+
RowComponent: ve,
|
|
427
|
+
...N,
|
|
428
|
+
className: g("tw:px-1", N?.className),
|
|
429
|
+
style: {
|
|
430
|
+
// height: 160,
|
|
431
|
+
...N?.style
|
|
432
|
+
},
|
|
433
|
+
options: {
|
|
434
|
+
count: f.length,
|
|
435
|
+
estimateSize: () => 32,
|
|
436
|
+
...N?.options
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
] })
|
|
441
|
+
}
|
|
442
|
+
) })
|
|
443
|
+
] });
|
|
444
|
+
}, pt = ({
|
|
445
|
+
className: e,
|
|
446
|
+
style: o,
|
|
447
|
+
children: s,
|
|
448
|
+
isLoading: i,
|
|
449
|
+
hideChildrenOnLoading: u,
|
|
450
|
+
size: t = 24,
|
|
451
|
+
...a
|
|
452
|
+
}) => /* @__PURE__ */ k(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
className: g("tw:relative", e),
|
|
456
|
+
style: {
|
|
457
|
+
minWidth: t,
|
|
458
|
+
minHeight: t,
|
|
459
|
+
...o
|
|
460
|
+
},
|
|
461
|
+
...a,
|
|
462
|
+
children: [
|
|
463
|
+
!i || !u ? s : /* @__PURE__ */ n(q, {}),
|
|
464
|
+
i && /* @__PURE__ */ n("div", { className: "tw:absolute tw:inset-0 tw:z-50 tw:flex tw:items-center tw:justify-center", children: /* @__PURE__ */ n(O, { source: Te, className: "tw:animate-spin tw:text-ic-orange-6s", size: t }) })
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
), bt = ({ children: e, ...o }) => {
|
|
468
|
+
const s = $e(o);
|
|
469
|
+
return /* @__PURE__ */ k("div", { ...s.getRootProps(), children: [
|
|
470
|
+
e?.(s),
|
|
471
|
+
/* @__PURE__ */ n("input", { ...s.getInputProps() })
|
|
472
|
+
] });
|
|
473
|
+
};
|
|
474
|
+
export {
|
|
475
|
+
Xe as A,
|
|
476
|
+
Ue as W,
|
|
477
|
+
ct as a,
|
|
478
|
+
bt as b,
|
|
479
|
+
ut as c,
|
|
480
|
+
pt as d,
|
|
481
|
+
ft as e,
|
|
482
|
+
dt as f,
|
|
483
|
+
mt as g,
|
|
484
|
+
He as h,
|
|
485
|
+
Be as i,
|
|
486
|
+
Ge as j,
|
|
487
|
+
je as k,
|
|
488
|
+
wt as l,
|
|
489
|
+
Ze as m
|
|
490
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Screen } from '@janbox/storefront-ui/theme';
|
|
2
2
|
import { ToResponsiveProps } from '@janbox/storefront-ui/types';
|
|
3
3
|
import { Get, Paths } from 'type-fest';
|
|
4
|
-
export * from './use-editor
|
|
4
|
+
export * from './use-editor';
|
|
5
5
|
export declare const useEditorResponsive: () => {
|
|
6
6
|
getResponsiveProp: <O extends object, P extends Paths<O>, R = Get<O, `${P}`>>(record: ToResponsiveProps<O>, field: P, screen?: Screen, options?: {
|
|
7
7
|
condition?: (value?: R) => boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Theme } from '@janbox/storefront-ui/theme';
|
|
2
2
|
import { SidebarProps } from './sidebar';
|
|
3
3
|
import { Resolver } from '../../types';
|
|
4
|
-
import { EditorHandlers } from '../hooks/use-editor
|
|
4
|
+
import { EditorHandlers } from '../hooks/use-editor';
|
|
5
5
|
export type EditorProps = {
|
|
6
6
|
theme: Theme;
|
|
7
7
|
insert?: SidebarProps['insert'];
|
|
8
8
|
resolver?: Resolver;
|
|
9
9
|
handlers: EditorHandlers;
|
|
10
10
|
};
|
|
11
|
-
export type { EditorHandlers } from '../hooks/use-editor
|
|
12
|
-
export type {
|
|
11
|
+
export type { EditorHandlers } from '../hooks/use-editor';
|
|
12
|
+
export type { InsertTemplate, InsertTemplateGroup } from './sidebar/insert-action';
|
|
13
13
|
export declare const Editor: ({ theme, insert, resolver, handlers }: EditorProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,30 +1,23 @@
|
|
|
1
1
|
import { WbSvgLoaderProps } from '../../ui';
|
|
2
2
|
import { NodeTree } from '../../../types';
|
|
3
|
-
export type
|
|
4
|
-
name
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
autoFocus?: boolean | ((nodeTree: NodeTree) => boolean);
|
|
10
|
-
onCreate?: (nodeTree: NodeTree) => void;
|
|
11
|
-
}[];
|
|
3
|
+
export type InsertTemplate = {
|
|
4
|
+
name?: string;
|
|
5
|
+
icon?: WbSvgLoaderProps;
|
|
6
|
+
template: React.ReactElement | (() => NodeTree | React.ReactElement);
|
|
7
|
+
autoFocus?: boolean | ((nodeTree: NodeTree) => boolean);
|
|
8
|
+
onCreate?: (nodeTree: NodeTree) => void;
|
|
12
9
|
};
|
|
13
|
-
export type
|
|
10
|
+
export type InsertTemplateGroup = {
|
|
14
11
|
name: string;
|
|
15
|
-
icon
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
autoFocus?: boolean | ((nodeTree: NodeTree) => boolean);
|
|
19
|
-
onCreate?: (nodeTree: NodeTree) => void;
|
|
20
|
-
}[];
|
|
12
|
+
icon?: WbSvgLoaderProps;
|
|
13
|
+
templates?: InsertTemplate[];
|
|
14
|
+
renderer?: React.ComponentType;
|
|
21
15
|
};
|
|
22
16
|
export interface InsertActionProps {
|
|
23
|
-
|
|
24
|
-
sections?: InsertSectionGroup[];
|
|
17
|
+
groups?: InsertTemplateGroup[];
|
|
25
18
|
}
|
|
26
|
-
export declare const InsertAction: ({
|
|
27
|
-
export declare const
|
|
28
|
-
group:
|
|
19
|
+
export declare const InsertAction: ({ groups }: InsertActionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const TemplateInsertionGroup: ({ group }: {
|
|
21
|
+
group: InsertTemplateGroup;
|
|
29
22
|
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
30
|
-
export declare const
|
|
23
|
+
export declare const TemplateInsertion: ({ template, autoFocus, onCreate }: InsertTemplate) => import("@emotion/react/jsx-runtime").JSX.Element;
|