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.0.0.beta.9 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.8 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.7 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.6 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.5 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.4 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.3 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.2 app/components/lookbook/display_options/field/component.rb
lookbook-1.5.3 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.1 app/components/lookbook/display_options/field/component.rb
lookbook-1.5.2 app/components/lookbook/display_options/field/component.rb
lookbook-2.0.0.beta.0 app/components/lookbook/display_options/field/component.rb
lookbook-1.5.1 app/components/lookbook/display_options/field/component.rb
lookbook-1.5.0 app/components/lookbook/display_options/field/component.rb
lookbook-1.4.5 app/components/lookbook/display_options/field/component.rb
lookbook-1.4.4 app/components/lookbook/display_options/field/component.rb
lookbook-1.4.3 app/components/lookbook/display_options/field/component.rb
lookbook-1.4.2 app/components/lookbook/display_options/field/component.rb
lookbook-1.4.1 app/components/lookbook/display_options/field/component.rb
lookbook-1.4.0 app/components/lookbook/display_options/field/component.rb