ariadne_view_components 0.0.59 → 0.0.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/LICENSE.txt +661 -49
  4. data/README.md +52 -4
  5. data/app/assets/javascripts/ariadne_view_components.js +98 -7
  6. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  7. data/app/assets/stylesheets/ariadne_view_components.css +1 -7
  8. data/app/components/ariadne/base_component.rb +79 -27
  9. data/app/components/ariadne/behaviors/tooltipable.rb +120 -0
  10. data/app/components/ariadne/conditional_wrapper.rb +21 -0
  11. data/app/components/ariadne/form/base_component.rb +74 -0
  12. data/app/components/ariadne/form/base_input_component.rb +60 -0
  13. data/app/components/ariadne/form/caption/component.html.erb +10 -0
  14. data/app/components/ariadne/form/caption/component.rb +29 -0
  15. data/app/components/ariadne/form/form_control/component.html.erb +19 -0
  16. data/app/components/ariadne/form/form_control/component.rb +27 -0
  17. data/app/components/ariadne/form/form_reference/component.html.erb +1 -0
  18. data/app/components/ariadne/form/form_reference/component.rb +18 -0
  19. data/app/components/ariadne/form/group/component.html.erb +5 -0
  20. data/app/components/ariadne/form/group/component.rb +27 -0
  21. data/app/components/ariadne/form/hidden_field/component.html.erb +1 -0
  22. data/app/components/ariadne/form/hidden_field/component.rb +15 -0
  23. data/app/components/ariadne/form/separator/component.html.erb +1 -0
  24. data/app/components/ariadne/form/separator/component.rb +8 -0
  25. data/app/components/ariadne/form/spacing_wrapper/component.html.erb +3 -0
  26. data/app/components/ariadne/form/spacing_wrapper/component.rb +8 -0
  27. data/app/components/ariadne/form/text_field/component.html.erb +25 -0
  28. data/app/components/ariadne/form/text_field/component.rb +132 -0
  29. data/app/components/ariadne/form/validation_message/component.html.erb +5 -0
  30. data/app/components/ariadne/form/validation_message/component.rb +14 -0
  31. data/app/components/ariadne/layout/narrow/component.html.erb +10 -0
  32. data/app/components/ariadne/layout/narrow/component.rb +24 -0
  33. data/app/components/ariadne/layout/nav_bar/component.css +0 -0
  34. data/app/components/ariadne/layout/nav_bar/component.html.erb +123 -0
  35. data/app/components/ariadne/layout/nav_bar/component.rb +77 -0
  36. data/app/components/ariadne/ui/button/component.html.erb +5 -0
  37. data/app/components/ariadne/ui/button/component.rb +184 -0
  38. data/app/components/ariadne/ui/clipboard_copy/component.html.erb +8 -0
  39. data/app/components/ariadne/ui/clipboard_copy/component.rb +102 -0
  40. data/app/components/ariadne/ui/clipboard_copy/component.ts +54 -0
  41. data/app/components/ariadne/ui/combobox/component.html.erb +32 -0
  42. data/app/components/ariadne/ui/combobox/component.rb +83 -0
  43. data/app/components/ariadne/ui/combobox/component.ts +119 -0
  44. data/app/components/ariadne/ui/combobox/menu_item/component.html.erb +9 -0
  45. data/app/components/ariadne/ui/combobox/menu_item/component.rb +53 -0
  46. data/app/components/ariadne/ui/combobox/option/component.html.erb +11 -0
  47. data/app/components/ariadne/ui/combobox/option/component.rb +45 -0
  48. data/app/components/ariadne/ui/heroicon/component.html.erb +3 -0
  49. data/app/components/ariadne/ui/heroicon/component.rb +141 -0
  50. data/app/components/ariadne/ui/image/component.rb +69 -0
  51. data/app/components/ariadne/ui/link/component.html.erb +3 -0
  52. data/app/components/ariadne/ui/link/component.rb +56 -0
  53. data/app/components/ariadne/ui/typography/component.html.erb +3 -0
  54. data/app/components/ariadne/ui/typography/component.rb +41 -0
  55. data/app/lib/ariadne/attributes_helper.rb +119 -0
  56. data/app/lib/ariadne/fetch_or_fallback_helper.rb +1 -1
  57. data/app/lib/ariadne/form.rb +16 -0
  58. data/app/lib/ariadne/view_helper.rb +2 -5
  59. data/app/lib/view_components_contrib/html_attrs.rb +64 -0
  60. data/app/lib/view_components_contrib/style_variants.rb +14 -0
  61. data/lib/ariadne/forms/acts_as_component.rb +125 -0
  62. data/lib/ariadne/forms/base.html.erb +8 -0
  63. data/lib/ariadne/forms/base.rb +132 -0
  64. data/lib/ariadne/forms/buffer_rewriter.rb +51 -0
  65. data/lib/ariadne/forms/builder.rb +88 -0
  66. data/lib/ariadne/forms/dsl/button_input.rb +33 -0
  67. data/lib/ariadne/forms/dsl/form_object.rb +26 -0
  68. data/lib/ariadne/forms/dsl/input.rb +322 -0
  69. data/lib/ariadne/forms/dsl/input_group.rb +34 -0
  70. data/lib/ariadne/forms/dsl/input_methods.rb +157 -0
  71. data/lib/ariadne/forms/dsl/submit_button_input.rb +36 -0
  72. data/lib/ariadne/forms/dsl/text_field_input.rb +73 -0
  73. data/lib/ariadne/forms/utils.rb +34 -0
  74. data/lib/ariadne/generate.rb +11 -0
  75. data/lib/ariadne/view_components/engine.rb +24 -7
  76. data/lib/ariadne/view_components/version.rb +1 -1
  77. data/lib/ariadne/view_components.rb +1 -1
  78. data/lib/ariadne/yard/backend.rb +24 -0
  79. data/lib/ariadne/yard/component_manifest.rb +148 -0
  80. data/lib/ariadne/yard/component_ref.rb +49 -0
  81. data/lib/ariadne/yard/docs_helper.rb +98 -0
  82. data/lib/ariadne/yard/info_arch_docs_helper.rb +31 -0
  83. data/lib/ariadne/yard/lookbook_docs_helper.rb +32 -0
  84. data/lib/ariadne/yard/lookbook_pages_backend.rb +235 -0
  85. data/lib/ariadne/yard/registry.rb +136 -0
  86. data/lib/ariadne/yard/renders_many_handler.rb +23 -0
  87. data/lib/ariadne/yard/renders_one_handler.rb +23 -0
  88. data/lib/ariadne/yard.rb +19 -0
  89. data/static/arguments.yml +141 -48
  90. data/static/audited_at.json +0 -9
  91. data/static/classes.yml +210 -209
  92. data/static/constants.json +2 -209
  93. data/static/statuses.json +0 -9
  94. metadata +125 -210
  95. data/app/assets/builds/ariadne_view_components.css +0 -2202
  96. data/app/assets/javascripts/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
  97. data/app/assets/javascripts/components/ariadne/ariadne-form.d.ts +0 -22
  98. data/app/assets/javascripts/components/ariadne/ariadne.d.ts +0 -2
  99. data/app/assets/javascripts/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
  100. data/app/assets/javascripts/components/ariadne/dropdown/menu_component.d.ts +0 -1
  101. data/app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts +0 -4
  102. data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +0 -39
  103. data/app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
  104. data/app/assets/javascripts/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
  105. data/app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
  106. data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
  107. data/app/assets/javascripts/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
  108. data/app/assets/javascripts/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
  109. data/app/assets/javascripts/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
  110. data/app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
  111. data/app/assets/javascripts/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
  112. data/app/assets/stylesheets/dropdown.css +0 -46
  113. data/app/assets/stylesheets/prosemirror.css +0 -323
  114. data/app/assets/stylesheets/tooltip-component.css +0 -37
  115. data/app/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
  116. data/app/components/ariadne/accumulator_controller/accumulator_controller.js +0 -39
  117. data/app/components/ariadne/accumulator_controller/accumulator_controller.ts +0 -48
  118. data/app/components/ariadne/action_card_component.html.erb +0 -13
  119. data/app/components/ariadne/action_card_component.rb +0 -88
  120. data/app/components/ariadne/ariadne-form.d.ts +0 -22
  121. data/app/components/ariadne/ariadne-form.js +0 -85
  122. data/app/components/ariadne/ariadne.d.ts +0 -2
  123. data/app/components/ariadne/ariadne.js +0 -24
  124. data/app/components/ariadne/ariadne.ts +0 -29
  125. data/app/components/ariadne/avatar_component.rb +0 -81
  126. data/app/components/ariadne/avatar_stack_component/avatar_stack_component.html.erb +0 -12
  127. data/app/components/ariadne/avatar_stack_component.rb +0 -75
  128. data/app/components/ariadne/base_button.rb +0 -70
  129. data/app/components/ariadne/blankslate_component/blankslate_component.html.erb +0 -26
  130. data/app/components/ariadne/blankslate_component.rb +0 -148
  131. data/app/components/ariadne/body_component.rb +0 -30
  132. data/app/components/ariadne/bottom_tab_component.html.erb +0 -4
  133. data/app/components/ariadne/bottom_tab_component.rb +0 -44
  134. data/app/components/ariadne/bottom_tab_nav_component.html.erb +0 -5
  135. data/app/components/ariadne/bottom_tab_nav_component.rb +0 -33
  136. data/app/components/ariadne/breadcrumbs_component.html.erb +0 -13
  137. data/app/components/ariadne/breadcrumbs_component.rb +0 -31
  138. data/app/components/ariadne/button_component/button_component.html.erb +0 -4
  139. data/app/components/ariadne/button_component.rb +0 -165
  140. data/app/components/ariadne/checkbox_component.html.erb +0 -5
  141. data/app/components/ariadne/checkbox_component.rb +0 -43
  142. data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
  143. data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.js +0 -18
  144. data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.ts +0 -19
  145. data/app/components/ariadne/clipboard_copy_component/clipboard_copy_component.html.erb +0 -9
  146. data/app/components/ariadne/clipboard_copy_component.rb +0 -90
  147. data/app/components/ariadne/close_button_component.html.erb +0 -4
  148. data/app/components/ariadne/close_button_component.rb +0 -33
  149. data/app/components/ariadne/combobox_component.html.erb +0 -14
  150. data/app/components/ariadne/combobox_component.rb +0 -76
  151. data/app/components/ariadne/component.rb +0 -127
  152. data/app/components/ariadne/container_component/container_component.html.erb +0 -3
  153. data/app/components/ariadne/container_component.rb +0 -25
  154. data/app/components/ariadne/content.rb +0 -12
  155. data/app/components/ariadne/counter_component.rb +0 -100
  156. data/app/components/ariadne/details_component/details_component.html.erb +0 -4
  157. data/app/components/ariadne/details_component.rb +0 -81
  158. data/app/components/ariadne/dropdown/menu_component.d.ts +0 -1
  159. data/app/components/ariadne/dropdown/menu_component.html.erb +0 -20
  160. data/app/components/ariadne/dropdown/menu_component.js +0 -1
  161. data/app/components/ariadne/dropdown/menu_component.rb +0 -101
  162. data/app/components/ariadne/dropdown/menu_component.ts +0 -1
  163. data/app/components/ariadne/dropdown_component/dropdown_component.html.erb +0 -8
  164. data/app/components/ariadne/dropdown_component.rb +0 -172
  165. data/app/components/ariadne/events_controller/events_controller.d.ts +0 -4
  166. data/app/components/ariadne/events_controller/events_controller.js +0 -6
  167. data/app/components/ariadne/events_controller/events_controller.ts +0 -7
  168. data/app/components/ariadne/flash_component/flash_component.html.erb +0 -31
  169. data/app/components/ariadne/flash_component.rb +0 -128
  170. data/app/components/ariadne/flex_component/flex_component.html.erb +0 -5
  171. data/app/components/ariadne/flex_component.rb +0 -56
  172. data/app/components/ariadne/footer_component/footer_component.html.erb +0 -7
  173. data/app/components/ariadne/footer_component.rb +0 -23
  174. data/app/components/ariadne/grid_component/grid_component.html.erb +0 -26
  175. data/app/components/ariadne/grid_component.rb +0 -67
  176. data/app/components/ariadne/header_component/header_component.html.erb +0 -29
  177. data/app/components/ariadne/header_component.rb +0 -111
  178. data/app/components/ariadne/heading_component.rb +0 -49
  179. data/app/components/ariadne/heroicon_component/heroicon_component.html.erb +0 -4
  180. data/app/components/ariadne/heroicon_component.rb +0 -166
  181. data/app/components/ariadne/image_component.rb +0 -53
  182. data/app/components/ariadne/inline_flex_component/inline_flex_component.html.erb +0 -6
  183. data/app/components/ariadne/inline_flex_component.rb +0 -72
  184. data/app/components/ariadne/layout_component.html.erb +0 -21
  185. data/app/components/ariadne/layout_component.rb +0 -69
  186. data/app/components/ariadne/link_component.rb +0 -65
  187. data/app/components/ariadne/list_component/list_component.html.erb +0 -3
  188. data/app/components/ariadne/list_component.rb +0 -70
  189. data/app/components/ariadne/modal_component.html.erb +0 -11
  190. data/app/components/ariadne/modal_component.rb +0 -88
  191. data/app/components/ariadne/narrow_container_component/narrow_container_component.html.erb +0 -3
  192. data/app/components/ariadne/narrow_container_component.rb +0 -30
  193. data/app/components/ariadne/options_controller/options_controller.d.ts +0 -39
  194. data/app/components/ariadne/options_controller/options_controller.js +0 -89
  195. data/app/components/ariadne/options_controller/options_controller.ts +0 -122
  196. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
  197. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.js +0 -237
  198. data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.ts +0 -278
  199. data/app/components/ariadne/panel_bar_component/panel_bar_component.html.erb +0 -20
  200. data/app/components/ariadne/panel_bar_component.rb +0 -80
  201. data/app/components/ariadne/pill_component/pill_component.html.erb +0 -3
  202. data/app/components/ariadne/pill_component.rb +0 -44
  203. data/app/components/ariadne/popover_component.html.erb +0 -10
  204. data/app/components/ariadne/popover_component.rb +0 -81
  205. data/app/components/ariadne/progress_bar_component.html.erb +0 -5
  206. data/app/components/ariadne/progress_bar_component.rb +0 -63
  207. data/app/components/ariadne/relative_time_component.html.erb +0 -3
  208. data/app/components/ariadne/relative_time_component.rb +0 -61
  209. data/app/components/ariadne/show_more_button_component.html.erb +0 -11
  210. data/app/components/ariadne/show_more_button_component.rb +0 -47
  211. data/app/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
  212. data/app/components/ariadne/slideover_component/slideover-component.js +0 -11
  213. data/app/components/ariadne/slideover_component/slideover-component.ts +0 -17
  214. data/app/components/ariadne/slideover_component/slideover_component.html.erb +0 -9
  215. data/app/components/ariadne/slideover_component.rb +0 -66
  216. data/app/components/ariadne/spinner_component.html.erb +0 -16
  217. data/app/components/ariadne/spinner_component.rb +0 -45
  218. data/app/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
  219. data/app/components/ariadne/string_match_controller/string_match_controller.js +0 -51
  220. data/app/components/ariadne/string_match_controller/string_match_controller.ts +0 -65
  221. data/app/components/ariadne/subheader_component.html.erb +0 -11
  222. data/app/components/ariadne/subheader_component.rb +0 -65
  223. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
  224. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.js +0 -207
  225. data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.ts +0 -256
  226. data/app/components/ariadne/tab_component/tab_component.html.erb +0 -3
  227. data/app/components/ariadne/tab_component.rb +0 -98
  228. data/app/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
  229. data/app/components/ariadne/tab_container_component/tab-container-component.js +0 -23
  230. data/app/components/ariadne/tab_container_component/tab-container-component.ts +0 -24
  231. data/app/components/ariadne/tab_container_component.erb +0 -10
  232. data/app/components/ariadne/tab_container_component.rb +0 -68
  233. data/app/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
  234. data/app/components/ariadne/tab_nav_component/tab-nav-component.js +0 -33
  235. data/app/components/ariadne/tab_nav_component/tab-nav-component.ts +0 -34
  236. data/app/components/ariadne/tab_nav_component/tab_nav_component.html.erb +0 -7
  237. data/app/components/ariadne/tab_nav_component.rb +0 -72
  238. data/app/components/ariadne/table_nav_component/table_nav_component.html.erb +0 -52
  239. data/app/components/ariadne/table_nav_component.rb +0 -338
  240. data/app/components/ariadne/text.rb +0 -25
  241. data/app/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
  242. data/app/components/ariadne/time_ago_component/time-ago-component.js +0 -1
  243. data/app/components/ariadne/time_ago_component/time-ago-component.ts +0 -1
  244. data/app/components/ariadne/time_ago_component.rb +0 -56
  245. data/app/components/ariadne/timeline_component/timeline_component.html.erb +0 -19
  246. data/app/components/ariadne/timeline_component.rb +0 -34
  247. data/app/components/ariadne/toggle_component/toggle_component.html.erb +0 -15
  248. data/app/components/ariadne/toggle_component.rb +0 -95
  249. data/app/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
  250. data/app/components/ariadne/toggleable_controller/toggleable_controller.js +0 -54
  251. data/app/components/ariadne/toggleable_controller/toggleable_controller.ts +0 -77
  252. data/app/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
  253. data/app/components/ariadne/tooltip_component/tooltip-component.js +0 -43
  254. data/app/components/ariadne/tooltip_component/tooltip-component.ts +0 -57
  255. data/app/components/ariadne/tooltip_component/tooltip_component.html.erb +0 -4
  256. data/app/components/ariadne/tooltip_component.rb +0 -108
  257. data/app/lib/ariadne/action_view_extensions/form_helper.rb +0 -30
  258. data/app/lib/ariadne/audited/dsl.rb +0 -32
  259. data/app/lib/ariadne/form_builder.rb +0 -80
  260. data/app/lib/ariadne/status/dsl.rb +0 -41
  261. data/config/importmap.rb +0 -3
  262. data/exe/tailwindcss +0 -21
  263. data/lib/rubocop/cop/ariadne/base_cop.rb +0 -26
  264. data/tailwind.config.js +0 -70
