@janbox/storefront-builder 1.0.7 → 1.0.9

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 (33) hide show
  1. package/dist/anchor-target-BlOvysAr.js +2329 -0
  2. package/dist/color-picker-popover-B3AVFuei.js +201 -0
  3. package/dist/components/composer/dataset.d.ts +1 -0
  4. package/dist/constants/index.d.ts +1 -0
  5. package/dist/countdown-timer.node-j79tvSTR.js +826 -0
  6. package/dist/date-picker-B4Rju7gG.js +115 -0
  7. package/dist/{countdown-timer.node-CGKz1DZI.js → dialog-header-DPLOS7TT.js} +2209 -3174
  8. package/dist/dropzone-Dbfed3jK.js +490 -0
  9. package/dist/editor/hooks/index.d.ts +1 -1
  10. package/dist/editor/lib/index.d.ts +2 -2
  11. package/dist/editor/toolbars.js +336 -0
  12. package/dist/editor/types/index.d.ts +0 -2
  13. package/dist/editor/ui/button/button.d.ts +2 -3
  14. package/dist/editor/ui/icon-button/icon-button.d.ts +1 -2
  15. package/dist/editor/ui.js +110 -0
  16. package/dist/editor.js +273 -269
  17. package/dist/index-BbiQ0n_-.js +4 -0
  18. package/dist/index-C9Q0Iqvf.js +4447 -0
  19. package/dist/index.js +369 -107
  20. package/dist/lib/container/container.inspector/container.inspector.d.ts +1 -0
  21. package/dist/lib/container/container.inspector/index.d.ts +1 -0
  22. package/dist/lib/container/container.node/container.node.d.ts +2 -0
  23. package/dist/lib/container/container.node/index.d.ts +3 -0
  24. package/dist/lib/container/container.node/types.d.ts +2 -0
  25. package/dist/lib/container/index.d.ts +2 -0
  26. package/dist/lib/index.d.ts +1 -0
  27. package/dist/style.css +1 -1
  28. package/dist/templates.js +185 -189
  29. package/dist/{tooltip-Coblboaw.js → tooltip-KbIHELP2.js} +1 -1
  30. package/package.json +12 -4
  31. package/dist/index-Bvy64nrI.js +0 -4
  32. package/dist/index-Du5uN6Rq.js +0 -6015
  33. /package/dist/editor/hooks/{use-editor-state.d.ts → use-editor.d.ts} +0 -0
