coveragebook_components 0.19.12 → 0.19.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/coco.js +2 -2
  3. data/lib/coco.rb +1 -1
  4. data/lookbook/app/helpers/application_helper.rb +28 -0
  5. data/lookbook/app/previews/buttons/button_group_preview.rb +148 -0
  6. data/lookbook/app/previews/buttons/button_preview.rb +729 -0
  7. data/lookbook/app/previews/buttons/button_to_preview.rb +18 -0
  8. data/lookbook/app/previews/buttons/color_picker_button_preview.rb +42 -0
  9. data/lookbook/app/previews/buttons/image_picker_button_preview.rb +46 -0
  10. data/lookbook/app/previews/buttons/layout_picker_button_preview/default.html.erb +12 -0
  11. data/lookbook/app/previews/buttons/layout_picker_button_preview.rb +6 -0
  12. data/lookbook/app/previews/buttons/option_bar_preview.rb +29 -0
  13. data/lookbook/app/previews/buttons/toolbar_preview.rb +115 -0
  14. data/lookbook/app/previews/embeds/youtube_embed_preview.rb +7 -0
  15. data/lookbook/app/previews/forms/fields_preview/button.html.erb +3 -0
  16. data/lookbook/app/previews/forms/fields_preview/check_box.html.erb +3 -0
  17. data/lookbook/app/previews/forms/fields_preview/color_field.html.erb +3 -0
  18. data/lookbook/app/previews/forms/fields_preview/date_field.html.erb +3 -0
  19. data/lookbook/app/previews/forms/fields_preview/date_select.html.erb +3 -0
  20. data/lookbook/app/previews/forms/fields_preview/datetime_local_field.html.erb +3 -0
  21. data/lookbook/app/previews/forms/fields_preview/datetime_select.html.erb +3 -0
  22. data/lookbook/app/previews/forms/fields_preview/email_field.html.erb +3 -0
  23. data/lookbook/app/previews/forms/fields_preview/error_message.html.erb +3 -0
  24. data/lookbook/app/previews/forms/fields_preview/file_field.html.erb +3 -0
  25. data/lookbook/app/previews/forms/fields_preview/hint.html.erb +3 -0
  26. data/lookbook/app/previews/forms/fields_preview/label.html.erb +3 -0
  27. data/lookbook/app/previews/forms/fields_preview/month_field.html.erb +3 -0
  28. data/lookbook/app/previews/forms/fields_preview/number_field.html.erb +3 -0
  29. data/lookbook/app/previews/forms/fields_preview/password_field.html.erb +3 -0
  30. data/lookbook/app/previews/forms/fields_preview/radio_button.html.erb +3 -0
  31. data/lookbook/app/previews/forms/fields_preview/range_field.html.erb +3 -0
  32. data/lookbook/app/previews/forms/fields_preview/search_field.html.erb +3 -0
  33. data/lookbook/app/previews/forms/fields_preview/select.html.erb +3 -0
  34. data/lookbook/app/previews/forms/fields_preview/submit.html.erb +3 -0
  35. data/lookbook/app/previews/forms/fields_preview/telephone_field.html.erb +3 -0
  36. data/lookbook/app/previews/forms/fields_preview/text_area.html.erb +3 -0
  37. data/lookbook/app/previews/forms/fields_preview/text_field.html.erb +3 -0
  38. data/lookbook/app/previews/forms/fields_preview/time_field.html.erb +3 -0
  39. data/lookbook/app/previews/forms/fields_preview/time_select.html.erb +3 -0
  40. data/lookbook/app/previews/forms/fields_preview/time_zone_select.html.erb +3 -0
  41. data/lookbook/app/previews/forms/fields_preview/url_field.html.erb +3 -0
  42. data/lookbook/app/previews/forms/fields_preview/week_field.html.erb +3 -0
  43. data/lookbook/app/previews/forms/fields_preview/weekday_select.html.erb +3 -0
  44. data/lookbook/app/previews/forms/fields_preview.rb +111 -0
  45. data/lookbook/app/previews/images/avatar_preview.rb +24 -0
  46. data/lookbook/app/previews/images/icon_preview.rb +141 -0
  47. data/lookbook/app/previews/images/image_preview.rb +15 -0
  48. data/lookbook/app/previews/images/svg_preview.rb +8 -0
  49. data/lookbook/app/previews/indicators/badge_preview.rb +68 -0
  50. data/lookbook/app/previews/indicators/stamp_preview.rb +108 -0
  51. data/lookbook/app/previews/layout/page_layout_preview/block_content.html.erb +13 -0
  52. data/lookbook/app/previews/layout/page_layout_preview/default.html.erb +19 -0
  53. data/lookbook/app/previews/layout/page_layout_preview/full_width.html.erb +12 -0
  54. data/lookbook/app/previews/layout/page_layout_preview/hidden_content.html.erb +18 -0
  55. data/lookbook/app/previews/layout/page_layout_preview/mixed.html.erb +15 -0
  56. data/lookbook/app/previews/layout/page_layout_preview/pagination.html.erb +12 -0
  57. data/lookbook/app/previews/layout/page_layout_preview/polling.html.erb +12 -0
  58. data/lookbook/app/previews/layout/page_layout_preview/sections.html.erb +13 -0
  59. data/lookbook/app/previews/layout/page_layout_preview/spacing.html.erb +33 -0
  60. data/lookbook/app/previews/layout/page_layout_preview.rb +38 -0
  61. data/lookbook/app/previews/layout/panel_preview/basic.html.erb +5 -0
  62. data/lookbook/app/previews/layout/panel_preview.rb +6 -0
  63. data/lookbook/app/previews/layout/spacer_preview/default.html.erb +5 -0
  64. data/lookbook/app/previews/layout/spacer_preview/responsive.html.erb +12 -0
  65. data/lookbook/app/previews/layout/spacer_preview/sizes.html.erb +7 -0
  66. data/lookbook/app/previews/layout/spacer_preview.rb +19 -0
  67. data/lookbook/app/previews/layout/stack_preview/default.html.erb +13 -0
  68. data/lookbook/app/previews/layout/stack_preview/item_properties.html.erb +13 -0
  69. data/lookbook/app/previews/layout/stack_preview/item_spacing.html.erb +23 -0
  70. data/lookbook/app/previews/layout/stack_preview/nested.html.erb +19 -0
  71. data/lookbook/app/previews/layout/stack_preview/stack_spacing.html.erb +13 -0
  72. data/lookbook/app/previews/layout/stack_preview.rb +21 -0
  73. data/lookbook/app/previews/messaging/notice_preview.rb +196 -0
  74. data/lookbook/app/previews/messaging/popover_preview/placement.html.erb +7 -0
  75. data/lookbook/app/previews/messaging/popover_preview/targets.html.erb +17 -0
  76. data/lookbook/app/previews/messaging/popover_preview/themes.html.erb +19 -0
  77. data/lookbook/app/previews/messaging/popover_preview/triggers.html.erb +19 -0
  78. data/lookbook/app/previews/messaging/popover_preview.rb +15 -0
  79. data/lookbook/app/previews/messaging/snackbar_preview/manual_show.html.erb +5 -0
  80. data/lookbook/app/previews/messaging/snackbar_preview/queue.html.erb +20 -0
  81. data/lookbook/app/previews/messaging/snackbar_preview/system_test_manual_show.html.erb +5 -0
  82. data/lookbook/app/previews/messaging/snackbar_preview.rb +128 -0
  83. data/lookbook/app/previews/messaging/system_banner_preview.rb +85 -0
  84. data/lookbook/app/previews/messaging/toast_preview.rb +132 -0
  85. data/lookbook/app/previews/messaging/tooltip_preview.rb +11 -0
  86. data/lookbook/app/previews/modals/modal_canvas_preview/basic.html.erb +6 -0
  87. data/lookbook/app/previews/modals/modal_canvas_preview.rb +7 -0
  88. data/lookbook/app/previews/modals/modal_dialog_preview/basic.html.erb +4 -0
  89. data/lookbook/app/previews/modals/modal_dialog_preview/in_page.html.erb +3 -0
  90. data/lookbook/app/previews/modals/modal_dialog_preview/large.html.erb +4 -0
  91. data/lookbook/app/previews/modals/modal_dialog_preview/medium.html.erb +4 -0
  92. data/lookbook/app/previews/modals/modal_dialog_preview/named.html.erb +5 -0
  93. data/lookbook/app/previews/modals/modal_dialog_preview/navigate.html.erb +3 -0
  94. data/lookbook/app/previews/modals/modal_dialog_preview/not_dismissable.html.erb +3 -0
  95. data/lookbook/app/previews/modals/modal_dialog_preview/not_shown.html.erb +5 -0
  96. data/lookbook/app/previews/modals/modal_dialog_preview/notice.html.erb +8 -0
  97. data/lookbook/app/previews/modals/modal_dialog_preview/small.html.erb +4 -0
  98. data/lookbook/app/previews/modals/modal_dialog_preview/triggers.html.erb +9 -0
  99. data/lookbook/app/previews/modals/modal_dialog_preview.rb +45 -0
  100. data/lookbook/app/previews/modals/modal_lightbox_preview/basic.html.erb +5 -0
  101. data/lookbook/app/previews/modals/modal_lightbox_preview/named.html.erb +6 -0
  102. data/lookbook/app/previews/modals/modal_lightbox_preview/scroll.html.erb +6 -0
  103. data/lookbook/app/previews/modals/modal_lightbox_preview/triggers.html.erb +8 -0
  104. data/lookbook/app/previews/modals/modal_lightbox_preview.rb +20 -0
  105. data/lookbook/app/previews/modals/modal_preview/basic.html.erb +6 -0
  106. data/lookbook/app/previews/modals/modal_preview.rb +8 -0
  107. data/lookbook/app/previews/navigation/link_preview.rb +74 -0
  108. data/lookbook/app/previews/navigation/link_to_preview.rb +88 -0
  109. data/lookbook/app/previews/navigation/pager_button_preview.rb +12 -0
  110. data/lookbook/app/previews/navigation/tabs_preview/basic.html.erb +5 -0
  111. data/lookbook/app/previews/navigation/tabs_preview/full.html.erb +5 -0
  112. data/lookbook/app/previews/navigation/tabs_preview/icons.html.erb +5 -0
  113. data/lookbook/app/previews/navigation/tabs_preview.rb +15 -0
  114. data/lookbook/app/previews/pickers/color_picker_preview.rb +27 -0
  115. data/lookbook/app/previews/pickers/image_picker_preview.rb +24 -0
  116. data/lookbook/app/previews/typography/utils_preview/branded_headings.html.erb +24 -0
  117. data/lookbook/app/previews/typography/utils_preview/fixed_size_headings.html.erb +7 -0
  118. data/lookbook/app/previews/typography/utils_preview/headings.html.erb +35 -0
  119. data/lookbook/app/previews/typography/utils_preview.rb +16 -0
  120. data/lookbook/app/previews/utilities/dropdown_preview.rb +19 -0
  121. data/lookbook/app/previews/utilities/seamless_textarea_preview/focus.html.erb +9 -0
  122. data/lookbook/app/previews/utilities/seamless_textarea_preview/multi_line.html.erb +9 -0
  123. data/lookbook/app/previews/utilities/seamless_textarea_preview/single_line.html.erb +8 -0
  124. data/lookbook/app/previews/utilities/seamless_textarea_preview.rb +29 -0
  125. data/lookbook/app/views/layouts/application.html.erb +24 -0
  126. data/lookbook/app/views/layouts/blank.html.erb +12 -0
  127. data/lookbook/app/views/lookbook/previews/group.html.erb +37 -0
  128. data/lookbook/app/views/pages/plans.html.erb +21 -0
  129. data/lookbook/app/views/panels/_design.html.erb +85 -0
  130. data/lookbook/app/views/request/success.html.erb +1 -0
  131. data/lookbook/app/views/turbo_request/done.html.erb +3 -0
  132. data/lookbook/app/views/turbo_request/success.html.erb +1 -0
  133. metadata +130 -1
