Sha256: 931e6bd475a5064d172fc4f350a7cf1ef821657eba726ccea912609dac804828

Contents?: true

Size: 564 Bytes

Versions: 46

Compression:

Stored size: 564 Bytes

Contents

module Lookbook
  module DisplayOptions
    class Field::Component < Lookbook::BaseComponent
      attr_reader :name, :value

      def initialize(name:, opts:, value:, **html_attrs)
        @name = name
        @opts = opts
        @value = value
        super(**html_attrs)
      end

      def choices
        @opts.is_a?(Hash) ? @opts[:choices].to_a : @opts
      end

      protected

      def alpine_data
        "{name: '#{name}', value: '#{value}'}"
      end

      def alpine_component
        "displayOptionsFieldComponent"
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
lookbook-2.3.4 app/components/lookbook/display_options/field/component.rb
lookbook-2.3.3 app/components/lookbook/display_options/field/component.rb
lookbook-2.3.2 app/components/lookbook/display_options/field/component.rb
lookbook-2.3.0 app/components/lookbook/display_options/field/component.rb
lookbook-2.2.2 app/components/lookbook/display_options/field/component.rb
lookbook-2.2.1 app/components/lookbook/display_options/field/component.rb
lookbook-2.2.0 app/components/lookbook/display_options/field/component.rb
lookbook-2.1.1 app/components/lookbook/display_options/field/component.rb
lookbook-2.1.0 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.5 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.4 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.3 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.2 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.1 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.rc.3 app/components/lookbook/display_options/field/component.rb
lookbook-1.5.5 app/components/lookbook/display_options/field/component.rb
lookbook-1.5.4 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.rc.2 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.rc.1 app/components/lookbook/display_options/field/component.rb