coveragebook_components 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (355) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/app.css +6576 -5446
  3. data/app/assets/build/coco/app.js +3142 -3169
  4. data/app/assets/build/coco/book.css +5169 -2130
  5. data/app/assets/build/coco/book.js +3986 -1565
  6. data/app/assets/css/app.css +2 -8
  7. data/app/assets/css/base/config.css +1 -0
  8. data/app/assets/css/{base.css → base/setup.css} +7 -4
  9. data/app/assets/css/{shared → base}/tippy.css +18 -0
  10. data/app/assets/css/book.css +2 -4
  11. data/app/assets/js/app.js +25 -9
  12. data/app/assets/js/{libs → base}/alpine/directives/dropdown.js +1 -1
  13. data/app/assets/js/{libs → base}/alpine/directives/tooltip.js +1 -1
  14. data/app/assets/js/{libs → base}/alpine/index.js +7 -7
  15. data/app/assets/js/{libs → base}/alpine/utils/tippy_modifiers.js +1 -1
  16. data/app/assets/js/base/setup.js +8 -0
  17. data/app/assets/js/book.js +4 -4
  18. data/app/components/coco/app/{layouts/application/application.css → application_layout/application_layout.css} +2 -2
  19. data/app/components/coco/app/{layouts/application/application.js → application_layout/application_layout.js} +1 -1
  20. data/app/components/coco/app/application_layout/application_layout.rb +16 -0
  21. data/app/components/coco/app/contact_callout/contact_callout.rb +21 -0
  22. data/app/components/coco/app/faqs/faqs.rb +14 -0
  23. data/app/components/coco/app/{blocks/header → header}/header.js +1 -1
  24. data/app/components/coco/app/header/header.rb +33 -0
  25. data/app/components/coco/app/{blocks/nav_drawer → nav_drawer}/nav_drawer.css +1 -1
  26. data/app/components/coco/app/{blocks/nav_drawer → nav_drawer}/nav_drawer.js +1 -1
  27. data/app/components/coco/app/nav_drawer/nav_drawer.rb +32 -0
  28. data/app/components/coco/app/plan_card/plan_card.rb +39 -0
  29. data/app/components/coco/app/{blocks/plan_picker → plan_picker}/plan_picker.css +3 -3
  30. data/app/components/coco/app/{blocks/plan_picker → plan_picker}/plan_picker.js +1 -1
  31. data/app/components/coco/app/plan_picker/plan_picker.rb +25 -0
  32. data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/item/item.js +2 -2
  33. data/app/components/coco/app/sidebar_nav/item/item.rb +48 -0
  34. data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/menu/menu.js +1 -1
  35. data/app/components/coco/app/sidebar_nav/menu/menu.rb +46 -0
  36. data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/navbar/navbar.html.erb +1 -1
  37. data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/navbar/navbar.js +2 -2
  38. data/app/components/coco/app/sidebar_nav/navbar/navbar.rb +50 -0
  39. data/app/components/coco/app/{blocks/slide_editor → slide_editor}/slide_editor.js +2 -2
  40. data/app/components/coco/app/slide_editor/slide_editor.rb +114 -0
  41. data/app/components/coco/book/editable_slide/editable_slide.rb +72 -0
  42. data/app/components/coco/book/media_slide/media_slide.rb +12 -0
  43. data/app/components/coco/{shared → buttons}/button/button.js +1 -1
  44. data/app/components/coco/{shared → buttons}/button/button.rb +2 -2
  45. data/app/components/coco/{shared → buttons}/button/button_dropdown.js +1 -1
  46. data/app/components/coco/{shared → buttons}/button_group/button_group.js +2 -2
  47. data/app/components/coco/{shared → buttons}/button_to/button_to.rb +1 -1
  48. data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.css +2 -2
  49. data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.html.erb +1 -1
  50. data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.js +2 -2
  51. data/app/components/coco/buttons/color_picker_button/color_picker_button.rb +53 -0
  52. data/app/components/coco/{app/elements → buttons}/confirm_panel/confirm_panel.css +1 -1
  53. data/app/components/coco/{app/elements → buttons}/confirm_panel/confirm_panel.html.erb +1 -1
  54. data/app/components/coco/{app/elements → buttons}/confirm_panel/confirm_panel.js +2 -2
  55. data/app/components/coco/buttons/confirm_panel/confirm_panel.rb +19 -0
  56. data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.css +2 -2
  57. data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.html.erb +1 -1
  58. data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.js +2 -2
  59. data/app/components/coco/buttons/image_picker_button/image_picker_button.rb +44 -0
  60. data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.css +11 -11
  61. data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.html.erb +1 -1
  62. data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.js +2 -2
  63. data/app/components/coco/buttons/layout_picker_button/layout_picker_button.rb +33 -0
  64. data/app/components/coco/{app/elements → buttons}/menu/menu.css +2 -4
  65. data/app/components/coco/buttons/menu/menu.rb +37 -0
  66. data/app/components/coco/{app/elements → buttons}/menu_button/menu_button.css +1 -1
  67. data/app/components/coco/{app/elements → buttons}/menu_button/menu_button.html.erb +1 -1
  68. data/app/components/coco/buttons/menu_button/menu_button.js +6 -0
  69. data/app/components/coco/buttons/menu_button/menu_button.rb +30 -0
  70. data/app/components/coco/{app/elements → buttons}/menu_items/user_profile/user_profile.css +1 -1
  71. data/app/components/coco/buttons/menu_items/user_profile/user_profile.rb +18 -0
  72. data/app/components/coco/{app/elements → buttons}/option_bar/option_bar.css +1 -1
  73. data/app/components/coco/buttons/option_bar/option_bar.rb +13 -0
  74. data/app/components/coco/{app/elements → buttons}/toolbar/toolbar.css +1 -1
  75. data/app/components/coco/{app/elements → buttons}/toolbar/toolbar.js +1 -1
  76. data/app/components/coco/buttons/toolbar/toolbar.rb +35 -0
  77. data/app/components/coco/component.rb +1 -1
  78. data/app/components/coco/concerns/acts_as_button_group.rb +4 -11
  79. data/app/components/coco/concerns/acts_as_field_with_html_options.rb +1 -1
  80. data/app/components/coco/concerns/acts_as_field_with_options.rb +2 -2
  81. data/app/components/coco/embeds/youtube_embed/youtube_embed.rb +16 -0
  82. data/app/components/coco/fields/button_component.rb +14 -0
  83. data/app/components/coco/fields/check_box_component.rb +7 -0
  84. data/app/components/coco/fields/collection_check_boxes_component.rb +7 -0
  85. data/app/components/coco/fields/collection_radio_buttons_component.rb +7 -0
  86. data/app/components/coco/fields/collection_select_component.rb +7 -0
  87. data/app/components/coco/fields/color_field_component.rb +7 -0
  88. data/app/components/coco/fields/date_field_component.rb +7 -0
  89. data/app/components/coco/fields/date_select_component.rb +7 -0
  90. data/app/components/coco/fields/datetime_local_field_component.rb +7 -0
  91. data/app/components/coco/fields/datetime_select_component.rb +7 -0
  92. data/app/components/coco/fields/email_field_component.rb +7 -0
  93. data/app/components/coco/fields/error_message_component.rb +7 -0
  94. data/app/components/coco/fields/file_field_component.rb +7 -0
  95. data/app/components/coco/fields/grouped_collection_select_component.rb +7 -0
  96. data/app/components/coco/fields/hint_component.rb +7 -0
  97. data/app/components/coco/fields/label_component.rb +7 -0
  98. data/app/components/coco/fields/month_field_component.rb +7 -0
  99. data/app/components/coco/fields/number_field_component.rb +7 -0
  100. data/app/components/coco/fields/password_field_component.rb +7 -0
  101. data/app/components/coco/fields/radio_button_component.rb +7 -0
  102. data/app/components/coco/fields/range_field_component.rb +7 -0
  103. data/app/components/coco/fields/search_field_component.rb +7 -0
  104. data/app/components/coco/fields/select_component.rb +7 -0
  105. data/app/components/coco/fields/submit_component.rb +14 -0
  106. data/app/components/coco/fields/telephone_field_component.rb +7 -0
  107. data/app/components/coco/fields/text_area_component.rb +7 -0
  108. data/app/components/coco/fields/text_field_component.rb +7 -0
  109. data/app/components/coco/fields/time_field_component.rb +7 -0
  110. data/app/components/coco/fields/time_select_component.rb +7 -0
  111. data/app/components/coco/fields/time_zone_select_component.rb +7 -0
  112. data/app/components/coco/fields/url_field_component.rb +7 -0
  113. data/app/components/coco/fields/week_field_component.rb +7 -0
  114. data/app/components/coco/fields/weekday_select_component.rb +7 -0
  115. data/app/components/coco/{shared → images}/icon/icon.js +1 -1
  116. data/app/components/coco/{shared → images}/image_uploader/image_uploader.js +1 -1
  117. data/app/components/coco/{app/elements → indicators}/stamp/stamp.css +1 -1
  118. data/app/components/coco/indicators/stamp/stamp.rb +25 -0
  119. data/app/components/coco/{app/layouts → layout}/page/page.css +5 -2
  120. data/app/components/coco/{app/layouts → layout}/page/page.js +1 -1
  121. data/app/components/coco/layout/page/page.rb +55 -0
  122. data/app/components/coco/{app/elements → messaging}/alert/alert.css +7 -7
  123. data/app/components/coco/{app/elements → messaging}/alert/alert.html.erb +1 -1
  124. data/app/components/coco/{app/elements → messaging}/alert/alert.js +2 -2
  125. data/app/components/coco/messaging/alert/alert.rb +75 -0
  126. data/app/components/coco/{app/elements → messaging}/notice/notice.css +1 -1
  127. data/app/components/coco/messaging/notice/notice.html.erb +5 -0
  128. data/app/components/coco/messaging/notice/notice.js +5 -0
  129. data/app/components/coco/messaging/notice/notice.rb +18 -0
  130. data/app/components/coco/{app/elements → messaging}/snackbar/snackbar.css +1 -1
  131. data/app/components/coco/{app/elements → messaging}/snackbar/snackbar.html.erb +1 -1
  132. data/app/components/coco/{app/elements → messaging}/snackbar/snackbar.js +2 -2
  133. data/app/components/coco/messaging/snackbar/snackbar.rb +34 -0
  134. data/app/components/coco/messaging/system_banner/system_banner.css +4 -0
  135. data/app/components/coco/messaging/system_banner/system_banner.html.erb +5 -0
  136. data/app/components/coco/{app/elements → messaging}/system_banner/system_banner.js +2 -2
  137. data/app/components/coco/messaging/system_banner/system_banner.rb +78 -0
  138. data/app/components/coco/{app/elements → messaging}/toast/toast.css +1 -1
  139. data/app/components/coco/{app/elements → messaging}/toast/toast.html.erb +1 -1
  140. data/app/components/coco/{app/elements → messaging}/toast/toast.js +2 -2
  141. data/app/components/coco/messaging/toast/toast.rb +19 -0
  142. data/app/components/coco/{shared → modals}/modal/modal.js +2 -2
  143. data/app/components/coco/{shared → modals}/modal/modal.rb +1 -0
  144. data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.js +1 -1
  145. data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.js +1 -1
  146. data/app/components/coco/{shared → navigation}/link/link.rb +1 -1
  147. data/app/components/coco/{shared/pager_link/pager_link.css → navigation/pager_button/pager_button.css} +1 -1
  148. data/app/components/coco/{shared/pager_link/pager_link.rb → navigation/pager_button/pager_button.rb} +1 -1
  149. data/app/components/coco/{app/elements → pickers}/color_picker/color_picker.css +11 -11
  150. data/app/components/coco/{app/elements → pickers}/color_picker/color_picker.html.erb +1 -1
  151. data/app/components/coco/{app/elements → pickers}/color_picker/color_picker.js +2 -2
  152. data/app/components/coco/pickers/color_picker/color_picker.rb +48 -0
  153. data/app/components/coco/{app/elements → pickers}/image_picker/image_picker.css +11 -11
  154. data/app/components/coco/{app/elements → pickers}/image_picker/image_picker.html.erb +1 -1
  155. data/app/components/coco/{app/elements → pickers}/image_picker/image_picker.js +2 -2
  156. data/app/components/coco/pickers/image_picker/image_picker.rb +20 -0
  157. data/app/components/coco/presented_component.rb +1 -1
  158. data/app/components/coco/{shared → utilities}/dropdown/dropdown.js +1 -1
  159. data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.js +1 -1
  160. data/app/components/coco/{app/elements → utilities}/seamless_textarea/seamless_textarea.css +1 -1
  161. data/app/components/coco/{app/elements → utilities}/seamless_textarea/seamless_textarea.html.erb +1 -1
  162. data/app/components/coco/{app/elements → utilities}/seamless_textarea/seamless_textarea.js +2 -2
  163. data/app/components/coco/utilities/seamless_textarea/seamless_textarea.rb +25 -0
  164. data/app/helpers/coco/app_components_helper.rb +35 -0
  165. data/app/helpers/coco/book_components_helper.rb +11 -0
  166. data/app/helpers/coco/components_helper.rb +7 -0
  167. data/app/helpers/coco/core_components_helper.rb +257 -0
  168. data/app/helpers/coco/helpers.rb +2 -2
  169. data/app/helpers/coco/modal_helper.rb +22 -0
  170. data/config/locales/coco.en.yml +17 -18
  171. data/config/{tailwind.base.config.cjs → tailwind.config.cjs} +10 -0
  172. data/config/tokens.cjs +9 -23
  173. data/lib/coco/app_form_builder.rb +1 -1
  174. data/lib/coco/engine.rb +3 -3
  175. data/lib/coco.rb +1 -1
  176. metadata +251 -258
  177. data/app/assets/css/app/config.css +0 -1
  178. data/app/assets/css/app/tippy.css +0 -19
  179. data/app/assets/css/book/config.css +0 -1
  180. data/app/assets/js/app/components.js +0 -4
  181. data/app/assets/js/app/setup.js +0 -23
  182. data/app/assets/js/book/components.js +0 -4
  183. data/app/assets/js/shared/components.js +0 -4
  184. data/app/components/coco/app/blocks/contact_callout/contact_callout.rb +0 -23
  185. data/app/components/coco/app/blocks/faqs/faqs.rb +0 -16
  186. data/app/components/coco/app/blocks/header/header.rb +0 -35
  187. data/app/components/coco/app/blocks/nav_drawer/nav_drawer.rb +0 -34
  188. data/app/components/coco/app/blocks/plan_picker/plan_picker.rb +0 -27
  189. data/app/components/coco/app/blocks/sidebar_nav/item/item.rb +0 -50
  190. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.rb +0 -48
  191. data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.rb +0 -50
  192. data/app/components/coco/app/blocks/slide_editor/slide_editor.rb +0 -116
  193. data/app/components/coco/app/elements/alert/alert.rb +0 -79
  194. data/app/components/coco/app/elements/color_picker/color_picker.rb +0 -53
  195. data/app/components/coco/app/elements/color_picker_button/color_picker_button.rb +0 -58
  196. data/app/components/coco/app/elements/confirm_panel/confirm_panel.rb +0 -23
  197. data/app/components/coco/app/elements/image_picker/image_picker.rb +0 -25
  198. data/app/components/coco/app/elements/image_picker_button/image_picker_button.rb +0 -49
  199. data/app/components/coco/app/elements/layout_picker_button/layout_picker_button.rb +0 -38
  200. data/app/components/coco/app/elements/menu/menu.rb +0 -41
  201. data/app/components/coco/app/elements/menu_button/menu_button.js +0 -6
  202. data/app/components/coco/app/elements/menu_button/menu_button.rb +0 -35
  203. data/app/components/coco/app/elements/menu_items/user_profile/user_profile.rb +0 -20
  204. data/app/components/coco/app/elements/notice/notice.html.erb +0 -5
  205. data/app/components/coco/app/elements/notice/notice.js +0 -5
  206. data/app/components/coco/app/elements/notice/notice.rb +0 -22
  207. data/app/components/coco/app/elements/option_bar/option_bar.rb +0 -17
  208. data/app/components/coco/app/elements/plan_card/plan_card.rb +0 -41
  209. data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.rb +0 -29
  210. data/app/components/coco/app/elements/snackbar/snackbar.rb +0 -38
  211. data/app/components/coco/app/elements/stamp/stamp.rb +0 -29
  212. data/app/components/coco/app/elements/system_banner/system_banner.css +0 -4
  213. data/app/components/coco/app/elements/system_banner/system_banner.html.erb +0 -5
  214. data/app/components/coco/app/elements/system_banner/system_banner.rb +0 -82
  215. data/app/components/coco/app/elements/toast/toast.rb +0 -23
  216. data/app/components/coco/app/elements/toolbar/toolbar.rb +0 -41
  217. data/app/components/coco/app/fields/button_component.rb +0 -16
  218. data/app/components/coco/app/fields/check_box_component.rb +0 -9
  219. data/app/components/coco/app/fields/collection_check_boxes_component.rb +0 -9
  220. data/app/components/coco/app/fields/collection_radio_buttons_component.rb +0 -9
  221. data/app/components/coco/app/fields/collection_select_component.rb +0 -9
  222. data/app/components/coco/app/fields/color_field_component.rb +0 -9
  223. data/app/components/coco/app/fields/date_field_component.rb +0 -9
  224. data/app/components/coco/app/fields/date_select_component.rb +0 -9
  225. data/app/components/coco/app/fields/datetime_local_field_component.rb +0 -9
  226. data/app/components/coco/app/fields/datetime_select_component.rb +0 -9
  227. data/app/components/coco/app/fields/email_field_component.rb +0 -9
  228. data/app/components/coco/app/fields/error_message_component.rb +0 -9
  229. data/app/components/coco/app/fields/file_field_component.rb +0 -9
  230. data/app/components/coco/app/fields/grouped_collection_select_component.rb +0 -9
  231. data/app/components/coco/app/fields/hint_component.rb +0 -9
  232. data/app/components/coco/app/fields/label_component.rb +0 -9
  233. data/app/components/coco/app/fields/month_field_component.rb +0 -9
  234. data/app/components/coco/app/fields/number_field_component.rb +0 -9
  235. data/app/components/coco/app/fields/password_field_component.rb +0 -9
  236. data/app/components/coco/app/fields/radio_button_component.rb +0 -9
  237. data/app/components/coco/app/fields/range_field_component.rb +0 -9
  238. data/app/components/coco/app/fields/search_field_component.rb +0 -9
  239. data/app/components/coco/app/fields/select_component.rb +0 -9
  240. data/app/components/coco/app/fields/submit_component.rb +0 -16
  241. data/app/components/coco/app/fields/telephone_field_component.rb +0 -9
  242. data/app/components/coco/app/fields/text_area_component.rb +0 -9
  243. data/app/components/coco/app/fields/text_field_component.rb +0 -9
  244. data/app/components/coco/app/fields/time_field_component.rb +0 -9
  245. data/app/components/coco/app/fields/time_select_component.rb +0 -9
  246. data/app/components/coco/app/fields/time_zone_select_component.rb +0 -9
  247. data/app/components/coco/app/fields/url_field_component.rb +0 -9
  248. data/app/components/coco/app/fields/week_field_component.rb +0 -9
  249. data/app/components/coco/app/fields/weekday_select_component.rb +0 -9
  250. data/app/components/coco/app/layouts/application/application.rb +0 -18
  251. data/app/components/coco/app/layouts/page/page.rb +0 -59
  252. data/app/components/coco/book/blocks/slides/editable_slide/editable_slide.rb +0 -76
  253. data/app/components/coco/book/blocks/slides/media_slide/media_slide.rb +0 -16
  254. data/app/components/coco/shared/embeds/youtube/youtube.rb +0 -20
  255. data/app/helpers/coco/app_helper.rb +0 -141
  256. data/app/helpers/coco/book_helper.rb +0 -11
  257. data/app/helpers/coco/component_helper.rb +0 -15
  258. data/app/helpers/coco/shared_helper.rb +0 -111
  259. data/app/helpers/coco/url_helper.rb +0 -30
  260. data/config/tailwind.app.config.cjs +0 -21
  261. data/config/tailwind.book.config.cjs +0 -21
  262. /data/app/assets/css/{shared → base}/utils/colors.css +0 -0
  263. /data/app/assets/css/{shared → base}/utils/icons.css +0 -0
  264. /data/app/assets/css/{app/utils.css → base/utils/layout.css} +0 -0
  265. /data/app/assets/css/{shared → base}/utils/text.css +0 -0
  266. /data/app/assets/js/{libs → base}/alpine/directives/destroy.js +0 -0
  267. /data/app/assets/js/{libs → base}/alpine/directives/dimensions.js +0 -0
  268. /data/app/assets/js/{libs → base}/alpine/directives/notification.js +0 -0
  269. /data/app/assets/js/{libs → base}/alpine/directives/options.js +0 -0
  270. /data/app/assets/js/{libs → base}/alpine/directives/undo.js +0 -0
  271. /data/app/assets/js/{shared → base}/coco.js +0 -0
  272. /data/app/assets/js/{libs → base}/tippy/index.js +0 -0
  273. /data/app/assets/js/{libs → base}/tippy/plugins/hide_on_esc.js +0 -0
  274. /data/app/components/coco/app/{layouts/application/application.html.erb → application_layout/application_layout.html.erb} +0 -0
  275. /data/app/components/coco/app/{blocks/contact_callout → contact_callout}/contact_callout.css +0 -0
  276. /data/app/components/coco/app/{blocks/contact_callout → contact_callout}/contact_callout.html.erb +0 -0
  277. /data/app/components/coco/app/{blocks/faqs → faqs}/faqs.css +0 -0
  278. /data/app/components/coco/app/{blocks/faqs → faqs}/faqs.html.erb +0 -0
  279. /data/app/components/coco/app/{blocks/header → header}/header.css +0 -0
  280. /data/app/components/coco/app/{blocks/header → header}/header.html.erb +0 -0
  281. /data/app/components/coco/app/{blocks/nav_drawer → nav_drawer}/nav_drawer.html.erb +0 -0
  282. /data/app/components/coco/app/{elements/plan_card → plan_card}/plan_card.css +0 -0
  283. /data/app/components/coco/app/{elements/plan_card → plan_card}/plan_card.html.erb +0 -0
  284. /data/app/components/coco/app/{blocks/plan_picker → plan_picker}/plan_picker.html.erb +0 -0
  285. /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/item/item.css +0 -0
  286. /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/item/item.html.erb +0 -0
  287. /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/menu/menu.css +0 -0
  288. /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/menu/menu.html.erb +0 -0
  289. /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/navbar/navbar.css +0 -0
  290. /data/app/components/coco/app/{blocks/slide_editor → slide_editor}/slide_editor.css +0 -0
  291. /data/app/components/coco/app/{blocks/slide_editor → slide_editor}/slide_editor.html.erb +0 -0
  292. /data/app/components/coco/book/{blocks/slides/editable_slide → editable_slide}/editable_slide.css +0 -0
  293. /data/app/components/coco/book/{blocks/slides/editable_slide → editable_slide}/editable_slide.html.erb +0 -0
  294. /data/app/components/coco/book/{blocks/slides/media_slide → media_slide}/media_slide.css +0 -0
  295. /data/app/components/coco/book/{blocks/slides/media_slide → media_slide}/media_slide.html.erb +0 -0
  296. /data/app/components/coco/{shared → buttons}/button/button.css +0 -0
  297. /data/app/components/coco/{shared → buttons}/button/button.html.erb +0 -0
  298. /data/app/components/coco/{shared → buttons}/button_group/button_group.css +0 -0
  299. /data/app/components/coco/{shared → buttons}/button_group/button_group.html.erb +0 -0
  300. /data/app/components/coco/{shared → buttons}/button_group/button_group.rb +0 -0
  301. /data/app/components/coco/{shared → buttons}/button_to/button_to.css +0 -0
  302. /data/app/components/coco/{shared → buttons}/button_to/button_to.html.erb +0 -0
  303. /data/app/components/coco/{app/elements → buttons}/menu/menu.html.erb +0 -0
  304. /data/app/components/coco/{app/elements → buttons}/menu_items/user_profile/user_profile.html.erb +0 -0
  305. /data/app/components/coco/{app/elements → buttons}/option_bar/option_bar.html.erb +0 -0
  306. /data/app/components/coco/{app/elements → buttons}/toolbar/toolbar.html.erb +0 -0
  307. /data/app/components/coco/{shared/embeds/youtube/youtube.css → embeds/youtube_embed/youtube_embed.css} +0 -0
  308. /data/app/components/coco/{shared/embeds/youtube/youtube.html.erb → embeds/youtube_embed/youtube_embed.html.erb} +0 -0
  309. /data/app/components/coco/{shared → images}/avatar/avatar.css +0 -0
  310. /data/app/components/coco/{shared → images}/avatar/avatar.rb +0 -0
  311. /data/app/components/coco/{shared → images}/icon/icon.css +0 -0
  312. /data/app/components/coco/{shared → images}/icon/icon.html.erb +0 -0
  313. /data/app/components/coco/{shared → images}/icon/icon.rb +0 -0
  314. /data/app/components/coco/{shared → images}/image/image.css +0 -0
  315. /data/app/components/coco/{shared → images}/image/image.rb +0 -0
  316. /data/app/components/coco/{shared → images}/image_uploader/image_uploader.css +0 -0
  317. /data/app/components/coco/{shared → images}/image_uploader/image_uploader.html.erb +0 -0
  318. /data/app/components/coco/{shared → images}/image_uploader/image_uploader.rb +0 -0
  319. /data/app/components/coco/{shared → images}/svg/svg.html.erb +0 -0
  320. /data/app/components/coco/{shared → images}/svg/svg.rb +0 -0
  321. /data/app/components/coco/{shared → indicators}/badge/badge.css +0 -0
  322. /data/app/components/coco/{shared → indicators}/badge/badge.html.erb +0 -0
  323. /data/app/components/coco/{shared → indicators}/badge/badge.rb +0 -0
  324. /data/app/components/coco/{app/elements → indicators}/stamp/stamp.html.erb +0 -0
  325. /data/app/components/coco/{app/layouts → layout}/page/page.html.erb +0 -0
  326. /data/app/components/coco/{shared → layout}/panel/panel.css +0 -0
  327. /data/app/components/coco/{shared → layout}/panel/panel.html.erb +0 -0
  328. /data/app/components/coco/{shared → layout}/panel/panel.rb +0 -0
  329. /data/app/components/coco/{shared → layout}/spacer/spacer.css +0 -0
  330. /data/app/components/coco/{shared → layout}/spacer/spacer.rb +0 -0
  331. /data/app/components/coco/{shared → layout}/stack/stack.css +0 -0
  332. /data/app/components/coco/{shared → layout}/stack/stack.html.erb +0 -0
  333. /data/app/components/coco/{shared → layout}/stack/stack.rb +0 -0
  334. /data/app/components/coco/{shared → modals}/modal/modal.css +0 -0
  335. /data/app/components/coco/{shared → modals}/modal/modal.html.erb +0 -0
  336. /data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.css +0 -0
  337. /data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.html.erb +0 -0
  338. /data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.rb +0 -0
  339. /data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.css +0 -0
  340. /data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.html.erb +0 -0
  341. /data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.rb +0 -0
  342. /data/app/components/coco/{shared → navigation}/link/link.css +0 -0
  343. /data/app/components/coco/{shared/pager_link/pager_link.html.erb → navigation/pager_button/pager_button.html.erb} +0 -0
  344. /data/app/components/coco/{shared → typography}/prose/prose.css +0 -0
  345. /data/app/components/coco/{shared → typography}/prose/prose.rb +0 -0
  346. /data/app/components/coco/{shared → utilities}/content/content.rb +0 -0
  347. /data/app/components/coco/{shared → utilities}/dropdown/dropdown.css +0 -0
  348. /data/app/components/coco/{shared → utilities}/dropdown/dropdown.html.erb +0 -0
  349. /data/app/components/coco/{shared → utilities}/dropdown/dropdown.rb +0 -0
  350. /data/app/components/coco/{shared → utilities}/placeholder/placeholder.css +0 -0
  351. /data/app/components/coco/{shared → utilities}/placeholder/placeholder.html.erb +0 -0
  352. /data/app/components/coco/{shared → utilities}/placeholder/placeholder.rb +0 -0
  353. /data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.css +0 -0
  354. /data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.html.erb +0 -0
  355. /data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.rb +0 -0
