@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,864 @@
1
+ "use client";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // components/product.js
31
+ var product_exports = {};
32
+ __export(product_exports, {
33
+ default: () => product_default
34
+ });
35
+ module.exports = __toCommonJS(product_exports);
36
+ var import_react4 = require("react");
37
+ var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
38
+ var import_cdn = require("@drawbridge/shopify/cdn");
39
+ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
40
+
41
+ // components/input-group.js
42
+ var import_react = require("react");
43
+
44
+ // components/icons/warning.js
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
+ "svg",
48
+ {
49
+ ...{
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: 1.5,
53
+ viewBox: "0 0 24 24",
54
+ ...props
55
+ },
56
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
57
+ "path",
58
+ {
59
+ ...{
60
+ d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z",
61
+ strokeLinecap: "round",
62
+ strokeLinejoin: "round"
63
+ }
64
+ }
65
+ )
66
+ }
67
+ );
68
+ var warning_default = Warning;
69
+
70
+ // components/input-group.js
71
+ var import_jsx_runtime2 = require("react/jsx-runtime");
72
+ var InputGroup = ({
73
+ className,
74
+ error,
75
+ input,
76
+ label,
77
+ message,
78
+ style = {}
79
+ }) => {
80
+ var _a, _b, _c, _d;
81
+ const classes = [
82
+ "input-group"
83
+ ];
84
+ if (className) {
85
+ classes.push(className);
86
+ }
87
+ if (error) {
88
+ classes.push("error");
89
+ }
90
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
91
+ "div",
92
+ {
93
+ ...{
94
+ className: classes.join(" "),
95
+ "aria-live": "polite"
96
+ },
97
+ children: [
98
+ label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
99
+ "div",
100
+ {
101
+ ...{
102
+ className: "space-y-2"
103
+ },
104
+ children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
106
+ "span",
107
+ {
108
+ ...{
109
+ className: "block"
110
+ },
111
+ children: label
112
+ }
113
+ ),
114
+ input
115
+ ]
116
+ }
117
+ ) : input,
118
+ (error || message) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
119
+ "p",
120
+ {
121
+ ...{
122
+ className: "flex items-center justify-start space-x-2 py-1 rounded text-sm " + (error && "px-1.5"),
123
+ ...error && Object.keys(style).length > 0 && {
124
+ style: {
125
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb.replace(")", ",.1)"),
126
+ color: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
127
+ }
128
+ }
129
+ },
130
+ children: [
131
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
132
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
133
+ warning_default,
134
+ {
135
+ ...{
136
+ className: "w-4 h-4",
137
+ "aria-hidden": true
138
+ }
139
+ }
140
+ ),
141
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
142
+ "span",
143
+ {
144
+ ...{
145
+ className: "text-[0px] opacity-0 w-0 h-0 absolute"
146
+ },
147
+ children: [
148
+ label,
149
+ ": ",
150
+ error
151
+ ]
152
+ }
153
+ )
154
+ ] }),
155
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
156
+ "span",
157
+ {
158
+ ...{
159
+ ...error && {
160
+ "aria-hidden": true
161
+ }
162
+ },
163
+ children: error || message
164
+ }
165
+ )
166
+ ]
167
+ }
168
+ )
169
+ ]
170
+ }
171
+ );
172
+ };
173
+ var input_group_default = InputGroup;
174
+
175
+ // components/input-select.js
176
+ var import_react2 = require("react");
177
+
178
+ // components/icons/chevron-down.js
179
+ var import_jsx_runtime3 = require("react/jsx-runtime");
180
+ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
181
+ "svg",
182
+ {
183
+ ...{
184
+ fill: "none",
185
+ stroke: "currentColor",
186
+ strokeWidth: 1.5,
187
+ viewBox: "0 0 24 24",
188
+ ...props
189
+ },
190
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
191
+ "path",
192
+ {
193
+ ...{
194
+ d: "m19.5 8.25-7.5 7.5-7.5-7.5",
195
+ strokeLinecap: "round",
196
+ strokeLinejoin: "round"
197
+ }
198
+ }
199
+ )
200
+ }
201
+ );
202
+ var chevron_down_default = ChevronDown;
203
+
204
+ // components/styles.js
205
+ var buttonStyle = (style) => {
206
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
207
+ return {
208
+ 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),
209
+ 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),
210
+ borderRadius: ((_k = style == null ? void 0 : style.button) == null ? void 0 : _k.radius) != null ? style.button.radius / 4 + "px" : void 0,
211
+ 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)
212
+ };
213
+ };
214
+ var inputStyle = (style) => {
215
+ var _a, _b, _c, _d, _e, _f, _g;
216
+ return {
217
+ backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
218
+ borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
219
+ borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
220
+ color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
221
+ };
222
+ };
223
+
224
+ // components/input-select.js
225
+ var import_jsx_runtime4 = require("react/jsx-runtime");
226
+ var InputSelect = ({
227
+ onChange,
228
+ options = [],
229
+ style,
230
+ value,
231
+ ...rest
232
+ }) => {
233
+ const [keyboard, setKeyboard] = (0, import_react2.useState)(false);
234
+ (0, import_react2.useEffect)(() => {
235
+ const down = (e) => {
236
+ if (e.key === "Tab") setKeyboard(true);
237
+ };
238
+ const click = () => setKeyboard(false);
239
+ window.addEventListener("keydown", down);
240
+ window.addEventListener("mousedown", click);
241
+ return () => {
242
+ window.removeEventListener("keydown", down);
243
+ window.removeEventListener("mousedown", click);
244
+ };
245
+ }, []);
246
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
247
+ "div",
248
+ {
249
+ ...{
250
+ className: "relative"
251
+ },
252
+ children: [
253
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
254
+ "select",
255
+ {
256
+ ...{
257
+ ...rest,
258
+ 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"),
259
+ onChange: ({ target }) => onChange(target == null ? void 0 : target.value),
260
+ style: inputStyle(style),
261
+ value
262
+ },
263
+ children: [
264
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
265
+ "option",
266
+ {
267
+ ...{
268
+ disabled: true,
269
+ "aria-label": "Select option",
270
+ value: ""
271
+ },
272
+ children: "Select"
273
+ }
274
+ ),
275
+ options.map(({ label, option, value: optValue }, key) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
276
+ "option",
277
+ {
278
+ ...{
279
+ value: optValue ?? option
280
+ },
281
+ children: label ?? option
282
+ },
283
+ "input-select-option-" + key
284
+ ))
285
+ ]
286
+ }
287
+ ),
288
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
289
+ "div",
290
+ {
291
+ ...{
292
+ "aria-hidden": true,
293
+ className: "h-full flex items-center absolute inset-y-0 right-0 pointer-events-none px-2.5"
294
+ },
295
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
296
+ chevron_down_default,
297
+ {
298
+ ...{
299
+ className: "w-5 h-5 text-inherit"
300
+ }
301
+ }
302
+ )
303
+ }
304
+ )
305
+ ]
306
+ }
307
+ );
308
+ };
309
+ var input_select_default = InputSelect;
310
+
311
+ // components/wrapper-gradient.js
312
+ var import_react3 = require("react");
313
+ var import_jsx_runtime5 = require("react/jsx-runtime");
314
+ var WrapperGradientContext = (0, import_react3.createContext)(null);
315
+ var WrapperGradient = ({
316
+ children,
317
+ className,
318
+ classNameGradient,
319
+ classNameScroll,
320
+ color,
321
+ gradientTopOffset,
322
+ horizontal = false
323
+ }) => {
324
+ const showX = horizontal === true || horizontal === "both";
325
+ const showY = horizontal === false || horizontal === "both";
326
+ const overflowClass = horizontal === "both" ? "overflow-scroll" : horizontal ? "overflow-x-scroll overflow-y-visible" : "overflow-y-scroll overflow-x-visible";
327
+ const overscrollClass = horizontal === "both" ? "overscroll-none" : horizontal ? "overscroll-x-none overscroll-y-auto" : "overscroll-y-none overscroll-x-auto";
328
+ const themed = Boolean(color);
329
+ const gradientDefaults = "absolute z-[2] " + (themed ? "pointer-events-none " : "") + "transition-all duration-[100ms] ";
330
+ const classes = {
331
+ container: [
332
+ themed ? "relative" : "w-full relative",
333
+ ...className ? [className] : []
334
+ ],
335
+ inner: [
336
+ "w-full relative scroll-smooth hide-scrollbar",
337
+ overscrollClass,
338
+ overflowClass,
339
+ ...classNameScroll ? [classNameScroll] : []
340
+ ],
341
+ topGradient: [
342
+ gradientDefaults,
343
+ "w-full -top-[1px]",
344
+ ...themed ? [] : ["bg-gradient-to-b"],
345
+ ...classNameGradient ? [classNameGradient] : themed ? ["h-10"] : ["from-white to-transparent h-10"]
346
+ ],
347
+ bottomGradient: [
348
+ gradientDefaults,
349
+ "w-full -bottom-[1px]",
350
+ ...themed ? [] : ["bg-gradient-to-t"],
351
+ ...classNameGradient ? [classNameGradient] : themed ? ["h-10"] : ["from-white to-transparent h-10"]
352
+ ],
353
+ leftGradient: [
354
+ gradientDefaults,
355
+ "h-full top-0 left-0",
356
+ ...themed ? [] : ["bg-gradient-to-r"],
357
+ ...classNameGradient ? [classNameGradient] : themed ? ["w-4"] : ["from-white from-30% to-transparent w-4"]
358
+ ],
359
+ rightGradient: [
360
+ gradientDefaults,
361
+ "h-full top-0 right-0",
362
+ ...themed ? [] : ["bg-gradient-to-l"],
363
+ ...classNameGradient ? [classNameGradient] : themed ? ["w-4"] : ["from-white from-30% to-transparent w-4"]
364
+ ]
365
+ };
366
+ const gradients = {
367
+ top: "linear-gradient( to bottom, " + color + " 0%, transparent 100% )",
368
+ bottom: "linear-gradient( to top, " + color + " 0%, transparent 100% )",
369
+ left: "linear-gradient( to right, " + color + " 0%, transparent 100% )",
370
+ right: "linear-gradient( to left, " + color + " 0%, transparent 100% )"
371
+ };
372
+ const containerRef = (0, import_react3.useRef)(null);
373
+ const [scroll, setScroll] = (0, import_react3.useState)({
374
+ top: 0,
375
+ left: 0,
376
+ atBottom: true,
377
+ atRight: true
378
+ });
379
+ (0, import_react3.useEffect)(
380
+ () => {
381
+ const container = containerRef.current;
382
+ const handleScroll = () => {
383
+ const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } = container;
384
+ setScroll({
385
+ top: scrollTop,
386
+ left: scrollLeft,
387
+ atBottom: scrollTop + clientHeight >= scrollHeight - 1,
388
+ atRight: scrollLeft + clientWidth >= scrollWidth - 1
389
+ });
390
+ };
391
+ const handleUpdate = () => {
392
+ const { scrollHeight, scrollWidth, clientHeight, clientWidth } = container;
393
+ if (scrollHeight <= clientHeight && scrollWidth <= clientWidth) {
394
+ setScroll({
395
+ top: 0,
396
+ left: 0,
397
+ atBottom: true,
398
+ atRight: true
399
+ });
400
+ return;
401
+ }
402
+ ;
403
+ handleScroll();
404
+ };
405
+ handleUpdate();
406
+ container.addEventListener("scroll", handleScroll);
407
+ const observer = new MutationObserver((mutations) => {
408
+ for (const mutation of mutations) {
409
+ if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
410
+ handleUpdate();
411
+ break;
412
+ }
413
+ }
414
+ });
415
+ observer.observe(container, {
416
+ childList: true,
417
+ subtree: true
418
+ });
419
+ const resizeObserver = new ResizeObserver(handleUpdate);
420
+ resizeObserver.observe(container);
421
+ return () => {
422
+ container.removeEventListener("scroll", handleScroll);
423
+ observer.disconnect();
424
+ resizeObserver.disconnect();
425
+ };
426
+ },
427
+ [horizontal]
428
+ );
429
+ const contextValue = (0, import_react3.useMemo)(
430
+ () => ({
431
+ atBottom: scroll.atBottom,
432
+ atRight: scroll.atRight
433
+ }),
434
+ [scroll.atBottom, scroll.atRight]
435
+ );
436
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
437
+ "div",
438
+ {
439
+ ...{
440
+ className: classes.container.join(" ")
441
+ },
442
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(WrapperGradientContext.Provider, { value: contextValue, children: [
443
+ showY && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
444
+ "div",
445
+ {
446
+ ...{
447
+ className: classes.topGradient.join(" ") + (scroll.top > 5 ? " opacity-100 visible" : " opacity-0 invisible"),
448
+ style: {
449
+ ...themed && {
450
+ backgroundImage: gradients.top
451
+ },
452
+ ...gradientTopOffset && {
453
+ top: gradientTopOffset
454
+ }
455
+ }
456
+ }
457
+ }
458
+ ),
459
+ showX && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
460
+ "div",
461
+ {
462
+ ...{
463
+ className: classes.leftGradient.join(" ") + (scroll.left > 5 ? " opacity-100 visible" : " opacity-0 invisible"),
464
+ style: {
465
+ ...themed && {
466
+ backgroundImage: gradients.left
467
+ }
468
+ }
469
+ }
470
+ }
471
+ ),
472
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
473
+ "div",
474
+ {
475
+ ...{
476
+ className: classes.inner.join(" "),
477
+ ref: containerRef
478
+ },
479
+ children
480
+ }
481
+ ),
482
+ showY && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
483
+ "div",
484
+ {
485
+ ...{
486
+ className: classes.bottomGradient.join(" ") + (!scroll.atBottom ? " opacity-100 visible" : " opacity-0 invisible"),
487
+ style: {
488
+ ...themed && {
489
+ backgroundImage: gradients.bottom
490
+ }
491
+ }
492
+ }
493
+ }
494
+ ),
495
+ showX && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
496
+ "div",
497
+ {
498
+ ...{
499
+ className: classes.rightGradient.join(" ") + (!scroll.atRight ? " opacity-100 visible" : " opacity-0 invisible"),
500
+ style: {
501
+ ...themed && {
502
+ backgroundImage: gradients.right
503
+ }
504
+ }
505
+ }
506
+ }
507
+ )
508
+ ] })
509
+ }
510
+ );
511
+ };
512
+ var wrapper_gradient_default = WrapperGradient;
513
+
514
+ // components/icons/loader.js
515
+ var import_jsx_runtime6 = require("react/jsx-runtime");
516
+ var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
517
+ "svg",
518
+ {
519
+ ...{
520
+ fill: "none",
521
+ stroke: "none",
522
+ strokeWidth: 0,
523
+ viewBox: "0 0 24 24",
524
+ className: ["animate-spin", className].filter(Boolean).join(" "),
525
+ ...props
526
+ },
527
+ children: [
528
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
529
+ "circle",
530
+ {
531
+ ...{
532
+ className: "opacity-25",
533
+ cx: 12,
534
+ cy: 12,
535
+ r: 10,
536
+ stroke: "currentColor",
537
+ strokeWidth: 4
538
+ }
539
+ }
540
+ ),
541
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
542
+ "path",
543
+ {
544
+ ...{
545
+ className: "opacity-75",
546
+ fill: "currentColor",
547
+ 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"
548
+ }
549
+ }
550
+ )
551
+ ]
552
+ }
553
+ );
554
+ var loader_default = Loader;
555
+
556
+ // components/product.js
557
+ var import_jsx_runtime7 = require("react/jsx-runtime");
558
+ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
559
+ "img",
560
+ {
561
+ ...{
562
+ alt,
563
+ className,
564
+ src
565
+ }
566
+ }
567
+ );
568
+ var Product = ({
569
+ action = null,
570
+ disabled = false,
571
+ errors = {},
572
+ header,
573
+ ImageComponent = DefaultImage,
574
+ onAdd = () => {
575
+ },
576
+ onBuy = () => {
577
+ },
578
+ onVariantChange = () => {
579
+ },
580
+ product,
581
+ style = {},
582
+ variant
583
+ }) => {
584
+ var _a, _b, _c, _d, _e, _f, _g;
585
+ const available = (0, import_react4.useMemo)(
586
+ () => ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale),
587
+ [product]
588
+ );
589
+ const [activeImage, setActiveImage] = (0, import_react4.useState)(0);
590
+ const [emblaRef, emblaApi] = (0, import_embla_carousel_react.default)();
591
+ const selectedVariant = available.find((v) => v.id === variant) || null;
592
+ const images = (0, import_react4.useMemo)(
593
+ () => {
594
+ const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
595
+ const result = [];
596
+ const seen = /* @__PURE__ */ new Set();
597
+ if (product == null ? void 0 : product.image) {
598
+ seen.add(product.image);
599
+ result.push({
600
+ src: product.image,
601
+ variant: null
602
+ });
603
+ }
604
+ for (const v of variants) {
605
+ if (v.image && !seen.has(v.image)) {
606
+ seen.add(v.image);
607
+ result.push({
608
+ src: v.image,
609
+ variant: v
610
+ });
611
+ }
612
+ }
613
+ return result;
614
+ },
615
+ [product]
616
+ );
617
+ (0, import_react4.useEffect)(
618
+ () => {
619
+ if (!emblaApi) return;
620
+ const onSelect = () => {
621
+ const idx = emblaApi.selectedScrollSnap();
622
+ setActiveImage(idx);
623
+ const img = images[idx];
624
+ if (img == null ? void 0 : img.variant) onVariantChange(img.variant.id);
625
+ };
626
+ emblaApi.on("select", onSelect);
627
+ return () => emblaApi.off("select", onSelect);
628
+ },
629
+ [emblaApi, images, onVariantChange]
630
+ );
631
+ const handleVariant = (value) => {
632
+ onVariantChange(value);
633
+ const v = available.find((x) => x.id === value);
634
+ if (!(v == null ? void 0 : v.image)) return;
635
+ const idx = images.findIndex((img) => img.src === v.image);
636
+ if (idx >= 0) {
637
+ setActiveImage(idx);
638
+ emblaApi == null ? void 0 : emblaApi.scrollTo(idx);
639
+ }
640
+ ;
641
+ };
642
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
643
+ "div",
644
+ {
645
+ ...{
646
+ className: "space-y-6 pb-12"
647
+ },
648
+ children: [
649
+ header,
650
+ images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
651
+ "div",
652
+ {
653
+ ...{
654
+ className: "flex items-center h-48 " + (images.length > 1 && "pr-12")
655
+ },
656
+ children: [
657
+ images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
658
+ wrapper_gradient_default,
659
+ {
660
+ ...{
661
+ classNameScroll: "flex flex-col w-12 h-48 space-y-3",
662
+ color: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
663
+ },
664
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
665
+ "button",
666
+ {
667
+ ...{
668
+ className: "relative w-12 h-12 overflow-hidden rounded shrink-0 border border-transparent",
669
+ onClick: () => {
670
+ setActiveImage(key);
671
+ emblaApi == null ? void 0 : emblaApi.scrollTo(key);
672
+ },
673
+ type: "button",
674
+ ...activeImage === key && {
675
+ style: inputStyle(style)
676
+ }
677
+ },
678
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
679
+ ImageComponent,
680
+ {
681
+ ...{
682
+ alt: product.title + " thumbnail " + key,
683
+ className: "object-cover",
684
+ fill: true,
685
+ sizes: "48px",
686
+ src: (0, import_cdn.cdnShopify)(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
687
+ unoptimized: true
688
+ }
689
+ }
690
+ )
691
+ },
692
+ "thumbnail-" + key
693
+ ))
694
+ }
695
+ ),
696
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
697
+ "div",
698
+ {
699
+ ...{
700
+ className: "aspect-square w-48 overflow-hidden rounded-3xl m-auto",
701
+ ref: emblaRef
702
+ },
703
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
704
+ "div",
705
+ {
706
+ ...{
707
+ className: "flex h-full"
708
+ },
709
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
710
+ "div",
711
+ {
712
+ ...{
713
+ className: "min-w-0 flex-[0_0_100%] relative h-full bg-gray-100"
714
+ },
715
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
716
+ ImageComponent,
717
+ {
718
+ ...{
719
+ alt: product.title + " image " + key,
720
+ className: "object-cover",
721
+ fill: true,
722
+ sizes: "192px",
723
+ src: (0, import_cdn.cdnShopify)(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
724
+ unoptimized: true
725
+ }
726
+ }
727
+ )
728
+ },
729
+ "image-" + key
730
+ ))
731
+ }
732
+ )
733
+ }
734
+ )
735
+ ]
736
+ }
737
+ ),
738
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
739
+ "div",
740
+ {
741
+ ...{
742
+ className: "text-center space-y-2"
743
+ },
744
+ children: [
745
+ (product == null ? void 0 : product.title) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
746
+ "h2",
747
+ {
748
+ ...{
749
+ className: "max-w-80 mx-auto",
750
+ style: {
751
+ fontFamily: ((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.family) || (style == null ? void 0 : style.fontFamily) || "Roboto Flex",
752
+ fontWeight: ((_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.weight) || (style == null ? void 0 : style.fontWeight),
753
+ textTransform: ((_e = style == null ? void 0 : style.heading) == null ? void 0 : _e.transform) || (style == null ? void 0 : style.textTransform)
754
+ }
755
+ },
756
+ children: product == null ? void 0 : product.title
757
+ }
758
+ ),
759
+ !available.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "Unavailable" }) : (selectedVariant == null ? void 0 : selectedVariant.price) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: (0, import_drawbridge_utils.formatCurrency)({
760
+ code: selectedVariant.currency,
761
+ display: "parts",
762
+ value: selectedVariant.price
763
+ }) }),
764
+ (product == null ? void 0 : product.description) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
765
+ wrapper_gradient_default,
766
+ {
767
+ ...{
768
+ classNameScroll: "max-h-[4.5em]",
769
+ color: (_g = (_f = style == null ? void 0 : style.background) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
770
+ },
771
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: product.description })
772
+ }
773
+ )
774
+ ]
775
+ }
776
+ ),
777
+ available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
778
+ input_group_default,
779
+ {
780
+ ...{
781
+ error: errors == null ? void 0 : errors.variant,
782
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
783
+ input_select_default,
784
+ {
785
+ ...{
786
+ disabled,
787
+ onChange: handleVariant,
788
+ options: available.map((v) => ({
789
+ label: v.title,
790
+ value: v.id
791
+ })),
792
+ style,
793
+ value: variant || ""
794
+ }
795
+ }
796
+ ),
797
+ style
798
+ }
799
+ }
800
+ ),
801
+ available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
802
+ input_group_default,
803
+ {
804
+ ...{
805
+ error: errors == null ? void 0 : errors.root,
806
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
807
+ "div",
808
+ {
809
+ ...{
810
+ className: "grid grid-cols-2 gap-3"
811
+ },
812
+ children: [
813
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
814
+ "button",
815
+ {
816
+ ...{
817
+ className: "button justify-center border",
818
+ disabled: disabled || Boolean(action),
819
+ onClick: onAdd,
820
+ style: inputStyle(style),
821
+ type: "button"
822
+ },
823
+ children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
824
+ loader_default,
825
+ {
826
+ ...{
827
+ className: "w-6 h-6 animate-spin"
828
+ }
829
+ }
830
+ ) : "Add to cart"
831
+ }
832
+ ),
833
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
834
+ "button",
835
+ {
836
+ ...{
837
+ className: "button justify-center",
838
+ disabled: disabled || Boolean(action),
839
+ onClick: onBuy,
840
+ style: buttonStyle(style),
841
+ type: "button"
842
+ },
843
+ children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
844
+ loader_default,
845
+ {
846
+ ...{
847
+ className: "w-6 h-6 animate-spin"
848
+ }
849
+ }
850
+ ) : "Buy now"
851
+ }
852
+ )
853
+ ]
854
+ }
855
+ ),
856
+ style
857
+ }
858
+ }
859
+ )
860
+ ]
861
+ }
862
+ );
863
+ };
864
+ var product_default = Product;