@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.
Files changed (46) hide show
  1. package/README.md +83 -110
  2. package/dist/anchor-target-BlOvysAr.js +2329 -0
  3. package/dist/color-picker-popover-B3AVFuei.js +201 -0
  4. package/dist/components/composer/dataset.d.ts +1 -0
  5. package/dist/constants/index.d.ts +1 -0
  6. package/dist/countdown-timer.node-OmDiT-pz.js +825 -0
  7. package/dist/date-picker-B4Rju7gG.js +115 -0
  8. package/dist/{countdown-timer.node-BwrDThFq.js → dialog-header-DPLOS7TT.js} +2209 -3174
  9. package/dist/dropzone-Dbfed3jK.js +490 -0
  10. package/dist/editor/hooks/index.d.ts +1 -1
  11. package/dist/editor/lib/index.d.ts +3 -3
  12. package/dist/editor/lib/sidebar/insert-action.d.ts +15 -22
  13. package/dist/editor/toolbars.js +336 -0
  14. package/dist/editor/types/index.d.ts +0 -2
  15. package/dist/editor/ui/button/button.d.ts +2 -3
  16. package/dist/editor/ui/icon-button/icon-button.d.ts +1 -2
  17. package/dist/editor/ui.js +110 -0
  18. package/dist/editor.js +1024 -522
  19. package/dist/index-BbiQ0n_-.js +4 -0
  20. package/dist/index-CwrFnubn.js +4448 -0
  21. package/dist/index.js +369 -107
  22. package/dist/lib/container/container.inspector/container.inspector.d.ts +1 -0
  23. package/dist/lib/container/container.inspector/index.d.ts +1 -0
  24. package/dist/lib/container/container.node/container.node.d.ts +2 -0
  25. package/dist/lib/container/container.node/index.d.ts +3 -0
  26. package/dist/lib/container/container.node/types.d.ts +2 -0
  27. package/dist/lib/container/index.d.ts +2 -0
  28. package/dist/lib/index.d.ts +1 -0
  29. package/dist/style.css +1 -1
  30. package/dist/templates/elements/carousel/index.d.ts +2 -2
  31. package/dist/templates/elements/content-list/index.d.ts +2 -2
  32. package/dist/templates/elements/interactive/index.d.ts +2 -2
  33. package/dist/templates/elements/layout/index.d.ts +2 -2
  34. package/dist/templates/elements/media/index.d.ts +2 -2
  35. package/dist/templates/elements/text/index.d.ts +2 -2
  36. package/dist/templates/elements/utilities/index.d.ts +2 -2
  37. package/dist/templates/index.d.ts +0 -1
  38. package/dist/templates/sections/faqs/index.d.ts +2 -2
  39. package/dist/templates/sections/guarantee/index.d.ts +2 -2
  40. package/dist/templates/sections/hero/index.d.ts +2 -2
  41. package/dist/templates.js +153 -656
  42. package/dist/{tooltip-W55T4oR8.js → tooltip-KbIHELP2.js} +1 -1
  43. package/package.json +11 -3
  44. package/dist/index-Br_MUhzZ.js +0 -6015
  45. package/dist/index-DGKFfr43.js +0 -4
  46. /package/dist/editor/hooks/{use-editor-state.d.ts → use-editor.d.ts} +0 -0
