@drawbridge/components 0.1.33 → 0.1.35

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 (328) hide show
  1. package/components/styles.css +68 -355
  2. package/dist/advertisement.js +15 -20
  3. package/dist/advertisement.mjs +15 -20
  4. package/dist/bridge/advertisements.js +4 -2
  5. package/dist/bridge/advertisements.mjs +5 -3
  6. package/dist/bridge/fields.js +89 -6
  7. package/dist/bridge/fields.mjs +89 -7
  8. package/dist/bridge/form-subdomain-agreement.js +165 -0
  9. package/dist/bridge/form-subdomain-agreement.mjs +132 -0
  10. package/dist/bridge/form-subdomain-embed.js +5 -1
  11. package/dist/bridge/form-subdomain-embed.mjs +5 -1
  12. package/dist/bridge/form-subdomain-header.js +21 -14
  13. package/dist/bridge/form-subdomain-header.mjs +20 -14
  14. package/dist/bridge/form-subdomain-issue.js +17 -8
  15. package/dist/bridge/form-subdomain-issue.mjs +17 -8
  16. package/dist/bridge/form-subdomain-missions.js +58 -52
  17. package/dist/bridge/form-subdomain-missions.mjs +60 -54
  18. package/dist/bridge/form-subdomain.js +223 -94
  19. package/dist/bridge/form-subdomain.mjs +222 -96
  20. package/dist/bridge/lib/entry.js +61 -6
  21. package/dist/bridge/lib/entry.mjs +51 -5
  22. package/dist/bridge/lib/order.js +23 -0
  23. package/dist/bridge/lib/order.mjs +20 -0
  24. package/dist/bridge/template-layout.js +5 -2
  25. package/dist/bridge/template-layout.mjs +6 -3
  26. package/dist/bridge/template-modal.js +82 -15
  27. package/dist/bridge/template-modal.mjs +83 -16
  28. package/dist/bridge/template-subdomain-gallery.js +126 -75
  29. package/dist/bridge/template-subdomain-gallery.mjs +122 -75
  30. package/dist/bridge/template-subdomain.js +16 -14
  31. package/dist/bridge/template-subdomain.mjs +17 -15
  32. package/dist/dashboard/avatar.js +5 -0
  33. package/dist/dashboard/avatar.mjs +5 -0
  34. package/dist/dashboard/campaign-form.js +1798 -0
  35. package/dist/dashboard/campaign-form.mjs +1769 -0
  36. package/dist/dashboard/card-affiliate.js +3 -2
  37. package/dist/dashboard/card-affiliate.mjs +3 -2
  38. package/dist/dashboard/card-campaign-agreement.js +172 -0
  39. package/dist/dashboard/card-campaign-agreement.mjs +139 -0
  40. package/dist/dashboard/card-campaign-switch.js +34 -9
  41. package/dist/dashboard/card-campaign-switch.mjs +32 -8
  42. package/dist/dashboard/card-order.js +6 -14
  43. package/dist/dashboard/card-order.mjs +6 -14
  44. package/dist/dashboard/card-section.js +69 -26
  45. package/dist/dashboard/card-section.mjs +65 -26
  46. package/dist/dashboard/card-shortcut.js +181 -0
  47. package/dist/dashboard/card-shortcut.mjs +152 -0
  48. package/dist/dashboard/card-tile.js +3 -35
  49. package/dist/dashboard/card-tile.mjs +3 -34
  50. package/dist/dashboard/document-blocks.js +305 -0
  51. package/dist/dashboard/document-blocks.mjs +270 -0
  52. package/dist/dashboard/drawer-subscription.js +52 -14
  53. package/dist/dashboard/drawer-subscription.mjs +52 -14
  54. package/dist/dashboard/drawer.js +20 -3
  55. package/dist/dashboard/drawer.mjs +21 -4
  56. package/dist/dashboard/dropdown.js +6 -2
  57. package/dist/dashboard/dropdown.mjs +6 -2
  58. package/dist/dashboard/form-admin-subscription-custom.js +72 -8
  59. package/dist/dashboard/form-admin-subscription-custom.mjs +72 -8
  60. package/dist/dashboard/form-ai.js +0 -148
  61. package/dist/dashboard/form-ai.mjs +1 -148
  62. package/dist/dashboard/form-filters-analytics.js +88 -37
  63. package/dist/dashboard/form-filters-analytics.mjs +85 -38
  64. package/dist/dashboard/form-organization-brand.js +30 -13
  65. package/dist/dashboard/form-organization-brand.mjs +30 -13
  66. package/dist/dashboard/form-organization-campaign-advertisement.js +38 -112
  67. package/dist/dashboard/form-organization-campaign-advertisement.mjs +38 -112
  68. package/dist/dashboard/form-organization-campaign-advertisements.js +374 -0
  69. package/dist/dashboard/form-organization-campaign-advertisements.mjs +345 -0
  70. package/dist/dashboard/form-organization-campaign-agreement.js +414 -210
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +411 -212
  72. package/dist/dashboard/form-organization-campaign-design.js +258 -0
  73. package/dist/dashboard/form-organization-campaign-design.mjs +223 -0
  74. package/dist/dashboard/form-organization-campaign-field-item.js +585 -0
  75. package/dist/dashboard/form-organization-campaign-field-item.mjs +552 -0
  76. package/dist/dashboard/form-organization-campaign-field-number.js +48 -7
  77. package/dist/dashboard/form-organization-campaign-field-number.mjs +48 -7
  78. package/dist/dashboard/form-organization-campaign-field-select.js +15 -4
  79. package/dist/dashboard/form-organization-campaign-field-select.mjs +15 -4
  80. package/dist/dashboard/form-organization-campaign-field-skill.js +359 -0
  81. package/dist/dashboard/form-organization-campaign-field-skill.mjs +330 -0
  82. package/dist/dashboard/form-organization-campaign-field-text.js +46 -6
  83. package/dist/dashboard/form-organization-campaign-field-text.mjs +46 -6
  84. package/dist/dashboard/form-organization-campaign-field-textarea.js +22 -13
  85. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +22 -13
  86. package/dist/dashboard/form-organization-campaign-footer.js +178 -0
  87. package/dist/dashboard/form-organization-campaign-footer.mjs +149 -0
  88. package/dist/dashboard/form-organization-campaign-integration-age.js +2 -35
  89. package/dist/dashboard/form-organization-campaign-integration-age.mjs +2 -35
  90. package/dist/dashboard/form-organization-campaign-integration-geocode.js +4 -1
  91. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +4 -1
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
  94. package/dist/dashboard/form-organization-campaign-page-preview.js +1 -2
  95. package/dist/dashboard/form-organization-campaign-page-preview.mjs +1 -2
  96. package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
  97. package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
  98. package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
  99. package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
  100. package/dist/dashboard/form-organization-campaign-page-slug.js +2 -3
  101. package/dist/dashboard/form-organization-campaign-page-slug.mjs +2 -3
  102. package/dist/dashboard/form-organization-campaign-page.js +168 -265
  103. package/dist/dashboard/form-organization-campaign-page.mjs +170 -266
  104. package/dist/dashboard/form-organization-campaign-section.js +125 -107
  105. package/dist/dashboard/form-organization-campaign-section.mjs +121 -107
  106. package/dist/dashboard/form-organization-campaign.js +119 -9
  107. package/dist/dashboard/form-organization-campaign.mjs +118 -9
  108. package/dist/dashboard/form-organization-file-frame.js +7 -1
  109. package/dist/dashboard/form-organization-file-frame.mjs +7 -1
  110. package/dist/dashboard/form-organization-workflow.js +589 -532
  111. package/dist/dashboard/form-organization-workflow.mjs +590 -533
  112. package/dist/dashboard/form-organization.js +22 -0
  113. package/dist/dashboard/form-organization.mjs +22 -0
  114. package/dist/dashboard/form-reposition.js +396 -0
  115. package/dist/dashboard/form-reposition.mjs +359 -0
  116. package/dist/dashboard/form-support.js +189 -0
  117. package/dist/dashboard/form-support.mjs +160 -0
  118. package/dist/dashboard/form-tests.js +683 -0
  119. package/dist/dashboard/form-tests.mjs +646 -0
  120. package/dist/dashboard/form-verify-prize.js +114 -34
  121. package/dist/dashboard/form-verify-prize.mjs +111 -34
  122. package/dist/dashboard/google.js +8 -1
  123. package/dist/dashboard/google.mjs +8 -1
  124. package/dist/dashboard/input-array.js +2 -0
  125. package/dist/dashboard/input-array.mjs +2 -0
  126. package/dist/dashboard/input-editor.js +17 -6
  127. package/dist/dashboard/input-editor.mjs +17 -6
  128. package/dist/dashboard/input-fields.js +287 -437
  129. package/dist/dashboard/input-fields.mjs +287 -436
  130. package/dist/dashboard/input-file.js +70 -2
  131. package/dist/dashboard/input-file.mjs +70 -2
  132. package/dist/dashboard/input-font.js +64 -55
  133. package/dist/dashboard/input-font.mjs +64 -55
  134. package/dist/dashboard/input-resource.js +4 -1
  135. package/dist/dashboard/input-resource.mjs +4 -1
  136. package/dist/dashboard/lib/ab-tests.js +130 -0
  137. package/dist/dashboard/lib/ab-tests.mjs +94 -0
  138. package/dist/dashboard/lib/features.js +1 -1
  139. package/dist/dashboard/lib/features.mjs +1 -1
  140. package/dist/dashboard/lib/focus.js +93 -0
  141. package/dist/dashboard/lib/focus.mjs +69 -0
  142. package/dist/dashboard/lib/form-page.js +203 -0
  143. package/dist/dashboard/lib/form-page.mjs +155 -0
  144. package/dist/dashboard/lib/item-list.js +0 -15
  145. package/dist/dashboard/lib/item-list.mjs +0 -14
  146. package/dist/dashboard/lib/rail.js +16 -17
  147. package/dist/dashboard/lib/rail.mjs +15 -16
  148. package/dist/dashboard/lib/sms.js +8 -2
  149. package/dist/dashboard/lib/sms.mjs +6 -1
  150. package/dist/dashboard/list-resource.js +2 -0
  151. package/dist/dashboard/list-resource.mjs +2 -0
  152. package/dist/dashboard/menu.js +54 -5
  153. package/dist/dashboard/menu.mjs +53 -5
  154. package/dist/dashboard/modal.js +19 -4
  155. package/dist/dashboard/modal.mjs +20 -5
  156. package/dist/dashboard/order-sections.js +4 -0
  157. package/dist/dashboard/order-sections.mjs +4 -0
  158. package/dist/dashboard/preview.js +838 -324
  159. package/dist/dashboard/preview.mjs +826 -324
  160. package/dist/dashboard/provider-ui.js +20 -12
  161. package/dist/dashboard/provider-ui.mjs +21 -13
  162. package/dist/dashboard/recharts.js +53 -28
  163. package/dist/dashboard/recharts.mjs +53 -28
  164. package/dist/dashboard/swatch.js +35 -0
  165. package/dist/dashboard/swatch.mjs +31 -0
  166. package/dist/dashboard/table-contacts.js +6 -10
  167. package/dist/dashboard/table-contacts.mjs +6 -10
  168. package/dist/dashboard/table.js +10 -3
  169. package/dist/dashboard/table.mjs +9 -3
  170. package/dist/dashboard/template-dashboard.js +12 -7
  171. package/dist/dashboard/template-dashboard.mjs +11 -7
  172. package/dist/dashboard/template-design.js +564 -0
  173. package/dist/dashboard/template-design.mjs +531 -0
  174. package/dist/dashboard/template-rail.js +198 -126
  175. package/dist/dashboard/template-rail.mjs +196 -125
  176. package/dist/dashboard/template-socket.js +0 -3
  177. package/dist/dashboard/template-socket.mjs +0 -3
  178. package/dist/dashboard/template-test-page.js +436 -0
  179. package/dist/dashboard/template-test-page.mjs +407 -0
  180. package/dist/dashboard/template-tests.js +141 -0
  181. package/dist/dashboard/template-tests.mjs +112 -0
  182. package/dist/dashboard/template-ui.js +20 -11
  183. package/dist/dashboard/template-ui.mjs +22 -13
  184. package/dist/dashboard/template-variant.js +185 -0
  185. package/dist/dashboard/template-variant.mjs +156 -0
  186. package/dist/icons/arrow-down-long.js +47 -0
  187. package/dist/icons/arrow-down-long.mjs +28 -0
  188. package/dist/icons/arrows-pointing-out.js +46 -0
  189. package/dist/icons/arrows-pointing-out.mjs +27 -0
  190. package/dist/icons/beaker.js +46 -0
  191. package/dist/icons/beaker.mjs +27 -0
  192. package/dist/icons/identification.js +46 -0
  193. package/dist/icons/identification.mjs +27 -0
  194. package/dist/icons/lifebuoy.js +46 -0
  195. package/dist/icons/lifebuoy.mjs +27 -0
  196. package/dist/icons/rectangle-group.js +46 -0
  197. package/dist/icons/rectangle-group.mjs +27 -0
  198. package/dist/icons/rectangle-stack.js +46 -0
  199. package/dist/icons/rectangle-stack.mjs +27 -0
  200. package/dist/icons/shopping-bag.js +46 -0
  201. package/dist/icons/shopping-bag.mjs +27 -0
  202. package/dist/icons/swatch.js +46 -0
  203. package/dist/icons/swatch.mjs +27 -0
  204. package/dist/icons/window.js +46 -0
  205. package/dist/icons/window.mjs +27 -0
  206. package/dist/icons/zoom-in.js +46 -0
  207. package/dist/icons/zoom-in.mjs +27 -0
  208. package/dist/input-answer.js +60 -0
  209. package/dist/input-answer.mjs +27 -0
  210. package/dist/input-checkbox.js +7 -1
  211. package/dist/input-checkbox.mjs +7 -1
  212. package/dist/input-name.js +3 -3
  213. package/dist/input-name.mjs +3 -3
  214. package/dist/input-select.js +3 -1
  215. package/dist/input-select.mjs +3 -1
  216. package/dist/provider-font.js +4 -3
  217. package/dist/provider-font.mjs +4 -3
  218. package/dist/shared/badge.js +15 -0
  219. package/dist/shared/badge.mjs +11 -0
  220. package/dist/shared/carousel.js +11 -7
  221. package/dist/shared/carousel.mjs +11 -7
  222. package/dist/shared/document-pieces.js +295 -0
  223. package/dist/shared/document-pieces.mjs +260 -0
  224. package/dist/shared/lib/campaign.js +3 -9
  225. package/dist/shared/lib/campaign.mjs +3 -9
  226. package/dist/shared/lib/helpers.js +24 -0
  227. package/dist/shared/lib/helpers.mjs +22 -0
  228. package/dist/shared/lib/video.js +6 -0
  229. package/dist/shared/lib/video.mjs +5 -0
  230. package/dist/shared/sortable.js +27 -10
  231. package/dist/shared/sortable.mjs +27 -10
  232. package/dist/shared/tabs.js +1 -1
  233. package/dist/shared/tabs.mjs +1 -1
  234. package/dist/video.js +127 -9
  235. package/dist/video.mjs +125 -11
  236. package/package.json +176 -20
  237. package/types/bridge/fields.d.ts +6 -1
  238. package/types/bridge/form-subdomain-agreement.d.ts +27 -0
  239. package/types/bridge/form-subdomain-missions.d.ts +2 -0
  240. package/types/bridge/form-subdomain.d.ts +62 -3
  241. package/types/bridge/lib/entry.d.ts +44 -7
  242. package/types/bridge/lib/order.d.ts +13 -2
  243. package/types/bridge/subdomain-content.d.ts +1 -0
  244. package/types/bridge/template-subdomain-gallery.d.ts +13 -1
  245. package/types/dashboard/campaign-form.d.ts +42 -0
  246. package/types/dashboard/card-campaign-agreement.d.ts +26 -0
  247. package/types/dashboard/card-campaign-switch.d.ts +20 -1
  248. package/types/dashboard/card-order.d.ts +2 -2
  249. package/types/dashboard/card-section.d.ts +9 -1
  250. package/types/dashboard/card-shortcut.d.ts +38 -0
  251. package/types/dashboard/card-tile.d.ts +4 -9
  252. package/types/dashboard/document-blocks.d.ts +14 -0
  253. package/types/dashboard/drawer.d.ts +3 -0
  254. package/types/dashboard/form-ai.d.ts +0 -17
  255. package/types/dashboard/form-organization-brand.d.ts +3 -0
  256. package/types/dashboard/form-organization-campaign-advertisements.d.ts +15 -0
  257. package/types/dashboard/form-organization-campaign-agreement.d.ts +53 -10
  258. package/types/dashboard/form-organization-campaign-design.d.ts +46 -0
  259. package/types/dashboard/form-organization-campaign-field-item.d.ts +36 -0
  260. package/types/dashboard/form-organization-campaign-field-number.d.ts +4 -1
  261. package/types/dashboard/form-organization-campaign-field-select.d.ts +6 -1
  262. package/types/dashboard/form-organization-campaign-field-skill.d.ts +36 -0
  263. package/types/dashboard/form-organization-campaign-field-text.d.ts +5 -1
  264. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +4 -1
  265. package/types/dashboard/form-organization-campaign-footer.d.ts +23 -0
  266. package/types/dashboard/form-organization-campaign-integration-age.d.ts +2 -1
  267. package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +2 -0
  268. package/types/dashboard/form-organization-campaign-page.d.ts +9 -15
  269. package/types/dashboard/form-organization-campaign-section.d.ts +24 -8
  270. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  271. package/types/dashboard/form-organization-workflow.d.ts +3 -0
  272. package/types/dashboard/form-organization.d.ts +2 -2
  273. package/types/dashboard/form-reposition.d.ts +29 -0
  274. package/types/dashboard/form-support.d.ts +14 -0
  275. package/types/dashboard/form-tests.d.ts +78 -0
  276. package/types/dashboard/form-verify-prize.d.ts +30 -3
  277. package/types/dashboard/input-editor.d.ts +9 -0
  278. package/types/dashboard/input-fields.d.ts +8 -5
  279. package/types/dashboard/input-file.d.ts +4 -0
  280. package/types/dashboard/input-resource.d.ts +1 -0
  281. package/types/dashboard/lib/ab-tests.d.ts +50 -0
  282. package/types/dashboard/lib/escape.d.ts +4 -0
  283. package/types/dashboard/lib/focus.d.ts +16 -0
  284. package/types/dashboard/lib/form-page.d.ts +25 -0
  285. package/types/dashboard/lib/item-list.d.ts +10 -5
  286. package/types/dashboard/lib/rail.d.ts +0 -1
  287. package/types/dashboard/lib/sms.d.ts +7 -0
  288. package/types/dashboard/modal.d.ts +3 -1
  289. package/types/dashboard/preview.d.ts +65 -10
  290. package/types/dashboard/recharts.d.ts +3 -0
  291. package/types/dashboard/swatch.d.ts +4 -0
  292. package/types/dashboard/template-dashboard.d.ts +3 -0
  293. package/types/dashboard/template-design.d.ts +30 -0
  294. package/types/dashboard/template-test-page.d.ts +69 -0
  295. package/types/dashboard/template-tests.d.ts +30 -0
  296. package/types/dashboard/template-variant.d.ts +18 -0
  297. package/types/icons/arrow-down-long.d.ts +5 -0
  298. package/types/icons/arrows-pointing-out.d.ts +5 -0
  299. package/types/icons/beaker.d.ts +5 -0
  300. package/types/icons/identification.d.ts +5 -0
  301. package/types/icons/lifebuoy.d.ts +5 -0
  302. package/types/icons/rectangle-group.d.ts +5 -0
  303. package/types/icons/rectangle-stack.d.ts +5 -0
  304. package/types/icons/shopping-bag.d.ts +5 -0
  305. package/types/icons/swatch.d.ts +5 -0
  306. package/types/icons/window.d.ts +5 -0
  307. package/types/icons/zoom-in.d.ts +5 -0
  308. package/types/input-answer.d.ts +15 -0
  309. package/types/input-select.d.ts +2 -0
  310. package/types/shared/button.d.ts +1 -1
  311. package/types/shared/document-pieces.d.ts +34 -0
  312. package/types/shared/lib/helpers.d.ts +22 -1
  313. package/types/shared/lib/motion.d.ts +2 -0
  314. package/types/shared/lib/video.d.ts +3 -0
  315. package/types/shared/sortable.d.ts +6 -0
  316. package/types/video.d.ts +18 -2
  317. package/dist/bridge/template-preview.js +0 -208
  318. package/dist/bridge/template-preview.mjs +0 -173
  319. package/dist/dashboard/device.js +0 -95
  320. package/dist/dashboard/device.mjs +0 -72
  321. package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
  322. package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
  323. package/dist/dashboard/item-row.js +0 -92
  324. package/dist/dashboard/item-row.mjs +0 -63
  325. package/types/bridge/template-preview.d.ts +0 -10
  326. package/types/dashboard/device.d.ts +0 -12
  327. package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
  328. package/types/dashboard/item-row.d.ts +0 -25