@@ -0,0 +1,336 @@
1
+ import { T as f, C as k, a as F, b as P, c as A, d as I, F as B, e as O } from "../anchor-target-BlOvysAr.js";
2
+ import { A as Fe, f as Pe, B as Ae, g as Ie, h as Be, i as Oe, j as Ve, k as Ge, D as Me, l as Ue, m as He, G as Re, H as De, J as je, n as qe, M as Je, N as Ee, o as Le, O as $e, p as Ke, P as Qe, R as Xe, S as Ye, q as Ze, r as _e, s as et, W as tt, t as ot } from "../anchor-target-BlOvysAr.js";
3
+ import { jsxs as h, jsx as e } from "@emotion/react/jsx-runtime";
4
+ import { isNumber as T, isNil as b, isString as N, isEqual as V } from "lodash-es";
5
+ import { useRef as G, useState as M } from "react";
6
+ import "@janbox/storefront-ui/hooks";
7
+ import "@janbox/storefront-ui/theme";
8
+ import "@janbox/storefront-ui/utils";
9
+ import { y as U, t as S, l as g, W as p, P as C, M as W, q as H, s as R, c as D, r as j, C as q } from "../dialog-header-DPLOS7TT.js";
10
+ import { c as y, g as J, f as E } from "../dropzone-Dbfed3jK.js";
11
+ import "@floating-ui/react";
12
+ import "react-use";
13
+ import "react-colorful";
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
+ import "../color-picker-popover-B3AVFuei.js";
20
+ import "@tiptap/extension-text-style";
21
+ import "@tiptap/react";
22
+ import "@tiptap/react/menus";
23
+ import "@tiptap/starter-kit";
24
+ import "react-frame-component";
25
+ import "@craftjs/core";
26
+ import "flat";
27
+ import "@emotion/react";
28
+ import "clsx";
29
+ import "tailwind-merge";
30
+ var u = /* @__PURE__ */ ((t) => (t[t.Pixels = 0] = "Pixels", t[t.Unitless = 1] = "Unitless", t))(u || {});
31
+ const L = [
32
+ {
33
+ label: "Pixels",
34
+ value: 0
35
+ /* Pixels */
36
+ },
37
+ {
38
+ label: "Unitless",
39
+ value: 1
40
+ /* Unitless */
41
+ }
42
+ ], Ne = ({ name: t, responsive: m = !0, value: o, onChange: c }) => {
43
+ const r = T(o?.lineHeight) ? u.Unitless : u.Pixels, l = r === u.Unitless ? 0.1 : 1, a = U(o?.lineHeight, "float"), i = ({ unit: s, value: d }) => {
44
+ if (b(d)) {
45
+ c?.({
46
+ lineHeight: s === u.Unitless ? 1 : d
47
+ });
48
+ return;
49
+ }
50
+ c?.({
51
+ lineHeight: s === u.Unitless ? Number(d.toFixed(1)) : `${d}px`
52
+ });
53
+ }, n = (s) => {
54
+ i({ unit: Number(s.target.value) });
55
+ }, x = (s) => {
56
+ const d = isNaN(s.target.valueAsNumber) ? void 0 : s.target.valueAsNumber;
57
+ i({ unit: r, value: d });
58
+ }, w = (s) => {
59
+ s.stopPropagation(), !b(a) && i({ unit: r, value: Math.max(a + l, 0) });
60
+ }, z = (s) => {
61
+ s.stopPropagation(), !b(a) && i({ unit: r, value: Math.max(a - l, 0) });
62
+ };
63
+ return /* @__PURE__ */ h("div", { className: "tw:flex tw:flex-col tw:gap-2", children: [
64
+ /* @__PURE__ */ e(f, { responsive: m, name: t ?? "Line height", children: /* @__PURE__ */ e("div", { className: "tw:flex tw:items-center tw:gap-1", children: L.map((s) => /* @__PURE__ */ e(
65
+ S,
66
+ {
67
+ onChange: n,
68
+ checked: s.value === r,
69
+ value: s.value,
70
+ name: "toolbar-line-height",
71
+ children: s.label
72
+ },
73
+ s.value
74
+ )) }) }),
75
+ /* @__PURE__ */ e("div", { className: "tw:flex tw:justify-end", children: /* @__PURE__ */ e(
76
+ y,
77
+ {
78
+ fractionDigits: 1,
79
+ type: r === u.Unitless ? "decimal" : "integer",
80
+ value: a ?? "",
81
+ onChange: x,
82
+ prefix: /* @__PURE__ */ e(g, { disabled: T(a) && a <= 0, onClick: z, children: /* @__PURE__ */ e(p, { source: W }) }),
83
+ suffix: /* @__PURE__ */ e(g, { onClick: w, children: /* @__PURE__ */ e(p, { source: C }) }),
84
+ mode: "onBlur",
85
+ className: "tw:text-center",
86
+ placeholder: "normal",
87
+ classes: { container: "tw:w-1/2" }
88
+ }
89
+ ) })
90
+ ] });
91
+ }, ve = ({ name: t, responsive: m = !0, value: o, onChange: c }) => {
92
+ const r = (i) => {
93
+ const n = isNaN(i.target.valueAsNumber) ? void 0 : i.target.valueAsNumber;
94
+ c?.({
95
+ ...o,
96
+ fontSize: n
97
+ });
98
+ }, l = (i) => {
99
+ i.stopPropagation();
100
+ const n = N(o?.fontSize) ? void 0 : o?.fontSize;
101
+ c?.({
102
+ ...o,
103
+ fontSize: b(n) ? 16 : n + 1
104
+ });
105
+ }, a = (i) => {
106
+ i.stopPropagation();
107
+ const n = N(o?.fontSize) ? void 0 : o?.fontSize;
108
+ c?.({
109
+ ...o,
110
+ fontSize: b(n) ? 16 : Math.max(n - 1, 0)
111
+ });
112
+ };
113
+ return /* @__PURE__ */ e(f, { responsive: m, name: t ?? "Font size", children: /* @__PURE__ */ e(
114
+ y,
115
+ {
116
+ onCanPlay: r,
117
+ mode: "onBlur",
118
+ className: "tw:text-center",
119
+ placeholder: "inherit",
120
+ classes: { container: "tw:w-1/2" },
121
+ value: o?.fontSize ?? "",
122
+ prefix: /* @__PURE__ */ e(g, { disabled: T(o?.fontSize) && o.fontSize <= 0, onClick: a, children: /* @__PURE__ */ e(p, { source: W }) }),
123
+ suffix: /* @__PURE__ */ e(g, { onClick: l, children: /* @__PURE__ */ e(p, { source: C }) })
124
+ }
125
+ ) });
126
+ }, v = [
127
+ {
128
+ label: "Block",
129
+ value: "block"
130
+ },
131
+ {
132
+ label: "Inline",
133
+ value: "inline"
134
+ },
135
+ {
136
+ label: "Inline Block",
137
+ value: "inline-block"
138
+ },
139
+ {
140
+ label: "Flex",
141
+ value: "flex"
142
+ },
143
+ {
144
+ label: "Inline Flex",
145
+ value: "flex"
146
+ },
147
+ {
148
+ label: "Grid",
149
+ value: "grid"
150
+ },
151
+ {
152
+ label: "Inline Grid",
153
+ value: "inline-grid"
154
+ }
155
+ ], Se = ({
156
+ name: t,
157
+ responsive: m = !1,
158
+ availableDisplays: o,
159
+ onChange: c,
160
+ value: r
161
+ }) => {
162
+ const l = b(o) ? v : v.filter((i) => o.includes(i.value)), a = (i) => {
163
+ c?.({ display: i });
164
+ };
165
+ return /* @__PURE__ */ e(f, { name: t ?? "Display", responsive: m, children: /* @__PURE__ */ e(
166
+ J,
167
+ {
168
+ className: "tw:w-1/2",
169
+ placement: "bottom-end",
170
+ placeholder: "default",
171
+ options: l,
172
+ value: r?.display ?? null,
173
+ onChange: a
174
+ }
175
+ ) });
176
+ }, Ce = ({ value: t, onChange: m, name: o, responsive: c = !1 }) => {
177
+ const r = {
178
+ flexBasis: t?.flexBasis ?? "auto",
179
+ flexGrow: t?.flexGrow ?? 0,
180
+ flexShrink: t?.flexShrink ?? 1
181
+ }, l = [
182
+ {
183
+ label: "Auto fit",
184
+ value: 0,
185
+ rawValue: {
186
+ flexBasis: "auto",
187
+ flexGrow: 0,
188
+ flexShrink: 1
189
+ }
190
+ },
191
+ {
192
+ label: "Auto fill",
193
+ value: 1,
194
+ rawValue: {
195
+ flexBasis: "0%",
196
+ flexGrow: 1,
197
+ flexShrink: 1
198
+ }
199
+ }
200
+ ], a = l.find((n) => V(n.rawValue, r))?.value, i = (n) => {
201
+ const x = l.find((w) => w.value === Number(n.target.value));
202
+ x && m?.(x.rawValue);
203
+ };
204
+ return /* @__PURE__ */ e(f, { name: o ?? "Content", responsive: c, children: /* @__PURE__ */ e("div", { className: "tw:inline-flex tw:items-center tw:gap-2", children: l.map((n) => /* @__PURE__ */ e(
205
+ S,
206
+ {
207
+ checked: n.value === a,
208
+ value: n.value,
209
+ onChange: i,
210
+ children: n.label
211
+ },
212
+ n.value
213
+ )) }) });
214
+ }, We = ({ name: t, value: m, onChange: o, responsive: c = !0 }) => {
215
+ const r = G(null), l = (a) => {
216
+ o?.({
217
+ minWidth: a
218
+ });
219
+ };
220
+ return /* @__PURE__ */ e(f, { name: t ?? "Min width", responsive: c, children: /* @__PURE__ */ e("div", { className: "tw:relative tw:w-1/2", children: /* @__PURE__ */ e(
221
+ k,
222
+ {
223
+ fullWidth: !0,
224
+ wrapRef: r,
225
+ placeholder: "0",
226
+ value: m?.minWidth,
227
+ onChange: l,
228
+ defaultValue: {
229
+ "%": 100
230
+ }
231
+ }
232
+ ) }) });
233
+ }, ye = ({ value: t, onChange: m }) => {
234
+ const [o, c] = M(!1), r = (a) => {
235
+ m?.({ ...t, sizeVariant: a });
236
+ }, l = (a) => {
237
+ m?.({
238
+ ...t,
239
+ css: {
240
+ ...t?.css,
241
+ ...a
242
+ }
243
+ });
244
+ };
245
+ return /* @__PURE__ */ e(f, { name: "Text style", children: /* @__PURE__ */ h(H, { open: o, onOpenChange: c, placement: "right", children: [
246
+ /* @__PURE__ */ e(R, { children: /* @__PURE__ */ h(
247
+ "button",
248
+ {
249
+ className: D(
250
+ "tw:w-1/2 tw:h-8 tw:flex tw:items-center tw:gap-2 tw:rounded-md tw:bg-ic-white-1s tw:px-2 tw:text-left tw:truncate tw:text-xs",
251
+ {
252
+ "tw:bg-ic-black-7s": o
253
+ }
254
+ ),
255
+ children: [
256
+ /* @__PURE__ */ e(p, { className: "tw:text-white", source: F }),
257
+ /* @__PURE__ */ e("span", { children: "Auto" })
258
+ ]
259
+ }
260
+ ) }),
261
+ /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { style: { width: 280 }, children: [
262
+ /* @__PURE__ */ h("div", { className: "tw:flex tw:justify-between tw:items-center tw:gap-2", children: [
263
+ /* @__PURE__ */ e("div", { className: "tw:font-medium", children: "Text style" }),
264
+ /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(p, { source: q }) }) })
265
+ ] }),
266
+ /* @__PURE__ */ e("hr", { className: "tw:border-ic-white-1s tw:my-2" }),
267
+ /* @__PURE__ */ h("div", { className: "tw:flex tw:flex-col tw:gap-3", children: [
268
+ /* @__PURE__ */ e(P, { value: t?.sizeVariant, onChange: r }),
269
+ /* @__PURE__ */ e(A, { value: { color: t?.css?.color }, onChange: l }),
270
+ /* @__PURE__ */ e(
271
+ I,
272
+ {
273
+ name: "Style",
274
+ value: {
275
+ fontWeight: t?.css?.fontWeight,
276
+ fontStyle: t?.css?.fontStyle,
277
+ textDecorationLine: t?.css?.textDecorationLine
278
+ },
279
+ onChange: l
280
+ }
281
+ ),
282
+ /* @__PURE__ */ e(B, { value: { fontWeight: t?.css?.fontWeight }, onChange: l }),
283
+ /* @__PURE__ */ e(
284
+ O,
285
+ {
286
+ value: {
287
+ textTransform: t?.css?.textTransform
288
+ },
289
+ onChange: l
290
+ }
291
+ )
292
+ ] })
293
+ ] }) })
294
+ ] }) });
295
+ };
296
+ export {
297
+ Fe as AnchorTargetToolbar,
298
+ Pe as AspectRatioToolbar,
299
+ Ae as BackgroundToolbar,
300
+ Ie as BorderRadiusToolbar,
301
+ Be as BorderToolbar,
302
+ Oe as ChildNodesToolbar,
303
+ A as ColorToolbar,
304
+ Ve as ColorVariantToolbar,
305
+ Ge as ColumnGapToolbar,
306
+ Me as DisplayOnToolbar,
307
+ Se as DisplayToolbar,
308
+ Ue as FlexAlignItemsToolbar,
309
+ Ce as FlexToolbar,
310
+ He as FlexWrapToolbar,
311
+ ve as FontSizeToolbar,
312
+ B as FontWeightToolbar,
313
+ Re as GridAlignItemsToolbar,
314
+ De as HeightToolbar,
315
+ je as JustifyContentToolbar,
316
+ qe as JustifyItemsToolbar,
317
+ Ne as LineHeightToolbar,
318
+ Je as MarginToolbar,
319
+ We as MinWidthToolbar,
320
+ Ee as NumberField,
321
+ Le as NumberFieldMixOptions,
322
+ $e as ObjectFitToolbar,
323
+ Ke as OrderToolbar,
324
+ Qe as PaddingToolbar,
325
+ Xe as RowGapToolbar,
326
+ Ye as SpacingToolbar,
327
+ Ze as SvgSourceToolbar,
328
+ _e as TagNameToolbar,
329
+ et as TextAlignToolbar,
330
+ P as TextSizeVariantToolbar,
331
+ ye as TextStyleGroupToolbar,
332
+ I as TextStyleToolbar,
333
+ O as TextTransformToolbar,
334
+ tt as WidthToolbar,
335
+ ot as textSizeVariantOptions
336
+ };
@@ -1,3 +1 @@
1
- export type WbButtonVariant = 'contained' | 'outlined' | 'text';
2
- export type WbButtonSize = '20' | '24' | '28' | '32' | '36';
3
1
  export type CssUnit = 'px' | '%';
