Class: Ruflet::UI::Controls::RufletComponents::SwitchControl
- Defined in:
- lib/ruflet_ui/ruflet/ui/controls/materials/switch_control.rb
Constant Summary collapse
- TYPE =
"switch".freeze
- WIRE =
"Switch".freeze
- KEYWORDS =
[:active_color, :active_track_color, :adaptive, :align, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :aspect_ratio, :autofocus, :badge, :bottom, :col, :data, :disabled, :expand, :expand_loose, :focus_color, :height, :hover_color, :inactive_thumb_color, :inactive_track_color, :key, :label, :label_position, :label_text_style, :left, :margin, :mouse_cursor, :offset, :opacity, :overlay_color, :padding, :right, :rotate, :rtl, :scale, :size_change_interval, :splash_radius, :thumb_color, :thumb_icon, :tooltip, :top, :track_color, :track_outline_color, :track_outline_width, :value, :visible, :width, :on_animation_end, :on_blur, :on_change, :on_focus, :on_size_change].freeze
Constants inherited from Control
Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE
Instance Attribute Summary
Attributes inherited from Control
#children, #id, #props, #runtime_page, #type, #wire_id
Instance Method Summary collapse
-
#initialize(id: nil, **props) ⇒ SwitchControl
constructor
A new instance of SwitchControl.
Methods inherited from Control
#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch
Constructor Details
#initialize(id: nil, **props) ⇒ SwitchControl
Returns a new instance of SwitchControl.
13 14 15 16 17 18 19 20 |
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/switch_control.rb', line 13 def initialize(id: nil, **props) compact = {} props.each do |key, value| raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key) compact[key] = value unless value.nil? end super(type: TYPE, id: id, **compact) end |