ariadne_view_components 0.0.58 → 0.0.64
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/LICENSE.txt +661 -49
- data/README.md +52 -4
- data/app/assets/javascripts/ariadne_view_components.js +98 -7
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/stylesheets/ariadne_view_components.css +1 -7
- data/app/components/ariadne/base_component.rb +79 -27
- data/app/components/ariadne/behaviors/tooltipable.rb +120 -0
- data/app/components/ariadne/conditional_wrapper.rb +21 -0
- data/app/components/ariadne/form/base_component.rb +74 -0
- data/app/components/ariadne/form/base_input_component.rb +60 -0
- data/app/components/ariadne/form/caption/component.html.erb +10 -0
- data/app/components/ariadne/form/caption/component.rb +29 -0
- data/app/components/ariadne/form/form_control/component.html.erb +19 -0
- data/app/components/ariadne/form/form_control/component.rb +27 -0
- data/app/components/ariadne/form/form_reference/component.html.erb +1 -0
- data/app/components/ariadne/form/form_reference/component.rb +18 -0
- data/app/components/ariadne/form/group/component.html.erb +5 -0
- data/app/components/ariadne/form/group/component.rb +27 -0
- data/app/components/ariadne/form/hidden_field/component.html.erb +1 -0
- data/app/components/ariadne/form/hidden_field/component.rb +15 -0
- data/app/components/ariadne/form/separator/component.html.erb +1 -0
- data/app/components/ariadne/form/separator/component.rb +8 -0
- data/app/components/ariadne/form/spacing_wrapper/component.html.erb +3 -0
- data/app/components/ariadne/form/spacing_wrapper/component.rb +8 -0
- data/app/components/ariadne/form/text_field/component.html.erb +25 -0
- data/app/components/ariadne/form/text_field/component.rb +132 -0
- data/app/components/ariadne/form/validation_message/component.html.erb +5 -0
- data/app/components/ariadne/form/validation_message/component.rb +14 -0
- data/app/components/ariadne/layout/narrow/component.html.erb +10 -0
- data/app/components/ariadne/layout/narrow/component.rb +24 -0
- data/app/components/ariadne/layout/nav_bar/component.css +0 -0
- data/app/components/ariadne/layout/nav_bar/component.html.erb +123 -0
- data/app/components/ariadne/layout/nav_bar/component.rb +77 -0
- data/app/components/ariadne/ui/button/component.html.erb +5 -0
- data/app/components/ariadne/ui/button/component.rb +184 -0
- data/app/components/ariadne/ui/clipboard_copy/component.html.erb +8 -0
- data/app/components/ariadne/ui/clipboard_copy/component.rb +102 -0
- data/app/components/ariadne/ui/clipboard_copy/component.ts +54 -0
- data/app/components/ariadne/ui/combobox/component.html.erb +32 -0
- data/app/components/ariadne/ui/combobox/component.rb +83 -0
- data/app/components/ariadne/ui/combobox/component.ts +119 -0
- data/app/components/ariadne/ui/combobox/menu_item/component.html.erb +9 -0
- data/app/components/ariadne/ui/combobox/menu_item/component.rb +53 -0
- data/app/components/ariadne/ui/combobox/option/component.html.erb +11 -0
- data/app/components/ariadne/ui/combobox/option/component.rb +45 -0
- data/app/components/ariadne/ui/heroicon/component.html.erb +3 -0
- data/app/components/ariadne/ui/heroicon/component.rb +141 -0
- data/app/components/ariadne/ui/image/component.rb +69 -0
- data/app/components/ariadne/ui/link/component.html.erb +3 -0
- data/app/components/ariadne/ui/link/component.rb +56 -0
- data/app/components/ariadne/ui/typography/component.html.erb +3 -0
- data/app/components/ariadne/ui/typography/component.rb +41 -0
- data/app/lib/ariadne/attributes_helper.rb +119 -0
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +1 -1
- data/app/lib/ariadne/form.rb +16 -0
- data/app/lib/ariadne/view_helper.rb +2 -5
- data/app/lib/view_components_contrib/html_attrs.rb +64 -0
- data/app/lib/view_components_contrib/style_variants.rb +14 -0
- data/lib/ariadne/forms/acts_as_component.rb +125 -0
- data/lib/ariadne/forms/base.html.erb +8 -0
- data/lib/ariadne/forms/base.rb +132 -0
- data/lib/ariadne/forms/buffer_rewriter.rb +51 -0
- data/lib/ariadne/forms/builder.rb +88 -0
- data/lib/ariadne/forms/dsl/button_input.rb +33 -0
- data/lib/ariadne/forms/dsl/form_object.rb +26 -0
- data/lib/ariadne/forms/dsl/input.rb +322 -0
- data/lib/ariadne/forms/dsl/input_group.rb +34 -0
- data/lib/ariadne/forms/dsl/input_methods.rb +157 -0
- data/lib/ariadne/forms/dsl/submit_button_input.rb +36 -0
- data/lib/ariadne/forms/dsl/text_field_input.rb +73 -0
- data/lib/ariadne/forms/utils.rb +34 -0
- data/lib/ariadne/generate.rb +11 -0
- data/lib/ariadne/view_components/engine.rb +24 -7
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/ariadne/view_components.rb +1 -1
- data/lib/ariadne/yard/backend.rb +24 -0
- data/lib/ariadne/yard/component_manifest.rb +148 -0
- data/lib/ariadne/yard/component_ref.rb +49 -0
- data/lib/ariadne/yard/docs_helper.rb +98 -0
- data/lib/ariadne/yard/info_arch_docs_helper.rb +31 -0
- data/lib/ariadne/yard/lookbook_docs_helper.rb +32 -0
- data/lib/ariadne/yard/lookbook_pages_backend.rb +235 -0
- data/lib/ariadne/yard/registry.rb +136 -0
- data/lib/ariadne/yard/renders_many_handler.rb +23 -0
- data/lib/ariadne/yard/renders_one_handler.rb +23 -0
- data/lib/ariadne/yard.rb +19 -0
- data/static/arguments.yml +141 -48
- data/static/audited_at.json +0 -9
- data/static/classes.yml +210 -209
- data/static/constants.json +2 -209
- data/static/statuses.json +0 -9
- metadata +125 -210
- data/app/assets/builds/ariadne_view_components.css +0 -2202
- data/app/assets/javascripts/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
- data/app/assets/javascripts/components/ariadne/ariadne-form.d.ts +0 -22
- data/app/assets/javascripts/components/ariadne/ariadne.d.ts +0 -2
- data/app/assets/javascripts/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
- data/app/assets/javascripts/components/ariadne/dropdown/menu_component.d.ts +0 -1
- data/app/assets/javascripts/components/ariadne/events_controller/events_controller.d.ts +0 -4
- data/app/assets/javascripts/components/ariadne/options_controller/options_controller.d.ts +0 -39
- data/app/assets/javascripts/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
- data/app/assets/javascripts/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
- data/app/assets/javascripts/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
- data/app/assets/javascripts/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
- data/app/assets/javascripts/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
- data/app/assets/javascripts/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
- data/app/assets/javascripts/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
- data/app/assets/javascripts/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
- data/app/assets/javascripts/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
- data/app/assets/stylesheets/dropdown.css +0 -46
- data/app/assets/stylesheets/prosemirror.css +0 -323
- data/app/assets/stylesheets/tooltip-component.css +0 -37
- data/app/components/ariadne/accumulator_controller/accumulator_controller.d.ts +0 -22
- data/app/components/ariadne/accumulator_controller/accumulator_controller.js +0 -39
- data/app/components/ariadne/accumulator_controller/accumulator_controller.ts +0 -48
- data/app/components/ariadne/action_card_component.html.erb +0 -13
- data/app/components/ariadne/action_card_component.rb +0 -88
- data/app/components/ariadne/ariadne-form.d.ts +0 -22
- data/app/components/ariadne/ariadne-form.js +0 -85
- data/app/components/ariadne/ariadne.d.ts +0 -2
- data/app/components/ariadne/ariadne.js +0 -24
- data/app/components/ariadne/ariadne.ts +0 -29
- data/app/components/ariadne/avatar_component.rb +0 -81
- data/app/components/ariadne/avatar_stack_component/avatar_stack_component.html.erb +0 -12
- data/app/components/ariadne/avatar_stack_component.rb +0 -75
- data/app/components/ariadne/base_button.rb +0 -70
- data/app/components/ariadne/blankslate_component/blankslate_component.html.erb +0 -26
- data/app/components/ariadne/blankslate_component.rb +0 -148
- data/app/components/ariadne/body_component.rb +0 -30
- data/app/components/ariadne/bottom_tab_component.html.erb +0 -4
- data/app/components/ariadne/bottom_tab_component.rb +0 -44
- data/app/components/ariadne/bottom_tab_nav_component.html.erb +0 -5
- data/app/components/ariadne/bottom_tab_nav_component.rb +0 -33
- data/app/components/ariadne/breadcrumbs_component.html.erb +0 -13
- data/app/components/ariadne/breadcrumbs_component.rb +0 -31
- data/app/components/ariadne/button_component/button_component.html.erb +0 -4
- data/app/components/ariadne/button_component.rb +0 -165
- data/app/components/ariadne/checkbox_component.html.erb +0 -5
- data/app/components/ariadne/checkbox_component.rb +0 -43
- data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.d.ts +0 -4
- data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.js +0 -18
- data/app/components/ariadne/clipboard_copy_component/clipboard-copy-component.ts +0 -19
- data/app/components/ariadne/clipboard_copy_component/clipboard_copy_component.html.erb +0 -9
- data/app/components/ariadne/clipboard_copy_component.rb +0 -90
- data/app/components/ariadne/close_button_component.html.erb +0 -4
- data/app/components/ariadne/close_button_component.rb +0 -33
- data/app/components/ariadne/combobox_component.html.erb +0 -14
- data/app/components/ariadne/combobox_component.rb +0 -76
- data/app/components/ariadne/component.rb +0 -127
- data/app/components/ariadne/container_component/container_component.html.erb +0 -3
- data/app/components/ariadne/container_component.rb +0 -25
- data/app/components/ariadne/content.rb +0 -12
- data/app/components/ariadne/counter_component.rb +0 -100
- data/app/components/ariadne/details_component/details_component.html.erb +0 -4
- data/app/components/ariadne/details_component.rb +0 -81
- data/app/components/ariadne/dropdown/menu_component.d.ts +0 -1
- data/app/components/ariadne/dropdown/menu_component.html.erb +0 -20
- data/app/components/ariadne/dropdown/menu_component.js +0 -1
- data/app/components/ariadne/dropdown/menu_component.rb +0 -101
- data/app/components/ariadne/dropdown/menu_component.ts +0 -1
- data/app/components/ariadne/dropdown_component/dropdown_component.html.erb +0 -8
- data/app/components/ariadne/dropdown_component.rb +0 -172
- data/app/components/ariadne/events_controller/events_controller.d.ts +0 -4
- data/app/components/ariadne/events_controller/events_controller.js +0 -6
- data/app/components/ariadne/events_controller/events_controller.ts +0 -7
- data/app/components/ariadne/flash_component/flash_component.html.erb +0 -31
- data/app/components/ariadne/flash_component.rb +0 -128
- data/app/components/ariadne/flex_component/flex_component.html.erb +0 -5
- data/app/components/ariadne/flex_component.rb +0 -56
- data/app/components/ariadne/footer_component/footer_component.html.erb +0 -7
- data/app/components/ariadne/footer_component.rb +0 -23
- data/app/components/ariadne/grid_component/grid_component.html.erb +0 -26
- data/app/components/ariadne/grid_component.rb +0 -67
- data/app/components/ariadne/header_component/header_component.html.erb +0 -29
- data/app/components/ariadne/header_component.rb +0 -111
- data/app/components/ariadne/heading_component.rb +0 -49
- data/app/components/ariadne/heroicon_component/heroicon_component.html.erb +0 -4
- data/app/components/ariadne/heroicon_component.rb +0 -166
- data/app/components/ariadne/image_component.rb +0 -53
- data/app/components/ariadne/inline_flex_component/inline_flex_component.html.erb +0 -6
- data/app/components/ariadne/inline_flex_component.rb +0 -72
- data/app/components/ariadne/layout_component.html.erb +0 -21
- data/app/components/ariadne/layout_component.rb +0 -69
- data/app/components/ariadne/link_component.rb +0 -65
- data/app/components/ariadne/list_component/list_component.html.erb +0 -3
- data/app/components/ariadne/list_component.rb +0 -70
- data/app/components/ariadne/modal_component.html.erb +0 -11
- data/app/components/ariadne/modal_component.rb +0 -88
- data/app/components/ariadne/narrow_container_component/narrow_container_component.html.erb +0 -3
- data/app/components/ariadne/narrow_container_component.rb +0 -30
- data/app/components/ariadne/options_controller/options_controller.d.ts +0 -39
- data/app/components/ariadne/options_controller/options_controller.js +0 -89
- data/app/components/ariadne/options_controller/options_controller.ts +0 -122
- data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.d.ts +0 -42
- data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.js +0 -237
- data/app/components/ariadne/outlet_manager_controller/outlet_manager_controller.ts +0 -278
- data/app/components/ariadne/panel_bar_component/panel_bar_component.html.erb +0 -20
- data/app/components/ariadne/panel_bar_component.rb +0 -80
- data/app/components/ariadne/pill_component/pill_component.html.erb +0 -3
- data/app/components/ariadne/pill_component.rb +0 -44
- data/app/components/ariadne/popover_component.html.erb +0 -10
- data/app/components/ariadne/popover_component.rb +0 -81
- data/app/components/ariadne/progress_bar_component.html.erb +0 -5
- data/app/components/ariadne/progress_bar_component.rb +0 -63
- data/app/components/ariadne/relative_time_component.html.erb +0 -3
- data/app/components/ariadne/relative_time_component.rb +0 -61
- data/app/components/ariadne/show_more_button_component.html.erb +0 -11
- data/app/components/ariadne/show_more_button_component.rb +0 -47
- data/app/components/ariadne/slideover_component/slideover-component.d.ts +0 -9
- data/app/components/ariadne/slideover_component/slideover-component.js +0 -11
- data/app/components/ariadne/slideover_component/slideover-component.ts +0 -17
- data/app/components/ariadne/slideover_component/slideover_component.html.erb +0 -9
- data/app/components/ariadne/slideover_component.rb +0 -66
- data/app/components/ariadne/spinner_component.html.erb +0 -16
- data/app/components/ariadne/spinner_component.rb +0 -45
- data/app/components/ariadne/string_match_controller/string_match_controller.d.ts +0 -27
- data/app/components/ariadne/string_match_controller/string_match_controller.js +0 -51
- data/app/components/ariadne/string_match_controller/string_match_controller.ts +0 -65
- data/app/components/ariadne/subheader_component.html.erb +0 -11
- data/app/components/ariadne/subheader_component.rb +0 -65
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.d.ts +0 -48
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.js +0 -207
- data/app/components/ariadne/synced_boolean_attributes_controller/synced_boolean_attributes_controller.ts +0 -256
- data/app/components/ariadne/tab_component/tab_component.html.erb +0 -3
- data/app/components/ariadne/tab_component.rb +0 -98
- data/app/components/ariadne/tab_container_component/tab-container-component.d.ts +0 -1
- data/app/components/ariadne/tab_container_component/tab-container-component.js +0 -23
- data/app/components/ariadne/tab_container_component/tab-container-component.ts +0 -24
- data/app/components/ariadne/tab_container_component.erb +0 -10
- data/app/components/ariadne/tab_container_component.rb +0 -68
- data/app/components/ariadne/tab_nav_component/tab-nav-component.d.ts +0 -9
- data/app/components/ariadne/tab_nav_component/tab-nav-component.js +0 -33
- data/app/components/ariadne/tab_nav_component/tab-nav-component.ts +0 -34
- data/app/components/ariadne/tab_nav_component/tab_nav_component.html.erb +0 -7
- data/app/components/ariadne/tab_nav_component.rb +0 -72
- data/app/components/ariadne/table_nav_component/table_nav_component.html.erb +0 -52
- data/app/components/ariadne/table_nav_component.rb +0 -338
- data/app/components/ariadne/text.rb +0 -25
- data/app/components/ariadne/time_ago_component/time-ago-component.d.ts +0 -1
- data/app/components/ariadne/time_ago_component/time-ago-component.js +0 -1
- data/app/components/ariadne/time_ago_component/time-ago-component.ts +0 -1
- data/app/components/ariadne/time_ago_component.rb +0 -56
- data/app/components/ariadne/timeline_component/timeline_component.html.erb +0 -19
- data/app/components/ariadne/timeline_component.rb +0 -34
- data/app/components/ariadne/toggle_component/toggle_component.html.erb +0 -15
- data/app/components/ariadne/toggle_component.rb +0 -95
- data/app/components/ariadne/toggleable_controller/toggleable_controller.d.ts +0 -34
- data/app/components/ariadne/toggleable_controller/toggleable_controller.js +0 -54
- data/app/components/ariadne/toggleable_controller/toggleable_controller.ts +0 -77
- data/app/components/ariadne/tooltip_component/tooltip-component.d.ts +0 -24
- data/app/components/ariadne/tooltip_component/tooltip-component.js +0 -43
- data/app/components/ariadne/tooltip_component/tooltip-component.ts +0 -57
- data/app/components/ariadne/tooltip_component/tooltip_component.html.erb +0 -4
- data/app/components/ariadne/tooltip_component.rb +0 -108
- data/app/lib/ariadne/action_view_extensions/form_helper.rb +0 -30
- data/app/lib/ariadne/audited/dsl.rb +0 -32
- data/app/lib/ariadne/form_builder.rb +0 -80
- data/app/lib/ariadne/status/dsl.rb +0 -41
- data/config/importmap.rb +0 -3
- data/exe/tailwindcss +0 -21
- data/lib/rubocop/cop/ariadne/base_cop.rb +0 -26
- data/tailwind.config.js +0 -70
@@ -1,90 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Use `ClipboardCopyComponent` to copy element text content or input values to the clipboard.
|
5
|
-
#
|
6
|
-
# @accessibility
|
7
|
-
# Always set an accessible label to help the user interact with the component.
|
8
|
-
class ClipboardCopyComponent < Ariadne::Component
|
9
|
-
DEFAULT_TAG = :"clipboard-copy"
|
10
|
-
|
11
|
-
DEFAULT_CLASSES = LinkComponent::DEFAULT_ACTIONABLE_CLASSES
|
12
|
-
|
13
|
-
DATA_CONTROLLER = "clipboard-copy-component"
|
14
|
-
DATA_ACTION = "click->clipboard-copy-component#copy"
|
15
|
-
|
16
|
-
# `Tooltip` that appears on mouse hover or keyboard focus over the button. Use tooltips sparingly and as a last resort.
|
17
|
-
# **Important:** This tooltip defaults to `type: :description`. In a few scenarios, `type: :label` may be more appropriate.
|
18
|
-
# Consult the <%= link_to_component(Ariadne::TooltipComponent) %> documentation for more information.
|
19
|
-
#
|
20
|
-
# @param tag [Symbol, String] The rendered tag name
|
21
|
-
# @param text [String] The text content of the tooltip. This should be brief and no longer than a sentence.
|
22
|
-
# @param direction [Symbol] <%= one_of(Ariadne::TooltipComponent::VALID_PLACEMENTS) %>
|
23
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
24
|
-
# @param attributes [Hash] Same arguments as <%= link_to_component(Ariadne::TooltipComponent) %>.
|
25
|
-
renders_one :tooltip, lambda { |tag: Ariadne::TooltipComponent::DEFAULT_TAG, text:, direction: Ariadne::TooltipComponent::DEFAULT_PLACEMENT, type: Ariadne::TooltipComponent::TYPE_DEFAULT, classes: "", attributes: {}|
|
26
|
-
raise ArgumentError, "CopyClipboardComponents with a tooltip must have a unique `id` set on the `CopyClipboardComponent`." if @id.blank?
|
27
|
-
|
28
|
-
@data_tooltip_direction = { "data-tooltip-component-direction": direction }
|
29
|
-
|
30
|
-
Ariadne::TooltipComponent.new(tag: tag, for_id: @id, text: text, direction: direction, type: type, classes: classes, attributes: attributes)
|
31
|
-
}
|
32
|
-
|
33
|
-
# @example Default
|
34
|
-
# <%= render(Ariadne::ClipboardCopyComponent.new(value: "Text to copy", aria_label: "Copy text to the system clipboard" )) %>
|
35
|
-
#
|
36
|
-
# @example With text instead of icons
|
37
|
-
# <%= render(Ariadne::ClipboardCopyComponent.new(value: "Text to copy", aria_label: "Copy text to the system clipboard" )) do %>
|
38
|
-
# Click to copy!
|
39
|
-
# <% end %>
|
40
|
-
#
|
41
|
-
# @example Copying from an element
|
42
|
-
# <%= render(Ariadne::ClipboardCopyComponent.new(for_id: "blob-path", aria_label: "Copy text to the system clipboard" )) %>
|
43
|
-
# <div id="blob-path">src/index.js</div>
|
44
|
-
#
|
45
|
-
# @param tag [Symbol, String] The rendered tag name
|
46
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
47
|
-
# @param value [String] Text to copy into the users clipboard when they click the component.
|
48
|
-
# @param for_id [String] If `value` is not provided, the element with this id will be copied.
|
49
|
-
# @param aria_label [String] Text for accessibility. Can also be passed in as part of `attributes`, but it must be present.
|
50
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
51
|
-
def initialize(tag: DEFAULT_TAG, value: "", for_id: nil, aria_label: "", classes: "", attributes: {})
|
52
|
-
@attributes = attributes
|
53
|
-
@value = value
|
54
|
-
|
55
|
-
@attributes[:"aria-label"] = aria_label
|
56
|
-
@attributes[:for] ||= for_id
|
57
|
-
@id = @attributes[:id]
|
58
|
-
|
59
|
-
validate!
|
60
|
-
|
61
|
-
@classes = merge_class_names(DEFAULT_CLASSES, classes)
|
62
|
-
@tag = check_incoming_tag(DEFAULT_TAG, tag)
|
63
|
-
@attributes[:value] = value if value.present?
|
64
|
-
end
|
65
|
-
|
66
|
-
private def validate!
|
67
|
-
validate_aria_label!
|
68
|
-
raise ArgumentError, "Must provide either `value` or `for`" if @value.blank? && @attributes[:for].blank?
|
69
|
-
raise ArgumentError, "Must provide only `value` or `for`, not both" if @value.present? && @attributes[:for].present?
|
70
|
-
end
|
71
|
-
|
72
|
-
DATA_CONTROLLERS_WITH_TOOLTIPS = {
|
73
|
-
"data-controller": "#{DATA_CONTROLLER} #{Ariadne::TooltipComponent::DATA_CONTROLLER}",
|
74
|
-
"data-action": "#{DATA_ACTION} #{Ariadne::TooltipComponent::DATA_ACTION}",
|
75
|
-
"data-tooltip-component-target": "trigger",
|
76
|
-
}
|
77
|
-
|
78
|
-
DATA_CONTROLLERS =
|
79
|
-
{
|
80
|
-
"data-controller": DATA_CONTROLLER.to_s,
|
81
|
-
"data-action": DATA_ACTION,
|
82
|
-
}
|
83
|
-
|
84
|
-
def controller_data
|
85
|
-
return DATA_CONTROLLERS_WITH_TOOLTIPS if tooltip.present?
|
86
|
-
|
87
|
-
DATA_CONTROLLERS
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,4 +0,0 @@
|
|
1
|
-
<%= render Ariadne::ButtonComponent.new(tag: @tag, classes: @classes, scheme: @scheme, attributes: @attributes) do |component| %>
|
2
|
-
<%= render Ariadne::HeroiconComponent.new(icon: "x-mark", variant: HeroiconsHelper::Icon::VARIANT_OUTLINE, classes: @icon_classes, size: @size) do |icon| %>
|
3
|
-
<% end %>
|
4
|
-
<% end %>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Simple button with X icon to close models and such
|
5
|
-
class CloseButtonComponent < Ariadne::Component
|
6
|
-
DEFAULT_TAG = :button
|
7
|
-
TAG_OPTIONS = [DEFAULT_TAG].freeze
|
8
|
-
|
9
|
-
DEFAULT_CLASSES = "ariadne-border-none ariadne-bg-transparent ariadne-shadow-none hover:ariadne-bg-transparent"
|
10
|
-
|
11
|
-
# @example Default
|
12
|
-
#
|
13
|
-
# <%= render(Ariadne::CloseButtonComponent.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: "", icon_classes: "", size: :xs, aria_label: nil, scheme: :none, attributes: {})
|
19
|
-
raise ArgumentError, "An 'aria_label' argument is required to use a Close Button. Include as much detail as you can about what the button will be closing." if aria_label.blank?
|
20
|
-
|
21
|
-
@tag = check_incoming_tag(DEFAULT_TAG, tag)
|
22
|
-
@attributes = { "aria-label": aria_label }.merge(attributes)
|
23
|
-
@classes = merge_class_names(
|
24
|
-
DEFAULT_CLASSES,
|
25
|
-
classes,
|
26
|
-
)
|
27
|
-
|
28
|
-
@scheme = scheme
|
29
|
-
@size = size
|
30
|
-
@icon_classses = icon_classes
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do %>
|
2
|
-
<%= render Ariadne::BaseComponent.new(tag: :input, classes: @input_classes, attributes: @input_attributes) do %>
|
3
|
-
<% if icon? %>
|
4
|
-
<%= icon %>
|
5
|
-
<% else %>
|
6
|
-
<%= Ariadne::HeroiconComponent.new(icon: :cube, variant: HeroiconsHelper::Icon::VARIANT_OUTLINE) %>
|
7
|
-
<% end %>
|
8
|
-
<% end %>
|
9
|
-
<%= render Ariadne::BaseComponent.new(tag: @options_wrapper_tag, classes: @options_wrapper_classes, attributes: @options_wrapper_attributes) do %>
|
10
|
-
<% options.each do |option| %>
|
11
|
-
<%= option %>
|
12
|
-
<% end %>
|
13
|
-
<% end %>
|
14
|
-
<% end %>
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Input with a dropdown selection
|
5
|
-
class ComboboxComponent < Ariadne::Component
|
6
|
-
DEFAULT_TAG = :div
|
7
|
-
DEFAULT_OPTIONS_WRAPPER_TAG = :div
|
8
|
-
TAG_OPTIONS = [DEFAULT_TAG].freeze
|
9
|
-
|
10
|
-
DEFAULT_CLASSES = {
|
11
|
-
wrapper: "ariadne-group ariadne-w-fit ariadne-relative",
|
12
|
-
options_wrapper: "group-data-[toggleable-state-value=false]:ariadne-hidden ariadne-absolute ariadne-w-full ariadne-z-10",
|
13
|
-
input: "",
|
14
|
-
}
|
15
|
-
|
16
|
-
DEFAULT_ATTRIBUTES = {
|
17
|
-
wrapper: {
|
18
|
-
"data-controller": "options toggleable string-match",
|
19
|
-
},
|
20
|
-
options_wrapper: {},
|
21
|
-
input: {
|
22
|
-
type: "text",
|
23
|
-
autocomplete: "off",
|
24
|
-
"data-action": "input->string-match#change focusin->toggleable#on",
|
25
|
-
},
|
26
|
-
}
|
27
|
-
|
28
|
-
renders_many :options
|
29
|
-
|
30
|
-
renders_one :icon, Ariadne::HeroiconComponent
|
31
|
-
|
32
|
-
# @example Default
|
33
|
-
#
|
34
|
-
# <%= render(Ariadne::ComboboxComponent.new) { "Example" } %>
|
35
|
-
#
|
36
|
-
# @param tag [Symbol, String] The rendered tag name.
|
37
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
38
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
39
|
-
def initialize(
|
40
|
-
tag: DEFAULT_TAG,
|
41
|
-
classes: "",
|
42
|
-
attributes: {},
|
43
|
-
options_tag: DEFAULT_OPTIONS_WRAPPER_TAG,
|
44
|
-
options_wrapper_classes: "",
|
45
|
-
options_wrapper_attributes: {},
|
46
|
-
close_on_outside_click: true,
|
47
|
-
close_on_select: false,
|
48
|
-
initially_open: false,
|
49
|
-
single_selection: false,
|
50
|
-
toggleable_options: true, # Do options unselect if clicked a second time
|
51
|
-
input_classes: "",
|
52
|
-
input_attributes: {}
|
53
|
-
)
|
54
|
-
@tag = check_incoming_tag(DEFAULT_TAG, tag)
|
55
|
-
@classes = merge_class_names(DEFAULT_CLASSES[:wrapper], classes)
|
56
|
-
@attributes = DEFAULT_ATTRIBUTES[:wrapper]
|
57
|
-
.merge({
|
58
|
-
"data-options-is-multi-value": !single_selection,
|
59
|
-
"data-options-toggleable-value": toggleable_options,
|
60
|
-
"data-toggleable-close-on-outside-click-value": close_on_outside_click,
|
61
|
-
"data-toggleable-state-value": initially_open,
|
62
|
-
"aria-multiselectable": !single_selection,
|
63
|
-
})
|
64
|
-
.merge(attributes)
|
65
|
-
|
66
|
-
@input_classes = merge_class_names(DEFAULT_CLASSES[:input], input_classes)
|
67
|
-
@input_attributes = DEFAULT_ATTRIBUTES[:input].merge(input_attributes)
|
68
|
-
|
69
|
-
@options_wrapper_tag = check_incoming_tag(DEFAULT_OPTIONS_WRAPPER_TAG, options_tag)
|
70
|
-
@options_wrapper_classes = merge_class_names(DEFAULT_CLASSES[:options_wrapper], options_wrapper_classes)
|
71
|
-
@options_wrapper_attributes = DEFAULT_ATTRIBUTES[:options_wrapper]
|
72
|
-
.merge({ "data-action": close_on_select ? "click->toggleable#off" : "" })
|
73
|
-
.merge(options_wrapper_attributes)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "view_component/version"
|
4
|
-
|
5
|
-
require "heroicons_helper"
|
6
|
-
|
7
|
-
module Ariadne
|
8
|
-
# @private
|
9
|
-
class Component < ViewComponent::Base
|
10
|
-
include ClassNameHelper
|
11
|
-
include FetchOrFallbackHelper
|
12
|
-
include ViewHelper
|
13
|
-
include Status::Dsl
|
14
|
-
include Audited::Dsl
|
15
|
-
include LoggerHelper
|
16
|
-
include Ariadne::ActionViewExtensions::FormHelper
|
17
|
-
|
18
|
-
BASE_WRAPPER_CLASSES = "ariadne-flex ariadne-flex-col ariadne-h-screen ariadne-justify-between"
|
19
|
-
BASE_MAIN_CLASSES = "ariadne-flex-auto"
|
20
|
-
|
21
|
-
# this is defined here for the Tailwind parser to pick up; it can be useful
|
22
|
-
# in situations where hiddenness is defined by a kwarg, eg `selected: false`
|
23
|
-
BASE_HIDDEN_CLASS = "ariadne-hidden"
|
24
|
-
|
25
|
-
INVALID_ARIA_LABEL_TAGS = [:div, :span, :p].freeze
|
26
|
-
|
27
|
-
private def raise_on_invalid_options?
|
28
|
-
Rails.application.config.ariadne_view_components.raise_on_invalid_options
|
29
|
-
end
|
30
|
-
|
31
|
-
private def raise_on_invalid_aria?
|
32
|
-
Rails.application.config.ariadne_view_components.raise_on_invalid_aria
|
33
|
-
end
|
34
|
-
|
35
|
-
private def deprecated_component_warning(new_class: nil, version: nil)
|
36
|
-
return if silence_deprecations?
|
37
|
-
|
38
|
-
message = "#{self.class.name} is deprecated"
|
39
|
-
message += " and will be removed in v#{version}." if version
|
40
|
-
message += " Use #{new_class.name} instead." if new_class
|
41
|
-
|
42
|
-
ActiveSupport::Deprecation.warn(message)
|
43
|
-
end
|
44
|
-
|
45
|
-
private def aria(val, attributes)
|
46
|
-
attributes[:"aria-#{val}"] || attributes.dig(:aria, val.to_sym)
|
47
|
-
end
|
48
|
-
|
49
|
-
private def validate_aria_label!
|
50
|
-
aria_label = aria("label", @attributes)
|
51
|
-
raise ArgumentError, "`aria-label` is required." if aria_label.blank?
|
52
|
-
end
|
53
|
-
|
54
|
-
private def check_denylist(denylist = [], attributes = {})
|
55
|
-
if should_raise_error?
|
56
|
-
|
57
|
-
# Convert denylist from:
|
58
|
-
# { [:p, :pt] => "message" } to:
|
59
|
-
# { p: "message", pt: "message" }
|
60
|
-
unpacked_denylist =
|
61
|
-
denylist.each_with_object({}) do |(keys, value), memo|
|
62
|
-
keys.each { |key| memo[key] = value }
|
63
|
-
end
|
64
|
-
|
65
|
-
violations = unpacked_denylist.keys & attributes.keys
|
66
|
-
|
67
|
-
if violations.any?
|
68
|
-
message = "Found #{violations.count} #{"violation".pluralize(violations)}:"
|
69
|
-
violations.each do |violation|
|
70
|
-
message += "\n The #{violation} argument is not allowed here. #{unpacked_denylist[violation]}"
|
71
|
-
end
|
72
|
-
|
73
|
-
raise(ArgumentError, message)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
attributes
|
78
|
-
end
|
79
|
-
|
80
|
-
private def validate_attributes(tag:, denylist_name: :attributes_denylist, attributes: {})
|
81
|
-
deny_single_argument(:class, "Use `classes` instead.", attributes)
|
82
|
-
|
83
|
-
if (denylist = attributes[denylist_name])
|
84
|
-
check_denylist(denylist, attributes)
|
85
|
-
|
86
|
-
# Remove :attributes_denylist key and any denied keys from attributes
|
87
|
-
attributes.except!(denylist_name)
|
88
|
-
attributes.except!(*denylist.keys.flatten)
|
89
|
-
end
|
90
|
-
|
91
|
-
deny_aria_label(tag: tag, attributes: attributes)
|
92
|
-
|
93
|
-
attributes
|
94
|
-
end
|
95
|
-
|
96
|
-
private def deny_single_argument(key, help_text, attributes)
|
97
|
-
raise ArgumentError, "`#{key}` is an invalid argument. #{help_text}" \
|
98
|
-
if should_raise_error? && attributes.key?(key)
|
99
|
-
|
100
|
-
attributes.except!(key)
|
101
|
-
end
|
102
|
-
|
103
|
-
private def deny_aria_label(tag:, attributes:)
|
104
|
-
return attributes.except!(:skip_aria_label_check) if attributes[:skip_aria_label_check]
|
105
|
-
return if attributes[:role]
|
106
|
-
return unless INVALID_ARIA_LABEL_TAGS.include?(tag)
|
107
|
-
|
108
|
-
deny_aria_key(
|
109
|
-
:label,
|
110
|
-
"Don't use `aria-label` on `#{tag}` elements. See https://www.tpgi.com/short-note-on-aria-label-aria-labelledby-and-aria-describedby/",
|
111
|
-
attributes,
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
private def deny_aria_key(key, help_text, attributes)
|
116
|
-
raise ArgumentError, help_text if should_raise_aria_error? && aria(key, attributes)
|
117
|
-
end
|
118
|
-
|
119
|
-
private def should_raise_error?
|
120
|
-
raise_on_invalid_options? && !ENV["ARIADNE_WARNINGS_DISABLED"]
|
121
|
-
end
|
122
|
-
|
123
|
-
private def should_raise_aria_error?
|
124
|
-
raise_on_invalid_aria? && !ENV["ARIADNE_WARNINGS_DISABLED"]
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# The container wraps the majority, if not all, of the content on a page.
|
5
|
-
class ContainerComponent < Ariadne::Component
|
6
|
-
DEFAULT_CLASSES = "ariadne-px-4 sm:ariadne-px-6 lg:ariadne-px-8"
|
7
|
-
|
8
|
-
# @example Default
|
9
|
-
# <%= render(Ariadne::ContainerComponent.new) do |container| %>
|
10
|
-
# <%= render(Ariadne::ButtonComponent.new) { "Click me!" } %>
|
11
|
-
# <% end %>
|
12
|
-
#
|
13
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
14
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
15
|
-
def initialize(classes: "", attributes: {})
|
16
|
-
@tag = :div
|
17
|
-
@classes = merge_class_names(
|
18
|
-
DEFAULT_CLASSES,
|
19
|
-
classes,
|
20
|
-
)
|
21
|
-
|
22
|
-
@attributes = attributes
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Use `CounterComponent` to add a count to navigational elements and buttons.
|
5
|
-
#
|
6
|
-
# @accessibility
|
7
|
-
# Always use `CounterComponent` with adjacent text that provides supplementary information regarding what the count is for. For instance, `Counter`
|
8
|
-
# should be accompanied with text such as `issues` or `pull requests`.
|
9
|
-
#
|
10
|
-
class CounterComponent < Ariadne::Component
|
11
|
-
DEFAULT_CLASSES = "ariadne-inline-flex ariadne-items-center ariadne-p-1 ariadne-border ariadne-border-transparent ariadne-rounded-full ariadne-shadow-sm focus:ariadne-outline-none focus:ariadne-ring-2 focus:ariadne-ring-offset-2"
|
12
|
-
|
13
|
-
# @example Default
|
14
|
-
# <%= render(Ariadne::CounterComponent.new(count: 25)) %>
|
15
|
-
#
|
16
|
-
# @example Schemes
|
17
|
-
# <%= render(Ariadne::CounterComponent.new(count: 25)) %>
|
18
|
-
# <%= render(Ariadne::CounterComponent.new(count: 25)) %>
|
19
|
-
#
|
20
|
-
# @param tag [Symbol, String] The rendered tag name
|
21
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
22
|
-
# @param count [Integer, Float::INFINITY, nil] The number to be displayed (e.x. # of issues, pull requests)
|
23
|
-
# @param limit [Integer, nil] Maximum value to display. Pass `nil` for no limit. (e.x. if `count` == 6,000 and `limit` == 5000, counter will display "5,000+")
|
24
|
-
# @param hide_if_zero [Boolean] If true, a `hidden` attribute is added to the counter if `count` is zero.
|
25
|
-
# @param text [String] Text to display instead of count.
|
26
|
-
# @param round [Boolean] Whether to apply rounding logic to value.
|
27
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
28
|
-
def initialize(
|
29
|
-
tag: :span,
|
30
|
-
count: 0,
|
31
|
-
limit: 9_000,
|
32
|
-
hide_if_zero: false,
|
33
|
-
text: "",
|
34
|
-
round: false,
|
35
|
-
classes: "",
|
36
|
-
attributes: {}
|
37
|
-
)
|
38
|
-
@count = count
|
39
|
-
@limit = limit
|
40
|
-
@hide_if_zero = hide_if_zero
|
41
|
-
@text = text
|
42
|
-
@round = round
|
43
|
-
@attributes = attributes
|
44
|
-
|
45
|
-
@has_limit = !@limit.nil?
|
46
|
-
|
47
|
-
@tag = check_incoming_tag(:span, tag)
|
48
|
-
|
49
|
-
@attributes[:title] = title
|
50
|
-
|
51
|
-
@classes = merge_class_names(
|
52
|
-
DEFAULT_CLASSES,
|
53
|
-
classes,
|
54
|
-
)
|
55
|
-
@attributes[:hidden] = true if count == 0 && hide_if_zero
|
56
|
-
end
|
57
|
-
|
58
|
-
def call
|
59
|
-
render(Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes)) { value }
|
60
|
-
end
|
61
|
-
|
62
|
-
private def title
|
63
|
-
if @text.present?
|
64
|
-
@text
|
65
|
-
elsif @count.nil?
|
66
|
-
"Not available"
|
67
|
-
elsif @count == Float::INFINITY
|
68
|
-
"Infinity"
|
69
|
-
else
|
70
|
-
count = @count.to_i
|
71
|
-
str = number_with_delimiter(@has_limit ? [count, @limit].min : count)
|
72
|
-
str += "+" if @has_limit && count > @limit
|
73
|
-
str
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
private def value
|
78
|
-
if @text.present?
|
79
|
-
@text
|
80
|
-
elsif @count.nil?
|
81
|
-
"" # CSS will hide it
|
82
|
-
elsif @count == Float::INFINITY
|
83
|
-
"∞"
|
84
|
-
else
|
85
|
-
if @round
|
86
|
-
count = @has_limit ? [@count.to_i, @limit].min : @count.to_i
|
87
|
-
precision = count.between?(100_000, 999_999) ? 0 : 1
|
88
|
-
units = { thousand: "k", million: "m", billion: "b" }
|
89
|
-
str = number_to_human(count, precision: precision, significant: false, units: units, format: "%n%u")
|
90
|
-
else
|
91
|
-
@count = @count.to_i
|
92
|
-
str = number_with_delimiter(@has_limit ? [@count, @limit].min : @count)
|
93
|
-
end
|
94
|
-
|
95
|
-
str += "+" if @has_limit && @count.to_i > @limit
|
96
|
-
str
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Use `DetailsComponent` to reveal content after clicking a button.
|
5
|
-
class DetailsComponent < Ariadne::Component
|
6
|
-
DEFAULT_TAG = :details
|
7
|
-
DEFAULT_BODY_TAG = :div
|
8
|
-
|
9
|
-
VALID_BODY_TAGS = [:ul, :"details-menu", :"details-dialog", DEFAULT_BODY_TAG].freeze
|
10
|
-
|
11
|
-
NO_OVERLAY = :none
|
12
|
-
OVERLAY_MAPPINGS = {
|
13
|
-
NO_OVERLAY => "",
|
14
|
-
:default => "",
|
15
|
-
}.freeze
|
16
|
-
|
17
|
-
# Use the Summary as a trigger to reveal the content.
|
18
|
-
#
|
19
|
-
# @param button [Boolean] (true) Whether to render the Summary as a button or not.
|
20
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
21
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
22
|
-
renders_one :summary, lambda { |button: true, classes: "", attributes: {}|
|
23
|
-
tag = :summary
|
24
|
-
attributes[:role] = "button"
|
25
|
-
if button
|
26
|
-
Ariadne::ButtonComponent.new(tag: tag, classes: classes, attributes: attributes)
|
27
|
-
else
|
28
|
-
Ariadne::BaseComponent.new(tag: tag, classes: classes, attributes: attributes)
|
29
|
-
end
|
30
|
-
}
|
31
|
-
|
32
|
-
DEFAULT_BODY_CLASSES = "ariadne-absolute ariadne-mt-2 ariadne-w-56 ariadne-divide-y ariadne-divide-gray-100 ariadne-rounded-md ariadne-shadow-lg ariadne-ring-1 ariadne-ring-black ariadne-ring-opacity-5 focus:ariadne-outline-none"
|
33
|
-
# Use the Body slot as the main content to be shown when triggered by the Summary.
|
34
|
-
#
|
35
|
-
# @param tag [Symbol] The tag to use for the body/ <%= one_of(Ariadne::DetailsComponent::VALID_BODY_TAGS) %>
|
36
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
37
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
38
|
-
renders_one :body, lambda { |tag: DEFAULT_BODY_TAG, classes: "", attributes: {}|
|
39
|
-
tag = fetch_or_raise(VALID_BODY_TAGS, tag)
|
40
|
-
actual_classes = merge_class_names(DEFAULT_BODY_CLASSES, classes)
|
41
|
-
|
42
|
-
Ariadne::BaseComponent.new(tag: tag, classes: actual_classes, attributes: attributes)
|
43
|
-
}
|
44
|
-
|
45
|
-
DEFAULT_CLASSES = ""
|
46
|
-
|
47
|
-
# @example Default
|
48
|
-
#
|
49
|
-
# <%= render Ariadne::DetailsComponent.new do |c| %>
|
50
|
-
# <% c.with_summary do %>
|
51
|
-
# Summary
|
52
|
-
# <% end %>
|
53
|
-
# <% c.with_body do %>
|
54
|
-
# Body
|
55
|
-
# <% end %>
|
56
|
-
# <% end %>
|
57
|
-
#
|
58
|
-
# @param overlay [Symbol] Dictates the type of overlay to render with. <%= one_of(Ariadne::DetailsComponent::OVERLAY_MAPPINGS.keys) %>
|
59
|
-
# @param reset [Boolean] If set to true, it will remove the default caret and remove style from the summary element
|
60
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
61
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
62
|
-
def initialize(overlay: NO_OVERLAY, reset: true, classes: "", attributes: {})
|
63
|
-
@tag = DEFAULT_TAG
|
64
|
-
@reset = reset
|
65
|
-
|
66
|
-
@classes = merge_class_names(
|
67
|
-
DEFAULT_CLASSES,
|
68
|
-
classes,
|
69
|
-
@reset ? "ariadne__details-reset" : "",
|
70
|
-
)
|
71
|
-
|
72
|
-
@attributes = attributes
|
73
|
-
|
74
|
-
@overlay = fetch_or_raise(OVERLAY_MAPPINGS.keys, overlay)
|
75
|
-
end
|
76
|
-
|
77
|
-
def render?
|
78
|
-
summary? && body?
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
import '@github/details-menu-element';
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<%= render Ariadne::BaseComponent.new(tag: @tag, classes: @classes, attributes: @attributes) do |component| %>
|
2
|
-
<%= header %>
|
3
|
-
<% if list? %>
|
4
|
-
<ul>
|
5
|
-
<% items.each do |item| %>
|
6
|
-
<% if item.divider? %>
|
7
|
-
<%= item %>
|
8
|
-
<% else %>
|
9
|
-
<li>
|
10
|
-
<%= item %>
|
11
|
-
</li>
|
12
|
-
<% end %>
|
13
|
-
<% end %>
|
14
|
-
</ul>
|
15
|
-
<% else %>
|
16
|
-
<% items.each do |item| %>
|
17
|
-
<%= item %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
@@ -1 +0,0 @@
|
|
1
|
-
import '@github/details-menu-element';
|