@@ -1,11 +1,10 @@
1
1
  import { JSX } from 'react';
2
- import { WbButtonSize, WbButtonVariant } from '../../types';
3
2
  import { ShallowMerge } from '@janbox/storefront-ui/types';
4
3
  export type WbButtonProps = ShallowMerge<JSX.IntrinsicElements['button'], {
5
- size?: WbButtonSize;
4
+ size?: '20' | '24' | '28' | '32' | '36';
6
5
  prefix?: React.ReactNode;
7
6
  suffix?: React.ReactNode;
8
- variant?: WbButtonVariant;
7
+ variant?: 'contained' | 'outlined' | 'text';
9
8
  fullWidth?: boolean;
10
9
  isLoading?: boolean;
11
10
  }>;
@@ -1,9 +1,8 @@
1
1
  import { JSX } from 'react';
2
2
  import { ShallowMerge } from '@janbox/storefront-ui/types';
3
- import { WbButtonSize } from '../../types';
4
3
  import { WbTooltipProps } from '../tooltip';
5
4
  export type WbIconButtonProps = ShallowMerge<JSX.IntrinsicElements['button'], {
6
- size?: WbButtonSize;
5
+ size?: '20' | '24' | '28' | '32' | '36';
7
6
  tooltip?: Omit<WbTooltipProps, 'children'>;
8
7
  isHighlighted?: boolean;
9
8
  }>;