@@ -10,6 +10,15 @@ const advertisementPreview = (values, options) => {
10
10
  };
11
11
  };
12
12
  const imageAlt = (file, description) => typeof description === "string" && description.trim() || (file == null ? void 0 : file.filename) || "";
13
+ const galleryItems = (gallery, described) => (gallery || []).filter(Boolean).map((item) => item.file && typeof item.file === "object" ? item : {
14
+ description: described == null ? void 0 : described[item.id],
15
+ file: item
16
+ });
17
+ const galleryValue = ({ description, file, position }) => ({
18
+ file: file == null ? void 0 : file.id,
19
+ ...typeof description === "string" && description.trim() && { description },
20
+ ...position && { position }
21
+ });
13
22
  const bust = (href, version) => href ? href + (href.includes("?") ? "&" : "?") + "query=" + encodeURIComponent(version) : null;
14
23
  const clickSummary = (click) => {
15
24
  const parts = Object.entries(click || {}).map(([key, value]) => key + ": " + value);
@@ -281,6 +290,17 @@ const statuses = {
281
290
  range: {
282
291
  active: { text: "Active", type: "success" }
283
292
  },
293
+ // @story ab-tests/list
294
+ // A test's status, which the api derives from its dates and its pause: Running
295
+ // green, Scheduled yellow, the rest gray. A deleted test is kept, and reads Deleted.
296
+ test: {
297
+ deleted: { text: "Deleted", type: "secondary" },
298
+ drafted: { text: "Drafted", type: "secondary" },
299
+ ended: { text: "Ended", type: "secondary" },
300
+ paused: { text: "Paused", type: "secondary" },
301
+ running: { text: "Running", type: "success" },
302
+ scheduled: { text: "Scheduled", type: "warning" }
303
+ },
284
304
  subscription: {
285
305
  active: { text: "Active", type: "success" },
286
306
  canceled: { text: "Canceled", type: "error" },
@@ -355,6 +375,8 @@ export {
355
375
  formatDateTime,
356
376
  formatLast4,
357
377
  formatUserName,
378
+ galleryItems,
379
+ galleryValue,
358
380
  grid,
359
381
  hasCapability,
360
382
  hasConnection,
@@ -19,6 +19,7 @@ var video_exports = {};
19
19
  __export(video_exports, {
20
20
  provideHls: () => provideHls,
21
21
  startSeek: () => startSeek,
22
+ videoClock: () => videoClock,
22
23
  videoErrorAction: () => videoErrorAction,
23
24
  videoOverlay: () => videoOverlay
24
25
  });
@@ -54,10 +55,15 @@ const startSeek = ({
54
55
  if (reset) return 0;
55
56
  return wasReset ? SHOWN_START : null;
56
57
  };
58
+ const videoClock = (seconds) => {
59
+ const value = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
60
+ return Math.floor(value / 60) + ":" + String(value % 60).padStart(2, "0");
61
+ };
57
62
  // Annotate the CommonJS export names for ESM import in node:
58
63
  0 && (module.exports = {
59
64
  provideHls,
60
65
  startSeek,
66
+ videoClock,
61
67
  videoErrorAction,
62
68
  videoOverlay
63
69
  });
@@ -29,9 +29,14 @@ const startSeek = ({
29
29
  if (reset) return 0;
30
30
  return wasReset ? SHOWN_START : null;
31
31
  };
32
+ const videoClock = (seconds) => {
33
+ const value = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
34
+ return Math.floor(value / 60) + ":" + String(value % 60).padStart(2, "0");
35
+ };
32
36
  export {
33
37
  provideHls,
34
38
  startSeek,
39
+ videoClock,
35
40
  videoErrorAction,
36
41
  videoOverlay
37
42
  };
@@ -118,9 +118,15 @@ const SortableItem = ({
118
118
  }
119
119
  );
120
120
  };
121
+ const toId = (index) => index + 1;
122
+ const toIndex = (id) => id - 1;
121
123
  const Sortable = ({
122
124
  classNameSortableItem,
123
125
  disabled = false,
126
+ handleClassName = "flex items-center justify-center shrink-0 w-4 h-6 rounded cursor-move touch-none",
127
+ handleLabel,
128
+ onDragging = () => {
129
+ },
124
130
  onSort = () => {
125
131
  },
126
132
  renderItem,
@@ -140,12 +146,15 @@ const Sortable = ({
140
146
  }
141
147
  )
142
148
  );
143
- const makeHandle = (props) => showHandle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
+ const makeHandle = (props, item) => showHandle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
150
  "div",
145
151
  {
146
152
  ...{
147
153
  ...props,
148
- className: "flex items-center justify-center shrink-0 w-6 h-6 rounded cursor-move touch-none"
154
+ ...handleLabel && item && {
155
+ "aria-label": handleLabel(item)
156
+ },
157
+ className: handleClassName
149
158
  },
150
159
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
151
160
  import_drag.default,
@@ -166,14 +175,22 @@ const Sortable = ({
166
175
  } : void 0,
167
176
  collisionDetection: import_core.closestCenter,
168
177
  onDragStart: ({ active }) => {
169
- setActiveId(active.id);
178
+ setActiveId(toIndex(active.id));
179
+ onDragging(true);
180
+ },
181
+ onDragCancel: () => {
182
+ setActiveId(null);
183
+ onDragging(false);
170
184
  },
171
185
  onDragEnd: ({ active, over }) => {
172
186
  if (over && active.id !== over.id) {
173
- const sorted = (0, import_sortable.arrayMove)(items, active.id, over.id);
174
- onSort(sorted, { from: active.id, to: over.id });
187
+ const from = toIndex(active.id);
188
+ const to = toIndex(over.id);
189
+ const sorted = (0, import_sortable.arrayMove)(items, from, to);
190
+ onSort(sorted, { from, to });
175
191
  }
176
192
  setActiveId(null);
193
+ onDragging(false);
177
194
  },
178
195
  sensors
179
196
  },
@@ -181,7 +198,7 @@ const Sortable = ({
181
198
  import_sortable.SortableContext,
182
199
  {
183
200
  ...{
184
- items: items.map((_, i) => i),
201
+ items: items.map((_, i) => toId(i)),
185
202
  strategy: import_sortable.verticalListSortingStrategy
186
203
  },
187
204
  children: [
@@ -191,9 +208,9 @@ const Sortable = ({
191
208
  ...{
192
209
  as: sortableElement,
193
210
  className: classNameSortableItem,
194
- id: index
211
+ id: toId(index)
195
212
  },
196
- children: (dragHandleProps) => sortableElement ? renderItem(item, index, makeHandle(dragHandleProps)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ children: (dragHandleProps) => sortableElement ? renderItem(item, index, makeHandle(dragHandleProps, item)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
197
214
  SortableItem,
198
215
  {
199
216
  ...{
@@ -201,7 +218,7 @@ const Sortable = ({
201
218
  className: classNameSortableItem
202
219
  }
203
220
  },
204
- children: renderItem(item, index, makeHandle(dragHandleProps))
221
+ children: renderItem(item, index, makeHandle(dragHandleProps, item))
205
222
  }
206
223
  )
207
224
  },
@@ -215,7 +232,7 @@ const Sortable = ({
215
232
  className: classNameSortableItem
216
233
  }
217
234
  },
218
- children: renderItem(items[activeId], activeId, makeHandle({}))
235
+ children: renderItem(items[activeId], activeId, makeHandle({}, items[activeId]))
219
236
  }
220
237
  ) : null })
221
238
  ]
@@ -86,9 +86,15 @@ const SortableItem = ({
86
86
  }
87
87
  );
88
88
  };
89
+ const toId = (index) => index + 1;
90
+ const toIndex = (id) => id - 1;
89
91
  const Sortable = ({
90
92
  classNameSortableItem,
91
93
  disabled = false,
94
+ handleClassName = "flex items-center justify-center shrink-0 w-4 h-6 rounded cursor-move touch-none",
95
+ handleLabel,
96
+ onDragging = () => {
97
+ },
92
98
  onSort = () => {
93
99
  },
94
100
  renderItem,
@@ -108,12 +114,15 @@ const Sortable = ({
108
114
  }
109
115
  )
110
116
  );
111
- const makeHandle = (props) => showHandle ? /* @__PURE__ */ jsx(
117
+ const makeHandle = (props, item) => showHandle ? /* @__PURE__ */ jsx(
112
118
  "div",
113
119
  {
114
120
  ...{
115
121
  ...props,
116
- className: "flex items-center justify-center shrink-0 w-6 h-6 rounded cursor-move touch-none"
122
+ ...handleLabel && item && {
123
+ "aria-label": handleLabel(item)
124
+ },
125
+ className: handleClassName
117
126
  },
118
127
  children: /* @__PURE__ */ jsx(
119
128
  Drag,
@@ -134,14 +143,22 @@ const Sortable = ({
134
143
  } : void 0,
135
144
  collisionDetection: closestCenter,
136
145
  onDragStart: ({ active }) => {
137
- setActiveId(active.id);
146
+ setActiveId(toIndex(active.id));
147
+ onDragging(true);
148
+ },
149
+ onDragCancel: () => {
150
+ setActiveId(null);
151
+ onDragging(false);
138
152
  },
139
153
  onDragEnd: ({ active, over }) => {
140
154
  if (over && active.id !== over.id) {
141
- const sorted = arrayMove(items, active.id, over.id);
142
- onSort(sorted, { from: active.id, to: over.id });
155
+ const from = toIndex(active.id);
156
+ const to = toIndex(over.id);
157
+ const sorted = arrayMove(items, from, to);
158
+ onSort(sorted, { from, to });
143
159
  }
144
160
  setActiveId(null);
161
+ onDragging(false);
145
162
  },
146
163
  sensors
147
164
  },
@@ -149,7 +166,7 @@ const Sortable = ({
149
166
  SortableContext,
150
167
  {
151
168
  ...{
152
- items: items.map((_, i) => i),
169
+ items: items.map((_, i) => toId(i)),
153
170
  strategy: verticalListSortingStrategy
154
171
  },
155
172
  children: [
@@ -159,9 +176,9 @@ const Sortable = ({
159
176
  ...{
160
177
  as: sortableElement,
161
178
  className: classNameSortableItem,
162
- id: index
179
+ id: toId(index)
163
180
  },
164
- children: (dragHandleProps) => sortableElement ? renderItem(item, index, makeHandle(dragHandleProps)) : /* @__PURE__ */ jsx(
181
+ children: (dragHandleProps) => sortableElement ? renderItem(item, index, makeHandle(dragHandleProps, item)) : /* @__PURE__ */ jsx(
165
182
  SortableItem,
166
183
  {
167
184
  ...{
@@ -169,7 +186,7 @@ const Sortable = ({
169
186
  className: classNameSortableItem
170
187
  }
171
188
  },
172
- children: renderItem(item, index, makeHandle(dragHandleProps))
189
+ children: renderItem(item, index, makeHandle(dragHandleProps, item))
173
190
  }
174
191
  )
175
192
  },
@@ -183,7 +200,7 @@ const Sortable = ({
183
200
  className: classNameSortableItem
184
201
  }
185
202
  },
186
- children: renderItem(items[activeId], activeId, makeHandle({}))
203
+ children: renderItem(items[activeId], activeId, makeHandle({}, items[activeId]))
187
204
  }
188
205
  ) : null })
189
206
  ]
@@ -85,7 +85,7 @@ const Tabs = ({
85
85
  "span",
86
86
  {
87
87
  ...{
88
- className: "flex items-center justify-center w-full p-3 space-x-2 transform transition ease-in-out duration-200 " + (brand ? selected ? "opacity-70" : "" : selected ? "bg-white" : "bg-gray-light"),
88
+ className: "flex items-center justify-center w-full p-3 space-x-2 transform transition ease-in-out duration-200 " + (brand ? selected ? "opacity-70" : "" : selected ? "bg-gray-light" : "bg-white"),
89
89
  ...brand && { style: { backgroundColor: brand.backgroundColor, color: brand.color } }
90
90
  },
91
91
  children: [
@@ -53,7 +53,7 @@ const Tabs = ({
53
53
  "span",
54
54
  {
55
55
  ...{
56
- className: "flex items-center justify-center w-full p-3 space-x-2 transform transition ease-in-out duration-200 " + (brand ? selected ? "opacity-70" : "" : selected ? "bg-white" : "bg-gray-light"),
56
+ className: "flex items-center justify-center w-full p-3 space-x-2 transform transition ease-in-out duration-200 " + (brand ? selected ? "opacity-70" : "" : selected ? "bg-gray-light" : "bg-white"),
57
57
  ...brand && { style: { backgroundColor: brand.backgroundColor, color: brand.color } }
58
58
  },
59
59
  children: [
package/dist/video.js CHANGED
@@ -28,14 +28,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var video_exports = {};
30
30
  __export(video_exports, {
31
+ Controls: () => Controls,
31
32
  default: () => video_default
32
33
  });
33
34
  module.exports = __toCommonJS(video_exports);
34
35
  var import_jsx_runtime = require("react/jsx-runtime");
35
36
  var import_dynamic = __toESM(require("next/dynamic"));
36
37
  var import_react = require("react");
38
+ var import_button = __toESM(require("./shared/button"));
39
+ var import_arrows_pointing_out = __toESM(require("./icons/arrows-pointing-out"));
37
40
  var import_loader = __toESM(require("./icons/loader"));
41
+ var import_pause = __toESM(require("./icons/pause"));
42
+ var import_play = __toESM(require("./icons/play"));
38
43
  var import_warning = __toESM(require("./icons/warning"));
44
+ var import_styles = require("./styles");
39
45
  var import_video = require("./shared/lib/video");
40
46
  const ReactPlayer = (0, import_dynamic.default)(
41
47
  () => Promise.all([
@@ -47,6 +53,107 @@ const ReactPlayer = (0, import_dynamic.default)(
47
53
  ssr: false
48
54
  }
49
55
  );
56
+ const Controls = ({ fullscreen = false, style, video }) => {
57
+ const [time, setTime] = (0, import_react.useState)(0);
58
+ const [duration, setDuration] = (0, import_react.useState)(0);
59
+ const [playing, setPlaying] = (0, import_react.useState)(false);
60
+ (0, import_react.useEffect)(
61
+ () => {
62
+ if (!video) return;
63
+ const sync = () => {
64
+ setTime(video.currentTime || 0);
65
+ setDuration(Number.isFinite(video.duration) ? video.duration : 0);
66
+ setPlaying(!video.paused);
67
+ };
68
+ const events = ["durationchange", "loadedmetadata", "pause", "play", "timeupdate"];
69
+ events.forEach((name) => video.addEventListener(name, sync));
70
+ sync();
71
+ return () => events.forEach((name) => video.removeEventListener(name, sync));
72
+ },
73
+ [video]
74
+ );
75
+ const played = duration ? time / duration * 100 : 0;
76
+ const rest = (0, import_styles.dotStyle)(style, false).backgroundColor;
77
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
78
+ "div",
79
+ {
80
+ ...{
81
+ className: "flex items-center gap-3 py-2",
82
+ ...style && {
83
+ style: {
84
+ color: (0, import_styles.buttonStyle)(style).backgroundColor
85
+ }
86
+ }
87
+ },
88
+ children: [
89
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
+ import_button.default,
91
+ {
92
+ ...{
93
+ "aria-label": playing ? "Pause" : "Play",
94
+ disabled: !video,
95
+ icon: playing ? import_pause.default : import_play.default,
96
+ inline: true,
97
+ onClick: () => {
98
+ var _a, _b;
99
+ return playing ? video == null ? void 0 : video.pause() : (_b = (_a = video == null ? void 0 : video.play()) == null ? void 0 : _a.catch) == null ? void 0 : _b.call(_a, () => {
100
+ });
101
+ },
102
+ variant: "link"
103
+ }
104
+ }
105
+ ),
106
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
+ "span",
108
+ {
109
+ ...{
110
+ className: "text-sm tabular-nums shrink-0"
111
+ },
112
+ children: (0, import_video.videoClock)(time) + " / " + (0, import_video.videoClock)(duration)
113
+ }
114
+ ),
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ "input",
117
+ {
118
+ ...{
119
+ "aria-label": "Video timeline",
120
+ className: "controls-track w-full h-1 cursor-pointer appearance-none rounded-full",
121
+ disabled: !video,
122
+ max: duration || 0,
123
+ min: 0,
124
+ onChange: ({ target }) => {
125
+ if (video) video.currentTime = Number(target.value);
126
+ },
127
+ step: 0.01,
128
+ style: {
129
+ background: "linear-gradient( to right, currentColor " + played + "%, " + rest + " " + played + "% )"
130
+ },
131
+ type: "range",
132
+ value: time
133
+ }
134
+ }
135
+ ),
136
+ fullscreen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
+ import_button.default,
138
+ {
139
+ ...{
140
+ "aria-label": "Full screen",
141
+ disabled: !video,
142
+ icon: import_arrows_pointing_out.default,
143
+ inline: true,
144
+ // iPhone Safari has no requestFullscreen on a video, only its own webkitEnterFullscreen.
145
+ onClick: () => {
146
+ var _a;
147
+ return (video == null ? void 0 : video.requestFullscreen) ? video.requestFullscreen() : (_a = video == null ? void 0 : video.webkitEnterFullscreen) == null ? void 0 : _a.call(video);
148
+ },
149
+ variant: "link"
150
+ }
151
+ }
152
+ )
153
+ ]
154
+ }
155
+ );
156
+ };
50
157
  const DEFER_FALLBACK_MS = 5e3;
51
158
  const Video = ({
52
159
  className,
@@ -74,6 +181,8 @@ const Video = ({
74
181
  const durationFired = (0, import_react.useRef)(false);
75
182
  const errored = (0, import_react.useRef)(false);
76
183
  const [player, setPlayer] = (0, import_react.useState)();
184
+ const bar = (0, import_react.isValidElement)(controls) ? controls : null;
185
+ const [element, setElement] = (0, import_react.useState)(null);
77
186
  const [videoUrl, setVideoUrl] = (0, import_react.useState)(hls ? hls : mp4);
78
187
  const [mountPlayer, setMountPlayer] = (0, import_react.useState)(!defer);
79
188
  const [posterPainted, setPosterPainted] = (0, import_react.useState)(false);
@@ -130,7 +239,7 @@ const Video = ({
130
239
  {
131
240
  ...{
132
241
  className: "relative react-video",
133
- controls,
242
+ controls: bar ? false : Boolean(controls),
134
243
  config: {
135
244
  file: {
136
245
  attributes: {
@@ -188,16 +297,17 @@ const Video = ({
188
297
  onReady: (instance) => {
189
298
  var _a2;
190
299
  setPlayer(instance.player);
191
- const element = (_a2 = instance.getInternalPlayer) == null ? void 0 : _a2.call(instance);
192
- if (!element || typeof element.readyState !== "number") {
300
+ const element2 = (_a2 = instance.getInternalPlayer) == null ? void 0 : _a2.call(instance);
301
+ if (bar && typeof (element2 == null ? void 0 : element2.play) === "function") setElement(element2);
302
+ if (!element2 || typeof element2.readyState !== "number") {
193
303
  setVideoPaintable(true);
194
304
  return;
195
305
  }
196
- if (element.readyState >= 2) {
306
+ if (element2.readyState >= 2) {
197
307
  setVideoPaintable(true);
198
308
  return;
199
309
  }
200
- element.addEventListener("loadeddata", () => setVideoPaintable(true), { once: true });
310
+ element2.addEventListener("loadeddata", () => setVideoPaintable(true), { once: true });
201
311
  },
202
312
  playing: Boolean(playing),
203
313
  playsinline: true,
@@ -214,14 +324,14 @@ const Video = ({
214
324
  "aria-hidden": true,
215
325
  className: "absolute inset-0 w-full h-full object-cover pointer-events-none",
216
326
  decoding: "async",
217
- ...priority ? { fetchpriority: "high", loading: "eager" } : { loading: "lazy" },
327
+ ...priority ? { fetchPriority: "high", loading: "eager" } : { loading: "lazy" },
218
328
  onLoad: () => setPosterPainted(true),
219
329
  // A cached poster can finish loading before React attaches
220
330
  // onLoad, so check completeness on attach too — otherwise the
221
331
  // exact case this optimises for (warm revisit) would fall
222
332
  // through to the 5s fallback.
223
- ref: (element) => {
224
- if ((element == null ? void 0 : element.complete) && element.naturalWidth > 0) setPosterPainted(true);
333
+ ref: (element2) => {
334
+ if ((element2 == null ? void 0 : element2.complete) && element2.naturalWidth > 0) setPosterPainted(true);
225
335
  },
226
336
  src: poster
227
337
  }
@@ -272,7 +382,7 @@ const Video = ({
272
382
  }
273
383
  )
274
384
  ] });
275
- return className ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
385
+ const box = className ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
276
386
  "div",
277
387
  {
278
388
  ...{
@@ -281,5 +391,13 @@ const Video = ({
281
391
  children: inner
282
392
  }
283
393
  ) : inner;
394
+ return bar ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
395
+ box,
396
+ (0, import_react.cloneElement)(bar, { video: element })
397
+ ] }) : box;
284
398
  };
285
399
  var video_default = Video;
400
+ // Annotate the CommonJS export names for ESM import in node:
401
+ 0 && (module.exports = {
402
+ Controls
403
+ });