Module: UI::InputOtpBehavior
- Included in:
- InputOtp, InputOtpComponent
- Defined in:
- app/behaviors/ui/input_otp_behavior.rb
Overview
UI::InputOtpBehavior
Instance Method Summary collapse
-
#input_otp_classes ⇒ Object
Returns combined CSS classes for the input OTP container.
-
#input_otp_data_attributes ⇒ Object
Returns data attributes for Stimulus controller.
-
#input_otp_html_attributes ⇒ Object
Returns HTML attributes for the input OTP container element.
Instance Method Details
#input_otp_classes ⇒ Object
Returns combined CSS classes for the input OTP container
35 36 37 38 39 40 41 |
# File 'app/behaviors/ui/input_otp_behavior.rb', line 35 def input_otp_classes classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ input_otp_base_classes, classes_value ].compact.join(" ")) end |
#input_otp_data_attributes ⇒ Object
Returns data attributes for Stimulus controller
44 45 46 47 48 49 50 |
# File 'app/behaviors/ui/input_otp_behavior.rb', line 44 def input_otp_data_attributes { controller: "ui--input-otp", ui__input_otp_length_value: @length, ui__input_otp_pattern_value: @pattern }.compact end |
#input_otp_html_attributes ⇒ Object
Returns HTML attributes for the input OTP container element
25 26 27 28 29 30 31 32 |
# File 'app/behaviors/ui/input_otp_behavior.rb', line 25 def input_otp_html_attributes attrs = { class: input_otp_classes, data: input_otp_data_attributes } attrs[:id] = @id if @id attrs end |