Sha256: dcdf589cf79d6a826eac0ab35307d8f589c318a7e18d8546b91e9cade119c7d2

Contents?: true

Size: 1.01 KB

Versions: 62

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Primer
  module Beta
    # `ClipboardCopyButton` uses the `ClipboardCopy` component to copy text to the clipboard,
    # styled as a Primer button. It can be used wherever a button is desired, and works well
    # with components like `ButtonGroup`.
    # @accessibility
    #   This component has a built-in `aria-live` region that announces "Copied!" when the copy button is pressed.
    class ClipboardCopyButton < Primer::Beta::Button
      # @param system_arguments [Hash] The arguments accepted by <%= link_to_component(Primer::Beta::Button) %> and <%= link_to_component(Primer::Beta::ClipboardCopy) %>.
      def initialize(**system_arguments)
        super(**system_arguments, base_button_class: ClipboardCopyBaseButton)
      end
    end

    # Internal
    #
    # :nodoc:
    class ClipboardCopyBaseButton < Primer::Beta::BaseButton
      def call
        arguments = @system_arguments.except(:tag)
        render(Primer::Beta::ClipboardCopy.new(**arguments))
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.52.2 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.36.4 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.52.1 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.52.0 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.36.3 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.51.0 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.36.2 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.50.1 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.50.0 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.36.1 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.36.0 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.49.2 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.35.2 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.49.1 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.49.0 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.35.1 app/components/primer/beta/clipboard_copy_button.rb
primer_view_components-0.35.0 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.48.2 app/components/primer/beta/clipboard_copy_button.rb
openproject-primer_view_components-0.48.1 app/components/primer/beta/clipboard_copy_button.rb