@@ -0,0 +1,110 @@
1
+ import { a as b, b as i, u as n, c as o } from "../dialog-header-DPLOS7TT.js";
2
+ import { d as D, e as F, f as P, g as k, h as I, i as y, j as L, k as B, W as S, l as j, m as M, n as z, o as O, p as V, q as E, r as G, s as _, t as q, v as A, w as H, x as R } from "../dialog-header-DPLOS7TT.js";
3
+ import { W } from "../dropzone-Dbfed3jK.js";
4
+ import { a as Z, b as J, c as K, d as Q, e as U, f as Y, g as $, h as tt, i as et, j as at, k as st, l as ot, m as lt } from "../dropzone-Dbfed3jK.js";
5
+ import { W as bt } from "../tooltip-KbIHELP2.js";
6
+ import { jsx as e, jsxs as l } from "@emotion/react/jsx-runtime";
7
+ import { FLOATING_Z_INDEX as w } from "@janbox/storefront-ui/theme";
8
+ import "lodash-es";
9
+ import { isValidElement as m } from "react";
10
+ import { W as nt } from "../date-picker-B4Rju7gG.js";
11
+ const g = ({ width: a = 600, children: s, ...t }) => /* @__PURE__ */ e(
12
+ b,
13
+ {
14
+ dismissProps: {
15
+ enabled: !0
16
+ },
17
+ ...t,
18
+ children: /* @__PURE__ */ l(
19
+ i,
20
+ {
21
+ floatingOverlayProps: {
22
+ disabled: !1,
23
+ className: "grid place-items-center p-4 sm:p-5 md:p-6",
24
+ lockScroll: !0,
25
+ style: {
26
+ zIndex: w
27
+ }
28
+ },
29
+ className: "tw:max-h-full tw:max-w-full tw:overflow-hidden tw:flex tw:flex-col",
30
+ children: [
31
+ /* @__PURE__ */ e(
32
+ "div",
33
+ {
34
+ css: {
35
+ backdropFilter: "blur(2px)"
36
+ },
37
+ className: "tw:fixed tw:inset-0 tw:bg-black tw:bg-opacity-40 tw:pointer-events-none"
38
+ }
39
+ ),
40
+ /* @__PURE__ */ e(
41
+ "div",
42
+ {
43
+ css: {
44
+ width: a
45
+ },
46
+ className: "tw:max-w-full tw:overflow-hidden tw:flex tw:flex-col tw:rounded-lg tw:py-2 tw:relative tw:bg-ic-ink-6s tw:text-white",
47
+ children: s
48
+ }
49
+ )
50
+ ]
51
+ }
52
+ )
53
+ }
54
+ ), v = () => n(), C = ({ className: a, ref: s, ...t }) => /* @__PURE__ */ e(
55
+ W,
56
+ {
57
+ className: o("tw:flex-1 tw:overflow-auto tw:py-3 tw:px-4 tw:sm:px-5 tw:text-xs", a),
58
+ ...t,
59
+ ref: s
60
+ }
61
+ ), N = ({ required: a, className: s, children: t, ...r }) => /* @__PURE__ */ l("div", { className: o("tw:mb-1.5 tw:flex tw:w-fit", s), ...r, children: [
62
+ m(t) ? t : /* @__PURE__ */ e("label", { children: t }),
63
+ a && /* @__PURE__ */ e("span", { className: "tw:text-ic-red-6s", children: " *" })
64
+ ] });
65
+ export {
66
+ D as WbButton,
67
+ Z as WbButtonGroup,
68
+ F as WbCollapse,
69
+ P as WbColorPicker,
70
+ nt as WbDatePicker,
71
+ g as WbDialog,
72
+ C as WbDialogBody,
73
+ k as WbDialogClose,
74
+ I as WbDialogFooter,
75
+ y as WbDialogHeader,
76
+ J as WbDropzone,
77
+ b as WbFloating,
78
+ L as WbFloatingClose,
79
+ i as WbFloatingContent,
80
+ B as WbFloatingContext,
81
+ N as WbFormLabel,
82
+ S as WbIcon,
83
+ j as WbIconButton,
84
+ M as WbInput,
85
+ K as WbInputNumber,
86
+ Q as WbLoadingOverlay,
87
+ U as WbMenu,
88
+ z as WbMenuItem,
89
+ O as WbMenuList,
90
+ V as WbMenuTrigger,
91
+ E as WbPopover,
92
+ Y as WbPopoverClose,
93
+ G as WbPopoverContent,
94
+ _ as WbPopoverTrigger,
95
+ q as WbRadioButton,
96
+ W as WbScrollView,
97
+ $ as WbSelect,
98
+ A as WbSvgLoader,
99
+ H as WbSwitch,
100
+ tt as WbTab,
101
+ et as WbTabContent,
102
+ at as WbTabList,
103
+ st as WbTabPanel,
104
+ ot as WbTabs,
105
+ R as WbTextarea,
106
+ bt as WbTooltip,
107
+ lt as WbVirtualizedList,
108
+ v as useDialogContext,
109
+ n as useWbFloatingContext
110
+ };