coveragebook_components 0.15.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/{book.css → coco.css} +1158 -1796
  3. data/app/assets/build/coco/coco.js +11206 -10950
  4. data/app/assets/build/coco/tailwind.preset.js +2760 -0
  5. data/app/assets/css/base/setup.css +0 -43
  6. data/app/assets/css/base/tippy.css +40 -43
  7. data/app/assets/css/base/utils/text.css +0 -210
  8. data/app/assets/css/coco.css +34 -0
  9. data/app/assets/css/plugins/aspect.js +27 -0
  10. data/app/assets/css/plugins/colors.js +30 -0
  11. data/app/assets/css/plugins/icons.js +17 -0
  12. data/app/assets/css/plugins/layout.js +15 -0
  13. data/app/assets/css/plugins/text.js +183 -0
  14. data/app/assets/js/base/tippy/plugins/hide_on_esc.js +3 -1
  15. data/app/assets/js/coco/coco.js +0 -9
  16. data/app/assets/js/coco.js +5 -0
  17. data/app/assets/js/helpers/index.js +10 -2
  18. data/app/components/coco/buttons/button/button.css +5 -5
  19. data/app/components/coco/buttons/button_group/button_group.css +1 -1
  20. data/app/components/coco/buttons/color_picker_button/color_picker_button.css +1 -1
  21. data/app/components/coco/buttons/layout_picker_button/layout_picker_button.html.erb +5 -1
  22. data/app/components/coco/buttons/layout_picker_button/layout_picker_button.rb +2 -2
  23. data/app/components/coco/buttons/menu/menu.css +1 -1
  24. data/app/components/coco/buttons/menu_items/user_profile/user_profile.css +1 -1
  25. data/app/components/coco/component.rb +1 -1
  26. data/app/components/coco/concerns/acts_as_field_with_options.rb +0 -1
  27. data/app/components/coco/fields/button_component.rb +1 -1
  28. data/app/components/coco/fields/submit_component.rb +1 -1
  29. data/app/components/coco/indicators/badge/badge.css +1 -1
  30. data/app/components/coco/layout/panel/panel.css +1 -1
  31. data/app/components/coco/modals/modal/modal.css +1 -1
  32. data/app/components/coco/modals/modal_dialog/modal_dialog.css +1 -1
  33. data/app/components/coco/utilities/placeholder/placeholder.css +1 -1
  34. data/app/helpers/coco/components_helper.rb +253 -3
  35. data/app/helpers/coco/integration_helper.rb +26 -4
  36. data/config/exports.js +0 -0
  37. data/config/locales/coco.en.yml +0 -18
  38. data/config/tailwind.config.js +1 -83
  39. data/config/tailwind.preset.js +67 -0
  40. data/config/tokens.js +25 -21
  41. data/lib/coco/engine.rb +0 -4
  42. data/lib/coco.rb +1 -1
  43. metadata +12 -68
  44. data/app/assets/build/coco/app.css +0 -9711
  45. data/app/assets/build/coco/app.js +0 -25142
  46. data/app/assets/build/coco/book.js +0 -16548
  47. data/app/assets/css/app.css +0 -3
  48. data/app/assets/css/base/utils/colors.css +0 -30
  49. data/app/assets/css/base/utils/icons.css +0 -16
  50. data/app/assets/css/base/utils/layout.css +0 -13
  51. data/app/assets/css/book.css +0 -3
  52. data/app/assets/js/app.js +0 -11
  53. data/app/assets/js/book.js +0 -9
  54. data/app/assets/js/helpers/screenshot.js +0 -42
  55. data/app/assets/js/helpers/turbo_events.js +0 -13
  56. data/app/components/coco/app/application_layout/application_layout.css +0 -122
  57. data/app/components/coco/app/application_layout/application_layout.html.erb +0 -32
  58. data/app/components/coco/app/application_layout/application_layout.js +0 -36
  59. data/app/components/coco/app/application_layout/application_layout.rb +0 -16
  60. data/app/components/coco/app/contact_callout/contact_callout.css +0 -119
  61. data/app/components/coco/app/contact_callout/contact_callout.html.erb +0 -28
  62. data/app/components/coco/app/contact_callout/contact_callout.rb +0 -21
  63. data/app/components/coco/app/faqs/faqs.css +0 -38
  64. data/app/components/coco/app/faqs/faqs.html.erb +0 -12
  65. data/app/components/coco/app/faqs/faqs.rb +0 -14
  66. data/app/components/coco/app/header/header.css +0 -47
  67. data/app/components/coco/app/header/header.html.erb +0 -30
  68. data/app/components/coco/app/header/header.js +0 -11
  69. data/app/components/coco/app/header/header.rb +0 -33
  70. data/app/components/coco/app/nav_drawer/nav_drawer.css +0 -58
  71. data/app/components/coco/app/nav_drawer/nav_drawer.html.erb +0 -16
  72. data/app/components/coco/app/nav_drawer/nav_drawer.js +0 -24
  73. data/app/components/coco/app/nav_drawer/nav_drawer.rb +0 -32
  74. data/app/components/coco/app/plan_card/plan_card.css +0 -132
  75. data/app/components/coco/app/plan_card/plan_card.html.erb +0 -36
  76. data/app/components/coco/app/plan_card/plan_card.rb +0 -66
  77. data/app/components/coco/app/plan_confirmation/plan_confirmation.css +0 -53
  78. data/app/components/coco/app/plan_confirmation/plan_confirmation.html.erb +0 -16
  79. data/app/components/coco/app/plan_confirmation/plan_confirmation.rb +0 -18
  80. data/app/components/coco/app/plan_picker/plan_picker.css +0 -128
  81. data/app/components/coco/app/plan_picker/plan_picker.html.erb +0 -69
  82. data/app/components/coco/app/plan_picker/plan_picker.js +0 -56
  83. data/app/components/coco/app/plan_picker/plan_picker.rb +0 -25
  84. data/app/components/coco/app/sidebar_nav/item/item.css +0 -121
  85. data/app/components/coco/app/sidebar_nav/item/item.html.erb +0 -9
  86. data/app/components/coco/app/sidebar_nav/item/item.js +0 -80
  87. data/app/components/coco/app/sidebar_nav/item/item.rb +0 -48
  88. data/app/components/coco/app/sidebar_nav/menu/menu.css +0 -138
  89. data/app/components/coco/app/sidebar_nav/menu/menu.html.erb +0 -24
  90. data/app/components/coco/app/sidebar_nav/menu/menu.js +0 -12
  91. data/app/components/coco/app/sidebar_nav/menu/menu.rb +0 -46
  92. data/app/components/coco/app/sidebar_nav/navbar/navbar.css +0 -75
  93. data/app/components/coco/app/sidebar_nav/navbar/navbar.html.erb +0 -29
  94. data/app/components/coco/app/sidebar_nav/navbar/navbar.js +0 -28
  95. data/app/components/coco/app/sidebar_nav/navbar/navbar.rb +0 -50
  96. data/app/components/coco/app/slide_editor/slide_editor.css +0 -149
  97. data/app/components/coco/app/slide_editor/slide_editor.html.erb +0 -302
  98. data/app/components/coco/app/slide_editor/slide_editor.js +0 -269
  99. data/app/components/coco/app/slide_editor/slide_editor.rb +0 -114
  100. data/app/components/coco/book/editable_slide/editable_slide.css +0 -332
  101. data/app/components/coco/book/editable_slide/editable_slide.html.erb +0 -48
  102. data/app/components/coco/book/editable_slide/editable_slide.rb +0 -72
  103. data/app/components/coco/book/media_slide/media_slide.css +0 -7
  104. data/app/components/coco/book/media_slide/media_slide.html.erb +0 -3
  105. data/app/components/coco/book/media_slide/media_slide.rb +0 -12
  106. data/app/helpers/coco/app_components_helper.rb +0 -39
  107. data/app/helpers/coco/book_components_helper.rb +0 -11
  108. data/app/helpers/coco/core_components_helper.rb +0 -257