@@ -0,0 +1,13 @@
1
+ <%= coco_stack(spacing: 8) do |stack| %>
2
+ <% stack.with_item do %>
3
+ <%= coco_placeholder("item one") %>
4
+ <% end %>
5
+
6
+ <% stack.with_item do %>
7
+ <%= coco_placeholder("item two") %>
8
+ <% end %>
9
+
10
+ <% stack.with_item do %>
11
+ <%= coco_placeholder("item three") %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,21 @@
1
+ module Layout
2
+ # @display max_width 100%
3
+ class StackPreview < Coco::Preview
4
+ def default
5
+ end
6
+
7
+ # Custom stack spacing
8
+ def stack_spacing
9
+ end
10
+
11
+ # Custom item spacing
12
+ def item_spacing
13
+ end
14
+
15
+ def item_properties
16
+ end
17
+
18
+ def nested
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,196 @@
1
+ module Messaging
2
+ # @figma https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FxjMavn8xyhnqVvqNJB4hBk%2FCoco-(Design-System)%3Ftype%3Ddesign%26node-id%3D860%253A30329%26t%3DYyUtDf6PBtxXLRdL-1
3
+ # @display max_width 100%
4
+ class NoticePreview < Coco::Preview
5
+ # @!group Default Themes
6
+
7
+ def positive
8
+ coco_notice(theme: :positive) do |notice|
9
+ notice.with_title { "A positive title" }
10
+
11
+ "Alert message text goes here"
12
+ end
13
+ end
14
+
15
+ def negative
16
+ coco_notice(theme: :negative) do |notice|
17
+ notice.with_title { "A negative title" }
18
+
19
+ "Alert message text goes here"
20
+ end
21
+ end
22
+
23
+ def warning
24
+ coco_notice(theme: :warning) do |notice|
25
+ notice.with_title { "A warning title" }
26
+
27
+ "Alert message text goes here"
28
+ end
29
+ end
30
+
31
+ def info
32
+ coco_notice(theme: :info) do |notice|
33
+ notice.with_title { "An info title" }
34
+
35
+ "Alert message text goes here"
36
+ end
37
+ end
38
+
39
+ # @!group Vivid Themes
40
+
41
+ def positive_vivid
42
+ coco_notice(theme: :positive_vivid) do |notice|
43
+ notice.with_title { "A vivid positive title" }
44
+
45
+ "Alert message text goes here"
46
+ end
47
+ end
48
+
49
+ def negative_vivid
50
+ coco_notice(theme: :negative_vivid) do |notice|
51
+ notice.with_title { "A vivid negative title" }
52
+
53
+ "Alert message text goes here <a href='#'>with a link</a>".html_safe
54
+ end
55
+ end
56
+
57
+ def warning_vivid
58
+ coco_notice(theme: :warning_vivid) do |notice|
59
+ notice.with_title { "A vivid warning title" }
60
+
61
+ "Alert message text goes here"
62
+ end
63
+ end
64
+
65
+ def info_vivid
66
+ coco_notice(theme: :info_vivid) do |notice|
67
+ notice.with_title { "A vivid info title" }
68
+
69
+ "Alert message text goes here"
70
+ end
71
+ end
72
+
73
+ # @!group Actions
74
+
75
+ def no_action
76
+ coco_notice do |notice|
77
+ notice.with_title { "An notice title" }
78
+
79
+ "Alert message text goes here"
80
+ end
81
+ end
82
+
83
+ def dismissable
84
+ coco_notice(dismissable: true) do |notice|
85
+ notice.with_title { "An notice title" }
86
+
87
+ "Alert message text goes here"
88
+ end
89
+ end
90
+
91
+ def with_action
92
+ coco_notice do |notice|
93
+ notice.with_title { "An notice title" }
94
+
95
+ notice.with_action(href: "#") { "click here" }
96
+
97
+ "Alert message text goes here"
98
+ end
99
+ end
100
+
101
+ def with_secondary_action
102
+ coco_notice do |notice|
103
+ notice.with_title { "An notice title" }
104
+
105
+ notice.with_action(href: "#") { "click here" }
106
+ notice.with_secondary_action(href: "#") { "or here" }
107
+
108
+ "Alert message text goes here"
109
+ end
110
+ end
111
+
112
+ def with_link
113
+ coco_notice do |notice|
114
+ notice.with_title { "An notice title" }
115
+ notice.with_link("why not click this link", "#")
116
+
117
+ "Alert message text goes here"
118
+ end
119
+ end
120
+
121
+ def vivid_with_link
122
+ coco_notice(theme: :info_vivid) do |notice|
123
+ notice.with_title { "An notice title" }
124
+ notice.with_link(href: "#") { "why not click this link" }
125
+
126
+ "Alert message text goes here"
127
+ end
128
+ end
129
+
130
+ # @!group Layout
131
+
132
+ def single_line
133
+ coco_notice(single_line: true) do |notice|
134
+ notice.with_title { "An notice title" }
135
+ notice.with_action(href: "#") { "click here" }
136
+
137
+ "Alert message text goes here"
138
+ end
139
+ end
140
+
141
+ def long_content
142
+ coco_notice do |notice|
143
+ notice.with_title { "An notice title that is probably too long" }
144
+ notice.with_action(href: "#") { "do this thing here" }
145
+
146
+ "Alert message text that is also too long. Alert message text that is also too long. Alert message text that is also too long. Alert message text that is also too long."
147
+ end
148
+ end
149
+
150
+ def no_title
151
+ coco_notice do |notice|
152
+ notice.with_action(href: "#") { "do this thing here" }
153
+
154
+ "Alert message that doesn't have a title"
155
+ end
156
+ end
157
+
158
+ def title_only
159
+ coco_notice do |notice|
160
+ notice.with_title { "Only a title" }
161
+ notice.with_action(href: "#") { "do this thing here" }
162
+ end
163
+ end
164
+
165
+ def message_only
166
+ coco_notice do |notice|
167
+ "Alert message that doesn't have a title or action"
168
+ end
169
+ end
170
+
171
+ def custom_icon
172
+ coco_notice(icon: :bug) do |notice|
173
+ notice.with_title { "Custom icon" }
174
+
175
+ "Notice with a custom icon"
176
+ end
177
+ end
178
+
179
+ def no_icon
180
+ coco_notice(icon: nil) do |notice|
181
+ notice.with_title { "No icon" }
182
+
183
+ "Notice with no icon"
184
+ end
185
+ end
186
+
187
+ def single_line_long_content
188
+ coco_notice(single_line: true) do |notice|
189
+ notice.with_title { "An notice title that is probably too long" }
190
+ notice.with_action(href: "#") { "do this thing here" }
191
+
192
+ "Alert message text that is also too long. Alert message text that is also too long. Alert message text that is also too long. Alert message text that is also too long."
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,7 @@
1
+ <div id="popover-placement-target" style="padding: 20px; background: #eee; width: fit-content">
2
+ The popover target
3
+ </div>
4
+
5
+ <%= coco_popover(placement: :right, target: "#popover-placement-target") do %>
6
+ <div id="popover-placement-content">Popover placed to the right</div>
7
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div id="internal-popover-target" style="padding: 20px; background: #eee; width: fit-content">
2
+ Popover nested in target
3
+
4
+ <%= coco_popover do %>
5
+ <div id="internal-popover-content">Popover content</div>
6
+ <% end %>
7
+ </div>
8
+
9
+ <br><br>
10
+
11
+ <div id="external-popover-target" style="padding: 20px; background: #eee; width: fit-content">
12
+ Popover outside of target
13
+ </div>
14
+
15
+ <%= coco_popover(target: "#external-popover-target") do %>
16
+ <div id="external-popover-content">Popover content</div>
17
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <div id="default-popover-target" style="padding: 20px; background: #eee; width: fit-content">
2
+ Popover target
3
+ </div>
4
+
5
+ <%= coco_popover(target: "#default-popover-target") do %>
6
+ Default (neutral) popover
7
+ <% end %>
8
+
9
+ <br><br>
10
+
11
+ <div id="info-popover-target" style="padding: 20px; background: #eee; width: fit-content">
12
+ Info popover target
13
+ </div>
14
+
15
+ <%= coco_popover(theme: :info, target: "#info-popover-target") do %>
16
+ Info popover
17
+ <% end %>
18
+
19
+ <br><br>
@@ -0,0 +1,19 @@
1
+ <div id="popover-click-trigger-target" style="padding: 20px; background: #eee; width: fit-content">
2
+ Default (click) trigger
3
+ </div>
4
+
5
+ <%= coco_popover(trigger: "click", target: "#popover-click-trigger-target") do %>
6
+ <div id="popover-click-trigger-content">Popover content</div>
7
+ <% end %>
8
+
9
+ <br><br>
10
+
11
+ <div id="popover-manual-trigger-target" style="padding: 20px; background: #eee; width: fit-content">
12
+ Manual trigger.
13
+
14
+ <button style="padding: 5px; background: #ddd;" x-data @click="$dispatch('popover:toggle', {target: '#popover-manual-trigger-target'})">Click here to toggle</button>
15
+ </div>
16
+
17
+ <%= coco_popover(trigger: "manual", target: "#popover-manual-trigger-target") do %>
18
+ <div id="popover-manual-trigger-content">Popover content</div>
19
+ <% end %>
@@ -0,0 +1,15 @@
1
+ module Messaging
2
+ class PopoverPreview < Coco::Preview
3
+ def targets
4
+ end
5
+
6
+ def themes
7
+ end
8
+
9
+ def placement
10
+ end
11
+
12
+ def triggers
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ <div x-data @snackbar:init="setTimeout(() => $event.detail.snackbar.show(), 3000)">
2
+ <%= coco_snackbar(show: false, position: :static) do %>
3
+ Manually shown after a 3s delay
4
+ <% end %>
5
+ </div>
@@ -0,0 +1,20 @@
1
+ <div
2
+ x-data="{show: {second: false, third: false}}"
3
+ x-init="setTimeout(() => { show.second = true; }, 3000); setTimeout(() => { show.third = true; }, 7000);">
4
+
5
+ <%= coco_snackbar(theme: :positive) do %>
6
+ First snackbar
7
+ <% end %>
8
+
9
+ <template x-if="show.second">
10
+ <%= coco_snackbar(theme: :warning) do %>
11
+ Second snackbar
12
+ <% end %>
13
+ </template>
14
+
15
+ <template x-if="show.third">
16
+ <%= coco_snackbar(theme: :negative) do %>
17
+ Third snackbar
18
+ <% end %>
19
+ </template>
20
+ </div>
@@ -0,0 +1,5 @@
1
+ <div x-data @snackbar:init="setTimeout(() => $event.detail.snackbar.show(), 3000)">
2
+ <%= coco_snackbar(show: false, position: :static) do %>
3
+ Manually shown after a 3s delay
4
+ <% end %>
5
+ </div>
@@ -0,0 +1,128 @@
1
+ module Messaging
2
+ # @figma https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FxjMavn8xyhnqVvqNJB4hBk%2FCoco-(Design-System)%3Ftype%3Ddesign%26node-id%3D860%253A30329%26t%3DYyUtDf6PBtxXLRdL-1
3
+ class SnackbarPreview < Coco::Preview
4
+ def standard
5
+ coco_snackbar(theme: :positive) do
6
+ "Status message about the result of an action goes here"
7
+ end
8
+ end
9
+
10
+ def queue
11
+ end
12
+
13
+ # @!group Themes
14
+
15
+ def positive
16
+ coco_snackbar(theme: :positive, dismiss: false, position: :static) do
17
+ "A positive message"
18
+ end
19
+ end
20
+
21
+ def warning
22
+ coco_snackbar(theme: :warning, dismiss: false, position: :static) do
23
+ "A warning message"
24
+ end
25
+ end
26
+
27
+ def negative
28
+ coco_snackbar(theme: :negative, dismiss: false, position: :static) do
29
+ "A negative message"
30
+ end
31
+ end
32
+
33
+ def pending
34
+ coco_snackbar(theme: :pending, dismiss: false, position: :static) do
35
+ "A pending message..."
36
+ end
37
+ end
38
+
39
+ # @label Theme with custom icon
40
+ def theme_custom_icon
41
+ coco_snackbar(theme: :positive, icon: :thumbs_up, dismiss: false, position: :static) do
42
+ "A positive message with custom icon"
43
+ end
44
+ end
45
+
46
+ # @!group Content options
47
+
48
+ def basic
49
+ coco_snackbar(dismiss: false, position: :static) do
50
+ "Status message about something"
51
+ end
52
+ end
53
+
54
+ def with_icon
55
+ coco_snackbar(icon: :smile, dismiss: false, position: :static) do
56
+ "Status message with an icon"
57
+ end
58
+ end
59
+
60
+ def with_action
61
+ coco_snackbar(dismiss: false, position: :static) do |snackbar|
62
+ snackbar.with_action(click: "alert('clicked!')") do
63
+ "Do this"
64
+ end
65
+
66
+ "Status message with an action"
67
+ end
68
+ end
69
+
70
+ def long_text
71
+ coco_snackbar(dismiss: false, position: :static) do
72
+ "This is a status message that is quite long and probably wraps onto a few lines at least."
73
+ end
74
+ end
75
+
76
+ # @!group Dismissing
77
+
78
+ def auto_dismiss
79
+ coco_snackbar(position: :static) do
80
+ "Default: auto-dismiss after 5s"
81
+ end
82
+ end
83
+
84
+ def auto_dismiss_custom
85
+ coco_snackbar(dismiss_delay: 7000, position: :static) do
86
+ "Auto-dismiss with custom duration (7s)"
87
+ end
88
+ end
89
+
90
+ def manual_dismiss
91
+ coco_snackbar(dismiss: false, position: :static) do
92
+ "Will not auto-dismiss"
93
+ end
94
+ end
95
+
96
+ # @!group Showing
97
+
98
+ def auto_show
99
+ coco_snackbar(position: :static) do
100
+ "Default: auto-show on load"
101
+ end
102
+ end
103
+
104
+ def delayed_auto_show
105
+ coco_snackbar(show_delay: 1000, position: :static) do
106
+ "Auto-show after 1s"
107
+ end
108
+ end
109
+
110
+ def manual_show
111
+ end
112
+
113
+ # @!endgroup
114
+
115
+ # @hidden
116
+ # @param dismiss
117
+ # @param show
118
+ def system_test(dismiss: true, show: true)
119
+ coco_snackbar(dismiss: dismiss, show: show) do
120
+ "Snackbar system test"
121
+ end
122
+ end
123
+
124
+ # @hidden
125
+ def system_test_manual_show
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,85 @@
1
+ module Messaging
2
+ # @figma https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FxjMavn8xyhnqVvqNJB4hBk%2FCoco-(Design-System)%3Ftype%3Ddesign%26node-id%3D860%253A30329%26t%3DYyUtDf6PBtxXLRdL-1
3
+ # @display max_width 100%
4
+ # @display group_display slats
5
+ # @display padding 0
6
+ class SystemBannerPreview < Coco::Preview
7
+ # @!group Themes
8
+
9
+ def positive
10
+ coco_system_banner(theme: :positive) do |banner|
11
+ banner.with_title { "A positive title" }
12
+
13
+ "Alert message text goes here"
14
+ end
15
+ end
16
+
17
+ def negative
18
+ coco_system_banner(theme: :negative) do |banner|
19
+ banner.with_title { "A negative title" }
20
+
21
+ "Alert message text goes here <a href='#'>with a link</a>".html_safe
22
+ end
23
+ end
24
+
25
+ def warning
26
+ coco_system_banner(theme: :warning) do |banner|
27
+ banner.with_title { "A warning title" }
28
+
29
+ banner.with_action { "Let's do it" }
30
+
31
+ "Alert message text goes here"
32
+ end
33
+ end
34
+
35
+ def info
36
+ coco_system_banner(theme: :info) do |banner|
37
+ banner.with_title { "An info title" }
38
+
39
+ "Alert message text goes here"
40
+ end
41
+ end
42
+
43
+ # @!group Variations
44
+
45
+ def no_title
46
+ coco_system_banner(theme: :info) do |banner|
47
+ "Alert message text goes here"
48
+ end
49
+ end
50
+
51
+ def custom_icon
52
+ coco_system_banner(icon: :bug, theme: :info) do |banner|
53
+ banner.with_title { "A custom icon" }
54
+
55
+ "Alert message text goes here"
56
+ end
57
+ end
58
+
59
+ def no_icon
60
+ coco_system_banner(icon: nil, theme: :info) do |banner|
61
+ banner.with_title { "No icon" }
62
+
63
+ "Alert message text goes here"
64
+ end
65
+ end
66
+
67
+ # @!group Dismissable
68
+
69
+ def temporary
70
+ coco_system_banner(id: "info-banner-one", dismissable: true, theme: :info) do |banner|
71
+ banner.with_title { "A dimissable system banner" }
72
+
73
+ "This will only be dismissed until the page is refreshed"
74
+ end
75
+ end
76
+
77
+ def for_duration
78
+ coco_system_banner(id: "info-banner-two", dismissable: true, dismiss_for: 1.day, theme: :info) do |banner|
79
+ banner.with_title { "A dimissable system banner" }
80
+
81
+ "This will be dismissed for the `dismiss_for` duration"
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,132 @@
1
+ module Messaging
2
+ # @figma https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FxjMavn8xyhnqVvqNJB4hBk%2FCoco-(Design-System)%3Ftype%3Ddesign%26node-id%3D860%253A30329%26t%3DYyUtDf6PBtxXLRdL-1
3
+ class ToastPreview < Coco::Preview
4
+ def standard
5
+ coco_toast(theme: :negative) do |toast|
6
+ toast.with_title { "Upload failed" }
7
+
8
+ "Please check your file is a valid format: jpg, png or gif."
9
+ end
10
+ end
11
+
12
+ # @!group Default Themes
13
+
14
+ def positive
15
+ coco_toast(position: :static, theme: :positive) do |toast|
16
+ toast.with_title { "A positive title" }
17
+
18
+ "Alert message text goes here"
19
+ end
20
+ end
21
+
22
+ def negative
23
+ coco_toast(position: :static, theme: :negative) do |toast|
24
+ toast.with_title { "A negative title" }
25
+
26
+ "Alert message text goes here"
27
+ end
28
+ end
29
+
30
+ def warning
31
+ coco_toast(position: :static, theme: :warning) do |toast|
32
+ toast.with_title { "A warning title" }
33
+
34
+ "Alert message text goes here"
35
+ end
36
+ end
37
+
38
+ def info
39
+ coco_toast(position: :static, theme: :info) do |toast|
40
+ toast.with_title { "An info title" }
41
+
42
+ "Alert message text goes here"
43
+ end
44
+ end
45
+
46
+ # @!group Vivid Themes
47
+
48
+ def positive_vivid
49
+ coco_toast(position: :static, theme: :positive_vivid) do |toast|
50
+ toast.with_title { "A vivid positive title" }
51
+
52
+ "Alert message text goes here"
53
+ end
54
+ end
55
+
56
+ def negative_vivid
57
+ coco_toast(position: :static, theme: :negative_vivid) do |toast|
58
+ toast.with_title { "A vivid negative title" }
59
+
60
+ "Alert message text goes here <a href='#'>with a link</a>".html_safe
61
+ end
62
+ end
63
+
64
+ def warning_vivid
65
+ coco_toast(position: :static, theme: :warning_vivid) do |toast|
66
+ toast.with_title { "A vivid warning title" }
67
+
68
+ "Alert message text goes here"
69
+ end
70
+ end
71
+
72
+ def info_vivid
73
+ coco_toast(position: :static, theme: :info_vivid) do |toast|
74
+ toast.with_title { "A vivid info title" }
75
+
76
+ "Alert message text goes here"
77
+ end
78
+ end
79
+
80
+ # @!group Dismissing
81
+
82
+ # @label Dismissable (default)
83
+ def dismissable
84
+ coco_toast(position: :static) do |toast|
85
+ toast.with_title { "Dismissable" }
86
+
87
+ "Toast can be dismissed"
88
+ end
89
+ end
90
+
91
+ def not_dismissable
92
+ coco_toast(position: :static, dismissable: false) do |toast|
93
+ toast.with_title { "Not dismissable" }
94
+
95
+ "Toast can't be dismissed"
96
+ end
97
+ end
98
+
99
+ def auto_dismiss
100
+ coco_toast(position: :static, dismiss: true) do |toast|
101
+ toast.with_title { "Auto dismiss" }
102
+
103
+ "Toast will be dismissed automatically"
104
+ end
105
+ end
106
+
107
+ # @!group Variants
108
+
109
+ def with_action
110
+ coco_toast(position: :static, theme: :info) do |toast|
111
+ toast.with_title { "Toast with an action" }
112
+ toast.with_action(href: "#") { "do this thing here" }
113
+
114
+ "Please check your file is a valid format: jpg, png or gif."
115
+ end
116
+ end
117
+
118
+ def no_title
119
+ coco_toast(position: :static, theme: :info) do |toast|
120
+ "Please check your file is a valid format: jpg, png or gif."
121
+ end
122
+ end
123
+
124
+ def no_title_with_action
125
+ coco_toast(position: :static, theme: :info) do |toast|
126
+ toast.with_action(href: "#") { "do this thing here" }
127
+
128
+ "Please check your file is a valid format: jpg, png or gif."
129
+ end
130
+ end
131
+ end
132
+ end