app/pb_kits/playbook/props.rb in playbook_ui-2.9.2 vs app/pb_kits/playbook/props.rb in playbook_ui-2.9.3
- old
+ new
@@ -3,25 +3,24 @@
require "active_support/concern"
require_relative "./props/base"
require_relative "./props/boolean"
require_relative "./props/enum"
require_relative "./props/hash"
+require_relative "./props/number"
require_relative "./props/number_array"
require_relative "./props/string"
+require_relative "./props/proc"
module Playbook
module Props
extend ActiveSupport::Concern
- attr_reader :block
-
def initialize(prop_values, &block)
- @values = prop_values
+ @values = { children: block }.merge(prop_values)
self.class.props.each do |key, definition|
definition.validate! @values[key]
end
- @block = block_given? ? block : nil
end
def prop(name)
self.class.props[name].value @values[name]
end
@@ -36,9 +35,10 @@
included do
prop :id
prop :data, type: Playbook::Props::Hash, default: {}
prop :classname
prop :aria, type: Playbook::Props::Hash, default: {}
+ prop :children, type: Playbook::Props::Proc
end
class_methods do
def props
@props