@billgangcom/theme-lib 1.7.0 → 1.8.1

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/dist/ui.es.js CHANGED
@@ -1,19 +1,19 @@
1
- import { j as t, I as p, a as A, c as Y, S as N, T as O, b as I, C as J, B as E, v as P } from "./index-DxdTFgwx.js";
2
- import { g as Se, h as Ae, e as Le, M as ze, P as Re, R as Oe, d as Ee, f as He } from "./index-DxdTFgwx.js";
3
- import k from "react";
4
- const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_15", V = "_subtitle_1g82c_22", W = "_alignmentContent_1g82c_29", X = "_alignments_1g82c_35", Z = "_alignment_1g82c_8", tt = "_circle_1g82c_54", et = "_paddings_1g82c_61", st = "_padding_1g82c_61", nt = "_input_1g82c_79", x = {
5
- wrapper: K,
6
- alignmentBlock: Q,
7
- title: U,
8
- subtitle: V,
9
- alignmentContent: W,
10
- alignments: X,
11
- alignment: Z,
12
- circle: tt,
13
- paddings: et,
14
- padding: st,
15
- input: nt
16
- }, ot = [
1
+ import { j as t, I as g, a as I, c as U, S as P, T as q, C as J, b as D, D as et, H as st, B as K, v as E, u as nt, d as ot } from "./index-C6aV8YdJ.js";
2
+ import { h as rs, i as ds, f as us, M as _s, P as ps, R as ms, e as hs, g as gs } from "./index-C6aV8YdJ.js";
3
+ import v from "react";
4
+ const ct = "_wrapper_1g82c_2", lt = "_alignmentBlock_1g82c_8", it = "_title_1g82c_15", at = "_subtitle_1g82c_22", rt = "_alignmentContent_1g82c_29", dt = "_alignments_1g82c_35", ut = "_alignment_1g82c_8", _t = "_circle_1g82c_54", pt = "_paddings_1g82c_61", mt = "_padding_1g82c_61", ht = "_input_1g82c_79", $ = {
5
+ wrapper: ct,
6
+ alignmentBlock: lt,
7
+ title: it,
8
+ subtitle: at,
9
+ alignmentContent: rt,
10
+ alignments: dt,
11
+ alignment: ut,
12
+ circle: _t,
13
+ paddings: pt,
14
+ padding: mt,
15
+ input: ht
16
+ }, gt = [
17
17
  "topLeft",
18
18
  "top",
19
19
  "topRight",
@@ -23,10 +23,10 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
23
23
  "bottomLeft",
24
24
  "bottom",
25
25
  "bottomRight"
26
- ], ct = ["left", "top", "right", "bottom"], Be = (r) => {
27
- const { alignment: e, padding: i, setPadding: s, setAlignment: n } = r;
28
- function u() {
29
- switch (e) {
26
+ ], xt = ["left", "top", "right", "bottom"], cs = (d) => {
27
+ const { alignment: s, padding: o, setPadding: c, setAlignment: l } = d;
28
+ function e() {
29
+ switch (s) {
30
30
  case "left":
31
31
  case "topLeft":
32
32
  case "bottomLeft":
@@ -43,24 +43,24 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
43
43
  return "center";
44
44
  }
45
45
  }
46
- return /* @__PURE__ */ t.jsxs("div", { className: x.layout, children: [
47
- /* @__PURE__ */ t.jsx("h3", { className: x.title, children: "Layout" }),
48
- /* @__PURE__ */ t.jsxs("div", { className: x.alignmentBlock, children: [
49
- /* @__PURE__ */ t.jsx("h5", { className: x.subtitle, children: "Alignment" }),
50
- /* @__PURE__ */ t.jsxs("div", { className: x.alignmentContent, children: [
51
- /* @__PURE__ */ t.jsx("div", { className: x.alignments, children: ot.map((l) => /* @__PURE__ */ t.jsxs(
46
+ return /* @__PURE__ */ t.jsxs("div", { className: $.layout, children: [
47
+ /* @__PURE__ */ t.jsx("h3", { className: $.title, children: "Layout" }),
48
+ /* @__PURE__ */ t.jsxs("div", { className: $.alignmentBlock, children: [
49
+ /* @__PURE__ */ t.jsx("h5", { className: $.subtitle, children: "Alignment" }),
50
+ /* @__PURE__ */ t.jsxs("div", { className: $.alignmentContent, children: [
51
+ /* @__PURE__ */ t.jsx("div", { className: $.alignments, children: gt.map((n) => /* @__PURE__ */ t.jsxs(
52
52
  "div",
53
53
  {
54
54
  onClick: () => {
55
- n((m) => l);
55
+ l(n);
56
56
  },
57
- className: x.alignment,
57
+ className: $.alignment,
58
58
  children: [
59
- l !== e && /* @__PURE__ */ t.jsx("div", { className: x.circle }),
60
- l === e && /* @__PURE__ */ t.jsx(
61
- p,
59
+ n !== s && /* @__PURE__ */ t.jsx("div", { className: $.circle }),
60
+ n === s && /* @__PURE__ */ t.jsx(
61
+ g,
62
62
  {
63
- name: `text-align-${u()}`,
63
+ name: `text-align-${e()}`,
64
64
  fill: "#FF3F19",
65
65
  width: 22,
66
66
  height: 22
@@ -68,26 +68,26 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
68
68
  )
69
69
  ]
70
70
  },
71
- l
71
+ n
72
72
  )) }),
73
- /* @__PURE__ */ t.jsx("div", { className: x.paddings, children: ct.map((l) => /* @__PURE__ */ t.jsxs("label", { className: x.padding, children: [
73
+ /* @__PURE__ */ t.jsx("div", { className: $.paddings, children: xt.map((n) => /* @__PURE__ */ t.jsxs("label", { className: $.padding, children: [
74
74
  /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
75
- p,
75
+ g,
76
76
  {
77
- name: `align-${l}`,
77
+ name: `align-${n}`,
78
78
  width: 20,
79
79
  height: 20
80
80
  }
81
81
  ) }),
82
82
  /* @__PURE__ */ t.jsx(
83
- A,
83
+ I,
84
84
  {
85
85
  type: "text",
86
- value: String(i[l]),
87
- onChange: (m) => s((o) => ({
86
+ value: String(o[n]),
87
+ onChange: (i) => c({
88
88
  ...o,
89
- [l]: Number(m)
90
- })),
89
+ [n]: Number(i)
90
+ }),
91
91
  paddingless: !0,
92
92
  borderless: !0
93
93
  }
@@ -96,190 +96,360 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
96
96
  ] })
97
97
  ] })
98
98
  ] });
99
- }, it = "_subtitle_2zbxx_1", lt = "_header_2zbxx_8", at = "_text_2zbxx_9", rt = "_top_2zbxx_16", dt = "_itemsBlock_2zbxx_23", w = {
100
- subtitle: it,
101
- header: lt,
102
- text: at,
103
- top: rt,
104
- itemsBlock: dt
105
- }, _t = "_typeTexts_3zlec_1", ut = "_block_3zlec_7", pt = "_active_3zlec_18", S = {
106
- typeTexts: _t,
107
- block: ut,
108
- active: pt
109
- }, ht = ["bold", "italic", "underline", "strike-through", "code"], H = (r) => {
110
- const { typeText: e, setTypeText: i } = r;
111
- return /* @__PURE__ */ t.jsx("div", { className: S.typeTexts, children: ht.map((s) => /* @__PURE__ */ t.jsx(
99
+ }, bt = "_subtitle_2zbxx_1", ft = "_header_2zbxx_8", vt = "_text_2zbxx_9", jt = "_top_2zbxx_16", kt = "_itemsBlock_2zbxx_23", O = {
100
+ subtitle: bt,
101
+ header: ft,
102
+ text: vt,
103
+ top: jt,
104
+ itemsBlock: kt
105
+ }, yt = "_typeTexts_3zlec_1", $t = "_block_3zlec_7", wt = "_active_3zlec_18", H = {
106
+ typeTexts: yt,
107
+ block: $t,
108
+ active: wt
109
+ }, Bt = ["bold", "italic", "underline", "strike-through", "code"], Q = (d) => {
110
+ const { typesText: s, setTypesText: o } = d;
111
+ return /* @__PURE__ */ t.jsx("div", { className: H.typeTexts, children: Bt.map((c) => /* @__PURE__ */ t.jsx(
112
112
  "div",
113
113
  {
114
- className: Y(S.block, {
115
- [S.active]: e === s
114
+ className: U(H.block, {
115
+ [H.active]: s.includes(c)
116
116
  }),
117
- onClick: () => i((n) => s),
117
+ onClick: () => {
118
+ const l = [...s];
119
+ if (l.includes(c)) {
120
+ const e = l.filter((n) => n !== c);
121
+ o(e);
122
+ } else
123
+ l.push(c), o(l);
124
+ },
118
125
  children: /* @__PURE__ */ t.jsx(
119
- p,
126
+ g,
120
127
  {
121
- name: `text-${s}`,
122
- fill: e === s ? "#252525" : "#757575",
128
+ name: `text-${c}`,
129
+ fill: s.includes(c) ? "#252525" : "#757575",
123
130
  width: 20,
124
131
  height: 20
125
132
  }
126
133
  )
127
134
  },
128
- String(s)
135
+ String(c)
129
136
  )) });
130
- }, Ne = (r) => {
137
+ }, Nt = (d) => {
131
138
  const {
132
- typeText: e,
133
- isActiveText: i,
134
- setIsActiveText: s,
135
- text: n,
136
- setText: u,
137
- setTypeText: l,
138
- title: m,
139
- subtitle: o = "Items"
140
- } = r;
141
- return /* @__PURE__ */ t.jsxs("div", { className: w.text, children: [
142
- /* @__PURE__ */ t.jsxs("div", { className: w.top, children: [
143
- /* @__PURE__ */ t.jsx("h3", { className: w.title, children: m }),
144
- /* @__PURE__ */ t.jsx(
145
- N,
139
+ typesText: s,
140
+ isActiveText: o,
141
+ setIsActiveText: c,
142
+ text: l,
143
+ setText: e,
144
+ setTypesText: n,
145
+ title: i,
146
+ subtitle: h = "Items"
147
+ } = d;
148
+ return /* @__PURE__ */ t.jsxs("div", { className: O.text, children: [
149
+ (i || o) && /* @__PURE__ */ t.jsxs("div", { className: O.top, children: [
150
+ i && /* @__PURE__ */ t.jsx("h3", { className: O.title, children: i }),
151
+ o && c && /* @__PURE__ */ t.jsx(
152
+ P,
146
153
  {
147
- current: i,
148
- onChange: (a) => s((d) => a)
154
+ current: o,
155
+ onChange: (j) => c(j)
149
156
  }
150
157
  )
151
158
  ] }),
152
- /* @__PURE__ */ t.jsxs("div", { className: w.itemsBlock, children: [
153
- /* @__PURE__ */ t.jsx("h5", { className: w.subtitle, children: o }),
159
+ /* @__PURE__ */ t.jsxs("div", { className: O.itemsBlock, children: [
160
+ /* @__PURE__ */ t.jsx("h5", { className: O.subtitle, children: h }),
154
161
  /* @__PURE__ */ t.jsx(
155
- O,
162
+ q,
156
163
  {
157
- onChange: (a) => u((d) => a),
158
- value: n,
164
+ onChange: (j) => e(j),
165
+ value: l,
159
166
  maxLength: 150
160
167
  }
161
168
  ),
162
169
  /* @__PURE__ */ t.jsx(
163
- H,
170
+ Q,
164
171
  {
165
- typeText: e,
166
- setTypeText: l
172
+ typesText: s,
173
+ setTypesText: n
167
174
  }
168
175
  )
169
176
  ] })
170
177
  ] });
171
- }, mt = "_subtitle_fsotk_1", xt = "_header_fsotk_8", gt = "_text_fsotk_9", bt = "_productsBlock_fsotk_10", kt = "_top_fsotk_22", ft = "_itemsBlock_fsotk_29", jt = "_typeTexts_fsotk_35", vt = "_block_fsotk_41", yt = "_active_fsotk_52", $t = "_products_fsotk_10", wt = "_product_fsotk_10", Bt = "_button_fsotk_70", Nt = "_image_fsotk_80", Ct = "_info_fsotk_87", Tt = "_name_fsotk_98", Pt = "_buttons_fsotk_102", It = "_modal_fsotk_108", g = {
172
- subtitle: mt,
173
- header: xt,
174
- text: gt,
175
- productsBlock: bt,
176
- top: kt,
177
- itemsBlock: ft,
178
- typeTexts: jt,
179
- block: vt,
180
- active: yt,
181
- products: $t,
182
- product: wt,
183
- button: Bt,
184
- image: Nt,
185
- info: Ct,
186
- name: Tt,
187
- buttons: Pt,
188
- modal: It
189
- }, St = (r) => {
190
- const { activeItem: e, setActiveItem: i, popupPosition: s } = r;
178
+ }, Ct = "_subtitle_1nl8x_1", Tt = "_header_1nl8x_8", It = "_text_1nl8x_9", Pt = "_productsBlock_1nl8x_10", St = "_top_1nl8x_22", At = "_itemsBlock_1nl8x_29", Ot = "_typeTexts_1nl8x_35", Lt = "_block_1nl8x_41", Dt = "_active_1nl8x_52", Rt = "_products_1nl8x_10", Et = "_product_1nl8x_10", zt = "_button_1nl8x_70", Ht = "_image_1nl8x_80", Mt = "_info_1nl8x_87", Ft = "_name_1nl8x_98", Gt = "_buttons_1nl8x_102", Yt = "_modal_1nl8x_108", Ut = "_link_1nl8x_126", qt = "_modalOptions_1nl8x_132", f = {
179
+ subtitle: Ct,
180
+ header: Tt,
181
+ text: It,
182
+ productsBlock: Pt,
183
+ top: St,
184
+ itemsBlock: At,
185
+ typeTexts: Ot,
186
+ block: Lt,
187
+ active: Dt,
188
+ products: Rt,
189
+ product: Et,
190
+ button: zt,
191
+ image: Ht,
192
+ info: Mt,
193
+ name: Ft,
194
+ buttons: Gt,
195
+ modal: Yt,
196
+ link: Ut,
197
+ modalOptions: qt
198
+ }, Jt = (d) => {
199
+ const { activeItem: s, setActiveItem: o, popupPosition: c, modalOptions: l } = d;
191
200
  return /* @__PURE__ */ t.jsxs(
192
201
  "div",
193
202
  {
194
- className: g.modal,
195
- onClick: (n) => {
196
- n.stopPropagation();
203
+ className: f.modal,
204
+ onClick: (e) => {
205
+ e.stopPropagation();
197
206
  },
198
207
  style: {
199
- top: `${s.top}px`,
200
- left: `${s.left}px`
208
+ top: `${c.top}px`,
209
+ left: `${c.left}px`
201
210
  },
202
211
  children: [
203
- /* @__PURE__ */ t.jsxs("div", { className: g.top, children: [
204
- /* @__PURE__ */ t.jsx("h3", { children: e.name }),
212
+ /* @__PURE__ */ t.jsxs("div", { className: f.top, children: [
213
+ /* @__PURE__ */ t.jsx("h3", { children: s.name }),
205
214
  /* @__PURE__ */ t.jsx(
206
- p,
215
+ g,
207
216
  {
208
217
  name: "x",
209
218
  height: 20,
210
219
  width: 20,
211
220
  hoverable: !0,
212
- onClick: () => i(null)
221
+ onClick: () => o(null)
213
222
  }
214
223
  )
215
224
  ] }),
216
- /* @__PURE__ */ t.jsxs("div", { children: [
217
- /* @__PURE__ */ t.jsx("span", { children: "Put up an attractive image" }),
218
- /* @__PURE__ */ t.jsx("div", { children: "Choose Image" })
219
- ] })
225
+ /* @__PURE__ */ t.jsx("div", { className: f.modalOptions, children: l.map((e) => {
226
+ if (e.type === "image")
227
+ return /* @__PURE__ */ t.jsx(
228
+ J,
229
+ {
230
+ label: "Put up an attractive image",
231
+ onChange: (n) => {
232
+ const i = {
233
+ ...s,
234
+ [e.field]: n[0]
235
+ };
236
+ o(i);
237
+ }
238
+ }
239
+ );
240
+ if (e.type === "text")
241
+ return /* @__PURE__ */ t.jsx(
242
+ Nt,
243
+ {
244
+ typesText: s[e.field.type],
245
+ setTypesText: (n) => {
246
+ const i = {
247
+ ...s,
248
+ [e.field.type]: n
249
+ };
250
+ o(i);
251
+ },
252
+ text: s[e.field.text] || "",
253
+ setText: (n) => {
254
+ const i = {
255
+ ...s,
256
+ [e.field.text]: n
257
+ };
258
+ o(i);
259
+ },
260
+ subtitle: e.label
261
+ }
262
+ );
263
+ if (e.type === "input")
264
+ return /* @__PURE__ */ t.jsx(
265
+ I,
266
+ {
267
+ onChange: (n) => {
268
+ const i = {
269
+ ...s,
270
+ [e.field]: n
271
+ };
272
+ o(i);
273
+ },
274
+ value: s[e.field] || "",
275
+ label: e.label,
276
+ placeholder: e.placeholder
277
+ }
278
+ );
279
+ if (e.type === "inputSwitch")
280
+ return /* @__PURE__ */ t.jsxs("div", { className: f.link, children: [
281
+ /* @__PURE__ */ t.jsx(
282
+ I,
283
+ {
284
+ onChange: (n) => {
285
+ const i = {
286
+ ...s,
287
+ [e.field.text]: n
288
+ };
289
+ o(i);
290
+ },
291
+ value: s[e.field.text] || "",
292
+ label: e.inputLabel,
293
+ placeholder: e.placeholder
294
+ }
295
+ ),
296
+ /* @__PURE__ */ t.jsx(
297
+ P,
298
+ {
299
+ current: !!s[e.field.switch] || !1,
300
+ label: e.switchLabel,
301
+ onChange: (n) => {
302
+ const i = {
303
+ ...s,
304
+ [e.field.switch]: n
305
+ };
306
+ o(i);
307
+ }
308
+ }
309
+ )
310
+ ] });
311
+ if (e.type === "list")
312
+ return /* @__PURE__ */ t.jsx(
313
+ Zt,
314
+ {
315
+ items: s[e.field] || [],
316
+ setItems: (n) => {
317
+ const i = {
318
+ ...s,
319
+ [e.field]: n
320
+ };
321
+ o(i);
322
+ },
323
+ itemsType: "select",
324
+ draggable: e.draggable || !1,
325
+ itemsOptions: e.itemsOptions,
326
+ deletable: e.deletable || !1,
327
+ editable: !1,
328
+ subtitle: e.label
329
+ }
330
+ );
331
+ if (e.type === "select")
332
+ return /* @__PURE__ */ t.jsx(
333
+ D,
334
+ {
335
+ options: e.itemsOptions,
336
+ onChange: (n) => {
337
+ const i = {
338
+ ...s,
339
+ [e.field]: n
340
+ };
341
+ o(i);
342
+ },
343
+ label: e.label,
344
+ value: s[e.field] || "String"
345
+ }
346
+ );
347
+ }) })
220
348
  ]
221
349
  }
222
350
  );
223
- }, At = "_other_jqtww_1", Lt = "_subtitle_jqtww_7", R = {
224
- other: At,
225
- subtitle: Lt
226
- }, zt = (r) => {
227
- const { isItem: e, setIsItem: i, title: s = "Other", label: n } = r;
228
- return /* @__PURE__ */ t.jsxs("div", { className: R.other, children: [
229
- /* @__PURE__ */ t.jsx("h5", { className: R.subtitle, children: s }),
230
- /* @__PURE__ */ t.jsx(
231
- N,
351
+ }, Kt = "_other_1wtgi_1", Qt = "_subtitle_1wtgi_7", Vt = "_items_1wtgi_14", M = {
352
+ other: Kt,
353
+ subtitle: Qt,
354
+ items: Vt
355
+ }, Wt = (d) => {
356
+ const { items: s, title: o = "Other" } = d;
357
+ return /* @__PURE__ */ t.jsxs("div", { className: M.other, children: [
358
+ /* @__PURE__ */ t.jsx("h5", { className: M.subtitle, children: o }),
359
+ /* @__PURE__ */ t.jsx("div", { className: M.items, children: s.map((c) => /* @__PURE__ */ t.jsx(
360
+ P,
232
361
  {
233
- current: e,
234
- onChange: (u) => i((l) => u),
235
- label: n,
362
+ current: c.isItem,
363
+ onChange: (l) => c.setIsItem(l),
364
+ label: c.label,
236
365
  hasBackground: !0,
237
366
  paddingless: !1
238
367
  }
239
- )
368
+ )) })
240
369
  ] });
241
- }, Ce = (r) => {
370
+ }, Xt = (d) => {
371
+ const { index: s, moveProduct: o, children: c } = d, [, l] = nt({
372
+ accept: "product",
373
+ hover(i) {
374
+ i.index !== s && (o(i.index, s), i.index = s);
375
+ }
376
+ }), [{ isDragging: e }, n] = ot({
377
+ type: "product",
378
+ item: { index: s },
379
+ collect: (i) => ({
380
+ isDragging: i.isDragging()
381
+ })
382
+ });
383
+ return /* @__PURE__ */ t.jsx(
384
+ "div",
385
+ {
386
+ ref: (i) => n(l(i)),
387
+ className: `${f.product} ${e ? f.dragging : ""}`,
388
+ children: c
389
+ }
390
+ );
391
+ }, Zt = (d) => {
242
392
  const {
243
- isActiveItems: e,
244
- setIsActiveItems: i,
245
- items: s,
246
- setItems: n,
247
- other: u,
248
- title: l,
249
- subtitle: m,
250
- editable: o = !0,
251
- draggable: a = !1,
252
- withImage: d = !1,
253
- deletable: v = !0,
254
- addable: y = !0,
255
- itemsType: h,
256
- itemsPlaceholder: F = "",
257
- itemsOptions: L
258
- } = r, [z, $] = k.useState(null), [G, M] = k.useState({
393
+ isActiveItems: s,
394
+ setIsActiveItems: o,
395
+ items: c,
396
+ setItems: l,
397
+ other: e,
398
+ title: n,
399
+ subtitle: i,
400
+ editable: h = !0,
401
+ draggable: j = !1,
402
+ withImage: r = !1,
403
+ deletable: p = !0,
404
+ addable: u = !0,
405
+ itemsType: k,
406
+ itemsPlaceholder: x = "",
407
+ itemsOptions: _,
408
+ hasRangeSelector: R = !1,
409
+ rangeSelectorOptions: F,
410
+ modalOptions: G,
411
+ addableOptions: z = {}
412
+ } = d, [C, S] = v.useState(null), [V, W] = v.useState({
259
413
  top: 0,
260
414
  left: 0
261
- });
262
- k.useEffect(() => {
263
- const c = () => {
264
- $(null);
415
+ }), X = (a, y) => {
416
+ const w = [...c], [b] = w.splice(a, 1);
417
+ w.splice(y, 0, b), l(w);
418
+ };
419
+ v.useEffect(() => {
420
+ const a = () => {
421
+ S(null);
265
422
  };
266
- return document.body.addEventListener("click", c), $(null), () => {
267
- $(null), document.body.removeEventListener("click", c);
423
+ return document.body.addEventListener("click", a), S(null), () => {
424
+ S(null), document.body.removeEventListener("click", a);
268
425
  };
269
- }, []);
270
- const q = (c, _) => {
271
- c.stopPropagation();
272
- const f = c.target.getBoundingClientRect(), C = 100, T = window.innerHeight;
273
- let b = f.top + window.scrollY;
274
- b + C > T && (b = T - C - 20), M({
275
- top: b - 80,
276
- left: f.left - 30
277
- }), $(_);
426
+ }, []), v.useEffect(() => {
427
+ if (C) {
428
+ const a = [...c].map((y) => y.id === C.id ? C : y);
429
+ l(a);
430
+ }
431
+ }, [C]);
432
+ const Z = (a, y) => {
433
+ a.stopPropagation();
434
+ const w = a.target.getBoundingClientRect(), b = 100, A = window.innerHeight;
435
+ let B = w.top + window.scrollY;
436
+ B + b > A && (B = A - b - 20), W({
437
+ top: B - 80,
438
+ left: w.left - 30
439
+ }), S(y);
278
440
  };
279
- function D(c) {
280
- if (d && !c)
281
- return /* @__PURE__ */ t.jsx(
282
- p,
441
+ function tt(a) {
442
+ if (r)
443
+ return a ? /* @__PURE__ */ t.jsx(
444
+ "img",
445
+ {
446
+ src: `https://imagedelivery.net/${a}/w=1000`,
447
+ alt: "image",
448
+ width: 16,
449
+ height: 16
450
+ }
451
+ ) : /* @__PURE__ */ t.jsx(
452
+ g,
283
453
  {
284
454
  name: "image",
285
455
  width: 16,
@@ -288,119 +458,149 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
288
458
  }
289
459
  );
290
460
  }
291
- return /* @__PURE__ */ t.jsxs("div", { className: g.productsBlock, children: [
292
- /* @__PURE__ */ t.jsxs("div", { className: g.top, children: [
293
- l && /* @__PURE__ */ t.jsx("h3", { className: g.title, children: l }),
294
- e && /* @__PURE__ */ t.jsx(
295
- N,
461
+ const Y = (a, y) => {
462
+ const w = /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
463
+ j && /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
464
+ g,
465
+ {
466
+ name: "drag",
467
+ hoverable: !0,
468
+ width: 20,
469
+ height: 20
470
+ }
471
+ ) }),
472
+ k === "select" && /* @__PURE__ */ t.jsx(
473
+ D,
474
+ {
475
+ onChange: (b) => {
476
+ const B = [...c].map((N) => N.id === a.id ? {
477
+ ...a,
478
+ name: b
479
+ } : N);
480
+ l(B);
481
+ },
482
+ value: a.name,
483
+ options: _,
484
+ leftAddon: tt(a.image)
485
+ }
486
+ ),
487
+ k === "input" && /* @__PURE__ */ t.jsx(
488
+ I,
489
+ {
490
+ onChange: (b) => {
491
+ const B = [...c].map((N) => N.id === a.id ? {
492
+ ...a,
493
+ name: b
494
+ } : N);
495
+ l(B);
496
+ },
497
+ value: a.name,
498
+ placeholder: x
499
+ }
500
+ ),
501
+ k === "image" && /* @__PURE__ */ t.jsx(
502
+ J,
296
503
  {
297
- current: e,
298
- onChange: (c) => i == null ? void 0 : i((_) => c)
504
+ onChange: (b) => {
505
+ const B = [...c].map((N) => N.id === a.id ? {
506
+ ...a,
507
+ image: b[0]
508
+ } : N);
509
+ l(B);
510
+ }
511
+ }
512
+ ),
513
+ /* @__PURE__ */ t.jsxs("div", { className: f.buttons, children: [
514
+ h && /* @__PURE__ */ t.jsx(
515
+ g,
516
+ {
517
+ name: "sliders",
518
+ hoverable: !0,
519
+ width: 20,
520
+ height: 20,
521
+ onClick: (b) => Z(b, a)
522
+ }
523
+ ),
524
+ p && /* @__PURE__ */ t.jsx(
525
+ g,
526
+ {
527
+ name: "trash",
528
+ hoverable: !0,
529
+ width: 20,
530
+ height: 20,
531
+ fill: "#C12A2A",
532
+ onClick: () => l(c.filter((b) => b.id !== a.id))
533
+ }
534
+ )
535
+ ] })
536
+ ] });
537
+ return j ? /* @__PURE__ */ t.jsx(
538
+ Xt,
539
+ {
540
+ product: a,
541
+ index: y,
542
+ moveProduct: X,
543
+ children: w
544
+ },
545
+ a.id
546
+ ) : /* @__PURE__ */ t.jsx(
547
+ "div",
548
+ {
549
+ className: f.product,
550
+ children: w
551
+ },
552
+ a.id
553
+ );
554
+ };
555
+ return /* @__PURE__ */ t.jsxs("div", { className: f.productsBlock, children: [
556
+ (n || s !== void 0) && /* @__PURE__ */ t.jsxs("div", { className: f.top, children: [
557
+ n && /* @__PURE__ */ t.jsx("h3", { className: f.title, children: n }),
558
+ s !== void 0 && /* @__PURE__ */ t.jsx(
559
+ P,
560
+ {
561
+ current: s,
562
+ onChange: (a) => o == null ? void 0 : o(a)
299
563
  }
300
564
  )
301
565
  ] }),
302
- z && o && /* @__PURE__ */ t.jsx(
303
- St,
566
+ C && h && G && /* @__PURE__ */ t.jsx(
567
+ Jt,
304
568
  {
305
- activeItem: z,
306
- setActiveItem: $,
307
- popupPosition: G
569
+ activeItem: C,
570
+ setActiveItem: S,
571
+ popupPosition: V,
572
+ modalOptions: G
308
573
  }
309
574
  ),
310
- /* @__PURE__ */ t.jsxs("div", { className: g.products, children: [
311
- m && /* @__PURE__ */ t.jsx("h5", { className: g.subtitle, children: m }),
312
- s.map((c) => /* @__PURE__ */ t.jsxs(
313
- "div",
314
- {
315
- className: g.product,
316
- children: [
317
- a && /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
318
- p,
319
- {
320
- name: "drag",
321
- hoverable: !0,
322
- width: 20,
323
- height: 20
324
- }
325
- ) }),
326
- h === "select" && /* @__PURE__ */ t.jsx(
327
- I,
328
- {
329
- onChange: (_) => {
330
- n((f) => [...f].map((b) => b.id === c.id ? {
331
- ...c,
332
- name: _
333
- } : b));
334
- },
335
- value: c.name,
336
- options: L,
337
- leftAddon: D(c.image)
338
- }
339
- ),
340
- h === "input" && /* @__PURE__ */ t.jsx(
341
- A,
342
- {
343
- onChange: (_) => {
344
- n((f) => [...f].map((b) => b.id === c.id ? {
345
- ...c,
346
- name: _
347
- } : b));
348
- },
349
- value: c.name,
350
- placeholder: F
351
- }
352
- ),
353
- h === "image" && /* @__PURE__ */ t.jsx(J, {}),
354
- /* @__PURE__ */ t.jsxs("div", { className: g.buttons, children: [
355
- o && /* @__PURE__ */ t.jsx(
356
- p,
357
- {
358
- name: "sliders",
359
- hoverable: !0,
360
- width: 20,
361
- height: 20,
362
- onClick: (_) => {
363
- q(_, c);
364
- }
365
- }
366
- ),
367
- v && /* @__PURE__ */ t.jsx(
368
- p,
369
- {
370
- name: "trash",
371
- hoverable: !0,
372
- onClick: () => n((_) => _.filter((f) => f.id !== c.id)),
373
- width: 20,
374
- height: 20,
375
- fill: "#C12A2A"
376
- }
377
- )
378
- ] })
379
- ]
380
- },
381
- c.id
382
- )),
383
- y && /* @__PURE__ */ t.jsxs(
384
- E,
575
+ R && F && /* @__PURE__ */ t.jsx(ss, { ...F }),
576
+ /* @__PURE__ */ t.jsxs("div", { className: f.products, children: [
577
+ i && /* @__PURE__ */ t.jsx("h5", { className: f.subtitle, children: i }),
578
+ j ? /* @__PURE__ */ t.jsx(et, { backend: st, children: c.map((a, y) => Y(a, y)) }) : c.map((a, y) => Y(a, y)),
579
+ u && /* @__PURE__ */ t.jsxs(
580
+ K,
385
581
  {
386
- className: g.button,
582
+ className: f.button,
387
583
  size: "s",
388
- onClick: () => n((c) => {
389
- const _ = [...c];
390
- return h === "select" ? _.push({
391
- name: L[0] || "",
392
- id: P()
393
- }) : h === "input" ? _.push({
584
+ onClick: () => {
585
+ const a = [...c];
586
+ k === "select" ? a.push({
587
+ name: _[0] || `Product ${c.length + 1}`,
588
+ id: E(),
589
+ ...z
590
+ }) : k === "input" ? a.push({
394
591
  name: "",
395
- id: P()
396
- }) : _.push({
397
- id: P()
398
- }), _;
399
- }),
592
+ id: E(),
593
+ ...z
594
+ }) : a.push({
595
+ name: `Image ${c.length + 1}`,
596
+ id: E(),
597
+ ...z
598
+ }), l(a);
599
+ },
400
600
  children: [
401
601
  /* @__PURE__ */ t.jsx("span", { children: "Add Option" }),
402
602
  /* @__PURE__ */ t.jsx(
403
- p,
603
+ g,
404
604
  {
405
605
  name: "plus",
406
606
  width: 16,
@@ -411,68 +611,78 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
411
611
  }
412
612
  )
413
613
  ] }),
414
- u !== void 0 && /* @__PURE__ */ t.jsx(zt, { ...u })
614
+ e !== void 0 && /* @__PURE__ */ t.jsx(Wt, { items: e })
415
615
  ] });
416
- }, Rt = "_subtitle_41klp_1", Ot = "_header_41klp_8", Et = "_text_41klp_9", Ht = "_productsBlock_41klp_10", Ft = "_buttonsBlock_41klp_11", Gt = "_top_41klp_21", Mt = "_itemsBlock_41klp_28", qt = "_typeTexts_41klp_34", Dt = "_block_41klp_40", Yt = "_active_41klp_51", Jt = "_products_41klp_10", Kt = "_product_41klp_10", Qt = "_button_41klp_11", Ut = "_image_41klp_79", Vt = "_info_41klp_86", Wt = "_name_41klp_97", Xt = "_buttons_41klp_11", Zt = "_modal_41klp_107", te = "_other_41klp_124", ee = "_options_41klp_130", j = {
417
- subtitle: Rt,
418
- header: Ot,
419
- text: Et,
420
- productsBlock: Ht,
421
- buttonsBlock: Ft,
422
- top: Gt,
423
- itemsBlock: Mt,
424
- typeTexts: qt,
425
- block: Dt,
426
- active: Yt,
427
- products: Jt,
428
- product: Kt,
429
- button: Qt,
430
- image: Ut,
431
- info: Vt,
432
- name: Wt,
433
- buttons: Xt,
434
- modal: Zt,
435
- other: te,
436
- options: ee
437
- }, se = (r) => {
438
- const { activeButton: e, setActiveButton: i, popupPosition: s } = r, [n, u] = k.useState(e.typeText), [l, m] = k.useState(e.destination), [o, a] = k.useState(e.link || "");
439
- return /* @__PURE__ */ t.jsxs(
616
+ }, te = "_subtitle_41klp_1", ee = "_header_41klp_8", se = "_text_41klp_9", ne = "_productsBlock_41klp_10", oe = "_buttonsBlock_41klp_11", ce = "_top_41klp_21", le = "_itemsBlock_41klp_28", ie = "_typeTexts_41klp_34", ae = "_block_41klp_40", re = "_active_41klp_51", de = "_products_41klp_10", ue = "_product_41klp_10", _e = "_button_41klp_11", pe = "_image_41klp_79", me = "_info_41klp_86", he = "_name_41klp_97", ge = "_buttons_41klp_11", xe = "_modal_41klp_107", be = "_other_41klp_124", fe = "_options_41klp_130", T = {
617
+ subtitle: te,
618
+ header: ee,
619
+ text: se,
620
+ productsBlock: ne,
621
+ buttonsBlock: oe,
622
+ top: ce,
623
+ itemsBlock: le,
624
+ typeTexts: ie,
625
+ block: ae,
626
+ active: re,
627
+ products: de,
628
+ product: ue,
629
+ button: _e,
630
+ image: pe,
631
+ info: me,
632
+ name: he,
633
+ buttons: ge,
634
+ modal: xe,
635
+ other: be,
636
+ options: fe
637
+ }, ve = (d) => {
638
+ const { activeButton: s, setActiveButton: o, popupPosition: c } = d, [l, e] = v.useState(s.typesText), [n, i] = v.useState(s.destination), [h, j] = v.useState(s.link || ""), [r, p] = v.useState(s.text || "");
639
+ return v.useEffect(() => {
640
+ o({
641
+ ...s,
642
+ ...{
643
+ text: r,
644
+ link: h,
645
+ destination: n,
646
+ typesText: l
647
+ }
648
+ });
649
+ }, [l, n, h, r]), /* @__PURE__ */ t.jsxs(
440
650
  "div",
441
651
  {
442
- className: j.modal,
443
- onClick: (d) => {
444
- d.stopPropagation();
652
+ className: T.modal,
653
+ onClick: (u) => {
654
+ u.stopPropagation();
445
655
  },
446
656
  style: {
447
- top: `${s.top}px`,
448
- left: `${s.left}px`
657
+ top: `${c.top}px`,
658
+ left: `${c.left}px`
449
659
  },
450
660
  children: [
451
- /* @__PURE__ */ t.jsxs("div", { className: j.top, children: [
452
- /* @__PURE__ */ t.jsx("h3", { children: e.type }),
661
+ /* @__PURE__ */ t.jsxs("div", { className: T.top, children: [
662
+ /* @__PURE__ */ t.jsx("h3", { children: s.type }),
453
663
  /* @__PURE__ */ t.jsx(
454
- p,
664
+ g,
455
665
  {
456
666
  name: "x",
457
667
  height: 20,
458
668
  width: 20,
459
669
  hoverable: !0,
460
- onClick: () => i(null)
670
+ onClick: () => o(null)
461
671
  }
462
672
  )
463
673
  ] }),
464
- /* @__PURE__ */ t.jsxs("div", { className: j.options, children: [
674
+ /* @__PURE__ */ t.jsxs("div", { className: T.options, children: [
465
675
  /* @__PURE__ */ t.jsx(
466
- I,
676
+ D,
467
677
  {
468
678
  label: "Destination",
469
- onChange: (d) => m(d),
679
+ onChange: (u) => i(u),
470
680
  options: ["Go to Page", "Open Link"],
471
- value: l
681
+ value: n
472
682
  }
473
683
  ),
474
- l === "Go to Page" ? /* @__PURE__ */ t.jsx(
475
- I,
684
+ n === "Go to Page" ? /* @__PURE__ */ t.jsx(
685
+ D,
476
686
  {
477
687
  label: "Go to",
478
688
  onChange: () => {
@@ -481,124 +691,132 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
481
691
  value: "Homepage"
482
692
  }
483
693
  ) : /* @__PURE__ */ t.jsx(
484
- A,
694
+ I,
485
695
  {
486
- onChange: (d) => a(d),
487
- value: o,
696
+ onChange: (u) => j(u),
697
+ value: h,
488
698
  placeholder: "https://",
489
699
  label: "Link"
490
700
  }
491
701
  ),
492
702
  /* @__PURE__ */ t.jsx(
493
- N,
703
+ P,
494
704
  {
495
705
  current: !1,
496
706
  label: "Open in new tab"
497
707
  }
498
708
  ),
499
709
  /* @__PURE__ */ t.jsx(
500
- O,
710
+ q,
501
711
  {
502
- onChange: () => {
503
- },
504
- value: "Lorem ipsum dolor sit amet com",
712
+ onChange: (u) => p(u),
713
+ value: r,
505
714
  label: "Text",
506
715
  maxLength: 150
507
716
  }
508
717
  ),
509
718
  /* @__PURE__ */ t.jsx(
510
- H,
719
+ Q,
511
720
  {
512
- typeText: n,
513
- setTypeText: u
721
+ typesText: l,
722
+ setTypesText: e
514
723
  }
515
724
  )
516
725
  ] })
517
726
  ]
518
727
  }
519
728
  );
520
- }, ne = "_subtitle_1y5sw_1", oe = "_header_1y5sw_8", ce = "_text_1y5sw_9", ie = "_productsBlock_1y5sw_10", le = "_buttonsBlock_1y5sw_11", ae = "_top_1y5sw_22", re = "_itemsBlock_1y5sw_29", de = "_typeTexts_1y5sw_35", _e = "_block_1y5sw_41", ue = "_active_1y5sw_52", pe = "_products_1y5sw_10", he = "_product_1y5sw_10", me = "_button_1y5sw_11", xe = "_image_1y5sw_80", ge = "_info_1y5sw_87", be = "_name_1y5sw_98", ke = "_buttons_1y5sw_11", fe = "_modal_1y5sw_108", je = "_other_1y5sw_125", ve = "_options_1y5sw_131", B = {
521
- subtitle: ne,
522
- header: oe,
523
- text: ce,
524
- productsBlock: ie,
525
- buttonsBlock: le,
526
- top: ae,
527
- itemsBlock: re,
528
- typeTexts: de,
529
- block: _e,
530
- active: ue,
531
- products: pe,
532
- product: he,
533
- button: me,
534
- image: xe,
535
- info: ge,
536
- name: be,
537
- buttons: ke,
538
- modal: fe,
539
- other: je,
540
- options: ve
541
- }, ye = (r) => {
542
- const { buttons: e, setButtons: i } = r, [s, n] = k.useState(null), [u, l] = k.useState({
729
+ }, je = "_subtitle_1y5sw_1", ke = "_header_1y5sw_8", ye = "_text_1y5sw_9", $e = "_productsBlock_1y5sw_10", we = "_buttonsBlock_1y5sw_11", Be = "_top_1y5sw_22", Ne = "_itemsBlock_1y5sw_29", Ce = "_typeTexts_1y5sw_35", Te = "_block_1y5sw_41", Ie = "_active_1y5sw_52", Pe = "_products_1y5sw_10", Se = "_product_1y5sw_10", Ae = "_button_1y5sw_11", Oe = "_image_1y5sw_80", Le = "_info_1y5sw_87", De = "_name_1y5sw_98", Re = "_buttons_1y5sw_11", Ee = "_modal_1y5sw_108", ze = "_other_1y5sw_125", He = "_options_1y5sw_131", L = {
730
+ subtitle: je,
731
+ header: ke,
732
+ text: ye,
733
+ productsBlock: $e,
734
+ buttonsBlock: we,
735
+ top: Be,
736
+ itemsBlock: Ne,
737
+ typeTexts: Ce,
738
+ block: Te,
739
+ active: Ie,
740
+ products: Pe,
741
+ product: Se,
742
+ button: Ae,
743
+ image: Oe,
744
+ info: Le,
745
+ name: De,
746
+ buttons: Re,
747
+ modal: Ee,
748
+ other: ze,
749
+ options: He
750
+ }, Me = (d) => {
751
+ const { buttons: s, setButtons: o, deletable: c = !0, addable: l = !0 } = d, [e, n] = v.useState(null), [i, h] = v.useState({
543
752
  top: 0,
544
753
  left: 0
545
754
  });
546
- k.useEffect(() => {
547
- const o = () => {
755
+ v.useEffect(() => {
756
+ const r = () => {
548
757
  n(null);
549
758
  };
550
- return document.body.addEventListener("click", o), n(null), () => {
551
- n(null), document.body.removeEventListener("click", o);
759
+ return document.body.addEventListener("click", r), n(null), () => {
760
+ n(null), document.body.removeEventListener("click", r);
552
761
  };
553
- }, []);
554
- const m = (o, a) => {
555
- o.stopPropagation();
556
- const d = o.target.getBoundingClientRect(), v = 490, y = window.innerHeight;
557
- let h = d.top + window.scrollY;
558
- h + v > y && (h = y - v - 20), l({
559
- top: h,
560
- left: d.left - 30
561
- }), n(a);
762
+ }, []), v.useEffect(() => {
763
+ if (e) {
764
+ const r = [...s].map((p) => p.id === e.id ? e : p);
765
+ o(r);
766
+ }
767
+ }, [e]), console.log(s);
768
+ const j = (r, p) => {
769
+ r.stopPropagation();
770
+ const u = r.target.getBoundingClientRect(), k = 490, x = window.innerHeight;
771
+ let _ = u.top + window.scrollY;
772
+ _ + k > x && (_ = x - k - 20), h({
773
+ top: _,
774
+ left: u.left - 30
775
+ }), n(p);
562
776
  };
563
- return /* @__PURE__ */ t.jsxs("div", { className: B.products, children: [
564
- /* @__PURE__ */ t.jsx("h5", { className: B.subtitle, children: "Button Type" }),
565
- e.map((o) => /* @__PURE__ */ t.jsxs(
777
+ return /* @__PURE__ */ t.jsxs("div", { className: L.products, children: [
778
+ /* @__PURE__ */ t.jsx("h5", { className: L.subtitle, children: "Button Type" }),
779
+ s.map((r) => /* @__PURE__ */ t.jsxs(
566
780
  "div",
567
781
  {
568
- className: B.product,
782
+ className: L.product,
569
783
  children: [
570
784
  /* @__PURE__ */ t.jsx(
571
- I,
785
+ D,
572
786
  {
573
- onChange: (a) => {
574
- i((d) => [...d].map((h) => h.id === o.id ? {
575
- ...o,
576
- type: a
577
- } : h));
787
+ onChange: (p) => {
788
+ const k = [...s].map((x) => x.id === r.id ? {
789
+ ...r,
790
+ type: p
791
+ } : x);
792
+ o(k);
578
793
  },
579
- value: o.type,
794
+ value: r.type,
580
795
  options: ["Primary", "Secondary", "Tertiary"]
581
796
  }
582
797
  ),
583
- /* @__PURE__ */ t.jsxs("div", { className: B.buttons, children: [
798
+ /* @__PURE__ */ t.jsxs("div", { className: L.buttons, children: [
584
799
  /* @__PURE__ */ t.jsx(
585
- p,
800
+ g,
586
801
  {
587
802
  name: "sliders",
588
803
  hoverable: !0,
589
804
  width: 20,
590
805
  height: 20,
591
- onClick: (a) => {
592
- m(a, o);
806
+ onClick: (p) => {
807
+ j(p, r);
593
808
  }
594
809
  }
595
810
  ),
596
- /* @__PURE__ */ t.jsx(
597
- p,
811
+ c && /* @__PURE__ */ t.jsx(
812
+ g,
598
813
  {
599
814
  name: "trash",
600
815
  hoverable: !0,
601
- onClick: () => i((a) => a.filter((d) => d.id !== o.id)),
816
+ onClick: () => {
817
+ const p = s.filter((u) => u.id !== r.id);
818
+ o(p);
819
+ },
602
820
  width: 20,
603
821
  height: 20,
604
822
  fill: "#C12A2A"
@@ -607,34 +825,35 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
607
825
  ] })
608
826
  ]
609
827
  },
610
- o.id
828
+ r.id
611
829
  )),
612
- s && /* @__PURE__ */ t.jsx(
613
- se,
830
+ e && /* @__PURE__ */ t.jsx(
831
+ ve,
614
832
  {
615
- activeButton: s,
833
+ activeButton: e,
616
834
  setActiveButton: n,
617
- popupPosition: u
835
+ popupPosition: i
618
836
  }
619
837
  ),
620
- /* @__PURE__ */ t.jsxs(
621
- E,
838
+ l && /* @__PURE__ */ t.jsxs(
839
+ K,
622
840
  {
623
- className: B.button,
841
+ className: L.button,
624
842
  size: "s",
625
- onClick: () => i((o) => {
626
- const a = [...o];
627
- return a.push({
843
+ onClick: () => {
844
+ const r = [...s];
845
+ r.push({
628
846
  type: "Primary",
629
- id: P(),
630
- typeText: "bold",
631
- destination: "Go to Page"
632
- }), a;
633
- }),
847
+ id: E(),
848
+ typesText: [],
849
+ destination: "Go to Page",
850
+ text: ""
851
+ }), o(r);
852
+ },
634
853
  children: [
635
854
  /* @__PURE__ */ t.jsx("span", { children: "Add Option" }),
636
855
  /* @__PURE__ */ t.jsx(
637
- p,
856
+ g,
638
857
  {
639
858
  name: "plus",
640
859
  width: 16,
@@ -645,48 +864,173 @@ const K = "_wrapper_1g82c_2", Q = "_alignmentBlock_1g82c_8", U = "_title_1g82c_1
645
864
  }
646
865
  )
647
866
  ] });
648
- }, Te = (r) => {
649
- const { isActiveButtons: e, setIsActiveButtons: i, buttons: s, setButtons: n } = r;
650
- return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs("div", { className: j.buttonsBlock, children: [
651
- /* @__PURE__ */ t.jsxs("div", { className: j.top, children: [
652
- /* @__PURE__ */ t.jsx("h3", { className: j.title, children: "Buttons" }),
867
+ }, ls = (d) => {
868
+ const { isActiveButtons: s, setIsActiveButtons: o, buttons: c, setButtons: l } = d;
869
+ return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs("div", { className: T.buttonsBlock, children: [
870
+ /* @__PURE__ */ t.jsxs("div", { className: T.top, children: [
871
+ /* @__PURE__ */ t.jsx("h3", { className: T.title, children: "Buttons" }),
653
872
  /* @__PURE__ */ t.jsx(
654
- N,
873
+ P,
655
874
  {
656
- current: e,
657
- onChange: (u) => i((l) => u)
875
+ current: s,
876
+ onChange: (e) => o(e)
658
877
  }
659
878
  )
660
879
  ] }),
661
880
  /* @__PURE__ */ t.jsx(
662
- ye,
881
+ Me,
663
882
  {
664
- buttons: s,
665
- setButtons: n
883
+ buttons: c,
884
+ setButtons: l
666
885
  }
667
886
  )
668
887
  ] }) });
888
+ }, Fe = "_wrapper_tn7gb_1", Ge = "_subtitle_tn7gb_7", Ye = "_content_tn7gb_14", Ue = "_range_tn7gb_21", qe = "_track_tn7gb_26", Je = "_progress_tn7gb_35", Ke = "_dots_tn7gb_45", Qe = "_dot_tn7gb_45", Ve = "_active_tn7gb_62", We = "_input_tn7gb_74", Xe = "_countBlock_tn7gb_88", Ze = "_count_tn7gb_88", ts = "_controls_tn7gb_103", es = "_button_tn7gb_108", m = {
889
+ wrapper: Fe,
890
+ subtitle: Ge,
891
+ content: Ye,
892
+ range: Ue,
893
+ track: qe,
894
+ progress: Je,
895
+ dots: Ke,
896
+ dot: Qe,
897
+ active: Ve,
898
+ input: We,
899
+ countBlock: Xe,
900
+ count: Ze,
901
+ controls: ts,
902
+ button: es
903
+ }, ss = (d) => {
904
+ const { label: s, min: o = 1, max: c = 4, step: l = 1, count: e, setCount: n } = d, [i, h] = v.useState(!1), j = Array.from({ length: (c - o) / l + 1 }), r = (e - o) / (c - o) * 100, p = () => {
905
+ e < c && n(e + l);
906
+ }, u = () => {
907
+ e > o && n(e - l);
908
+ }, k = (x) => {
909
+ const _ = o + x * l;
910
+ n(_);
911
+ };
912
+ return /* @__PURE__ */ t.jsxs("div", { className: m.wrapper, children: [
913
+ s && /* @__PURE__ */ t.jsx("h5", { className: m.subtitle, children: s }),
914
+ /* @__PURE__ */ t.jsxs("div", { className: m.content, children: [
915
+ /* @__PURE__ */ t.jsxs("div", { className: m.range, children: [
916
+ /* @__PURE__ */ t.jsx("div", { className: m.track }),
917
+ /* @__PURE__ */ t.jsx(
918
+ "div",
919
+ {
920
+ className: m.progress,
921
+ style: { width: `${r}%` }
922
+ }
923
+ ),
924
+ /* @__PURE__ */ t.jsx("div", { className: m.dots, children: j.map((x, _) => {
925
+ const R = _ <= (e - o) / l;
926
+ return /* @__PURE__ */ t.jsx(
927
+ "button",
928
+ {
929
+ onClick: () => k(_),
930
+ className: U(m.dot, {
931
+ [m.active]: R,
932
+ [m.inactive]: !R,
933
+ [m.dragging]: i
934
+ }),
935
+ "aria-label": `Set value to ${o + _ * l}`
936
+ },
937
+ _
938
+ );
939
+ }) }),
940
+ /* @__PURE__ */ t.jsx(
941
+ "input",
942
+ {
943
+ type: "range",
944
+ min: o,
945
+ max: c,
946
+ step: l,
947
+ value: e,
948
+ onChange: (x) => n(Number(x.target.value)),
949
+ onMouseDown: () => h(!0),
950
+ onMouseUp: () => h(!1),
951
+ onTouchStart: () => h(!0),
952
+ onTouchEnd: () => h(!1),
953
+ className: m.input
954
+ }
955
+ )
956
+ ] }),
957
+ /* @__PURE__ */ t.jsxs("div", { className: m.countBlock, children: [
958
+ /* @__PURE__ */ t.jsx(
959
+ I,
960
+ {
961
+ type: "number",
962
+ min: o,
963
+ max: c,
964
+ paddingless: !0,
965
+ onChange: (x) => {
966
+ const _ = Number(x);
967
+ _ > c ? n(c) : _ < o ? n(o) : n(_);
968
+ },
969
+ value: String(e)
970
+ }
971
+ ),
972
+ /* @__PURE__ */ t.jsxs("div", { className: m.controls, children: [
973
+ /* @__PURE__ */ t.jsx(
974
+ "button",
975
+ {
976
+ onClick: p,
977
+ disabled: e >= c,
978
+ className: m.button,
979
+ "aria-label": "Increment count",
980
+ children: /* @__PURE__ */ t.jsx(
981
+ g,
982
+ {
983
+ name: "arrow-down",
984
+ width: 15,
985
+ height: 15,
986
+ rotated: !0
987
+ }
988
+ )
989
+ }
990
+ ),
991
+ /* @__PURE__ */ t.jsx(
992
+ "button",
993
+ {
994
+ onClick: u,
995
+ disabled: e <= o,
996
+ className: m.button,
997
+ "aria-label": "Decrement count",
998
+ children: /* @__PURE__ */ t.jsx(
999
+ g,
1000
+ {
1001
+ name: "arrow-down",
1002
+ width: 15,
1003
+ height: 15
1004
+ }
1005
+ )
1006
+ }
1007
+ )
1008
+ ] })
1009
+ ] })
1010
+ ] })
1011
+ ] });
669
1012
  };
670
1013
  export {
671
- E as Button,
672
- ye as ButtonTypeSettings,
673
- Te as ButtonsSettings,
674
- Se as Checkbox,
1014
+ K as Button,
1015
+ Me as ButtonTypeSettings,
1016
+ ls as ButtonsSettings,
1017
+ rs as Checkbox,
675
1018
  J as ChooseImage,
676
- Ae as ChooseImageModal,
677
- Le as ColorPicker,
678
- p as Icon,
679
- A as Input,
680
- Ce as ItemsSettings,
681
- Be as LayoutSettings,
682
- ze as Modal,
683
- Re as Picker,
684
- Oe as Radio,
685
- I as Select,
686
- Ee as Submodal,
687
- N as Switch,
688
- Ne as TextSettings,
689
- O as Textarea,
690
- He as Tip,
691
- H as TypeTexts
1019
+ ds as ChooseImageModal,
1020
+ us as ColorPicker,
1021
+ g as Icon,
1022
+ I as Input,
1023
+ Zt as ItemsSettings,
1024
+ cs as LayoutSettings,
1025
+ _s as Modal,
1026
+ ps as Picker,
1027
+ ms as Radio,
1028
+ ss as RangeSelector,
1029
+ D as Select,
1030
+ hs as Submodal,
1031
+ P as Switch,
1032
+ Nt as TextSettings,
1033
+ q as Textarea,
1034
+ gs as Tip,
1035
+ Q as TypesText
692
1036
  };