Module: UI::InputOtpSlotBehavior
- Included in:
- InputOtpSlot, InputOtpSlotComponent
- Defined in:
- app/behaviors/ui/input_otp_slot_behavior.rb
Overview
UI::InputOtpSlotBehavior
Instance Method Summary collapse
-
#input_otp_slot_classes ⇒ Object
Returns combined CSS classes for the input OTP slot.
-
#input_otp_slot_data_attributes ⇒ Object
Returns data attributes for Stimulus integration.
-
#input_otp_slot_html_attributes ⇒ Object
Returns HTML attributes for the input OTP slot element.
Instance Method Details
#input_otp_slot_classes ⇒ Object
Returns combined CSS classes for the input OTP slot
35 36 37 38 39 40 41 |
# File 'app/behaviors/ui/input_otp_slot_behavior.rb', line 35 def input_otp_slot_classes classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ input_otp_slot_base_classes, classes_value ].compact.join(" ")) end |
#input_otp_slot_data_attributes ⇒ Object
Returns data attributes for Stimulus integration
44 45 46 47 48 49 |
# File 'app/behaviors/ui/input_otp_slot_behavior.rb', line 44 def input_otp_slot_data_attributes { ui__input_otp_target: "input", action: "input->ui--input-otp#input keydown->ui--input-otp#keydown paste->ui--input-otp#paste" } end |
#input_otp_slot_html_attributes ⇒ Object
Returns HTML attributes for the input OTP slot element
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/behaviors/ui/input_otp_slot_behavior.rb', line 19 def input_otp_slot_html_attributes { type: "text", maxlength: 1, inputmode: "numeric", autocomplete: "one-time-code", value: @value, name: @name, id: @id, disabled: @disabled, class: input_otp_slot_classes, data: input_otp_slot_data_attributes }.compact end |