@drawbridge/components 0.0.37 → 0.0.40

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 (246) hide show
  1. package/dist/advertisement.js +1299 -0
  2. package/dist/advertisement.mjs +95 -0
  3. package/dist/card-advertisement.js +104 -31
  4. package/dist/card-advertisement.mjs +3 -281
  5. package/dist/chunk-2ZYGRSSA.mjs +45 -0
  6. package/dist/chunk-7ZLMDYBR.mjs +113 -0
  7. package/dist/chunk-BD3TDNJE.mjs +98 -0
  8. package/dist/chunk-FJXG3REN.mjs +93 -0
  9. package/dist/chunk-FYA7EAMR.mjs +29 -0
  10. package/dist/chunk-GFDZ7ER6.mjs +29 -0
  11. package/dist/chunk-HDOA3Y3U.mjs +334 -0
  12. package/dist/chunk-HH7WF5BT.mjs +29 -0
  13. package/dist/chunk-Q3UIVGPQ.mjs +29 -0
  14. package/dist/chunk-T5QQBFM3.mjs +29 -0
  15. package/dist/chunk-TJNIR4PF.mjs +358 -0
  16. package/dist/chunk-XWELEL6Z.mjs +208 -0
  17. package/dist/embla.js +41 -0
  18. package/dist/embla.mjs +6 -0
  19. package/dist/icons/arrow-down-tray.js +48 -0
  20. package/dist/icons/arrow-down-tray.mjs +28 -0
  21. package/dist/icons/arrow-left.js +48 -0
  22. package/dist/icons/arrow-left.mjs +28 -0
  23. package/dist/icons/arrow-right.js +48 -0
  24. package/dist/icons/arrow-right.mjs +28 -0
  25. package/dist/icons/arrow-up-tray.js +48 -0
  26. package/dist/icons/arrow-up-tray.mjs +28 -0
  27. package/dist/icons/bars-arrow-down.js +48 -0
  28. package/dist/icons/bars-arrow-down.mjs +28 -0
  29. package/dist/icons/bars-arrow-up.js +48 -0
  30. package/dist/icons/bars-arrow-up.mjs +28 -0
  31. package/dist/icons/bold.js +47 -0
  32. package/dist/icons/bold.mjs +27 -0
  33. package/dist/icons/bolt.js +48 -0
  34. package/dist/icons/bolt.mjs +28 -0
  35. package/dist/icons/calendar.js +48 -0
  36. package/dist/icons/calendar.mjs +28 -0
  37. package/dist/icons/cancel.js +48 -0
  38. package/dist/icons/cancel.mjs +28 -0
  39. package/dist/icons/card.js +48 -0
  40. package/dist/icons/card.mjs +28 -0
  41. package/dist/icons/chart.js +48 -0
  42. package/dist/icons/chart.mjs +28 -0
  43. package/dist/icons/check.js +48 -0
  44. package/dist/icons/check.mjs +6 -0
  45. package/dist/icons/chevron-down.js +48 -0
  46. package/dist/icons/chevron-down.mjs +6 -0
  47. package/dist/icons/chevron-left.js +48 -0
  48. package/dist/icons/chevron-left.mjs +28 -0
  49. package/dist/icons/chevron-right.js +48 -0
  50. package/dist/icons/chevron-right.mjs +28 -0
  51. package/dist/icons/chevron-up-down.js +48 -0
  52. package/dist/icons/chevron-up-down.mjs +28 -0
  53. package/dist/icons/chevron-up.js +48 -0
  54. package/dist/icons/chevron-up.mjs +28 -0
  55. package/dist/icons/clock.js +48 -0
  56. package/dist/icons/clock.mjs +28 -0
  57. package/dist/icons/code-bracket.js +48 -0
  58. package/dist/icons/code-bracket.mjs +28 -0
  59. package/dist/icons/cog.js +60 -0
  60. package/dist/icons/cog.mjs +40 -0
  61. package/dist/icons/copy.js +48 -0
  62. package/dist/icons/copy.mjs +28 -0
  63. package/dist/icons/document.js +48 -0
  64. package/dist/icons/document.mjs +28 -0
  65. package/dist/icons/download.js +48 -0
  66. package/dist/icons/download.mjs +28 -0
  67. package/dist/icons/drag.js +51 -0
  68. package/dist/icons/drag.mjs +31 -0
  69. package/dist/icons/ellipsis.js +48 -0
  70. package/dist/icons/ellipsis.mjs +28 -0
  71. package/dist/icons/email.js +48 -0
  72. package/dist/icons/email.mjs +28 -0
  73. package/dist/icons/external.js +48 -0
  74. package/dist/icons/external.mjs +28 -0
  75. package/dist/icons/filter.js +48 -0
  76. package/dist/icons/filter.mjs +28 -0
  77. package/dist/icons/flag.js +48 -0
  78. package/dist/icons/flag.mjs +28 -0
  79. package/dist/icons/google.js +74 -0
  80. package/dist/icons/google.mjs +54 -0
  81. package/dist/icons/home.js +48 -0
  82. package/dist/icons/home.mjs +28 -0
  83. package/dist/icons/image.js +48 -0
  84. package/dist/icons/image.mjs +28 -0
  85. package/dist/icons/italic.js +48 -0
  86. package/dist/icons/italic.mjs +28 -0
  87. package/dist/icons/link.js +48 -0
  88. package/dist/icons/link.mjs +28 -0
  89. package/dist/icons/loader.js +64 -0
  90. package/dist/icons/loader.mjs +6 -0
  91. package/dist/icons/lock.js +48 -0
  92. package/dist/icons/lock.mjs +28 -0
  93. package/dist/icons/logo-mark.js +55 -0
  94. package/dist/icons/logo-mark.mjs +35 -0
  95. package/dist/icons/logo-tagline.js +137 -0
  96. package/dist/icons/logo-tagline.mjs +117 -0
  97. package/dist/icons/map-pin.js +60 -0
  98. package/dist/icons/map-pin.mjs +40 -0
  99. package/dist/icons/menu.js +48 -0
  100. package/dist/icons/menu.mjs +28 -0
  101. package/dist/icons/minus.js +48 -0
  102. package/dist/icons/minus.mjs +6 -0
  103. package/dist/icons/muted.js +48 -0
  104. package/dist/icons/muted.mjs +28 -0
  105. package/dist/icons/pause.js +48 -0
  106. package/dist/icons/pause.mjs +28 -0
  107. package/dist/icons/pencil.js +48 -0
  108. package/dist/icons/pencil.mjs +28 -0
  109. package/dist/icons/play.js +48 -0
  110. package/dist/icons/play.mjs +28 -0
  111. package/dist/icons/plus.js +48 -0
  112. package/dist/icons/plus.mjs +6 -0
  113. package/dist/icons/powered-by.js +45 -0
  114. package/dist/icons/powered-by.mjs +25 -0
  115. package/dist/icons/qr-code.js +60 -0
  116. package/dist/icons/qr-code.mjs +40 -0
  117. package/dist/icons/queue.js +48 -0
  118. package/dist/icons/queue.mjs +28 -0
  119. package/dist/icons/refresh.js +48 -0
  120. package/dist/icons/refresh.mjs +28 -0
  121. package/dist/icons/refund.js +48 -0
  122. package/dist/icons/refund.mjs +28 -0
  123. package/dist/icons/rocket.js +48 -0
  124. package/dist/icons/rocket.mjs +28 -0
  125. package/dist/icons/search.js +48 -0
  126. package/dist/icons/search.mjs +28 -0
  127. package/dist/icons/share.js +48 -0
  128. package/dist/icons/share.mjs +28 -0
  129. package/dist/icons/shop.js +46 -0
  130. package/dist/icons/shop.mjs +26 -0
  131. package/dist/icons/sparkles.js +48 -0
  132. package/dist/icons/sparkles.mjs +28 -0
  133. package/dist/icons/star.js +48 -0
  134. package/dist/icons/star.mjs +28 -0
  135. package/dist/icons/switch.js +48 -0
  136. package/dist/icons/switch.mjs +28 -0
  137. package/dist/icons/times.js +48 -0
  138. package/dist/icons/times.mjs +28 -0
  139. package/dist/icons/trash.js +48 -0
  140. package/dist/icons/trash.mjs +28 -0
  141. package/dist/icons/underline.js +48 -0
  142. package/dist/icons/underline.mjs +28 -0
  143. package/dist/icons/upload.js +48 -0
  144. package/dist/icons/upload.mjs +28 -0
  145. package/dist/icons/volume.js +48 -0
  146. package/dist/icons/volume.mjs +28 -0
  147. package/dist/icons/warning.js +48 -0
  148. package/dist/icons/warning.mjs +6 -0
  149. package/dist/input-checkbox.js +130 -0
  150. package/dist/input-checkbox.mjs +71 -0
  151. package/dist/input-group.js +156 -0
  152. package/dist/input-group.mjs +7 -0
  153. package/dist/input-number.js +211 -0
  154. package/dist/input-number.mjs +136 -0
  155. package/dist/input-select.js +150 -0
  156. package/dist/input-select.mjs +9 -0
  157. package/dist/input-text.js +65 -0
  158. package/dist/input-text.mjs +36 -0
  159. package/dist/input-textarea.js +69 -0
  160. package/dist/input-textarea.mjs +40 -0
  161. package/dist/product.js +864 -0
  162. package/dist/product.mjs +14 -0
  163. package/dist/styles.js +127 -0
  164. package/dist/styles.mjs +28 -0
  165. package/dist/video.js +177 -0
  166. package/dist/video.mjs +107 -0
  167. package/dist/wrapper-gradient.js +232 -0
  168. package/dist/wrapper-gradient.mjs +9 -0
  169. package/package.json +312 -2
  170. package/types/advertisement.d.ts +35 -0
  171. package/types/embla.d.ts +2 -0
  172. package/types/icons/arrow-down-tray.d.ts +5 -0
  173. package/types/icons/arrow-left.d.ts +5 -0
  174. package/types/icons/arrow-right.d.ts +5 -0
  175. package/types/icons/arrow-up-tray.d.ts +5 -0
  176. package/types/icons/bars-arrow-down.d.ts +5 -0
  177. package/types/icons/bars-arrow-up.d.ts +5 -0
  178. package/types/icons/bold.d.ts +5 -0
  179. package/types/icons/bolt.d.ts +5 -0
  180. package/types/icons/calendar.d.ts +5 -0
  181. package/types/icons/cancel.d.ts +5 -0
  182. package/types/icons/card.d.ts +5 -0
  183. package/types/icons/chart.d.ts +5 -0
  184. package/types/icons/check.d.ts +5 -0
  185. package/types/icons/chevron-down.d.ts +5 -0
  186. package/types/icons/chevron-left.d.ts +5 -0
  187. package/types/icons/chevron-right.d.ts +5 -0
  188. package/types/icons/chevron-up-down.d.ts +5 -0
  189. package/types/icons/chevron-up.d.ts +5 -0
  190. package/types/icons/clock.d.ts +5 -0
  191. package/types/icons/code-bracket.d.ts +5 -0
  192. package/types/icons/cog.d.ts +5 -0
  193. package/types/icons/copy.d.ts +5 -0
  194. package/types/icons/document.d.ts +5 -0
  195. package/types/icons/download.d.ts +5 -0
  196. package/types/icons/drag.d.ts +5 -0
  197. package/types/icons/ellipsis.d.ts +5 -0
  198. package/types/icons/email.d.ts +5 -0
  199. package/types/icons/external.d.ts +5 -0
  200. package/types/icons/filter.d.ts +5 -0
  201. package/types/icons/flag.d.ts +5 -0
  202. package/types/icons/google.d.ts +5 -0
  203. package/types/icons/home.d.ts +5 -0
  204. package/types/icons/image.d.ts +5 -0
  205. package/types/icons/italic.d.ts +5 -0
  206. package/types/icons/link.d.ts +5 -0
  207. package/types/icons/loader.d.ts +5 -0
  208. package/types/icons/lock.d.ts +5 -0
  209. package/types/icons/logo-mark.d.ts +5 -0
  210. package/types/icons/logo-tagline.d.ts +5 -0
  211. package/types/icons/map-pin.d.ts +5 -0
  212. package/types/icons/menu.d.ts +5 -0
  213. package/types/icons/minus.d.ts +5 -0
  214. package/types/icons/muted.d.ts +5 -0
  215. package/types/icons/pause.d.ts +5 -0
  216. package/types/icons/pencil.d.ts +5 -0
  217. package/types/icons/play.d.ts +5 -0
  218. package/types/icons/plus.d.ts +5 -0
  219. package/types/icons/powered-by.d.ts +5 -0
  220. package/types/icons/qr-code.d.ts +5 -0
  221. package/types/icons/queue.d.ts +5 -0
  222. package/types/icons/refresh.d.ts +5 -0
  223. package/types/icons/refund.d.ts +5 -0
  224. package/types/icons/rocket.d.ts +5 -0
  225. package/types/icons/search.d.ts +5 -0
  226. package/types/icons/share.d.ts +5 -0
  227. package/types/icons/shop.d.ts +5 -0
  228. package/types/icons/sparkles.d.ts +5 -0
  229. package/types/icons/star.d.ts +5 -0
  230. package/types/icons/switch.d.ts +5 -0
  231. package/types/icons/times.d.ts +5 -0
  232. package/types/icons/trash.d.ts +5 -0
  233. package/types/icons/underline.d.ts +5 -0
  234. package/types/icons/upload.d.ts +5 -0
  235. package/types/icons/volume.d.ts +5 -0
  236. package/types/icons/warning.d.ts +5 -0
  237. package/types/input-checkbox.d.ts +14 -0
  238. package/types/input-group.d.ts +15 -0
  239. package/types/input-number.d.ts +17 -0
  240. package/types/input-select.d.ts +19 -0
  241. package/types/input-text.d.ts +12 -0
  242. package/types/input-textarea.d.ts +13 -0
  243. package/types/product.d.ts +20 -0
  244. package/types/styles.d.ts +37 -0
  245. package/types/video.d.ts +20 -0
  246. package/types/wrapper-gradient.d.ts +17 -0
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import {
3
+ product_default
4
+ } from "./chunk-HDOA3Y3U.mjs";
5
+ import "./chunk-2ZYGRSSA.mjs";
6
+ import "./chunk-XWELEL6Z.mjs";
7
+ import {
8
+ card_advertisement_default
9
+ } from "./chunk-TJNIR4PF.mjs";
10
+ import "./chunk-7ZLMDYBR.mjs";
11
+ import "./chunk-Q3UIVGPQ.mjs";
12
+ import "./chunk-BD3TDNJE.mjs";
13
+ import "./chunk-FYA7EAMR.mjs";
14
+ import "./chunk-FJXG3REN.mjs";
15
+
16
+ // components/advertisement.js
17
+ import { jsx } from "react/jsx-runtime";
18
+ var Advertisement = ({
19
+ action = null,
20
+ affiliate,
21
+ brand,
22
+ button,
23
+ campaign,
24
+ disabled = false,
25
+ errors,
26
+ file,
27
+ header,
28
+ id,
29
+ ImageComponent,
30
+ lead,
31
+ onAdd,
32
+ onBuy,
33
+ onClick = () => {
34
+ },
35
+ onVariantChange,
36
+ onVariantSelect = () => {
37
+ },
38
+ organization,
39
+ page,
40
+ preview = false,
41
+ product,
42
+ style = {},
43
+ title,
44
+ url,
45
+ variant,
46
+ VideoComponent
47
+ }) => {
48
+ if (product) {
49
+ return /* @__PURE__ */ jsx(
50
+ product_default,
51
+ {
52
+ ...{
53
+ action,
54
+ disabled: preview || disabled,
55
+ errors,
56
+ header,
57
+ ImageComponent,
58
+ onAdd,
59
+ onBuy,
60
+ onVariantChange,
61
+ product,
62
+ style,
63
+ variant
64
+ }
65
+ }
66
+ );
67
+ }
68
+ return /* @__PURE__ */ jsx(
69
+ card_advertisement_default,
70
+ {
71
+ ...{
72
+ advertisement: id,
73
+ affiliate,
74
+ asset: file,
75
+ brand: brand || { style },
76
+ button,
77
+ campaign,
78
+ ImageComponent,
79
+ lead,
80
+ onClick,
81
+ onVariantSelect,
82
+ organization,
83
+ page,
84
+ preview,
85
+ title,
86
+ url,
87
+ VideoComponent
88
+ }
89
+ }
90
+ );
91
+ };
92
+ var advertisement_default = Advertisement;
93
+ export {
94
+ advertisement_default as default
95
+ };
@@ -69,10 +69,23 @@ var CardAdvertisement = ({
69
69
  url,
70
70
  VideoComponent = DefaultVideo
71
71
  }) => {
72
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
72
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
73
73
  const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
74
74
  const hasVariants = variants.length > 0;
75
75
  const [selectedVariant, setSelectedVariant] = (0, import_react.useState)(variants[0] || null);
76
+ const [keyboard, setKeyboard] = (0, import_react.useState)(false);
77
+ (0, import_react.useEffect)(() => {
78
+ const down = (e) => {
79
+ if (e.key === "Tab") setKeyboard(true);
80
+ };
81
+ const click = () => setKeyboard(false);
82
+ window.addEventListener("keydown", down);
83
+ window.addEventListener("mousedown", click);
84
+ return () => {
85
+ window.removeEventListener("keydown", down);
86
+ window.removeEventListener("mousedown", click);
87
+ };
88
+ }, []);
76
89
  const style = {
77
90
  background: {
78
91
  color: ((_a = brand == null ? void 0 : brand.style) == null ? void 0 : _a.background) ? (_b = brand.style.background) == null ? void 0 : _b.color : {
@@ -100,7 +113,7 @@ var CardAdvertisement = ({
100
113
  "block w-full space-y-2 border border-gray rounded p-6"
101
114
  ],
102
115
  content: [
103
- "flex flex-col items-center justify-between space-x-4 text-left text-sm rounded"
116
+ "flex flex-col items-center justify-between gap-x-4 text-center text-sm rounded"
104
117
  ]
105
118
  };
106
119
  const productImage = (selectedVariant == null ? void 0 : selectedVariant.image) || (product == null ? void 0 : product.image) || null;
@@ -186,7 +199,8 @@ var CardAdvertisement = ({
186
199
  style: {
187
200
  ...fonts == null ? void 0 : fonts.body,
188
201
  color: (_l = (_k = style == null ? void 0 : style.text) == null ? void 0 : _k.color) == null ? void 0 : _l.hex,
189
- gap: "10px"
202
+ gap: "10px",
203
+ marginTop: "10px"
190
204
  }
191
205
  },
192
206
  children: [
@@ -213,7 +227,8 @@ var CardAdvertisement = ({
213
227
  {
214
228
  ...{
215
229
  style: {
216
- fontSize: "14px"
230
+ fontSize: "14px",
231
+ marginBottom: "10px"
217
232
  }
218
233
  },
219
234
  children: [
@@ -242,32 +257,90 @@ var CardAdvertisement = ({
242
257
  ]
243
258
  }
244
259
  ),
245
- variants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
246
- "select",
260
+ variants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
261
+ "div",
247
262
  {
248
263
  ...{
249
- className: "w-full text-xs border px-2 py-1 bg-transparent",
250
- onChange: (e) => {
251
- const variant = variants.find((v) => v.id === e.target.value);
252
- if (variant) setSelectedVariant(variant);
253
- },
254
- style: {
255
- borderColor: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb.replace(")", ", 0.3)"),
256
- borderRadius: ((_p = (_o = brand == null ? void 0 : brand.style) == null ? void 0 : _o.button) == null ? void 0 : _p.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
257
- color: (_r = (_q = style == null ? void 0 : style.background) == null ? void 0 : _q.color) == null ? void 0 : _r.hex
258
- },
259
- value: (selectedVariant == null ? void 0 : selectedVariant.id) || ""
264
+ className: "relative w-full"
260
265
  },
261
- children: variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
262
- "option",
263
- {
264
- ...{
265
- value: variant.id
266
- },
267
- children: variant.title
268
- },
269
- variant.id
270
- ))
266
+ children: [
267
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
268
+ "select",
269
+ {
270
+ ...{
271
+ className: "input appearance-none " + (keyboard ? "focus-visible:!outline-1 focus-visible:!ring-1 focus-visible:!ring-blue-600" : "focus-visible:!outline-0 focus-visible:!ring-0"),
272
+ onChange: (e) => {
273
+ const variant = variants.find((v) => v.id === e.target.value);
274
+ if (variant) setSelectedVariant(variant);
275
+ },
276
+ style: {
277
+ appearance: "none",
278
+ backgroundColor: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb,
279
+ backgroundImage: "none",
280
+ borderColor: (_p = (_o = style == null ? void 0 : style.text) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb,
281
+ borderRadius: ((_r = (_q = brand == null ? void 0 : brand.style) == null ? void 0 : _q.button) == null ? void 0 : _r.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
282
+ color: (_t = (_s = style == null ? void 0 : style.text) == null ? void 0 : _s.color) == null ? void 0 : _t.rgb,
283
+ WebkitAppearance: "none"
284
+ },
285
+ value: (selectedVariant == null ? void 0 : selectedVariant.id) || ""
286
+ },
287
+ children: variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
288
+ "option",
289
+ {
290
+ ...{
291
+ value: variant.id
292
+ },
293
+ children: variant.title
294
+ },
295
+ variant.id
296
+ ))
297
+ }
298
+ ),
299
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
300
+ "div",
301
+ {
302
+ ...{
303
+ "aria-hidden": true,
304
+ style: {
305
+ alignItems: "center",
306
+ bottom: 0,
307
+ display: "flex",
308
+ paddingRight: "0.625rem",
309
+ pointerEvents: "none",
310
+ position: "absolute",
311
+ right: 0,
312
+ top: 0
313
+ }
314
+ },
315
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
316
+ "svg",
317
+ {
318
+ ...{
319
+ style: {
320
+ height: "1.25rem",
321
+ width: "1.25rem"
322
+ },
323
+ fill: "none",
324
+ stroke: "currentColor",
325
+ strokeWidth: 1.5,
326
+ viewBox: "0 0 24 24",
327
+ xmlns: "http://www.w3.org/2000/svg"
328
+ },
329
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
330
+ "path",
331
+ {
332
+ ...{
333
+ d: "M19.5 8.25l-7.5 7.5-7.5-7.5",
334
+ strokeLinecap: "round",
335
+ strokeLinejoin: "round"
336
+ }
337
+ }
338
+ )
339
+ }
340
+ )
341
+ }
342
+ )
343
+ ]
271
344
  }
272
345
  )
273
346
  ]
@@ -284,10 +357,10 @@ var CardAdvertisement = ({
284
357
  } : preview ? () => {
285
358
  } : onClick,
286
359
  style: {
287
- backgroundColor: ((_v = (_u = (_t = (_s = brand == null ? void 0 : brand.style) == null ? void 0 : _s.button) == null ? void 0 : _t.background) == null ? void 0 : _u.color) == null ? void 0 : _v.hex) || ((_x = (_w = style == null ? void 0 : style.text) == null ? void 0 : _w.color) == null ? void 0 : _x.hex),
288
- borderColor: ((_B = (_A = (_z = (_y = brand == null ? void 0 : brand.style) == null ? void 0 : _y.button) == null ? void 0 : _z.background) == null ? void 0 : _A.color) == null ? void 0 : _B.hex) || ((_D = (_C = style == null ? void 0 : style.text) == null ? void 0 : _C.color) == null ? void 0 : _D.hex),
289
- borderRadius: ((_F = (_E = brand == null ? void 0 : brand.style) == null ? void 0 : _E.button) == null ? void 0 : _F.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
290
- color: ((_J = (_I = (_H = (_G = brand == null ? void 0 : brand.style) == null ? void 0 : _G.button) == null ? void 0 : _H.text) == null ? void 0 : _I.color) == null ? void 0 : _J.hex) || ((_L = (_K = style == null ? void 0 : style.background) == null ? void 0 : _K.color) == null ? void 0 : _L.hex)
360
+ backgroundColor: ((_x = (_w = (_v = (_u = brand == null ? void 0 : brand.style) == null ? void 0 : _u.button) == null ? void 0 : _v.background) == null ? void 0 : _w.color) == null ? void 0 : _x.hex) || ((_z = (_y = style == null ? void 0 : style.text) == null ? void 0 : _y.color) == null ? void 0 : _z.hex),
361
+ borderColor: ((_D = (_C = (_B = (_A = brand == null ? void 0 : brand.style) == null ? void 0 : _A.button) == null ? void 0 : _B.background) == null ? void 0 : _C.color) == null ? void 0 : _D.hex) || ((_F = (_E = style == null ? void 0 : style.text) == null ? void 0 : _E.color) == null ? void 0 : _F.hex),
362
+ borderRadius: ((_H = (_G = brand == null ? void 0 : brand.style) == null ? void 0 : _G.button) == null ? void 0 : _H.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
363
+ color: ((_L = (_K = (_J = (_I = brand == null ? void 0 : brand.style) == null ? void 0 : _I.button) == null ? void 0 : _J.text) == null ? void 0 : _K.color) == null ? void 0 : _L.hex) || ((_N = (_M = style == null ? void 0 : style.background) == null ? void 0 : _M.color) == null ? void 0 : _N.hex)
291
364
  },
292
365
  type: "button"
293
366
  },
@@ -1,284 +1,6 @@
1
- // components/card-advertisement.js
2
- import { useState } from "react";
3
- import { cdnShopify } from "@drawbridge/shopify/cdn";
4
- import { cdnSrc } from "@drawbridge/drawbridge-utils/cdn";
5
- import { formatCurrency } from "@drawbridge/drawbridge-utils";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ jsx(
8
- "img",
9
- {
10
- ...{
11
- alt,
12
- className,
13
- src
14
- }
15
- }
16
- );
17
- var DefaultVideo = ({ className, hls, mp4, poster }) => /* @__PURE__ */ jsx(
18
- "video",
19
- {
20
- ...{
21
- className,
22
- poster,
23
- src: mp4 || hls
24
- }
25
- }
26
- );
27
- var CardAdvertisement = ({
28
- advertisement,
29
- affiliate,
30
- asset,
31
- brand = {},
32
- button,
33
- campaign,
34
- fonts,
35
- ImageComponent = DefaultImage,
36
- lead,
37
- onClick = () => {
38
- },
39
- onVariantSelect = () => {
40
- },
41
- organization,
42
- page,
43
- preview = false,
44
- product,
45
- title,
46
- url,
47
- VideoComponent = DefaultVideo
48
- }) => {
49
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
50
- const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
51
- const hasVariants = variants.length > 0;
52
- const [selectedVariant, setSelectedVariant] = useState(variants[0] || null);
53
- const style = {
54
- background: {
55
- color: ((_a = brand == null ? void 0 : brand.style) == null ? void 0 : _a.background) ? (_b = brand.style.background) == null ? void 0 : _b.color : {
56
- hex: "#FFFFFF",
57
- rgb: "rgb( 255, 255, 255 )"
58
- }
59
- },
60
- text: {
61
- color: ((_c = brand == null ? void 0 : brand.style) == null ? void 0 : _c.text) ? (_d = brand.style.text) == null ? void 0 : _d.color : {
62
- hex: "#000000",
63
- rgb: "rgb( 0, 0, 0 )"
64
- }
65
- }
66
- };
67
- const classes = {
68
- asset: [
69
- "block relative aspect-square rounded overflow-hidden"
70
- ],
71
- button: [
72
- "card-advertisement-button",
73
- "flex items-center justify-center py-3 px-4 w-full border"
74
- ],
75
- container: [
76
- "card-advertisement",
77
- "block w-full space-y-2 border border-gray rounded p-6"
78
- ],
79
- content: [
80
- "flex flex-col items-center justify-between space-x-4 text-left text-sm rounded"
81
- ]
82
- };
83
- const productImage = (selectedVariant == null ? void 0 : selectedVariant.image) || (product == null ? void 0 : product.image) || null;
84
- const productImageSrc = cdnShopify(productImage, "400x400", product == null ? void 0 : product.updatedAt);
85
- if (!(asset == null ? void 0 : asset.sizes) && !productImageSrc) {
86
- classes.asset.push("bg-gray-light");
87
- }
88
- ;
89
- return /* @__PURE__ */ jsxs(
90
- "div",
91
- {
92
- ...{
93
- className: classes.container.join(" "),
94
- style: {
95
- backgroundColor: (_f = (_e = style == null ? void 0 : style.background) == null ? void 0 : _e.color) == null ? void 0 : _f.hex,
96
- color: (_h = (_g = style == null ? void 0 : style.text) == null ? void 0 : _g.color) == null ? void 0 : _h.hex
97
- }
98
- },
99
- children: [
100
- /* @__PURE__ */ jsxs(
101
- "span",
102
- {
103
- ...{
104
- className: classes.asset.join(" ")
105
- },
106
- children: [
107
- (asset == null ? void 0 : asset.sizes) && asset.mimetype.includes("image") && /* @__PURE__ */ jsx(
108
- ImageComponent,
109
- {
110
- ...{
111
- alt: asset == null ? void 0 : asset.filename,
112
- className: "w-full h-full object-cover",
113
- fill: true,
114
- priority: false,
115
- sizes: "100%",
116
- src: cdnSrc(asset, "400x400", asset == null ? void 0 : asset.updatedAt)
117
- }
118
- },
119
- asset == null ? void 0 : asset.id
120
- ),
121
- !(asset == null ? void 0 : asset.sizes) && productImageSrc && /* @__PURE__ */ jsx(
122
- ImageComponent,
123
- {
124
- ...{
125
- alt: (product == null ? void 0 : product.title) || "Product",
126
- className: "w-full h-full object-cover",
127
- fill: true,
128
- priority: false,
129
- sizes: "100%",
130
- src: productImageSrc,
131
- unoptimized: true
132
- }
133
- },
134
- productImageSrc
135
- ),
136
- (asset == null ? void 0 : asset.sizes) && asset.mimetype.includes("video") && /* @__PURE__ */ jsx(
137
- "div",
138
- {
139
- ...{
140
- className: "relative h-full w-full aspect-[9/16]"
141
- },
142
- children: /* @__PURE__ */ jsx(
143
- VideoComponent,
144
- {
145
- ...{
146
- className: "w-full h-full",
147
- hls: cdnSrc(asset, "hls", asset == null ? void 0 : asset.updatedAt),
148
- mp4: cdnSrc(asset, "original", asset == null ? void 0 : asset.updatedAt),
149
- poster: cdnSrc((_i = asset == null ? void 0 : asset.frames) == null ? void 0 : _i[asset == null ? void 0 : asset.poster], "500x500", asset == null ? void 0 : asset.updatedAt) || cdnSrc((_j = asset == null ? void 0 : asset.frames) == null ? void 0 : _j[asset == null ? void 0 : asset.poster], "1080x1920", asset == null ? void 0 : asset.updatedAt)
150
- }
151
- }
152
- )
153
- }
154
- )
155
- ]
156
- }
157
- ),
158
- /* @__PURE__ */ jsxs(
159
- "span",
160
- {
161
- ...{
162
- className: classes.content.join(" "),
163
- style: {
164
- ...fonts == null ? void 0 : fonts.body,
165
- color: (_l = (_k = style == null ? void 0 : style.text) == null ? void 0 : _k.color) == null ? void 0 : _l.hex,
166
- gap: "10px"
167
- }
168
- },
169
- children: [
170
- /* @__PURE__ */ jsxs(
171
- "div",
172
- {
173
- ...{
174
- className: "flex-1 min-w-0 space-y-2"
175
- },
176
- children: [
177
- title && /* @__PURE__ */ jsx(
178
- "p",
179
- {
180
- ...{
181
- style: {
182
- fontSize: "18px"
183
- }
184
- },
185
- children: title
186
- }
187
- ),
188
- (selectedVariant == null ? void 0 : selectedVariant.price) && (selectedVariant == null ? void 0 : selectedVariant.currency) && /* @__PURE__ */ jsxs(
189
- "p",
190
- {
191
- ...{
192
- style: {
193
- fontSize: "14px"
194
- }
195
- },
196
- children: [
197
- (selectedVariant == null ? void 0 : selectedVariant.sale) && selectedVariant.sale > selectedVariant.price && /* @__PURE__ */ jsx(
198
- "span",
199
- {
200
- ...{
201
- style: {
202
- marginRight: "6px",
203
- opacity: 0.5,
204
- textDecoration: "line-through"
205
- }
206
- },
207
- children: formatCurrency({
208
- code: selectedVariant.currency,
209
- display: "parts",
210
- value: selectedVariant.sale
211
- })
212
- }
213
- ),
214
- formatCurrency({
215
- code: selectedVariant.currency,
216
- display: "parts",
217
- value: selectedVariant.price
218
- })
219
- ]
220
- }
221
- ),
222
- variants.length > 1 && /* @__PURE__ */ jsx(
223
- "select",
224
- {
225
- ...{
226
- className: "w-full text-xs border px-2 py-1 bg-transparent",
227
- onChange: (e) => {
228
- const variant = variants.find((v) => v.id === e.target.value);
229
- if (variant) setSelectedVariant(variant);
230
- },
231
- style: {
232
- borderColor: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb.replace(")", ", 0.3)"),
233
- borderRadius: ((_p = (_o = brand == null ? void 0 : brand.style) == null ? void 0 : _o.button) == null ? void 0 : _p.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
234
- color: (_r = (_q = style == null ? void 0 : style.background) == null ? void 0 : _q.color) == null ? void 0 : _r.hex
235
- },
236
- value: (selectedVariant == null ? void 0 : selectedVariant.id) || ""
237
- },
238
- children: variants.map((variant) => /* @__PURE__ */ jsx(
239
- "option",
240
- {
241
- ...{
242
- value: variant.id
243
- },
244
- children: variant.title
245
- },
246
- variant.id
247
- ))
248
- }
249
- )
250
- ]
251
- }
252
- ),
253
- button && /* @__PURE__ */ jsx(
254
- "button",
255
- {
256
- ...{
257
- className: classes.button.join(" "),
258
- disabled: !preview && !hasVariants && !url,
259
- onClick: hasVariants ? () => {
260
- if (!preview) onVariantSelect(selectedVariant);
261
- } : preview ? () => {
262
- } : onClick,
263
- style: {
264
- backgroundColor: ((_v = (_u = (_t = (_s = brand == null ? void 0 : brand.style) == null ? void 0 : _s.button) == null ? void 0 : _t.background) == null ? void 0 : _u.color) == null ? void 0 : _v.hex) || ((_x = (_w = style == null ? void 0 : style.text) == null ? void 0 : _w.color) == null ? void 0 : _x.hex),
265
- borderColor: ((_B = (_A = (_z = (_y = brand == null ? void 0 : brand.style) == null ? void 0 : _y.button) == null ? void 0 : _z.background) == null ? void 0 : _A.color) == null ? void 0 : _B.hex) || ((_D = (_C = style == null ? void 0 : style.text) == null ? void 0 : _C.color) == null ? void 0 : _D.hex),
266
- borderRadius: ((_F = (_E = brand == null ? void 0 : brand.style) == null ? void 0 : _E.button) == null ? void 0 : _F.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
267
- color: ((_J = (_I = (_H = (_G = brand == null ? void 0 : brand.style) == null ? void 0 : _G.button) == null ? void 0 : _H.text) == null ? void 0 : _I.color) == null ? void 0 : _J.hex) || ((_L = (_K = style == null ? void 0 : style.background) == null ? void 0 : _K.color) == null ? void 0 : _L.hex)
268
- },
269
- type: "button"
270
- },
271
- children: button
272
- }
273
- )
274
- ]
275
- }
276
- )
277
- ]
278
- }
279
- );
280
- };
281
- var card_advertisement_default = CardAdvertisement;
1
+ import {
2
+ card_advertisement_default
3
+ } from "./chunk-TJNIR4PF.mjs";
282
4
  export {
283
5
  card_advertisement_default as default
284
6
  };
@@ -0,0 +1,45 @@
1
+ // components/icons/loader.js
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ var Loader = ({ className, ...props }) => /* @__PURE__ */ jsxs(
4
+ "svg",
5
+ {
6
+ ...{
7
+ fill: "none",
8
+ stroke: "none",
9
+ strokeWidth: 0,
10
+ viewBox: "0 0 24 24",
11
+ className: ["animate-spin", className].filter(Boolean).join(" "),
12
+ ...props
13
+ },
14
+ children: [
15
+ /* @__PURE__ */ jsx(
16
+ "circle",
17
+ {
18
+ ...{
19
+ className: "opacity-25",
20
+ cx: 12,
21
+ cy: 12,
22
+ r: 10,
23
+ stroke: "currentColor",
24
+ strokeWidth: 4
25
+ }
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsx(
29
+ "path",
30
+ {
31
+ ...{
32
+ className: "opacity-75",
33
+ fill: "currentColor",
34
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
35
+ }
36
+ }
37
+ )
38
+ ]
39
+ }
40
+ );
41
+ var loader_default = Loader;
42
+
43
+ export {
44
+ loader_default
45
+ };