summaryrefslogtreecommitdiff
path: root/app/components
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-10 18:09:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-10 18:09:28 +0000
commit2f7719abdfde4cb50ed05346b98bac26ea06a8de (patch)
tree71bc9a5cde931b50f38f2e2fe76cc67e1181e3d6 /app/components
parent37140013714814d8ffe662a372697c56eea2fde0 (diff)
downloadgitlab-ce-2f7719abdfde4cb50ed05346b98bac26ea06a8de.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/components')
-rw-r--r--app/components/pajamas/button_component.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/components/pajamas/button_component.rb b/app/components/pajamas/button_component.rb
index da00301516a..c6193d1ae05 100644
--- a/app/components/pajamas/button_component.rb
+++ b/app/components/pajamas/button_component.rb
@@ -5,6 +5,7 @@ module Pajamas
# @param [Symbol] category
# @param [Symbol] variant
# @param [Symbol] size
+ # @param [Symbol] type
# @param [Boolean] disabled
# @param [Boolean] loading
# @param [Boolean] block
@@ -19,6 +20,7 @@ module Pajamas
category: :primary,
variant: :default,
size: :medium,
+ type: :button,
disabled: false,
loading: false,
block: false,
@@ -33,6 +35,7 @@ module Pajamas
@category = filter_attribute(category.to_sym, CATEGORY_OPTIONS)
@variant = filter_attribute(variant.to_sym, VARIANT_OPTIONS)
@size = filter_attribute(size.to_sym, SIZE_OPTIONS)
+ @type = filter_attribute(type.to_sym, TYPE_OPTIONS, default: :button)
@disabled = disabled
@loading = loading
@block = block
@@ -70,6 +73,7 @@ module Pajamas
CATEGORY_OPTIONS = [:primary, :secondary, :tertiary].freeze
VARIANT_OPTIONS = [:default, :confirm, :danger, :dashed, :link, :reset].freeze
SIZE_OPTIONS = [:small, :medium].freeze
+ TYPE_OPTIONS = [:button, :reset, :submit].freeze
TARGET_OPTIONS = %w[_self _blank _parent _top].freeze
CATEGORY_CLASSES = {
@@ -106,7 +110,7 @@ module Pajamas
attributes['disabled'] = '' if @disabled || @loading
attributes['aria-disabled'] = true if @disabled || @loading
- attributes['type'] = 'button' unless @href
+ attributes['type'] = @type unless @href
attributes
end