@@ -1,26 +0,0 @@
1
- <%= render Ariadne::NarrowContainerComponent.new do %>
2
- <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do %>
3
- <% if icon.present? %>
4
- <%= icon %>
5
- <% elsif image.present? %>
6
- <%= image %>
7
- <% end %>
8
- <%= heading %>
9
- <% if description.present? %>
10
- <%= description %>
11
- <% end %>
12
- <%= content %>
13
- <div class="ariadne-mt-8 ariadne-flex ariadne-justify-center">
14
- <% if primary_action.present? %>
15
- <div class="ariadne-inline-flex ariadne-rounded-md shadow">
16
- <%= primary_action %>
17
- </div>
18
- <% end %>
19
- <% if secondary_action.present? %>
20
- <div class="ariadne-ml-3 ariadne-inline-flex">
21
- <%= secondary_action %>
22
- </div>
23
- <% end %>
24
- </div>
25
- <% end %>
26
- <% end %>
@@ -1,148 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Use `Blankslate` when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.
5
- #
6
- # @accessibility
7
- # - The blankslate uses a semantic heading that must be set at the appropriate level based on the hierarchy of the page.
8
- # - All blankslate visuals have been programmed as decorative images, using `aria-hidden=”true”` and `img alt=””`, which will hide the visual from screen reader users.
9
- # - The blankslate supports a primary and secondary action. Both actions have been built as semantic links with primary and secondary styling.
10
- # - `secondary_action` text should be meaningful out of context and clearly describe the destination. Avoid using vague text like, "Learn more" or "Click here".
11
- class BlankslateComponent < Ariadne::Component
12
- DEFAULT_TAG = :div
13
- TAG_OPTIONS = [DEFAULT_TAG].freeze
14
-
15
- DEFAULT_CLASSES = "ariadne-text-center"
16
-
17
- # Optional visual that renders an <%= link_to_component(Ariadne::HeroiconComponent) %>.
18
- #
19
- # @param tag [Symbol, String] The rendered tag name
20
- # @param icon [String] Name of <%= link_to_heroicons %> to use.
21
- # @param size [Symbol] <%= one_of(Ariadne::HeroiconComponent::SIZE_MAPPINGS, sort: false) %>
22
- # @param variant [String] <%= one_of(HeroiconsHelper::Icon::VALID_VARIANTS, sort: false) %>
23
- # @param classes [String] <%= link_to_classes_docs %>
24
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::HeroiconComponent) %>.
25
- renders_one :icon, lambda { |tag: :svg, icon:, size: Ariadne::HeroiconComponent::SIZE_DEFAULT, variant: HeroiconsHelper::Icon::VARIANT_SOLID, classes: "", attributes: {}|
26
- @icon = icon
27
- @variant = variant
28
- tag = check_incoming_tag(:svg, tag)
29
- Ariadne::HeroiconComponent.new(tag: tag, icon: icon, size: size, variant: variant, classes: classes, attributes: attributes)
30
- }
31
-
32
- # Optional visual that renders an <%= link_to_component(Ariadne::ImageComponent) %>.
33
- #
34
- # @param tag [Symbol, String] The rendered tag name
35
- # @param src [String] The source url of the image.
36
- # @param alt [String] Specifies an alternate text for the image.
37
- # @param lazy [Boolean] Whether or not to lazily load the image.
38
- # @param classes [String] <%= link_to_classes_docs %>
39
- # @param attributes [Hash] <%= link_to_attributes_docs %>
40
- DEFAULT_IMAGE_SIZE = 56
41
- renders_one :image, lambda { |tag: Ariadne::ImageComponent::DEFAULT_TAG, src:, alt:, lazy: false, classes: "", attributes: {}|
42
- attributes[:height] = DEFAULT_IMAGE_SIZE
43
- attributes[:width] = DEFAULT_IMAGE_SIZE
44
-
45
- Ariadne::ImageComponent.new(tag: tag, src: src, alt: alt, lazy: lazy, classes: classes, attributes: attributes)
46
- }
47
-
48
- # Required heading.
49
- #
50
- # @param tag [Symbol, String] <%= one_of(Ariadne::HeadingComponent::TAG_OPTIONS) %>
51
- # @param classes [String] <%= link_to_classes_docs %>
52
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::HeroiconComponent) %>.
53
- DEFAULT_HEADING_CLASSES = "ariadne-text-3xl ariadne-font-extrabold ariadne-tracking-tight ariadne-text-gray-900 sm:ariadne-text-4xl"
54
- renders_one :heading, lambda { |tag: :h1, classes: "", attributes: {}|
55
- actual_classes = merge_class_names(DEFAULT_HEADING_CLASSES, classes)
56
-
57
- Ariadne::HeadingComponent.new(tag: tag, classes: actual_classes, attributes: attributes)
58
- }
59
-
60
- # Optional description.
61
- #
62
- # - The description should always be informative and actionable.
63
- # - Don't use phrases like "You can".
64
- #
65
- # @param tag [Symbol, String] The rendered tag name
66
- # @param classes [String] <%= link_to_classes_docs %>
67
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::HeroiconComponent) %>.
68
- renders_one :description, lambda { |tag: :p, classes: "", attributes: {}|
69
- actual_tag = check_incoming_tag(:p, tag)
70
-
71
- Ariadne::BaseComponent.new(tag: actual_tag, classes: classes, attributes: attributes)
72
- }
73
-
74
- # Optional primary action
75
- #
76
- # The `primary_action` slot renders an anchor link which is visually styled as a button to provide more emphasis to the
77
- # Blankslate's primary action.
78
- #
79
- # @param href [String] URL to be used for the primary action.
80
- # @param classes [String] <%= link_to_classes_docs %>
81
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::HeroiconComponent) %>.
82
- renders_one :primary_action, lambda { |href: nil, tag: :a, method: nil, size: :md, scheme: :default, classes: "", attributes: {}|
83
- attributes[:href] = href
84
- attributes[:method] = method
85
-
86
- Ariadne::ButtonComponent.new(
87
- tag: tag,
88
- type: Ariadne::BaseButton::DEFAULT_TYPE,
89
- scheme: scheme,
90
- size: size,
91
- classes: classes,
92
- attributes: attributes,
93
- )
94
- }
95
-
96
- # Optional secondary action
97
- #
98
- # The `secondary_action` slot renders a normal anchor link, which can be used to redirect the user to additional information
99
- # (e.g. Help documentation).
100
- #
101
- # @param href [String] URL to be used for the secondary action.
102
- # @param classes [String] <%= link_to_classes_docs %>
103
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::HeroiconComponent) %>.
104
- renders_one :secondary_action, lambda { |href:, classes: "", attributes: {}|
105
- attributes[:href] = href
106
-
107
- Ariadne::LinkComponent.new(href: href, classes: classes, attributes: attributes)
108
- }
109
-
110
- # @example Basic
111
- # <%= render Ariadne::BlankslateComponent.new do |c| %>
112
- # <% c.with_heading(tag: :h2) { "heading" } %>
113
- # <% c.with_description { "Description"} %>
114
- # <% end %>
115
- #
116
- # @example Icon
117
- # @description
118
- # Add an `icon` to give additional context. Refer to the [Heroicons](https://heroicons.com) documentation to choose an icon.
119
- # @code
120
- # <%= render Ariadne::BlankslateComponent.new do |c| %>
121
- # <% c.with_icon(icon: :"globe-europe-africa") %>
122
- # <% c.with_heading(tag: :h2) { "heading" } %>
123
- # <% c.with_description { "Description"} %>
124
- # <% end %>
125
- #
126
- # @example Using an image
127
- # @description
128
- # Add an `image` to give context that an Octicon couldn't.
129
- # @code
130
- # <%= render Ariadne::BlankslateComponent.new do |c| %>
131
- # <% c.with_image(src: "https://github.githubassets.com/images/modules/site/features/security-icon.svg", alt: "Security - secure vault") %>
132
- # <% c.with_heading(tag: :h2){ "heading" } %>
133
- # <% end %>
134
- #
135
- # @param tag [Symbol, String] The rendered tag name
136
- # @param classes [String] <%= link_to_classes_docs %>
137
- # @param attributes [Hash] <%= link_to_attributes_docs %>
138
- def initialize(tag: DEFAULT_TAG, classes: "", attributes: {})
139
- @tag = check_incoming_tag(DEFAULT_TAG, tag)
140
- @classes = merge_class_names(DEFAULT_CLASSES, classes)
141
- @attributes = attributes
142
- end
143
-
144
- def render?
145
- heading.present?
146
- end
147
- end
148
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Add a general description of component here
5
- # Add additional usage considerations or best practices that may aid the user to use the component correctly.
6
- # @accessibility Add any accessibility considerations
7
- class BodyComponent < Ariadne::Component
8
- DEFAULT_CLASSES = "ariadne-scroll-smooth ariadne-antialiased"
9
-
10
- # @example Default
11
- #
12
- # <%= render(Ariadne::BodyComponent.new) { "Example" } %>
13
- #
14
- # @param classes [String] <%= link_to_classes_docs %>
15
- # @param attributes [Hash] <%= link_to_attributes_docs %>
16
- def initialize(classes: "", attributes: {})
17
- @tag = :body
18
- @classes = merge_class_names(
19
- DEFAULT_CLASSES,
20
- classes,
21
- )
22
-
23
- @attributes = attributes
24
- end
25
-
26
- def call
27
- render(Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes)) { content }
28
- end
29
- end
30
- end
@@ -1,4 +0,0 @@
1
- <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |component| %>
2
- <%= icon %>
3
- <%= content %>
4
- <% end %>
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Tab component to be used with bottom_tab_nav
5
-
6
- # Accessibility considerations:
7
- # aria-controls="tabpanelID": Use this if content is being conditionally controlled. Reference the ID of the content being controlled
8
- class BottomTabComponent < Ariadne::Component
9
- DEFAULT_TAG = :a
10
- TAG_OPTIONS = [DEFAULT_TAG].freeze
11
-
12
- DEFAULT_CLASSES = "ariadne-w-full ariadne-py-4 ariadne-flex ariadne-flex-col ariadne-justify-center ariadne-items-center ariadne-cursor-pointer [&>span]:ariadne-p-0 ariadne-border-y-2 ariadne-border-r-2 first:ariadne-border-l-2 ariadne-border-solid ariadne-border-black"
13
- TAB_BACKGROUND_COLOR_CLASSES = "aria-selected:ariadne-bg-gray-200"
14
-
15
- DEFAULT_ATTRIBUTES = {
16
- "data-action": "click->options#select",
17
- "data-options-target": "option",
18
- role: "tab",
19
- tabindex: "0",
20
- }
21
-
22
- renders_one :icon, Ariadne::HeroiconComponent
23
-
24
- # @example Default
25
- #
26
- # <%= render(Ariadne::BottomTabComponent.new) { "Example" } %>
27
- #
28
- # @param tag [Symbol, String] The rendered tag name.
29
- # @param classes [String] <%= link_to_classes_docs %>
30
- # @param attributes [Hash] <%= link_to_attributes_docs %>
31
- def initialize(tag: DEFAULT_TAG, classes: "", active: false, attributes: {})
32
- @tag = check_incoming_tag(DEFAULT_TAG, tag)
33
- @classes = merge_class_names(
34
- DEFAULT_CLASSES,
35
- TAB_BACKGROUND_COLOR_CLASSES,
36
- classes,
37
- )
38
-
39
- @attributes = DEFAULT_ATTRIBUTES
40
- .merge({ "aria-selected": active })
41
- .merge(attributes)
42
- end
43
- end
44
- end
@@ -1,5 +0,0 @@
1
- <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do %>
2
- <% tabs.each do |tab| %>
3
- <%= tab %>
4
- <% end %>
5
- <% end %>
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Navigation component for BottomTabs
5
- class BottomTabNavComponent < Ariadne::Component
6
- DEFAULT_TAG = :nav
7
- DEFAULT_TAB_TAG = :a
8
- TAG_OPTIONS = [DEFAULT_TAG].freeze
9
-
10
- DEFAULT_CLASSES = "ariadne-flex"
11
-
12
- DEFAULT_ATTRIBUTES = {
13
- "data-controller": "options",
14
- "data-options-synced-attrs-value": '["aria-selected"]',
15
- role: "tablist",
16
- }
17
-
18
- renders_many :tabs, Ariadne::BottomTabComponent
19
-
20
- # @example Default
21
- #
22
- # <%= render(Ariadne::BottomTabNavComponent.new) { "Example" } %>
23
- #
24
- # @param tag [Symbol, String] The rendered tag name.
25
- # @param classes [String] <%= link_to_classes_docs %>
26
- # @param attributes [Hash] <%= link_to_attributes_docs %>
27
- def initialize(tag: DEFAULT_TAG, classes: "", attributes: {})
28
- @tag = check_incoming_tag(DEFAULT_TAG, tag)
29
- @classes = merge_class_names(DEFAULT_CLASSES, classes)
30
- @attributes = DEFAULT_ATTRIBUTES.merge(attributes)
31
- end
32
- end
33
- end
@@ -1,13 +0,0 @@
1
- <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |component| %>
2
- <ol class="ariadne-flex ariadne-gap-2 ariadne-items-center">
3
- <% @items.each_with_index do |item, index| %>
4
- <% if index == @items.size - 1 %>
5
- <li class="<%= @active_item_classes %>" aria-current="page"><%= item[:title] %></li>
6
- <% else %>
7
- <li class="<%= @item_classes %>"><a href="<%= item[:url] %>"><%= item[:title] %></a></li>
8
- <%= render Ariadne::HeroiconComponent.new(tag: :svg, icon: "chevron-right", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE, size: :xs) do |icon| %>
9
- <% end %>
10
- <% end %>
11
- <% end %>
12
- </ol>
13
- <% end %>
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Breadcrumb component showing current navigation. The last item is considered the active one
5
- class BreadcrumbsComponent < Ariadne::Component
6
- DEFAULT_TAG = :nav
7
- TAG_OPTIONS = [DEFAULT_TAG].freeze
8
-
9
- DEFAULT_CLASSES = { wrapper: "", item: "", active_item: "ariadne-underline" }
10
-
11
- # @example Default
12
- #
13
- # <%= render(Ariadne::BreadcrumbsComponent.new) { "Example" } %>
14
- #
15
- # @param tag [Symbol, String] The rendered tag name.
16
- # @param classes [String] <%= link_to_classes_docs %>
17
- # @param attributes [Hash] <%= link_to_attributes_docs %>
18
- def initialize(tag: DEFAULT_TAG, classes: "", items: [], item_classes: "", active_item_classes: "", attributes: {})
19
- @tag = check_incoming_tag(DEFAULT_TAG, tag)
20
- @classes = merge_class_names(
21
- DEFAULT_CLASSES[:wrapper],
22
- classes,
23
- )
24
-
25
- @items = items
26
- @item_classes = merge_class_names(DEFAULT_CLASSES[:item], item_classes)
27
- @active_item_classes = merge_class_names(DEFAULT_CLASSES[:item], DEFAULT_CLASSES[:active_item], item_classes, active_item_classes)
28
- @attributes = attributes
29
- end
30
- end
31
- end
@@ -1,4 +0,0 @@
1
- <%= render Ariadne::BaseButton.new(tag: @tag, type: @type, classes: @classes, attributes: @attributes) do -%>
2
- <%= icon %><%= trimmed_content %><%= counter %><%= ariadne_heroicon(icon: :"chevron-down", variant: HeroiconsHelper::Icon::VARIANT_MINI, classes: "ariadne-ml-2 ariadne--mr-1") if dropdown? %>
3
- <%= tooltip %>
4
- <% end -%>
@@ -1,165 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Use `Button` for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
5
- class ButtonComponent < Ariadne::Component
6
- include IconHelper
7
-
8
- DEFAULT_SCHEME = :default
9
- LINK_SCHEME = :link
10
-
11
- SCHEME_CLASS_MAPPINGS = {
12
- link: Ariadne::LinkComponent::DEFAULT_ACTIONABLE_CLASSES,
13
- none: "",
14
- default: "ariadne-text-slate-800 ariadne-bg-slate-50 hover:ariadne-bg-slate-100 ariadne-border-slate-300 focus:ariadne-ring-offset-slate-50 focus:ariadne-ring-slate-600",
15
- info: "ariadne-text-slate-800 ariadne-bg-slate-50 hover:ariadne-bg-slate-100 ariadne-border-slate-300 focus:ariadne-ring-offset-blue-50 focus:ariadne-ring-slate-600",
16
- success: "ariadne-text-green-800 ariadne-bg-green-50 hover:ariadne-bg-green-100 ariadne-border-green-300 focus:ariadne-ring-offset-green-50 focus:ariadne-ring-green-600",
17
- warning: "ariadne-text-yellow-800 ariadne-bg-yellow-50 hover:ariadne-bg-yellow-100 ariadne-border-yellow-300 focus:ariadne-ring-offset-yellow-50 focus:ariadne-ring-yellow-600",
18
- danger: "ariadne-text-red-800 ariadne-bg-red-50 hover:ariadne-bg-red-100 ariadne-border-red-300 focus:ariadne-ring-offset-red-50 focus:ariadne-ring-red-600",
19
- }.freeze
20
- VALID_SCHEMES = SCHEME_CLASS_MAPPINGS.keys.freeze
21
-
22
- # Leading visuals appear to the left of the button text.
23
- #
24
- # Use:
25
- #
26
- # - `icon` for a <%= link_to_component(Ariadne::HeroiconComponent) %>.
27
- #
28
- # @param tag [Symbol, String] The rendered tag name
29
- # @param classes [String] <%= link_to_classes_docs %>
30
- # @param icon [String] Name of <%= link_to_heroicons %> to use.
31
- # @param variant [String] <%= one_of(HeroiconsHelper::Icon::VALID_VARIANTS, sort: false) %>
32
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::HeroiconComponent) %>.
33
- renders_one :icon, lambda { |tag: :svg, icon:, variant:, classes: "", attributes: {}|
34
- @icon = icon
35
- @variant = variant
36
- tag = check_incoming_tag(:svg, tag)
37
- Ariadne::HeroiconComponent.new(tag: tag, icon: icon, variant: variant, classes: classes, attributes: attributes)
38
- }
39
-
40
- # Trailing visuals appear to the right of the button text.
41
- #
42
- # Use:
43
- #
44
- # - `counter` for a <%= link_to_component(Ariadne::CounterComponent) %>.
45
- #
46
- # @param tag [Symbol, String] The rendered tag name
47
- # @param classes [String] <%= link_to_classes_docs %>
48
- # @param counter [Number] The starting counter value
49
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::CounterComponent) %>.
50
- renders_one :counter, lambda { |tag: :span, count: 0, classes: "", attributes: {}|
51
- tag = check_incoming_tag(:span, tag)
52
- attributes[:ml] = check_incoming_value(2, ml: attributes[:ml])
53
-
54
- Ariadne::CounterComponent.new(tag: tag, count: count, classes: classes, attributes: attributes)
55
- }
56
-
57
- # `Tooltip` that appears on mouse hover or keyboard focus over the button. Use tooltips sparingly and as a last resort.
58
- # **Important:** This tooltip defaults to `type: :description`. In a few scenarios, `type: :label` may be more appropriate.
59
- # Consult the <%= link_to_component(Ariadne::TooltipComponent) %> documentation for more information.
60
- #
61
- # @param tag [Symbol, String] The rendered tag name
62
- # @param text [String] The text content of the tooltip. This should be brief and no longer than a sentence.
63
- # @param direction [Symbol] <%= one_of(Ariadne::TooltipComponent::VALID_PLACEMENTS) %>
64
- # @param classes [String] <%= link_to_classes_docs %>
65
- # @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::TooltipComponent) %>.
66
- renders_one :tooltip, lambda { |tag: Ariadne::TooltipComponent::DEFAULT_TAG, text:, direction: Ariadne::TooltipComponent::DEFAULT_PLACEMENT, type: Ariadne::TooltipComponent::TYPE_DEFAULT, classes: "", attributes: {}|
67
- raise ArgumentError, "Buttons with a tooltip must have a unique `id` set on the `Button`." if @id.blank?
68
-
69
- Ariadne::TooltipComponent.new(for_id: @id, tag: tag, text: text, direction: direction, type: type, classes: classes, attributes: attributes)
70
- }
71
-
72
- # @example Schemes
73
- # <%= render(Ariadne::ButtonComponent.new) { "Default" } %>
74
- # <%= render(Ariadne::ButtonComponent.new(scheme: :default)) { "Default" } %>
75
- # <%= render(Ariadne::ButtonComponent.new(scheme: :info)) { "Info" } %>
76
- # <%= render(Ariadne::ButtonComponent.new(scheme: :success)) { "Success" } %>
77
- # <%= render(Ariadne::ButtonComponent.new(scheme: :warning)) { "Warning" } %>
78
- # <%= render(Ariadne::ButtonComponent.new(scheme: :danger)) { "Danger" } %>
79
- #
80
- # @example Sizes
81
- # <%= render(Ariadne::ButtonComponent.new(size: :sm)) { "Small" } %>
82
- # <%= render(Ariadne::ButtonComponent.new(size: :md)) { "Medium" } %>
83
- #
84
- # @example With leading visual
85
- # <%= render(Ariadne::ButtonComponent.new) do |c| %>
86
- # <% c.with_icon(icon: :star, variant: HeroiconsHelper::Icon::VARIANT_OUTLINE, classes: "ariadne-text-yellow-600") %>
87
- # Button
88
- # <% end %>
89
- #
90
- # @example With trailing visual
91
- # <%= render(Ariadne::ButtonComponent.new) do |c| %>
92
- # <% c.with_counter(count: 15) %>
93
- # Button
94
- # <% end %>
95
- #
96
- # @example With leading and trailing visuals
97
- # <%= render(Ariadne::ButtonComponent.new) do |c| %>
98
- # <% c.with_icon(icon: :star, variant: HeroiconsHelper::Icon::VARIANT_OUTLINE) %>
99
- # <% c.with_counter(count: 15) %>
100
- # Button
101
- # <% end %>
102
- #
103
- # @example With tooltip
104
- # @description
105
- # Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Ariadne::TooltipComponent) %> documentation for more information.
106
- # @code
107
- # <%= render(Ariadne::ButtonComponent.new(attributes: { id: "button-with-tooltip" })) do |c| %>
108
- # <% c.with_tooltip(text: "Tooltip text") %>
109
- # Button
110
- # <% end %>
111
- #
112
- # @param tag [Symbol] <%= one_of(Ariadne::BaseButton::TAG_OPTIONS) %>
113
- # @param type [Symbol] <%= one_of(Ariadne::BaseButton::VALID_TYPES) %>
114
- # @param scheme [Symbol] <%= one_of(Ariadne::ButtonComponent::VALID_SCHEMES) %>
115
- # @param size [Symbol] <%= one_of(Ariadne::BaseButton::VALID_SIZES) %>
116
- # @param dropdown [Boolean] Whether or not to render a dropdown caret.
117
- # @param classes [String] <%= link_to_classes_docs %>
118
- # @param attributes [Hash] <%= link_to_attributes_docs %>
119
- def initialize(
120
- tag: Ariadne::BaseButton::DEFAULT_TAG,
121
- type: Ariadne::BaseButton::DEFAULT_TYPE,
122
- scheme: DEFAULT_SCHEME,
123
- size: BaseButton::DEFAULT_SIZE,
124
- dropdown: false,
125
- classes: "",
126
- attributes: {}
127
- )
128
- @tag = tag
129
- @type = type
130
-
131
- @attributes = attributes
132
- @id = @attributes[:id]
133
-
134
- @size = fetch_or_raise(Ariadne::BaseButton::VALID_SIZES, size)
135
- @scheme = fetch_or_raise(VALID_SCHEMES, scheme)
136
- @scheme = LINK_SCHEME if @tag == :a
137
-
138
- @classes = merge_class_names(
139
- SCHEME_CLASS_MAPPINGS[@scheme],
140
- classes,
141
- )
142
-
143
- @dropdown = dropdown
144
- end
145
-
146
- private def dropdown?
147
- @dropdown
148
- end
149
-
150
- private def trimmed_content
151
- return if content.blank?
152
-
153
- trimmed_content = content.strip
154
-
155
- return trimmed_content unless content.html_safe?
156
-
157
- # strip unsets `html_safe`, so we have to set it back again to guarantee that HTML blocks won't break
158
- trimmed_content.html_safe # rubocop:disable Rails/OutputSafety
159
- end
160
-
161
- private def link?
162
- @scheme == LINK_SCHEME
163
- end
164
- end
165
- end
@@ -1,5 +0,0 @@
1
- <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @label_classes, attributes: @label_attributes) do |component| %>
2
- <%= render Ariadne::BaseComponent.new(tag: :input, classes: @input_classes, attributes: @input_attributes) do |input| %>
3
- <% end %>
4
- <%= content %>
5
- <% end %>
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Ariadne
4
- # Just a checkbox with a label, state managed by toggleable controller
5
- class CheckboxComponent < Ariadne::Component
6
- DEFAULT_TAG = :label
7
- TAG_OPTIONS = [DEFAULT_TAG].freeze
8
-
9
- DEFAULT_CLASSES = {
10
- input: "ariadne-mr-2",
11
- label: "ariadne-flex ariadne-items-center ariadne-cursor-pointer ariadne-w-fit",
12
- }
13
-
14
- DEFAULT_ATTRIBUTES = {
15
- input: {
16
- type: "checkbox",
17
- "data-controller": "toggleable",
18
- "data-toggleable-synced-attrs-value": '["checked", "aria-checked"]',
19
- "data-action": "click->toggleable#toggle",
20
- },
21
- label: {},
22
- }
23
-
24
- # @example Default
25
- #
26
- # <%= render(Ariadne::CheckboxComponent.new) { "Example" } %>
27
- #
28
- # @param tag [Symbol, String] The rendered tag name.
29
- # @param classes [String] <%= link_to_classes_docs %>
30
- # @param attributes [Hash] <%= link_to_attributes_docs %>
31
- def initialize(tag: DEFAULT_TAG, classes: "", input_classes: "", initial_value: false, input_attributes: {}, attributes: {})
32
- @tag = @tag = check_incoming_tag(DEFAULT_TAG, tag)
33
-
34
- @label_attributes = DEFAULT_ATTRIBUTES[:label].merge(attributes)
35
- @label_classes = merge_class_names(DEFAULT_CLASSES[:label], classes)
36
-
37
- @input_classes = merge_class_names(DEFAULT_CLASSES[:input], input_classes)
38
- @input_attributes = DEFAULT_ATTRIBUTES[:input]
39
- .merge({ "data-toggleable-state-value": initial_value.to_s })
40
- .merge(input_attributes)
41
- end
42
- end
43
- end
@@ -1,4 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus';
2
- export default class ClipboardCopyComponent extends Controller {
3
- copy(): void;
4
- }
@@ -1,18 +0,0 @@
1
- import { Controller } from '@hotwired/stimulus';
2
- export default class ClipboardCopyComponent extends Controller {
3
- copy() {
4
- const value = this.element.attributes.getNamedItem('value');
5
- const forNode = this.element.attributes.getNamedItem('for');
6
- if (value) {
7
- navigator.clipboard.writeText(value.value);
8
- }
9
- else if (forNode) {
10
- const node = document.getElementById(forNode.value);
11
- navigator.clipboard.writeText((node === null || node === void 0 ? void 0 : node.textContent) || '');
12
- }
13
- else {
14
- // just copy inner text
15
- navigator.clipboard.writeText(this.element.textContent || '');
16
- }
17
- }
18
- }
@@ -1,19 +0,0 @@
1
- import {Controller} from '@hotwired/stimulus'
2
-
3
- export default class ClipboardCopyComponent extends Controller {
4
- copy() {
5
- const value = this.element.attributes.getNamedItem('value')
6
-
7
- const forNode = this.element.attributes.getNamedItem('for')
8
-
9
- if (value) {
10
- navigator.clipboard.writeText(value.value)
11
- } else if (forNode) {
12
- const node = document.getElementById(forNode.value)
13
- navigator.clipboard.writeText(node?.textContent || '')
14
- } else {
15
- // just copy inner text
16
- navigator.clipboard.writeText(this.element.textContent || '')
17
- }
18
- }
19
- }
@@ -1,9 +0,0 @@
1
- <%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes.merge(controller_data)) do %>
2
- <% if content.present? %>
3
- <%= content.to_s + tooltip.to_s %>
4
- <% else %>
5
- <%= render Ariadne::HeroiconComponent.new(icon: :"document-duplicate", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE) %>
6
- <!-- TODO: fix, check should replace on click -->
7
- <%= render Ariadne::HeroiconComponent.new(icon: :check, variant: HeroiconsHelper::Icon::VARIANT_OUTLINE, classes: "ariadne-text-green-600", attributes: { style: "display: none;" }) %>
8
- <% end %>
9
- <% end %>