@@ -0,0 +1,114 @@
1
+ module Coco
2
+ module App
3
+ class SlideEditor < Coco::Component
4
+ include Coco::AppComponentsHelper
5
+ include Coco::BookComponentsHelper
6
+ include Coco::FormatHelper
7
+
8
+ DEFAULT_LAYOUT = "one-col-title"
9
+
10
+ renders_one :title, ->(value = nil, **textarea_options) do
11
+ Coco::SeamlessTextarea.new(**textarea_options,
12
+ value: value,
13
+ multiline: false,
14
+ focus: true,
15
+ data: {role: "title-editor"},
16
+ x: {modelable: "value", model: "title"})
17
+ end
18
+
19
+ renders_one :text_1, ->(value = nil, **textarea_options) do
20
+ Coco::SeamlessTextarea.new(**textarea_options,
21
+ value: value,
22
+ multiline: true,
23
+ data: {role: "text-1-editor"},
24
+ x: {modelable: "value", model: "text1"})
25
+ end
26
+
27
+ renders_one :text_2, ->(value = nil, **textarea_options) do
28
+ Coco::SeamlessTextarea.new(**textarea_options,
29
+ value: value,
30
+ multiline: true,
31
+ data: {role: "text-2-editor"},
32
+ x: {modelable: "value", model: "text2"})
33
+ end
34
+
35
+ renders_one :image_1, ->(src = nil, **image_options) do
36
+ @image_1_options = {src: src, **image_options}
37
+ end
38
+
39
+ renders_one :image_2, ->(src = nil, **image_options) do
40
+ @image_2_options = {src: src, **image_options}
41
+ end
42
+
43
+ renders_one :bg_color, ->(value = nil, **input_options) do
44
+ @bg_color_options = {selected: value, **input_options}
45
+ end
46
+
47
+ renders_one :text_color, ->(value = nil, **input_options) do
48
+ @text_color_options = {selected: value, **input_options}
49
+ end
50
+
51
+ renders_one :bg_image, ->(src = nil, **input_options) do
52
+ @bg_image_options = {src: src, **input_options}
53
+ end
54
+
55
+ renders_one :layout, ->(value = DEFAULT_LAYOUT, **input_options) do
56
+ @layout_options = {selected: value&.to_s&.tr("_", "-"), **input_options}
57
+ end
58
+
59
+ def initialize(generate_thumbnail: true, **kwargs)
60
+ @generate_thumbnail = generate_thumbnail
61
+ end
62
+
63
+ def generate_thumbnail? = @generate_thumbnail
64
+
65
+ def slide_args
66
+ {
67
+ bg_image: bg_image_src,
68
+ bg_color_hex: bg_color_css,
69
+ text_color_hex: text_color_css,
70
+ layout: current_layout,
71
+ render_empty: true
72
+ }
73
+ end
74
+
75
+ def alpine_props
76
+ {
77
+ bg_color: bg_color_css,
78
+ text_color: text_color_css,
79
+ title: title&.value,
80
+ text_1: text_1&.value,
81
+ text_2: text_2&.value,
82
+ image_1: image_1_src,
83
+ image_2: image_2_src,
84
+ bg_image: bg_image_src,
85
+ layout: current_layout
86
+ }
87
+ end
88
+
89
+ def bg_color_css
90
+ @bg_color_options[:selected] if @bg_color_options
91
+ end
92
+
93
+ def text_color_css
94
+ @text_color_options[:selected] if @text_color_options
95
+ end
96
+
97
+ def bg_image_src
98
+ @bg_image_options[:src] if @bg_image_options
99
+ end
100
+
101
+ def image_1_src
102
+ @image_1_options[:src] if @image_1_options
103
+ end
104
+
105
+ def image_2_src
106
+ @image_2_options[:src] if @image_2_options
107
+ end
108
+
109
+ def current_layout
110
+ @layout_options&.fetch(:selected, DEFAULT_LAYOUT) || DEFAULT_LAYOUT
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,72 @@
1
+ module Coco
2
+ module Book
3
+ class EditableSlide < Coco::Component
4
+ include Concerns::AcceptsOptions
5
+ include Coco::TagHelper
6
+ include Coco::FormatHelper
7
+
8
+ accepts_option :layout, from: %w[one-col-title one-col-text one-col-media two-col-text two-col-media two-col-mixed], default: "one-col-title"
9
+
10
+ renders_one :title,
11
+ ->(&block) do
12
+ @has_content = true
13
+ block.call
14
+ end
15
+
16
+ renders_one :text_1,
17
+ ->(&block) do
18
+ @has_content = true
19
+ block.call
20
+ end
21
+
22
+ renders_one :text_2,
23
+ ->(&block) do
24
+ @has_content = true
25
+ block.call
26
+ end
27
+
28
+ renders_one :image_1,
29
+ ->(src: nil, &block) do
30
+ @has_content = true
31
+ block ? block.call : tag.img(src: src)
32
+ end
33
+
34
+ renders_one :image_2,
35
+ ->(src: nil, &block) do
36
+ @has_content = true
37
+ block ? block.call : tag.img(src: src)
38
+ end
39
+
40
+ before_initialize do |kwargs|
41
+ if kwargs[:layout]
42
+ kwargs[:layout] = kwargs[:layout].to_s.tr("_", "-")
43
+ kwargs[:layout] = "one-col-title" if kwargs[:layout] == "basic" # handle legacy layout name
44
+ end
45
+
46
+ kwargs
47
+ end
48
+
49
+ attr_reader :bg_image, :text_color_hex, :bg_color_hex
50
+
51
+ def initialize(bg_image: nil, bg_color_hex: nil, text_color_hex: nil, render_empty: false, **kwargs)
52
+ @bg_image = bg_image
53
+ @bg_color_hex = bg_color_hex
54
+ @text_color_hex = text_color_hex
55
+ @has_content = false
56
+ @render_empty = render_empty
57
+ end
58
+
59
+ def render?
60
+ @has_content || bg_image.present? || @render_empty == true
61
+ end
62
+
63
+ def slide_styles
64
+ style_str({
65
+ background_color: format_css_hex_color(bg_color_hex),
66
+ color: format_css_hex_color(text_color_hex),
67
+ background_image: ("url('#{bg_image}')" if bg_image)
68
+ })
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,12 @@
1
+ module Coco
2
+ module Book
3
+ class MediaSlide < Coco::Component
4
+ attr_reader :src, :alt
5
+
6
+ def initialize(src:, alt: nil, **kwargs)
7
+ @src = src
8
+ @alt = alt
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@assets/js/shared/coco.js";
1
+ import { CocoComponent } from "@assets/js/base/coco.js";
2
2
  import { camelCase } from "lodash";
