lib/slack/block_kit/layout/input.rb in slack-ruby-block-kit-0.20.0 vs lib/slack/block_kit/layout/input.rb in slack-ruby-block-kit-0.21.0
- old
+ new
@@ -6,11 +6,11 @@
# A block that collects information from users - it can hold a plain-text
# input element, a checkbox element, a radio button element,
# a select menu element, a multi-select menu element, or a datepicker.
#
# https://api.slack.com/reference/block-kit/blocks#input
- class Input
+ class Input # rubocop:disable Metrics/ClassLength
TYPE = 'input'
attr_accessor :label, :element, :block_id, :hint, :optional, :emoji
def initialize(
@@ -102,10 +102,21 @@
yield(@element) if block_given?
self
end
+ def datetimepicker(action_id:, initial: nil)
+ @element = Element::Datetimepicker.new(
+ action_id: action_id,
+ initial: initial
+ )
+
+ yield(@element) if block_given?
+
+ self
+ end
+
def multi_channels_select(placeholder:, action_id:, initial: nil, emoji: nil, max_selected_items: nil)
@element = Element::MultiChannelsSelect.new(
placeholder: placeholder,
action_id: action_id,
initial: initial,
@@ -197,9 +208,37 @@
min_length: min_length,
max_length: max_length
)
self
+ end
+
+ def url_text_input(
+ action_id:,
+ placeholder: nil,
+ initial_value: nil,
+ focus_on_load: nil
+ )
+ @element = Element::UrlTextInput.new(
+ action_id: action_id,
+ placeholder: placeholder,
+ initial_value: initial_value,
+ focus_on_load: focus_on_load
+ )
+ end
+
+ def email_text_input(
+ action_id:,
+ placeholder: nil,
+ initial_value: nil,
+ focus_on_load: nil
+ )
+ @element = Element::EmailTextInput.new(
+ action_id: action_id,
+ placeholder: placeholder,
+ initial_value: initial_value,
+ focus_on_load: focus_on_load
+ )
end
def radio_buttons(action_id:)
@element = Element::RadioButtons.new(action_id: action_id)