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.
- checksums.yaml +4 -4
- data/app/assets/build/coco/app.css +6576 -5446
- data/app/assets/build/coco/app.js +3142 -3169
- data/app/assets/build/coco/book.css +5169 -2130
- data/app/assets/build/coco/book.js +3986 -1565
- data/app/assets/css/app.css +2 -8
- data/app/assets/css/base/config.css +1 -0
- data/app/assets/css/{base.css → base/setup.css} +7 -4
- data/app/assets/css/{shared → base}/tippy.css +18 -0
- data/app/assets/css/book.css +2 -4
- data/app/assets/js/app.js +25 -9
- data/app/assets/js/{libs → base}/alpine/directives/dropdown.js +1 -1
- data/app/assets/js/{libs → base}/alpine/directives/tooltip.js +1 -1
- data/app/assets/js/{libs → base}/alpine/index.js +7 -7
- data/app/assets/js/{libs → base}/alpine/utils/tippy_modifiers.js +1 -1
- data/app/assets/js/base/setup.js +8 -0
- data/app/assets/js/book.js +4 -4
- data/app/components/coco/app/{layouts/application/application.css → application_layout/application_layout.css} +2 -2
- data/app/components/coco/app/{layouts/application/application.js → application_layout/application_layout.js} +1 -1
- data/app/components/coco/app/application_layout/application_layout.rb +16 -0
- data/app/components/coco/app/contact_callout/contact_callout.rb +21 -0
- data/app/components/coco/app/faqs/faqs.rb +14 -0
- data/app/components/coco/app/{blocks/header → header}/header.js +1 -1
- data/app/components/coco/app/header/header.rb +33 -0
- data/app/components/coco/app/{blocks/nav_drawer → nav_drawer}/nav_drawer.css +1 -1
- data/app/components/coco/app/{blocks/nav_drawer → nav_drawer}/nav_drawer.js +1 -1
- data/app/components/coco/app/nav_drawer/nav_drawer.rb +32 -0
- data/app/components/coco/app/plan_card/plan_card.rb +39 -0
- data/app/components/coco/app/{blocks/plan_picker → plan_picker}/plan_picker.css +3 -3
- data/app/components/coco/app/{blocks/plan_picker → plan_picker}/plan_picker.js +1 -1
- data/app/components/coco/app/plan_picker/plan_picker.rb +25 -0
- data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/item/item.js +2 -2
- data/app/components/coco/app/sidebar_nav/item/item.rb +48 -0
- data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/menu/menu.js +1 -1
- data/app/components/coco/app/sidebar_nav/menu/menu.rb +46 -0
- data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/navbar/navbar.html.erb +1 -1
- data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/navbar/navbar.js +2 -2
- data/app/components/coco/app/sidebar_nav/navbar/navbar.rb +50 -0
- data/app/components/coco/app/{blocks/slide_editor → slide_editor}/slide_editor.js +2 -2
- data/app/components/coco/app/slide_editor/slide_editor.rb +114 -0
- data/app/components/coco/book/editable_slide/editable_slide.rb +72 -0
- data/app/components/coco/book/media_slide/media_slide.rb +12 -0
- data/app/components/coco/{shared → buttons}/button/button.js +1 -1
- data/app/components/coco/{shared → buttons}/button/button.rb +2 -2
- data/app/components/coco/{shared → buttons}/button/button_dropdown.js +1 -1
- data/app/components/coco/{shared → buttons}/button_group/button_group.js +2 -2
- data/app/components/coco/{shared → buttons}/button_to/button_to.rb +1 -1
- data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.css +2 -2
- data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.html.erb +1 -1
- data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.js +2 -2
- data/app/components/coco/buttons/color_picker_button/color_picker_button.rb +53 -0
- data/app/components/coco/{app/elements → buttons}/confirm_panel/confirm_panel.css +1 -1
- data/app/components/coco/{app/elements → buttons}/confirm_panel/confirm_panel.html.erb +1 -1
- data/app/components/coco/{app/elements → buttons}/confirm_panel/confirm_panel.js +2 -2
- data/app/components/coco/buttons/confirm_panel/confirm_panel.rb +19 -0
- data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.css +2 -2
- data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.html.erb +1 -1
- data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.js +2 -2
- data/app/components/coco/buttons/image_picker_button/image_picker_button.rb +44 -0
- data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.css +11 -11
- data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.html.erb +1 -1
- data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.js +2 -2
- data/app/components/coco/buttons/layout_picker_button/layout_picker_button.rb +33 -0
- data/app/components/coco/{app/elements → buttons}/menu/menu.css +2 -4
- data/app/components/coco/buttons/menu/menu.rb +37 -0
- data/app/components/coco/{app/elements → buttons}/menu_button/menu_button.css +1 -1
- data/app/components/coco/{app/elements → buttons}/menu_button/menu_button.html.erb +1 -1
- data/app/components/coco/buttons/menu_button/menu_button.js +6 -0
- data/app/components/coco/buttons/menu_button/menu_button.rb +30 -0
- data/app/components/coco/{app/elements → buttons}/menu_items/user_profile/user_profile.css +1 -1
- data/app/components/coco/buttons/menu_items/user_profile/user_profile.rb +18 -0
- data/app/components/coco/{app/elements → buttons}/option_bar/option_bar.css +1 -1
- data/app/components/coco/buttons/option_bar/option_bar.rb +13 -0
- data/app/components/coco/{app/elements → buttons}/toolbar/toolbar.css +1 -1
- data/app/components/coco/{app/elements → buttons}/toolbar/toolbar.js +1 -1
- data/app/components/coco/buttons/toolbar/toolbar.rb +35 -0
- data/app/components/coco/component.rb +1 -1
- data/app/components/coco/concerns/acts_as_button_group.rb +4 -11
- data/app/components/coco/concerns/acts_as_field_with_html_options.rb +1 -1
- data/app/components/coco/concerns/acts_as_field_with_options.rb +2 -2
- data/app/components/coco/embeds/youtube_embed/youtube_embed.rb +16 -0
- data/app/components/coco/fields/button_component.rb +14 -0
- data/app/components/coco/fields/check_box_component.rb +7 -0
- data/app/components/coco/fields/collection_check_boxes_component.rb +7 -0
- data/app/components/coco/fields/collection_radio_buttons_component.rb +7 -0
- data/app/components/coco/fields/collection_select_component.rb +7 -0
- data/app/components/coco/fields/color_field_component.rb +7 -0
- data/app/components/coco/fields/date_field_component.rb +7 -0
- data/app/components/coco/fields/date_select_component.rb +7 -0
- data/app/components/coco/fields/datetime_local_field_component.rb +7 -0
- data/app/components/coco/fields/datetime_select_component.rb +7 -0
- data/app/components/coco/fields/email_field_component.rb +7 -0
- data/app/components/coco/fields/error_message_component.rb +7 -0
- data/app/components/coco/fields/file_field_component.rb +7 -0
- data/app/components/coco/fields/grouped_collection_select_component.rb +7 -0
- data/app/components/coco/fields/hint_component.rb +7 -0
- data/app/components/coco/fields/label_component.rb +7 -0
- data/app/components/coco/fields/month_field_component.rb +7 -0
- data/app/components/coco/fields/number_field_component.rb +7 -0
- data/app/components/coco/fields/password_field_component.rb +7 -0
- data/app/components/coco/fields/radio_button_component.rb +7 -0
- data/app/components/coco/fields/range_field_component.rb +7 -0
- data/app/components/coco/fields/search_field_component.rb +7 -0
- data/app/components/coco/fields/select_component.rb +7 -0
- data/app/components/coco/fields/submit_component.rb +14 -0
- data/app/components/coco/fields/telephone_field_component.rb +7 -0
- data/app/components/coco/fields/text_area_component.rb +7 -0
- data/app/components/coco/fields/text_field_component.rb +7 -0
- data/app/components/coco/fields/time_field_component.rb +7 -0
- data/app/components/coco/fields/time_select_component.rb +7 -0
- data/app/components/coco/fields/time_zone_select_component.rb +7 -0
- data/app/components/coco/fields/url_field_component.rb +7 -0
- data/app/components/coco/fields/week_field_component.rb +7 -0
- data/app/components/coco/fields/weekday_select_component.rb +7 -0
- data/app/components/coco/{shared → images}/icon/icon.js +1 -1
- data/app/components/coco/{shared → images}/image_uploader/image_uploader.js +1 -1
- data/app/components/coco/{app/elements → indicators}/stamp/stamp.css +1 -1
- data/app/components/coco/indicators/stamp/stamp.rb +25 -0
- data/app/components/coco/{app/layouts → layout}/page/page.css +5 -2
- data/app/components/coco/{app/layouts → layout}/page/page.js +1 -1
- data/app/components/coco/layout/page/page.rb +55 -0
- data/app/components/coco/{app/elements → messaging}/alert/alert.css +7 -7
- data/app/components/coco/{app/elements → messaging}/alert/alert.html.erb +1 -1
- data/app/components/coco/{app/elements → messaging}/alert/alert.js +2 -2
- data/app/components/coco/messaging/alert/alert.rb +75 -0
- data/app/components/coco/{app/elements → messaging}/notice/notice.css +1 -1
- data/app/components/coco/messaging/notice/notice.html.erb +5 -0
- data/app/components/coco/messaging/notice/notice.js +5 -0
- data/app/components/coco/messaging/notice/notice.rb +18 -0
- data/app/components/coco/{app/elements → messaging}/snackbar/snackbar.css +1 -1
- data/app/components/coco/{app/elements → messaging}/snackbar/snackbar.html.erb +1 -1
- data/app/components/coco/{app/elements → messaging}/snackbar/snackbar.js +2 -2
- data/app/components/coco/messaging/snackbar/snackbar.rb +34 -0
- data/app/components/coco/messaging/system_banner/system_banner.css +4 -0
- data/app/components/coco/messaging/system_banner/system_banner.html.erb +5 -0
- data/app/components/coco/{app/elements → messaging}/system_banner/system_banner.js +2 -2
- data/app/components/coco/messaging/system_banner/system_banner.rb +78 -0
- data/app/components/coco/{app/elements → messaging}/toast/toast.css +1 -1
- data/app/components/coco/{app/elements → messaging}/toast/toast.html.erb +1 -1
- data/app/components/coco/{app/elements → messaging}/toast/toast.js +2 -2
- data/app/components/coco/messaging/toast/toast.rb +19 -0
- data/app/components/coco/{shared → modals}/modal/modal.js +2 -2
- data/app/components/coco/{shared → modals}/modal/modal.rb +1 -0
- data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.js +1 -1
- data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.js +1 -1
- data/app/components/coco/{shared → navigation}/link/link.rb +1 -1
- data/app/components/coco/{shared/pager_link/pager_link.css → navigation/pager_button/pager_button.css} +1 -1
- data/app/components/coco/{shared/pager_link/pager_link.rb → navigation/pager_button/pager_button.rb} +1 -1
- data/app/components/coco/{app/elements → pickers}/color_picker/color_picker.css +11 -11
- data/app/components/coco/{app/elements → pickers}/color_picker/color_picker.html.erb +1 -1
- data/app/components/coco/{app/elements → pickers}/color_picker/color_picker.js +2 -2
- data/app/components/coco/pickers/color_picker/color_picker.rb +48 -0
- data/app/components/coco/{app/elements → pickers}/image_picker/image_picker.css +11 -11
- data/app/components/coco/{app/elements → pickers}/image_picker/image_picker.html.erb +1 -1
- data/app/components/coco/{app/elements → pickers}/image_picker/image_picker.js +2 -2
- data/app/components/coco/pickers/image_picker/image_picker.rb +20 -0
- data/app/components/coco/presented_component.rb +1 -1
- data/app/components/coco/{shared → utilities}/dropdown/dropdown.js +1 -1
- data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.js +1 -1
- data/app/components/coco/{app/elements → utilities}/seamless_textarea/seamless_textarea.css +1 -1
- data/app/components/coco/{app/elements → utilities}/seamless_textarea/seamless_textarea.html.erb +1 -1
- data/app/components/coco/{app/elements → utilities}/seamless_textarea/seamless_textarea.js +2 -2
- data/app/components/coco/utilities/seamless_textarea/seamless_textarea.rb +25 -0
- data/app/helpers/coco/app_components_helper.rb +35 -0
- data/app/helpers/coco/book_components_helper.rb +11 -0
- data/app/helpers/coco/components_helper.rb +7 -0
- data/app/helpers/coco/core_components_helper.rb +257 -0
- data/app/helpers/coco/helpers.rb +2 -2
- data/app/helpers/coco/modal_helper.rb +22 -0
- data/config/locales/coco.en.yml +17 -18
- data/config/{tailwind.base.config.cjs → tailwind.config.cjs} +10 -0
- data/config/tokens.cjs +9 -23
- data/lib/coco/app_form_builder.rb +1 -1
- data/lib/coco/engine.rb +3 -3
- data/lib/coco.rb +1 -1
- metadata +251 -258
- data/app/assets/css/app/config.css +0 -1
- data/app/assets/css/app/tippy.css +0 -19
- data/app/assets/css/book/config.css +0 -1
- data/app/assets/js/app/components.js +0 -4
- data/app/assets/js/app/setup.js +0 -23
- data/app/assets/js/book/components.js +0 -4
- data/app/assets/js/shared/components.js +0 -4
- data/app/components/coco/app/blocks/contact_callout/contact_callout.rb +0 -23
- data/app/components/coco/app/blocks/faqs/faqs.rb +0 -16
- data/app/components/coco/app/blocks/header/header.rb +0 -35
- data/app/components/coco/app/blocks/nav_drawer/nav_drawer.rb +0 -34
- data/app/components/coco/app/blocks/plan_picker/plan_picker.rb +0 -27
- data/app/components/coco/app/blocks/sidebar_nav/item/item.rb +0 -50
- data/app/components/coco/app/blocks/sidebar_nav/menu/menu.rb +0 -48
- data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.rb +0 -50
- data/app/components/coco/app/blocks/slide_editor/slide_editor.rb +0 -116
- data/app/components/coco/app/elements/alert/alert.rb +0 -79
- data/app/components/coco/app/elements/color_picker/color_picker.rb +0 -53
- data/app/components/coco/app/elements/color_picker_button/color_picker_button.rb +0 -58
- data/app/components/coco/app/elements/confirm_panel/confirm_panel.rb +0 -23
- data/app/components/coco/app/elements/image_picker/image_picker.rb +0 -25
- data/app/components/coco/app/elements/image_picker_button/image_picker_button.rb +0 -49
- data/app/components/coco/app/elements/layout_picker_button/layout_picker_button.rb +0 -38
- data/app/components/coco/app/elements/menu/menu.rb +0 -41
- data/app/components/coco/app/elements/menu_button/menu_button.js +0 -6
- data/app/components/coco/app/elements/menu_button/menu_button.rb +0 -35
- data/app/components/coco/app/elements/menu_items/user_profile/user_profile.rb +0 -20
- data/app/components/coco/app/elements/notice/notice.html.erb +0 -5
- data/app/components/coco/app/elements/notice/notice.js +0 -5
- data/app/components/coco/app/elements/notice/notice.rb +0 -22
- data/app/components/coco/app/elements/option_bar/option_bar.rb +0 -17
- data/app/components/coco/app/elements/plan_card/plan_card.rb +0 -41
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.rb +0 -29
- data/app/components/coco/app/elements/snackbar/snackbar.rb +0 -38
- data/app/components/coco/app/elements/stamp/stamp.rb +0 -29
- data/app/components/coco/app/elements/system_banner/system_banner.css +0 -4
- data/app/components/coco/app/elements/system_banner/system_banner.html.erb +0 -5
- data/app/components/coco/app/elements/system_banner/system_banner.rb +0 -82
- data/app/components/coco/app/elements/toast/toast.rb +0 -23
- data/app/components/coco/app/elements/toolbar/toolbar.rb +0 -41
- data/app/components/coco/app/fields/button_component.rb +0 -16
- data/app/components/coco/app/fields/check_box_component.rb +0 -9
- data/app/components/coco/app/fields/collection_check_boxes_component.rb +0 -9
- data/app/components/coco/app/fields/collection_radio_buttons_component.rb +0 -9
- data/app/components/coco/app/fields/collection_select_component.rb +0 -9
- data/app/components/coco/app/fields/color_field_component.rb +0 -9
- data/app/components/coco/app/fields/date_field_component.rb +0 -9
- data/app/components/coco/app/fields/date_select_component.rb +0 -9
- data/app/components/coco/app/fields/datetime_local_field_component.rb +0 -9
- data/app/components/coco/app/fields/datetime_select_component.rb +0 -9
- data/app/components/coco/app/fields/email_field_component.rb +0 -9
- data/app/components/coco/app/fields/error_message_component.rb +0 -9
- data/app/components/coco/app/fields/file_field_component.rb +0 -9
- data/app/components/coco/app/fields/grouped_collection_select_component.rb +0 -9
- data/app/components/coco/app/fields/hint_component.rb +0 -9
- data/app/components/coco/app/fields/label_component.rb +0 -9
- data/app/components/coco/app/fields/month_field_component.rb +0 -9
- data/app/components/coco/app/fields/number_field_component.rb +0 -9
- data/app/components/coco/app/fields/password_field_component.rb +0 -9
- data/app/components/coco/app/fields/radio_button_component.rb +0 -9
- data/app/components/coco/app/fields/range_field_component.rb +0 -9
- data/app/components/coco/app/fields/search_field_component.rb +0 -9
- data/app/components/coco/app/fields/select_component.rb +0 -9
- data/app/components/coco/app/fields/submit_component.rb +0 -16
- data/app/components/coco/app/fields/telephone_field_component.rb +0 -9
- data/app/components/coco/app/fields/text_area_component.rb +0 -9
- data/app/components/coco/app/fields/text_field_component.rb +0 -9
- data/app/components/coco/app/fields/time_field_component.rb +0 -9
- data/app/components/coco/app/fields/time_select_component.rb +0 -9
- data/app/components/coco/app/fields/time_zone_select_component.rb +0 -9
- data/app/components/coco/app/fields/url_field_component.rb +0 -9
- data/app/components/coco/app/fields/week_field_component.rb +0 -9
- data/app/components/coco/app/fields/weekday_select_component.rb +0 -9
- data/app/components/coco/app/layouts/application/application.rb +0 -18
- data/app/components/coco/app/layouts/page/page.rb +0 -59
- data/app/components/coco/book/blocks/slides/editable_slide/editable_slide.rb +0 -76
- data/app/components/coco/book/blocks/slides/media_slide/media_slide.rb +0 -16
- data/app/components/coco/shared/embeds/youtube/youtube.rb +0 -20
- data/app/helpers/coco/app_helper.rb +0 -141
- data/app/helpers/coco/book_helper.rb +0 -11
- data/app/helpers/coco/component_helper.rb +0 -15
- data/app/helpers/coco/shared_helper.rb +0 -111
- data/app/helpers/coco/url_helper.rb +0 -30
- data/config/tailwind.app.config.cjs +0 -21
- data/config/tailwind.book.config.cjs +0 -21
- /data/app/assets/css/{shared → base}/utils/colors.css +0 -0
- /data/app/assets/css/{shared → base}/utils/icons.css +0 -0
- /data/app/assets/css/{app/utils.css → base/utils/layout.css} +0 -0
- /data/app/assets/css/{shared → base}/utils/text.css +0 -0
- /data/app/assets/js/{libs → base}/alpine/directives/destroy.js +0 -0
- /data/app/assets/js/{libs → base}/alpine/directives/dimensions.js +0 -0
- /data/app/assets/js/{libs → base}/alpine/directives/notification.js +0 -0
- /data/app/assets/js/{libs → base}/alpine/directives/options.js +0 -0
- /data/app/assets/js/{libs → base}/alpine/directives/undo.js +0 -0
- /data/app/assets/js/{shared → base}/coco.js +0 -0
- /data/app/assets/js/{libs → base}/tippy/index.js +0 -0
- /data/app/assets/js/{libs → base}/tippy/plugins/hide_on_esc.js +0 -0
- /data/app/components/coco/app/{layouts/application/application.html.erb → application_layout/application_layout.html.erb} +0 -0
- /data/app/components/coco/app/{blocks/contact_callout → contact_callout}/contact_callout.css +0 -0
- /data/app/components/coco/app/{blocks/contact_callout → contact_callout}/contact_callout.html.erb +0 -0
- /data/app/components/coco/app/{blocks/faqs → faqs}/faqs.css +0 -0
- /data/app/components/coco/app/{blocks/faqs → faqs}/faqs.html.erb +0 -0
- /data/app/components/coco/app/{blocks/header → header}/header.css +0 -0
- /data/app/components/coco/app/{blocks/header → header}/header.html.erb +0 -0
- /data/app/components/coco/app/{blocks/nav_drawer → nav_drawer}/nav_drawer.html.erb +0 -0
- /data/app/components/coco/app/{elements/plan_card → plan_card}/plan_card.css +0 -0
- /data/app/components/coco/app/{elements/plan_card → plan_card}/plan_card.html.erb +0 -0
- /data/app/components/coco/app/{blocks/plan_picker → plan_picker}/plan_picker.html.erb +0 -0
- /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/item/item.css +0 -0
- /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/item/item.html.erb +0 -0
- /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/menu/menu.css +0 -0
- /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/menu/menu.html.erb +0 -0
- /data/app/components/coco/app/{blocks/sidebar_nav → sidebar_nav}/navbar/navbar.css +0 -0
- /data/app/components/coco/app/{blocks/slide_editor → slide_editor}/slide_editor.css +0 -0
- /data/app/components/coco/app/{blocks/slide_editor → slide_editor}/slide_editor.html.erb +0 -0
- /data/app/components/coco/book/{blocks/slides/editable_slide → editable_slide}/editable_slide.css +0 -0
- /data/app/components/coco/book/{blocks/slides/editable_slide → editable_slide}/editable_slide.html.erb +0 -0
- /data/app/components/coco/book/{blocks/slides/media_slide → media_slide}/media_slide.css +0 -0
- /data/app/components/coco/book/{blocks/slides/media_slide → media_slide}/media_slide.html.erb +0 -0
- /data/app/components/coco/{shared → buttons}/button/button.css +0 -0
- /data/app/components/coco/{shared → buttons}/button/button.html.erb +0 -0
- /data/app/components/coco/{shared → buttons}/button_group/button_group.css +0 -0
- /data/app/components/coco/{shared → buttons}/button_group/button_group.html.erb +0 -0
- /data/app/components/coco/{shared → buttons}/button_group/button_group.rb +0 -0
- /data/app/components/coco/{shared → buttons}/button_to/button_to.css +0 -0
- /data/app/components/coco/{shared → buttons}/button_to/button_to.html.erb +0 -0
- /data/app/components/coco/{app/elements → buttons}/menu/menu.html.erb +0 -0
- /data/app/components/coco/{app/elements → buttons}/menu_items/user_profile/user_profile.html.erb +0 -0
- /data/app/components/coco/{app/elements → buttons}/option_bar/option_bar.html.erb +0 -0
- /data/app/components/coco/{app/elements → buttons}/toolbar/toolbar.html.erb +0 -0
- /data/app/components/coco/{shared/embeds/youtube/youtube.css → embeds/youtube_embed/youtube_embed.css} +0 -0
- /data/app/components/coco/{shared/embeds/youtube/youtube.html.erb → embeds/youtube_embed/youtube_embed.html.erb} +0 -0
- /data/app/components/coco/{shared → images}/avatar/avatar.css +0 -0
- /data/app/components/coco/{shared → images}/avatar/avatar.rb +0 -0
- /data/app/components/coco/{shared → images}/icon/icon.css +0 -0
- /data/app/components/coco/{shared → images}/icon/icon.html.erb +0 -0
- /data/app/components/coco/{shared → images}/icon/icon.rb +0 -0
- /data/app/components/coco/{shared → images}/image/image.css +0 -0
- /data/app/components/coco/{shared → images}/image/image.rb +0 -0
- /data/app/components/coco/{shared → images}/image_uploader/image_uploader.css +0 -0
- /data/app/components/coco/{shared → images}/image_uploader/image_uploader.html.erb +0 -0
- /data/app/components/coco/{shared → images}/image_uploader/image_uploader.rb +0 -0
- /data/app/components/coco/{shared → images}/svg/svg.html.erb +0 -0
- /data/app/components/coco/{shared → images}/svg/svg.rb +0 -0
- /data/app/components/coco/{shared → indicators}/badge/badge.css +0 -0
- /data/app/components/coco/{shared → indicators}/badge/badge.html.erb +0 -0
- /data/app/components/coco/{shared → indicators}/badge/badge.rb +0 -0
- /data/app/components/coco/{app/elements → indicators}/stamp/stamp.html.erb +0 -0
- /data/app/components/coco/{app/layouts → layout}/page/page.html.erb +0 -0
- /data/app/components/coco/{shared → layout}/panel/panel.css +0 -0
- /data/app/components/coco/{shared → layout}/panel/panel.html.erb +0 -0
- /data/app/components/coco/{shared → layout}/panel/panel.rb +0 -0
- /data/app/components/coco/{shared → layout}/spacer/spacer.css +0 -0
- /data/app/components/coco/{shared → layout}/spacer/spacer.rb +0 -0
- /data/app/components/coco/{shared → layout}/stack/stack.css +0 -0
- /data/app/components/coco/{shared → layout}/stack/stack.html.erb +0 -0
- /data/app/components/coco/{shared → layout}/stack/stack.rb +0 -0
- /data/app/components/coco/{shared → modals}/modal/modal.css +0 -0
- /data/app/components/coco/{shared → modals}/modal/modal.html.erb +0 -0
- /data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.css +0 -0
- /data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.html.erb +0 -0
- /data/app/components/coco/{shared → modals}/modal_dialog/modal_dialog.rb +0 -0
- /data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.css +0 -0
- /data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.html.erb +0 -0
- /data/app/components/coco/{shared → modals}/modal_lightbox/modal_lightbox.rb +0 -0
- /data/app/components/coco/{shared → navigation}/link/link.css +0 -0
- /data/app/components/coco/{shared/pager_link/pager_link.html.erb → navigation/pager_button/pager_button.html.erb} +0 -0
- /data/app/components/coco/{shared → typography}/prose/prose.css +0 -0
- /data/app/components/coco/{shared → typography}/prose/prose.rb +0 -0
- /data/app/components/coco/{shared → utilities}/content/content.rb +0 -0
- /data/app/components/coco/{shared → utilities}/dropdown/dropdown.css +0 -0
- /data/app/components/coco/{shared → utilities}/dropdown/dropdown.html.erb +0 -0
- /data/app/components/coco/{shared → utilities}/dropdown/dropdown.rb +0 -0
- /data/app/components/coco/{shared → utilities}/placeholder/placeholder.css +0 -0
- /data/app/components/coco/{shared → utilities}/placeholder/placeholder.html.erb +0 -0
- /data/app/components/coco/{shared → utilities}/placeholder/placeholder.rb +0 -0
- /data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.css +0 -0
- /data/app/components/coco/{shared → utilities}/poll_controller/poll_controller.html.erb +0 -0
- /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
|
@@ -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::
|
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::
|
260
|
+
include Coco::ModalHelper
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
1
|
+
import { CocoComponent } from "@assets/js/base/coco.js";
|
2
2
|
import { getComponent } from "@helpers/alpine";
|
3
|
-
import { createSingleton } from "@assets/js/
|
3
|
+
import { createSingleton } from "@assets/js/base/tippy";
|
4
4
|
|
5
5
|
export default CocoComponent("appButtonGroup", () => {
|
6
6
|
return {
|
data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.css
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
@layer components {
|
2
|
-
[data-coco][data-component="
|
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="
|
13
|
+
[data-component="color-picker"] {
|
14
14
|
@apply rounded-md;
|
15
15
|
}
|
16
16
|
}
|
data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.html.erb
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= render component_tag(x: {
|
2
|
-
data: x_data("
|
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})">
|
data/app/components/coco/{app/elements → buttons}/color_picker_button/color_picker_button.js
RENAMED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
1
|
+
import { CocoComponent } from "@assets/js/base/coco";
|
2
2
|
import { getData } from "@helpers/alpine";
|
3
3
|
|
4
|
-
export default CocoComponent("
|
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,6 +1,6 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
1
|
+
import { CocoComponent } from "@assets/js/base/coco.js";
|
2
2
|
|
3
|
-
export default CocoComponent("
|
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
|
data/app/components/coco/{app/elements → buttons}/image_picker_button/image_picker_button.js
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
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("
|
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
|
data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.css
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
@layer components {
|
2
|
-
[data-coco][data-component="
|
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
|
24
|
+
@apply layout-picker-sm;
|
25
25
|
}
|
26
26
|
|
27
27
|
.layout-picker[data-size="md"] {
|
28
|
-
@apply
|
28
|
+
@apply layout-picker-md;
|
29
29
|
}
|
30
30
|
|
31
31
|
@media screen(md) {
|
32
32
|
.layout-picker[data-size-md="sm"] {
|
33
|
-
@apply
|
33
|
+
@apply layout-picker-sm;
|
34
34
|
}
|
35
35
|
|
36
36
|
.layout-picker[data-size-md="md"] {
|
37
|
-
@apply
|
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
|
43
|
+
@apply layout-picker-sm;
|
44
44
|
}
|
45
45
|
|
46
46
|
.layout-picker[data-size-lg="md"] {
|
47
|
-
@apply
|
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
|
53
|
+
@apply layout-picker-sm;
|
54
54
|
}
|
55
55
|
|
56
56
|
.layout-picker[data-size-xl="md"] {
|
57
|
-
@apply
|
57
|
+
@apply layout-picker-md;
|
58
58
|
}
|
59
59
|
}
|
60
60
|
}
|
61
61
|
}
|
62
62
|
|
63
63
|
@layer utilities {
|
64
|
-
.
|
64
|
+
.layout-picker-sm {
|
65
65
|
width: 284px;
|
66
66
|
@apply p-4 gap-4;
|
67
67
|
}
|
68
68
|
|
69
|
-
.
|
69
|
+
.layout-picker-md {
|
70
70
|
width: 380px;
|
71
71
|
@apply p-6 gap-6;
|
72
72
|
}
|
data/app/components/coco/{app/elements → buttons}/layout_picker_button/layout_picker_button.js
RENAMED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { CocoComponent } from "@assets/js/
|
1
|
+
import { CocoComponent } from "@assets/js/base/coco";
|
2
2
|
import { getData } from "@helpers/alpine";
|
3
3
|
|
4
|
-
export default CocoComponent("
|
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="
|
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="
|
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
|