3
3
 
4
4
  export default CocoComponent("button", (data = {}) => {
@@ -63,7 +63,7 @@ module Coco
63
63
  content: ->(&block) { block.call },
64
64
  confirmation: ->(**kwargs) do
65
65
  set_option_value(:confirm, true)
66
- Coco::App::Elements::ConfirmPanel.new(**kwargs)
66
+ Coco::ConfirmPanel.new(**kwargs)
67
67
  end
68
68
  }
69
69
 
@@ -257,7 +257,7 @@ module Coco
257
257
  end
258
258
  end
259
259
  class << self
260
- include Coco::SharedHelper
260
+ include Coco::ModalHelper
261
261
  end
262
262
  end
263
263
  end
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@assets/js/shared/coco.js";
1
+ import { CocoComponent } from "@assets/js/base/coco.js";
2
2
  import { getComponent } from "@helpers/alpine";
3
3
 
4
4
  export default CocoComponent("buttonDropdown", () => {
@@ -1,6 +1,6 @@
1
- import { CocoComponent } from "@assets/js/shared/coco.js";
1
+ import { CocoComponent } from "@assets/js/base/coco.js";
2
2
  import { getComponent } from "@helpers/alpine";
3
- import { createSingleton } from "@assets/js/libs/tippy";
3
+ import { createSingleton } from "@assets/js/base/tippy";
4
4
 
5
5
  export default CocoComponent("appButtonGroup", () => {
6
6
  return {
@@ -15,7 +15,7 @@ module Coco
15
15
 
16
16
  %i[confirmation].each do |slot_name|
17
17
  renders_one slot_name, ->(**kwargs, &block) do
18
- button.send("with_#{slot_name}".to_sym, **kwargs, &block)
18
+ button.send(:"with_#{slot_name}", **kwargs, &block)
19
19
  end
20
20
  end
21
21
 
@@ -1,5 +1,5 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-color-picker-button"] {
2
+ [data-coco][data-component="color-picker-button"] {
3
3
  @apply contents;
4
4
 
5
5
  .picker-icon {
@@ -10,7 +10,7 @@
10
10
  @apply w-full h-full block rounded-full bg-white border border-gray-900;
11
11
  }
12
12
 
13
- [data-component="app-color-picker"] {
13
+ [data-component="color-picker"] {
14
14
  @apply rounded-md;
15
15
  }
16
16
  }
@@ -1,5 +1,5 @@
1
1
  <%= render component_tag(x: {
2
- data: x_data("appColorPickerButton", {selected: selected}),
2
+ data: x_data("colorPickerButton", {selected: selected}),
3
3
  "@dropdown:mount": "onDropdownMount"
4
4
  }) do %>
5
5
  <div x-effect="$dispatch('color-picker:change', {color: selectedColor})">
@@ -1,7 +1,7 @@
1
- import { CocoComponent } from "@assets/js/shared/coco";
1
+ import { CocoComponent } from "@assets/js/base/coco";
2
2
  import { getData } from "@helpers/alpine";
3
3
 
4
- export default CocoComponent("appColorPickerButton", ({ selected }) => {
4
+ export default CocoComponent("colorPickerButton", ({ selected }) => {
5
5
  selected = selected ? "#" + selected.replace("#", "") : "#FFFFFF";
6
6
  return {
7
7
  selectedColor: selected,
@@ -0,0 +1,53 @@
1
+ module Coco
2
+ class ColorPickerButton < Coco::Component
3
+ include Concerns::WithDropdownOptions
4
+ include Concerns::WrapsComponent
5
+
6
+ wraps_component :button do |args|
7
+ Coco::Button.new(**args)
8
+ end
9
+
10
+ renders_one :text, Coco::Content
11
+
12
+ renders_one :picker, ->(picker = nil, **kwargs, &block) do
13
+ if picker.is_a?(Coco::ColorPicker)
14
+ picker
15
+ else
16
+ picker&.to_s.presence || Coco::ColorPicker.new(
17
+ size: @size,
18
+ resize: @resize,
19
+ selected: @selected,
20
+ **kwargs
21
+ )
22
+ end
23
+ end
24
+
25
+ renders_one :icon, ->(&block) do
26
+ tag.span class: "picker-icon", style: "color: #{@selected}", ":style": "{color: selectedColor}", &block
27
+ end
28
+
29
+ before_render do
30
+ with_picker(selected: @selected) unless picker?
31
+ unless icon?
32
+ with_icon do
33
+ tag.span class: "picker-button-color", ":style": "{backgroundColor: selectedColor}"
34
+ end
35
+ end
36
+ end
37
+
38
+ attr_reader :selected
39
+
40
+ def initialize(selected: nil, **kwargs)
41
+ @selected = selected
42
+
43
+ @size = kwargs.fetch(:size, :default)&.to_sym
44
+ if @size.in?(Coco::Button::SIZE_ALIASES.keys) && !kwargs.key?(:resize)
45
+ @size, @resize = Coco::Button::SIZE_ALIASES.fetch(@size)
46
+ end
47
+ end
48
+
49
+ def button_text
50
+ text || content
51
+ end
52
+ end
53
+ end
@@ -1,5 +1,5 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-confirm-panel"] {
2
+ [data-coco][data-component="confirm-panel"] {
3
3
  width: min-content;
4
4
  @apply px-5 py-4 text-center max-w-[200px] space-y-4;
5
5
 
@@ -1,4 +1,4 @@
1
- <%= render component_tag(x: {data: "appConfirmPanel"}) do %>
1
+ <%= render component_tag(x: {data: "confirmPanel"}) do %>
2
2
  <% if text? %>
3
3
  <div class="confirm-text">
4
4
  <%= text %>
@@ -1,6 +1,6 @@
1
- import { CocoComponent } from "@assets/js/shared/coco.js";
1
+ import { CocoComponent } from "@assets/js/base/coco.js";
2
2
 
3
- export default CocoComponent("appConfirmPanel", () => {
3
+ export default CocoComponent("confirmPanel", () => {
4
4
  return {
5
5
  confirm() {
6
6
  this.$dispatch("confirmation:confirm");
@@ -0,0 +1,19 @@
1
+ module Coco
2
+ class ConfirmPanel < Coco::Component
3
+ renders_one :button, ->(**kwargs, &block) do
4
+ coco_button(theme: :negative, **kwargs, fit: :full, size: :sm, &block)
5
+ end
6
+
7
+ renders_one :cancel, ->(**kwargs, &block) do
8
+ coco_button(theme: :secondary, **kwargs, fit: :full, size: :sm, &block)
9
+ end
10
+
11
+ renders_one :text, Coco::Content
12
+
13
+ before_render do
14
+ unless button?
15
+ raise ArgumentError, "No confirmation button defined"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,8 +1,8 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-image-picker-button"] {
2
+ [data-coco][data-component="image-picker-button"] {
3
3
  @apply contents;
4
4
 
5
- [data-component="app-image-picker"] {
5
+ [data-component="image-picker"] {
6
6
  @apply rounded-md;
7
7
  }
8
8
 
@@ -1,5 +1,5 @@
1
1
  <%= render component_tag(x: {
2
- data: x_data("appImagePickerButton", {src: src}),
2
+ data: x_data("imagePickerButton", {src: src}),
3
3
  "@dropdown:mount": "onDropdownMount",
4
4
  effect: "$dispatch('image-picker:change', {image: selectedImage})"
5
5
  }) do %>
@@ -1,8 +1,8 @@
1
- import { CocoComponent } from "@assets/js/shared/coco";
1
+ import { CocoComponent } from "@assets/js/base/coco";
2
2
  import { getData } from "@helpers/alpine";
3
3
  import { basename } from "@helpers/path";
4
4
 
5
- export default CocoComponent("appImagePickerButton", ({ src }) => {
5
+ export default CocoComponent("imagePickerButton", ({ src }) => {
6
6
  return {
7
7
  selectedImage: {
8
8
  name: basename(src),
@@ -0,0 +1,44 @@
1
+ module Coco
2
+ class ImagePickerButton < Coco::Component
3
+ include Concerns::WithDropdownOptions
4
+ include Concerns::WrapsComponent
5
+
6
+ wraps_component :button do |args|
7
+ Coco::Button.new(icon: :image_plus, **args)
8
+ end
9
+
10
+ renders_one :text, Coco::Content
11
+
12
+ renders_one :picker, ->(picker = nil, **kwargs, &block) do
13
+ if picker.is_a?(Coco::ImagePicker)
14
+ picker
15
+ else
16
+ picker&.to_s.presence || Coco::ImagePicker.new(
17
+ size: @size,
18
+ resize: @resize,
19
+ src: @src,
20
+ **kwargs
21
+ )
22
+ end
23
+ end
24
+
25
+ before_render do
26
+ with_picker(src: @src) unless picker?
27
+ end
28
+
29
+ attr_reader :src
30
+
31
+ def initialize(src: nil, **kwargs)
32
+ @src = src
33
+
34
+ @size = kwargs.fetch(:size, :default)&.to_sym
35
+ if @size.in?(Coco::Button::SIZE_ALIASES.keys) && !kwargs.key?(:resize)
36
+ @size, @resize = Coco::Button::SIZE_ALIASES.fetch(@size)
37
+ end
38
+ end
39
+
40
+ def button_text
41
+ text || content
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,5 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-layout-picker-button"] {
2
+ [data-coco][data-component="layout-picker-button"] {
3
3
  @apply contents;
4
4
 
5
5
  .layout-picker {
@@ -21,52 +21,52 @@
21
21
  /* Sizes */
22
22
 
23
23
  .layout-picker[data-size="sm"] {
24
- @apply app-layout-picker-sm;
24
+ @apply layout-picker-sm;
25
25
  }
26
26
 
27
27
  .layout-picker[data-size="md"] {
28
- @apply app-layout-picker-md;
28
+ @apply layout-picker-md;
29
29
  }
30
30
 
31
31
  @media screen(md) {
32
32
  .layout-picker[data-size-md="sm"] {
33
- @apply app-layout-picker-sm;
33
+ @apply layout-picker-sm;
34
34
  }
35
35
 
36
36
  .layout-picker[data-size-md="md"] {
37
- @apply app-layout-picker-md;
37
+ @apply layout-picker-md;
38
38
  }
39
39
  }
40
40
 
41
41
  @media screen(lg) {
42
42
  .layout-picker[data-size-lg="sm"] {
43
- @apply app-layout-picker-sm;
43
+ @apply layout-picker-sm;
44
44
  }
45
45
 
46
46
  .layout-picker[data-size-lg="md"] {
47
- @apply app-layout-picker-md;
47
+ @apply layout-picker-md;
48
48
  }
49
49
  }
50
50
 
51
51
  @media screen(xl) {
52
52
  .layout-picker[data-size-xl="sm"] {
53
- @apply app-layout-picker-sm;
53
+ @apply layout-picker-sm;
54
54
  }
55
55
 
56
56
  .layout-picker[data-size-xl="md"] {
57
- @apply app-layout-picker-md;
57
+ @apply layout-picker-md;
58
58
  }
59
59
  }
60
60
  }
61
61
  }
62
62
 
63
63
  @layer utilities {
64
- .app-layout-picker-sm {
64
+ .layout-picker-sm {
65
65
  width: 284px;
66
66
  @apply p-4 gap-4;
67
67
  }
68
68
 
69
- .app-layout-picker-md {
69
+ .layout-picker-md {
70
70
  width: 380px;
71
71
  @apply p-6 gap-6;
72
72
  }
@@ -1,5 +1,5 @@
1
1
  <%= render component_tag(x: {
2
- data: x_data("appLayoutPickerButton", {selected: selected})
2
+ data: x_data("layoutPickerButton", {selected: selected})
3
3
  }) do %>
4
4
  <div
5
5
  @layout-picker:selected="selectedLayout = $event.detail.layout"
@@ -1,7 +1,7 @@
1
- import { CocoComponent } from "@assets/js/shared/coco";
1
+ import { CocoComponent } from "@assets/js/base/coco";
2
2
  import { getData } from "@helpers/alpine";
3
3
 
4
- export default CocoComponent("appLayoutPickerButton", ({ selected }) => {
4
+ export default CocoComponent("layoutPickerButton", ({ selected }) => {
5
5
  return {
6
6
  selectedLayout: selected,
7
7
 
@@ -0,0 +1,33 @@
1
+ module Coco
2
+ class LayoutPickerButton < Coco::Component
3
+ include Concerns::AcceptsOptions
4
+ include Concerns::WithDropdownOptions
5
+ include Concerns::WrapsComponent
6
+
7
+ wraps_component :button do |args|
8
+ args[:class] = [args[:class], "layout-picker-trigger"]
9
+ Coco::Button.new(**args)
10
+ end
11
+
12
+ renders_many :layouts, ->(name:, thumbnail:, **layout_options) do
13
+ @layout_options << {name: name, thumbnail: thumbnail, **layout_options}
14
+ end
15
+
16
+ attr_reader :layout_options, :size, :resize
17
+
18
+ def initialize(selected: nil, **kwargs)
19
+ @selected = selected
20
+ @layout_options = []
21
+ @resize = {}
22
+
23
+ @size = kwargs.fetch(:size, :default)&.to_sym
24
+ if @size.in?(Coco::Button::SIZE_ALIASES.keys) && !kwargs.key?(:resize)
25
+ @size, @resize = Coco::Button::SIZE_ALIASES.fetch(@size)
26
+ end
27
+ end
28
+
29
+ def selected
30
+ @selected || @layout_options.first[:name]
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-menu"] {
2
+ [data-coco][data-component="menu"] {
3
3
  width: fit-content;
4
4
  max-width: 240px;
5
5
 
@@ -10,9 +10,7 @@
10
10
 
11
11
  > .coco-button-wrapper > .coco-button,
12
12
  > [data-component="button-to"] .coco-button,
13
- > [data-component="app-menu-button"]
14
- > .coco-button-wrapper
15
- > .coco-button {
13
+ > [data-component="menu-button"] > .coco-button-wrapper > .coco-button {
16
14
  @apply hover:bg-gray-blend-50 active:bg-gray-blend-100;
17
15
 
18
16
  .button-inner {
@@ -0,0 +1,37 @@
1
+ module Coco
2
+ class Menu < Coco::Component
3
+ include Concerns::ActsAsButtonGroup
4
+ include Concerns::AcceptsOptions
5
+
6
+ accepts_option :size, from: [:xs, :sm, :md, nil], default: :sm
7
+
8
+ renders_many :htmls, ->(*args, **kwargs, &block) do
9
+ init_button_group
10
+ items << block.call
11
+ end
12
+
13
+ before_render do
14
+ args[:resize]&.each { set_tag_data_attr("size-#{_1}", _2) }
15
+ end
16
+
17
+ def button_kwargs(kwargs, type = nil)
18
+ btn_kwargs = {
19
+ theme: nil,
20
+ size: get_option_value(:size),
21
+ resize: args[:resize],
22
+ **kwargs,
23
+ fit: :full,
24
+ collapsible: false
25
+ }
26
+
27
+ if type == :menu
28
+ btn_kwargs[:toggle] = :horizontal
29
+ btn_kwargs[:dropdown] ||= {
30
+ placement: "right-start"
31
+ }
32
+ end
33
+
34
+ btn_kwargs
35
+ end
36
+ end
37
+ end
@@ -1,5 +1,5 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-menu-button"] {
2
+ [data-coco][data-component="menu-button"] {
3
3
  @apply contents;
4
4
 
5
5
  &[data-fit="full"] {
@@ -1,4 +1,4 @@
1
- <%= render component_tag(x: {data: "appMenuButton"}) do %>
1
+ <%= render component_tag(x: {data: "menuButton"}) do %>
2
2
  <%= render button do |btn| %>
3
3
  <% if icon? %>
4
4
  <% btn.with_icon do %>
@@ -0,0 +1,6 @@
1
+ import { CocoComponent } from "@assets/js/base/coco";
2
+ import { getComponent } from "@helpers/alpine";
3
+
4
+ export default CocoComponent("menuButton", () => {
5
+ return {};
6
+ });