@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,113 @@
1
+ import {
2
+ warning_default
3
+ } from "./chunk-Q3UIVGPQ.mjs";
4
+
5
+ // components/input-group.js
6
+ import { Fragment } from "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var InputGroup = ({
9
+ className,
10
+ error,
11
+ input,
12
+ label,
13
+ message,
14
+ style = {}
15
+ }) => {
16
+ var _a, _b, _c, _d;
17
+ const classes = [
18
+ "input-group"
19
+ ];
20
+ if (className) {
21
+ classes.push(className);
22
+ }
23
+ if (error) {
24
+ classes.push("error");
25
+ }
26
+ return /* @__PURE__ */ jsxs(
27
+ "div",
28
+ {
29
+ ...{
30
+ className: classes.join(" "),
31
+ "aria-live": "polite"
32
+ },
33
+ children: [
34
+ label ? /* @__PURE__ */ jsxs(
35
+ "div",
36
+ {
37
+ ...{
38
+ className: "space-y-2"
39
+ },
40
+ children: [
41
+ /* @__PURE__ */ jsx(
42
+ "span",
43
+ {
44
+ ...{
45
+ className: "block"
46
+ },
47
+ children: label
48
+ }
49
+ ),
50
+ input
51
+ ]
52
+ }
53
+ ) : input,
54
+ (error || message) && /* @__PURE__ */ jsxs(
55
+ "p",
56
+ {
57
+ ...{
58
+ className: "flex items-center justify-start space-x-2 py-1 rounded text-sm " + (error && "px-1.5"),
59
+ ...error && Object.keys(style).length > 0 && {
60
+ style: {
61
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb.replace(")", ",.1)"),
62
+ color: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
63
+ }
64
+ }
65
+ },
66
+ children: [
67
+ error && /* @__PURE__ */ jsxs(Fragment, { children: [
68
+ /* @__PURE__ */ jsx(
69
+ warning_default,
70
+ {
71
+ ...{
72
+ className: "w-4 h-4",
73
+ "aria-hidden": true
74
+ }
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsxs(
78
+ "span",
79
+ {
80
+ ...{
81
+ className: "text-[0px] opacity-0 w-0 h-0 absolute"
82
+ },
83
+ children: [
84
+ label,
85
+ ": ",
86
+ error
87
+ ]
88
+ }
89
+ )
90
+ ] }),
91
+ /* @__PURE__ */ jsx(
92
+ "span",
93
+ {
94
+ ...{
95
+ ...error && {
96
+ "aria-hidden": true
97
+ }
98
+ },
99
+ children: error || message
100
+ }
101
+ )
102
+ ]
103
+ }
104
+ )
105
+ ]
106
+ }
107
+ );
108
+ };
109
+ var input_group_default = InputGroup;
110
+
111
+ export {
112
+ input_group_default
113
+ };
@@ -0,0 +1,98 @@
1
+ import {
2
+ chevron_down_default
3
+ } from "./chunk-FYA7EAMR.mjs";
4
+ import {
5
+ inputStyle
6
+ } from "./chunk-FJXG3REN.mjs";
7
+
8
+ // components/input-select.js
9
+ import { useEffect, useState } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var InputSelect = ({
12
+ onChange,
13
+ options = [],
14
+ style,
15
+ value,
16
+ ...rest
17
+ }) => {
18
+ const [keyboard, setKeyboard] = useState(false);
19
+ useEffect(() => {
20
+ const down = (e) => {
21
+ if (e.key === "Tab") setKeyboard(true);
22
+ };
23
+ const click = () => setKeyboard(false);
24
+ window.addEventListener("keydown", down);
25
+ window.addEventListener("mousedown", click);
26
+ return () => {
27
+ window.removeEventListener("keydown", down);
28
+ window.removeEventListener("mousedown", click);
29
+ };
30
+ }, []);
31
+ return /* @__PURE__ */ jsxs(
32
+ "div",
33
+ {
34
+ ...{
35
+ className: "relative"
36
+ },
37
+ children: [
38
+ /* @__PURE__ */ jsxs(
39
+ "select",
40
+ {
41
+ ...{
42
+ ...rest,
43
+ 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"),
44
+ onChange: ({ target }) => onChange(target == null ? void 0 : target.value),
45
+ style: inputStyle(style),
46
+ value
47
+ },
48
+ children: [
49
+ /* @__PURE__ */ jsx(
50
+ "option",
51
+ {
52
+ ...{
53
+ disabled: true,
54
+ "aria-label": "Select option",
55
+ value: ""
56
+ },
57
+ children: "Select"
58
+ }
59
+ ),
60
+ options.map(({ label, option, value: optValue }, key) => /* @__PURE__ */ jsx(
61
+ "option",
62
+ {
63
+ ...{
64
+ value: optValue ?? option
65
+ },
66
+ children: label ?? option
67
+ },
68
+ "input-select-option-" + key
69
+ ))
70
+ ]
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsx(
74
+ "div",
75
+ {
76
+ ...{
77
+ "aria-hidden": true,
78
+ className: "h-full flex items-center absolute inset-y-0 right-0 pointer-events-none px-2.5"
79
+ },
80
+ children: /* @__PURE__ */ jsx(
81
+ chevron_down_default,
82
+ {
83
+ ...{
84
+ className: "w-5 h-5 text-inherit"
85
+ }
86
+ }
87
+ )
88
+ }
89
+ )
90
+ ]
91
+ }
92
+ );
93
+ };
94
+ var input_select_default = InputSelect;
95
+
96
+ export {
97
+ input_select_default
98
+ };
@@ -0,0 +1,93 @@
1
+ // components/styles.js
2
+ var backgroundStyle = (style) => {
3
+ var _a, _b, _c, _d;
4
+ return {
5
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
6
+ color: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
7
+ };
8
+ };
9
+ var borderStyle = (style) => {
10
+ var _a, _b;
11
+ return {
12
+ borderColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
13
+ };
14
+ };
15
+ var buttonStyle = (style) => {
16
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
17
+ return {
18
+ backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || ((_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb),
19
+ borderColor: ((_h = (_g = (_f = style == null ? void 0 : style.button) == null ? void 0 : _f.background) == null ? void 0 : _g.color) == null ? void 0 : _h.rgb) || ((_j = (_i = style == null ? void 0 : style.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb),
20
+ borderRadius: ((_k = style == null ? void 0 : style.button) == null ? void 0 : _k.radius) != null ? style.button.radius / 4 + "px" : void 0,
21
+ color: ((_n = (_m = (_l = style == null ? void 0 : style.button) == null ? void 0 : _l.text) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb) || ((_p = (_o = style == null ? void 0 : style.background) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb)
22
+ };
23
+ };
24
+ var closeStyle = (style) => {
25
+ var _a, _b, _c, _d;
26
+ return {
27
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
28
+ color: (_d = (_c = style == null ? void 0 : style.background) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
29
+ };
30
+ };
31
+ var headerStyle = (style) => {
32
+ var _a, _b, _c;
33
+ return {
34
+ fontFamily: (_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family,
35
+ fontWeight: (_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight,
36
+ textTransform: (_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.transform
37
+ };
38
+ };
39
+ var inputStyle = (style) => {
40
+ var _a, _b, _c, _d, _e, _f, _g;
41
+ return {
42
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
43
+ borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
44
+ borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
45
+ color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
46
+ };
47
+ };
48
+ var inputCheckboxStyle = (style) => {
49
+ var _a;
50
+ return {
51
+ ...inputStyle(style),
52
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? Math.min(style.input.radius / 4, 6) + "px" : void 0
53
+ };
54
+ };
55
+ var inputNameStyle = (style) => inputStyle(style);
56
+ var inputPhoneStyle = (style) => inputStyle(style);
57
+ var menuStyle = (style) => {
58
+ var _a, _b, _c, _d, _e, _f;
59
+ return {
60
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
61
+ borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
62
+ color: (_f = (_e = style == null ? void 0 : style.text) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb
63
+ };
64
+ };
65
+ var selectStyle = (style) => {
66
+ var _a, _b, _c, _d, _e, _f;
67
+ return {
68
+ borderColor: (_c = (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) == null ? void 0 : _c.replace(")", ", 0.3)"),
69
+ borderRadius: ((_d = style == null ? void 0 : style.input) == null ? void 0 : _d.radius) != null ? style.input.radius / 4 + "px" : void 0,
70
+ color: (_f = (_e = style == null ? void 0 : style.text) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb
71
+ };
72
+ };
73
+ var textStyle = (style) => {
74
+ var _a, _b;
75
+ return {
76
+ color: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
77
+ };
78
+ };
79
+
80
+ export {
81
+ backgroundStyle,
82
+ borderStyle,
83
+ buttonStyle,
84
+ closeStyle,
85
+ headerStyle,
86
+ inputStyle,
87
+ inputCheckboxStyle,
88
+ inputNameStyle,
89
+ inputPhoneStyle,
90
+ menuStyle,
91
+ selectStyle,
92
+ textStyle
93
+ };
@@ -0,0 +1,29 @@
1
+ // components/icons/chevron-down.js
2
+ import { jsx } from "react/jsx-runtime";
3
+ var ChevronDown = (props) => /* @__PURE__ */ jsx(
4
+ "svg",
5
+ {
6
+ ...{
7
+ fill: "none",
8
+ stroke: "currentColor",
9
+ strokeWidth: 1.5,
10
+ viewBox: "0 0 24 24",
11
+ ...props
12
+ },
13
+ children: /* @__PURE__ */ jsx(
14
+ "path",
15
+ {
16
+ ...{
17
+ d: "m19.5 8.25-7.5 7.5-7.5-7.5",
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round"
20
+ }
21
+ }
22
+ )
23
+ }
24
+ );
25
+ var chevron_down_default = ChevronDown;
26
+
27
+ export {
28
+ chevron_down_default
29
+ };
@@ -0,0 +1,29 @@
1
+ // components/icons/check.js
2
+ import { jsx } from "react/jsx-runtime";
3
+ var Check = (props) => /* @__PURE__ */ jsx(
4
+ "svg",
5
+ {
6
+ ...{
7
+ fill: "none",
8
+ stroke: "currentColor",
9
+ strokeWidth: 1.5,
10
+ viewBox: "0 0 24 24",
11
+ ...props
12
+ },
13
+ children: /* @__PURE__ */ jsx(
14
+ "path",
15
+ {
16
+ ...{
17
+ d: "m4.5 12.75 6 6 9-13.5",
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round"
20
+ }
21
+ }
22
+ )
23
+ }
24
+ );
25
+ var check_default = Check;
26
+
27
+ export {
28
+ check_default
29
+ };
@@ -0,0 +1,334 @@
1
+ import {
2
+ loader_default
3
+ } from "./chunk-2ZYGRSSA.mjs";
4
+ import {
5
+ wrapper_gradient_default
6
+ } from "./chunk-XWELEL6Z.mjs";
7
+ import {
8
+ input_group_default
9
+ } from "./chunk-7ZLMDYBR.mjs";
10
+ import {
11
+ input_select_default
12
+ } from "./chunk-BD3TDNJE.mjs";
13
+ import {
14
+ buttonStyle,
15
+ inputStyle
16
+ } from "./chunk-FJXG3REN.mjs";
17
+
18
+ // components/product.js
19
+ import { useEffect, useMemo, useState } from "react";
20
+ import useEmblaCarousel from "embla-carousel-react";
21
+ import { cdnShopify } from "@drawbridge/shopify/cdn";
22
+ import { formatCurrency } from "@drawbridge/drawbridge-utils";
23
+ import { jsx, jsxs } from "react/jsx-runtime";
24
+ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ jsx(
25
+ "img",
26
+ {
27
+ ...{
28
+ alt,
29
+ className,
30
+ src
31
+ }
32
+ }
33
+ );
34
+ var Product = ({
35
+ action = null,
36
+ disabled = false,
37
+ errors = {},
38
+ header,
39
+ ImageComponent = DefaultImage,
40
+ onAdd = () => {
41
+ },
42
+ onBuy = () => {
43
+ },
44
+ onVariantChange = () => {
45
+ },
46
+ product,
47
+ style = {},
48
+ variant
49
+ }) => {
50
+ var _a, _b, _c, _d, _e, _f, _g;
51
+ const available = useMemo(
52
+ () => ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale),
53
+ [product]
54
+ );
55
+ const [activeImage, setActiveImage] = useState(0);
56
+ const [emblaRef, emblaApi] = useEmblaCarousel();
57
+ const selectedVariant = available.find((v) => v.id === variant) || null;
58
+ const images = useMemo(
59
+ () => {
60
+ const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
61
+ const result = [];
62
+ const seen = /* @__PURE__ */ new Set();
63
+ if (product == null ? void 0 : product.image) {
64
+ seen.add(product.image);
65
+ result.push({
66
+ src: product.image,
67
+ variant: null
68
+ });
69
+ }
70
+ for (const v of variants) {
71
+ if (v.image && !seen.has(v.image)) {
72
+ seen.add(v.image);
73
+ result.push({
74
+ src: v.image,
75
+ variant: v
76
+ });
77
+ }
78
+ }
79
+ return result;
80
+ },
81
+ [product]
82
+ );
83
+ useEffect(
84
+ () => {
85
+ if (!emblaApi) return;
86
+ const onSelect = () => {
87
+ const idx = emblaApi.selectedScrollSnap();
88
+ setActiveImage(idx);
89
+ const img = images[idx];
90
+ if (img == null ? void 0 : img.variant) onVariantChange(img.variant.id);
91
+ };
92
+ emblaApi.on("select", onSelect);
93
+ return () => emblaApi.off("select", onSelect);
94
+ },
95
+ [emblaApi, images, onVariantChange]
96
+ );
97
+ const handleVariant = (value) => {
98
+ onVariantChange(value);
99
+ const v = available.find((x) => x.id === value);
100
+ if (!(v == null ? void 0 : v.image)) return;
101
+ const idx = images.findIndex((img) => img.src === v.image);
102
+ if (idx >= 0) {
103
+ setActiveImage(idx);
104
+ emblaApi == null ? void 0 : emblaApi.scrollTo(idx);
105
+ }
106
+ ;
107
+ };
108
+ return /* @__PURE__ */ jsxs(
109
+ "div",
110
+ {
111
+ ...{
112
+ className: "space-y-6 pb-12"
113
+ },
114
+ children: [
115
+ header,
116
+ images.length > 0 && /* @__PURE__ */ jsxs(
117
+ "div",
118
+ {
119
+ ...{
120
+ className: "flex items-center h-48 " + (images.length > 1 && "pr-12")
121
+ },
122
+ children: [
123
+ images.length > 1 && /* @__PURE__ */ jsx(
124
+ wrapper_gradient_default,
125
+ {
126
+ ...{
127
+ classNameScroll: "flex flex-col w-12 h-48 space-y-3",
128
+ color: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
129
+ },
130
+ children: images.map(({ src }, key) => /* @__PURE__ */ jsx(
131
+ "button",
132
+ {
133
+ ...{
134
+ className: "relative w-12 h-12 overflow-hidden rounded shrink-0 border border-transparent",
135
+ onClick: () => {
136
+ setActiveImage(key);
137
+ emblaApi == null ? void 0 : emblaApi.scrollTo(key);
138
+ },
139
+ type: "button",
140
+ ...activeImage === key && {
141
+ style: inputStyle(style)
142
+ }
143
+ },
144
+ children: /* @__PURE__ */ jsx(
145
+ ImageComponent,
146
+ {
147
+ ...{
148
+ alt: product.title + " thumbnail " + key,
149
+ className: "object-cover",
150
+ fill: true,
151
+ sizes: "48px",
152
+ src: cdnShopify(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
153
+ unoptimized: true
154
+ }
155
+ }
156
+ )
157
+ },
158
+ "thumbnail-" + key
159
+ ))
160
+ }
161
+ ),
162
+ /* @__PURE__ */ jsx(
163
+ "div",
164
+ {
165
+ ...{
166
+ className: "aspect-square w-48 overflow-hidden rounded-3xl m-auto",
167
+ ref: emblaRef
168
+ },
169
+ children: /* @__PURE__ */ jsx(
170
+ "div",
171
+ {
172
+ ...{
173
+ className: "flex h-full"
174
+ },
175
+ children: images.map(({ src }, key) => /* @__PURE__ */ jsx(
176
+ "div",
177
+ {
178
+ ...{
179
+ className: "min-w-0 flex-[0_0_100%] relative h-full bg-gray-100"
180
+ },
181
+ children: /* @__PURE__ */ jsx(
182
+ ImageComponent,
183
+ {
184
+ ...{
185
+ alt: product.title + " image " + key,
186
+ className: "object-cover",
187
+ fill: true,
188
+ sizes: "192px",
189
+ src: cdnShopify(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
190
+ unoptimized: true
191
+ }
192
+ }
193
+ )
194
+ },
195
+ "image-" + key
196
+ ))
197
+ }
198
+ )
199
+ }
200
+ )
201
+ ]
202
+ }
203
+ ),
204
+ /* @__PURE__ */ jsxs(
205
+ "div",
206
+ {
207
+ ...{
208
+ className: "text-center space-y-2"
209
+ },
210
+ children: [
211
+ (product == null ? void 0 : product.title) && /* @__PURE__ */ jsx(
212
+ "h2",
213
+ {
214
+ ...{
215
+ className: "max-w-80 mx-auto",
216
+ style: {
217
+ fontFamily: ((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.family) || (style == null ? void 0 : style.fontFamily) || "Roboto Flex",
218
+ fontWeight: ((_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.weight) || (style == null ? void 0 : style.fontWeight),
219
+ textTransform: ((_e = style == null ? void 0 : style.heading) == null ? void 0 : _e.transform) || (style == null ? void 0 : style.textTransform)
220
+ }
221
+ },
222
+ children: product == null ? void 0 : product.title
223
+ }
224
+ ),
225
+ !available.length ? /* @__PURE__ */ jsx("p", { children: "Unavailable" }) : (selectedVariant == null ? void 0 : selectedVariant.price) && /* @__PURE__ */ jsx("p", { children: formatCurrency({
226
+ code: selectedVariant.currency,
227
+ display: "parts",
228
+ value: selectedVariant.price
229
+ }) }),
230
+ (product == null ? void 0 : product.description) && /* @__PURE__ */ jsx(
231
+ wrapper_gradient_default,
232
+ {
233
+ ...{
234
+ classNameScroll: "max-h-[4.5em]",
235
+ color: (_g = (_f = style == null ? void 0 : style.background) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
236
+ },
237
+ children: /* @__PURE__ */ jsx("p", { children: product.description })
238
+ }
239
+ )
240
+ ]
241
+ }
242
+ ),
243
+ available.length > 1 && /* @__PURE__ */ jsx(
244
+ input_group_default,
245
+ {
246
+ ...{
247
+ error: errors == null ? void 0 : errors.variant,
248
+ input: /* @__PURE__ */ jsx(
249
+ input_select_default,
250
+ {
251
+ ...{
252
+ disabled,
253
+ onChange: handleVariant,
254
+ options: available.map((v) => ({
255
+ label: v.title,
256
+ value: v.id
257
+ })),
258
+ style,
259
+ value: variant || ""
260
+ }
261
+ }
262
+ ),
263
+ style
264
+ }
265
+ }
266
+ ),
267
+ available.length > 0 && /* @__PURE__ */ jsx(
268
+ input_group_default,
269
+ {
270
+ ...{
271
+ error: errors == null ? void 0 : errors.root,
272
+ input: /* @__PURE__ */ jsxs(
273
+ "div",
274
+ {
275
+ ...{
276
+ className: "grid grid-cols-2 gap-3"
277
+ },
278
+ children: [
279
+ /* @__PURE__ */ jsx(
280
+ "button",
281
+ {
282
+ ...{
283
+ className: "button justify-center border",
284
+ disabled: disabled || Boolean(action),
285
+ onClick: onAdd,
286
+ style: inputStyle(style),
287
+ type: "button"
288
+ },
289
+ children: action === "add" ? /* @__PURE__ */ jsx(
290
+ loader_default,
291
+ {
292
+ ...{
293
+ className: "w-6 h-6 animate-spin"
294
+ }
295
+ }
296
+ ) : "Add to cart"
297
+ }
298
+ ),
299
+ /* @__PURE__ */ jsx(
300
+ "button",
301
+ {
302
+ ...{
303
+ className: "button justify-center",
304
+ disabled: disabled || Boolean(action),
305
+ onClick: onBuy,
306
+ style: buttonStyle(style),
307
+ type: "button"
308
+ },
309
+ children: action === "buy" ? /* @__PURE__ */ jsx(
310
+ loader_default,
311
+ {
312
+ ...{
313
+ className: "w-6 h-6 animate-spin"
314
+ }
315
+ }
316
+ ) : "Buy now"
317
+ }
318
+ )
319
+ ]
320
+ }
321
+ ),
322
+ style
323
+ }
324
+ }
325
+ )
326
+ ]
327
+ }
328
+ );
329
+ };
330
+ var product_default = Product;
331
+
332
+ export {
333
+ product_default
334
+ };