@@ -0,0 +1,201 @@
1
+ import { isString as g } from "lodash-es";
2
+ import { useCallback as v, useMemo as P, useSyncExternalStore as W, Fragment as z } from "react";
3
+ import "clsx";
4
+ import "tailwind-merge";
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";
7
+ import { jsxs as c, jsx as r } from "@emotion/react/jsx-runtime";
8
+ import { parseColor as x, paletteVars as B, groupedColors as O } from "@janbox/storefront-ui/theme";
9
+ import { flatten as $ } from "flat";
10
+ import "@janbox/storefront-ui/hooks";
11
+ import "@janbox/storefront-ui/utils";
12
+ import "@floating-ui/react";
13
+ import "react-use";
14
+ import "overlayscrollbars-react";
15
+ import "@tanstack/react-virtual";
16
+ import "react-dropzone";
17
+ import "react-datepicker/dist/react-datepicker.css";
18
+ import "react-datepicker";
19
+ const k = (e) => e.info ?? {}, y = (e) => e.data?.custom ?? {}, de = (e) => {
20
+ const t = y(e);
21
+ if (g(t.displayName))
22
+ return t.displayName;
23
+ const o = k(e);
24
+ return g(o.displayName) ? o.displayName : o.displayName?.(e.data.props) ?? e.data.displayName;
25
+ }, le = (e) => e.data.displayName, ce = (e) => e.related ?? {}, he = (e) => y(e).selectable ?? k(e).selectable ?? !0, ue = (e, t) => {
26
+ try {
27
+ e.craft && (e.craft = {
28
+ ...e.craft,
29
+ related: {
30
+ ...e.craft?.related,
31
+ ...t
32
+ }
33
+ });
34
+ } catch (o) {
35
+ console.error(`Error setting related for ${e.craft?.displayName}`, o);
36
+ }
37
+ }, pe = (e, t = "xs") => t === "xs" ? e : { [t]: e }, we = (e, t) => {
38
+ const { resolved: o, ...i } = t;
39
+ return e.craft = {
40
+ displayName: o,
41
+ ...i,
42
+ related: i.related ?? {}
43
+ }, e;
44
+ }, me = (e = () => ({})) => {
45
+ const t = q(e), { query: o, actions: i } = t, h = v(
46
+ (s, a, d) => {
47
+ const l = o.node(s).get(), n = a ?? l.data.parent, w = n ? o.node(n).get() : null;
48
+ if (!w)
49
+ throw new Error("Parent node not found");
50
+ const u = {
51
+ data: {
52
+ ...l.data,
53
+ nodes: [],
54
+ linkedNodes: {}
55
+ }
56
+ }, f = o.parseFreshNode(u).toNode();
57
+ return i.add(f, w.id, d ?? w.data.nodes.length), l.data.nodes.forEach((S, E) => {
58
+ h(S, f.id, E);
59
+ }), o.node(f.id).get();
60
+ },
61
+ [i, o]
62
+ ), p = v(
63
+ (s) => {
64
+ const a = s.parentId ?? o.node(s.nodeId).get().data.parent;
65
+ if (!a)
66
+ throw new Error("Parent node not found");
67
+ let d;
68
+ if ("sourceIndex" in s) {
69
+ const { sourceIndex: l, destinationIndex: n } = s;
70
+ d = n > l ? n + 1 : n;
71
+ } else
72
+ d = s.moveIndex;
73
+ i.move(s.nodeId, a, d);
74
+ },
75
+ [i, o]
76
+ );
77
+ return P(() => ({
78
+ ...t,
79
+ actions: {
80
+ ...t.actions,
81
+ move: p,
82
+ duplicate: h
83
+ }
84
+ }), [h, t, p]);
85
+ }, A = () => {
86
+ let e;
87
+ const t = /* @__PURE__ */ new Set();
88
+ return { getSnapshot: () => {
89
+ if (!e)
90
+ throw new Error("useEditor must be initialized with initialState before use.");
91
+ return e;
92
+ }, subscribe: (s) => (t.add(s), () => t.delete(s)), initialize: (s) => {
93
+ e = s, t.forEach((a) => a());
94
+ }, setState: (s) => {
95
+ if (!e)
96
+ throw new Error("useEditor must be initialized before setState.");
97
+ e = { ...e, ...s }, t.forEach((a) => a());
98
+ } };
99
+ }, m = A();
100
+ let N = !1;
101
+ const I = (e) => (e && !N && (N = !0, m.initialize(e)), {
102
+ ...W(m.subscribe, m.getSnapshot),
103
+ setState: m.setState
104
+ }), b = ({ color: e, size: t = 24 }) => {
105
+ const o = I(), i = x(e, o.theme.palette);
106
+ return /* @__PURE__ */ c(
107
+ "div",
108
+ {
109
+ title: e,
110
+ className: "tw:rounded-full tw:border tw:border-ic-white-3s tw:overflow-hidden",
111
+ style: { backgroundColor: i?.toString(), width: t, height: t },
112
+ children: [
113
+ !i && /* @__PURE__ */ c("svg", { className: "tw:w-full tw:h-full tw:text-ic-white-5s", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: [
114
+ /* @__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
+ /* @__PURE__ */ r("rect", { width: "32", height: "32", fill: "url(#diagonal-stripes)" })
116
+ ] }),
117
+ i?.alpha() === 0 && /* @__PURE__ */ c("svg", { className: "tw:w-full tw:h-full", xmlns: "http://www.w3.org/2000/svg", children: [
118
+ /* @__PURE__ */ r("defs", { children: /* @__PURE__ */ c("pattern", { id: "checkerboard", patternUnits: "userSpaceOnUse", width: "8", height: "8", children: [
119
+ /* @__PURE__ */ r("rect", { width: "8", height: "8", fill: "white" }),
120
+ /* @__PURE__ */ r("rect", { width: "4", height: "4", fill: "lightgray" }),
121
+ /* @__PURE__ */ r("rect", { x: "4", y: "4", width: "4", height: "4", fill: "lightgray" })
122
+ ] }) }),
123
+ /* @__PURE__ */ r("rect", { width: "100%", height: "100%", fill: "url(#checkerboard)" })
124
+ ] })
125
+ ]
126
+ }
127
+ );
128
+ }, D = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
129
+ <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
+ <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
+ <path d="M12 12V17" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
132
+ </svg>
133
+ `, C = $(B), fe = ({
134
+ color: e,
135
+ onChange: t,
136
+ children: o,
137
+ placement: i = "right-start",
138
+ ...h
139
+ }) => {
140
+ const p = (n) => {
141
+ t?.(C[n.currentTarget.value]);
142
+ }, s = I(), a = x(e, s.theme.palette)?.hex(), d = (n) => {
143
+ n.target.select();
144
+ }, l = (n) => {
145
+ t?.(n.target.value);
146
+ };
147
+ return /* @__PURE__ */ c(M, { placement: i, ...h, children: [
148
+ /* @__PURE__ */ r(F, { children: o ?? /* @__PURE__ */ r("button", { className: "tw:border tw:border-ic-white-1s tw:rounded-full tw:hover:border-ic-white-3s tw:p-0.5", children: /* @__PURE__ */ r(b, { color: e }) }) }),
149
+ /* @__PURE__ */ r(V, { children: /* @__PURE__ */ c("div", { className: "tw:flex tw:flex-col tw:gap-3", children: [
150
+ /* @__PURE__ */ r("div", { className: "tw:flex tw:items-center tw:gap-2", children: /* @__PURE__ */ r("div", { className: "tw:flex-1", children: /* @__PURE__ */ r(
151
+ j,
152
+ {
153
+ fullWidth: !0,
154
+ suffix: /* @__PURE__ */ r(
155
+ R,
156
+ {
157
+ className: T({
158
+ hidden: e === a
159
+ }),
160
+ size: 16,
161
+ source: D
162
+ }
163
+ ),
164
+ onChange: l,
165
+ onFocus: d,
166
+ value: a,
167
+ size: "32"
168
+ }
169
+ ) }) }),
170
+ /* @__PURE__ */ r(U, { className: "tw:min-w-72", color: a, onChange: t }),
171
+ /* @__PURE__ */ r(
172
+ "div",
173
+ {
174
+ style: {
175
+ gridTemplateColumns: "max-content 1fr"
176
+ },
177
+ className: "tw:grid tw:items-center tw:gap-x-4 tw:gap-y-2",
178
+ children: O.map((n, w) => /* @__PURE__ */ c(z, { children: [
179
+ /* @__PURE__ */ r("p", { className: "tw:text-xs", children: n.name }),
180
+ /* @__PURE__ */ r("div", { className: "tw:inline-flex tw:items-center tw:gap-2", children: n.colors.map((u) => /* @__PURE__ */ r("div", { className: "tw:inline-flex", children: /* @__PURE__ */ r("button", { title: u, onClick: p, type: "button", value: u, children: /* @__PURE__ */ r(b, { color: C[u] }) }) }, u)) })
181
+ ] }, w))
182
+ }
183
+ )
184
+ ] }) })
185
+ ] });
186
+ };
187
+ export {
188
+ fe as C,
189
+ D as I,
190
+ de as a,
191
+ k as b,
192
+ ce as c,
193
+ we as d,
194
+ le as e,
195
+ I as f,
196
+ y as g,
197
+ he as i,
198
+ ue as r,
199
+ pe as t,
200
+ me as u
201
+ };
@@ -9,6 +9,7 @@ export declare const defaultResolver: {
9
9
  flexbox: (props: import('../../lib/flexbox/flexbox.node').FlexboxNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
10
10
  "flex-item": ({ children, ...props }: import('../../lib/flex-item/flex-item.node').FlexItemNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
11
  box: ({ children, ...props }: import('../../lib/box/box.node').BoxNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
12
+ container: ({ children, ...props }: import('../../lib/container/container.node').ContainerNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
12
13
  image: (props: import('../../lib/image/image.node').ImageNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
13
14
  video: ({ ...props }: import('../../lib/video/video.node').VideoNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
15
  icon: (props: import('../../lib/icon/icon.node').IconNodeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -30,6 +30,7 @@ export declare enum CoreNodeResolvedEnum {
30
30
  Accordion = "accordion",
31
31
  AccordionSummary = "accordion-summary",
32
32
  AccordionContent = "accordion-content",
33
+ Container = "container",
33
34
  CountdownTimer = "countdown-timer"
34
35
  }
35
36
  export declare enum NodeDatasetAttributes {