@@ -1,48 +0,0 @@
1
- <%= render component_tag(style: slide_styles, class: {"with-title": title?}) do %>
2
- <div class="slide-aspect">
3
- <div class="slide-container">
4
- <div class="slide-layout">
5
-
6
- <div class="slide-group" data-role="group-primary-text">
7
- <% if title? %>
8
- <header class="slide-header" data-role="header">
9
- <h3 class="slide-title" data-role="title">
10
- <%= title %>
11
- </h3>
12
- </header>
13
- <% end %>
14
-
15
- <% if text_1? %>
16
- <div class="slide-text" data-role="text-primary">
17
- <%= text_1 %>
18
- </div>
19
- <% end %>
20
- </div>
21
-
22
- <% if image_1? %>
23
- <div class="slide-media" data-role="media-primary">
24
- <div class="slide-media-wrapper">
25
- <%= image_1 %>
26
- </div>
27
- </div>
28
- <% end %>
29
-
30
- <div class="slide-group" data-role="group-secondary-text">
31
- <% if text_2? %>
32
- <div class="slide-text" data-role="text-secondary">
33
- <%= text_2 %>
34
- </div>
35
- <% end %>
36
- </div>
37
-
38
- <% if image_2? %>
39
- <div class="slide-media" data-role="media-secondary">
40
- <div class="slide-media-wrapper">
41
- <%= image_2 %>
42
- </div>
43
- </div>
44
- <% end %>
45
- </div>
46
- </div>
47
- </div>
48
- <% end %>
@@ -1,72 +0,0 @@
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
@@ -1,7 +0,0 @@
1
- @layer components {
2
- [data-coco][data-component="book-media-slide"] {
3
- img {
4
- @apply w-full h-full object-contain rounded-md;
5
- }
6
- }
7
- }
@@ -1,3 +0,0 @@
1
- <%= render component_tag(:figure) do %>
2
- <%= image_tag src, alt: alt %>
3
- <% end %>
@@ -1,12 +0,0 @@
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,39 +0,0 @@
1
- module Coco
2
- module AppComponentsHelper
3
- def coco_plan_card(**, &block)
4
- render Coco::App::PlanCard.new(**), &block
5
- end
6
-
7
- def coco_faqs(**, &block)
8
- render Coco::App::Faqs.new(**), &block
9
- end
10
-
11
- def coco_contact_callout(**, &block)
12
- render Coco::App::ContactCallout.new(**), &block
13
- end
14
-
15
- def coco_plan_picker(**, &block)
16
- render Coco::App::PlanPicker.new(**), &block
17
- end
18
-
19
- def coco_plan_confirmation(**, &block)
20
- render Coco::App::PlanConfirmation.new(**), &block
21
- end
22
-
23
- def coco_app_header(*, **, &block)
24
- render Coco::App::Header.new(*, **), &block
25
- end
26
-
27
- def coco_sidebar_nav(*, **, &block)
28
- render Coco::App::SidebarNav::Navbar.new(*, **), &block
29
- end
30
-
31
- def coco_sidebar_nav_menu(*, **, &block)
32
- render Coco::App::SidebarNav::Menu.new(*, **), &block
33
- end
34
-
35
- def coco_app_layout(**, &block)
36
- render Coco::App::ApplicationLayout.new(**), &block
37
- end
38
- end
39
- end
@@ -1,11 +0,0 @@
1
- module Coco
2
- module BookComponentsHelper
3
- def coco_editable_slide(**, &block)
4
- render Coco::Book::EditableSlide.new(**), &block
5
- end
6
-
7
- def coco_media_slide(src = nil, **, &block)
8
- render Coco::Book::MediaSlide.new(src: src, **), &block
9
- end
10
- end
11
- end
@@ -1,257 +0,0 @@
1
- module Coco
2
- module CoreComponentsHelper
3
- include ActionView::Helpers::UrlHelper
4
-
5
- # Buttons
6
-
7
- def coco_button(*args, **kwargs, &block)
8
- href, content = if block
9
- [args.first, nil]
10
- else
11
- (args.size == 1) ? [nil, args.first] : args[0..2].reverse!
12
- end
13
-
14
- button = if kwargs.key?(:action) || kwargs.key?(:method) || kwargs.key?(:params)
15
- "Coco::ButtonTo"
16
- else
17
- "Coco::Button"
18
- end
19
-
20
- component = button.constantize.new(href: href, **kwargs)
21
- component = component.with_content(content) if !block && content.present?
22
-
23
- render(component, &block)
24
- end
25
-
26
- def coco_button_group(**, &block)
27
- render Coco::ButtonGroup.new(**), &block
28
- end
29
-
30
- def coco_menu_button(**, &block)
31
- render Coco::MenuButton.new(**), &block
32
- end
33
-
34
- def coco_menu_item(type, **, &block)
35
- render coco_component("menu_items/#{type}", **), &block
36
- end
37
-
38
- def coco_confirm_button(href = nil, **, &block)
39
- render Coco::ConfirmButton.new(href: href, **), &block
40
- end
41
-
42
- def coco_color_picker_button(**, &block)
43
- render Coco::ColorPickerButton.new(**), &block
44
- end
45
-
46
- def coco_image_picker_button(**, &block)
47
- render Coco::ImagePickerButton.new(**), &block
48
- end
49
-
50
- def coco_layout_picker_button(**, &block)
51
- render Coco::LayoutPickerButton.new(**), &block
52
- end
53
-
54
- def coco_toolbar(**, &block)
55
- render Coco::Toolbar.new(**), &block
56
- end
57
-
58
- def coco_option_bar(**, &block)
59
- render Coco::OptionBar.new(**), &block
60
- end
61
-
62
- # Embeds
63
-
64
- def coco_embed(platform, url = nil, **)
65
- case platform
66
- when :youtube
67
- render Coco::YoutubeEmbed.new(url: url, **)
68
- else
69
- raise ArgumentError, "`#{platform}` is not a valid embed type"
70
- end
71
- end
72
-
73
- # Forms (WIP)
74
-
75
- def coco_form_with(**, &block)
76
- form_with(**, builder: Coco::AppFormBuilder, &block)
77
- end
78
-
79
- def coco_form_for(*, **, &block)
80
- form_for(*, **, builder: Coco::AppFormBuilder, &block)
81
- end
82
-
83
- def coco_fields(**, &block)
84
- fields(**, builder: Coco::AppFormBuilder, &block)
85
- end
86
-
87
- # Images
88
-
89
- def coco_svg(path = nil, **)
90
- render Coco::Svg.new(path: path, **)
91
- end
92
-
93
- def coco_image(src = nil, **)
94
- render Coco::Image.new(src: src, **)
95
- end
96
-
97
- def coco_avatar(src, name = nil, **)
98
- render Coco::Avatar.new(src: src, name: name, **)
99
- end
100
-
101
- def coco_icon(icon_name = nil, **, &block)
102
- render Coco::Icon.new(name: icon_name, **), &block
103
- end
104
-
105
- # Indicators
106
-
107
- def coco_stamp(type = nil, **)
108
- props = case type
109
- when :success, :positive
110
- {icon: :check_circle, theme: :positive}
111
- when :error, :negative
112
- {icon: :alert_circle, theme: :negative}
113
- when :warning
114
- {icon: :alert_triangle, theme: :warning}
115
- when :info
116
- {icon: :info, theme: :info}
117
- else
118
- {}
119
- end
120
-
121
- render Coco::Stamp.new(**props, **)
122
- end
123
-
124
- def coco_badge(text, **)
125
- render Coco::Badge.new(**).with_content(text)
126
- end
127
-
128
- # Layout
129
-
130
- def coco_spacer(size = Coco::Spacer::DEFAULT, **)
131
- render Coco::Spacer.new(size:, **)
132
- end
133
- alias_method :space, :coco_spacer
134
-
135
- def coco_stack(spacing: Coco::Spacer::DEFAULT, **, &block)
136
- render Coco::Stack.new(spacing:, **), &block
137
- end
138
-
139
- def coco_panel(**, &block)
140
- render Coco::Panel.new(**), &block
141
- end
142
-
143
- def coco_page(id, **, &block)
144
- render Coco::Page.new(id: id, **), &block
145
- end
146
-
147
- # Messaging
148
-
149
- def coco_notice(**, &block)
150
- render Coco::Notice.new(**), &block
151
- end
152
-
153
- def coco_snackbar(**, &block)
154
- render Coco::Snackbar.new(**), &block
155
- end
156
-
157
- def coco_toast(**, &block)
158
- render Coco::Toast.new(**), &block
159
- end
160
-
161
- def coco_system_banner(**, &block)
162
- render Coco::SystemBanner.new(**), &block
163
- end
164
-
165
- # Modals
166
-
167
- def coco_modal(name = "default", **, &block)
168
- render(Coco::Modal.new(name: name, **), &block)
169
- end
170
-
171
- def coco_modal_dialog(name = "default", **, &block)
172
- render(Coco::Modal.new(name: name, **)) do |modal|
173
- modal.with_container_dialog(&block)
174
- end
175
- end
176
-
177
- def coco_modal_lightbox(name = "default", scroll_top: nil, **, &block)
178
- render(Coco::Modal.new(name: name, scroll_top: scroll_top, **)) do |modal|
179
- modal.with_container_lightbox(&block)
180
- end
181
- end
182
-
183
- # Navigation
184
-
185
- def coco_link(*args, **, &block)
186
- href, content = if block
187
- [args.first, nil]
188
- else
189
- (args.size == 1) ? [nil, args.first] : args[0..2].reverse!
190
- end
191
-
192
- link = Coco::Link.new(href: href, **)
193
- link = link.with_content(content) if !block && content.present?
194
-
195
- render(link, &block)
196
- end
197
-
198
- def coco_link_to(name = nil, options = nil, html_options = nil, &block)
199
- html_options, options, name = options, name, block if block
200
- options ||= {}
201
- html_options = Coco::ActionViewHelper.convert_options_to_data_attributes(options, html_options)
202
-
203
- href = Coco::ActionViewHelper.url_target(name, options)
204
-
205
- if block
206
- coco_link(href, **html_options.symbolize_keys!, &block)
207
- else
208
- coco_link(name, href, **html_options.symbolize_keys!)
209
- end
210
- end
211
-
212
- def coco_button_to(name = nil, options = nil, html_options = nil, &block)
213
- html_options, options = options, name if block
214
- options ||= {}
215
- html_options ||= {}
216
- html_options.symbolize_keys!
217
-
218
- button = Coco::ButtonTo.new(action: options, type: :submit, **html_options)
219
- button = button.with_content(name) unless block
220
- render(button, &block)
221
- end
222
-
223
- def coco_pager_button(direction, **, &block)
224
- render Coco::PagerButton.new(direction:, **), &block
225
- end
226
-
227
- # Typography
228
-
229
- def coco_prose(**, &block)
230
- render Coco::Prose.new(**), &block
231
- end
232
-
233
- def coco_seamless_textarea(**, &block)
234
- render Coco::SeamlessTextarea.new(**), &block
235
- end
236
-
237
- # Utilties (internal)
238
-
239
- def coco_placeholder(text_content = nil, **, &block)
240
- render Coco::Placeholder.new(text_content:, **), &block
241
- end
242
-
243
- # General
244
-
245
- def coco_tag(*, **, &block)
246
- render Coco::Tag.new(*, **), &block
247
- end
248
-
249
- def coco_component(name, *, **)
250
- resolve_component("coco/#{name}", *, **)
251
- end
252
-
253
- def resolve_component(...)
254
- Coco::ComponentResolver.new(...)
255
- end
256
- end
257
- end