# Fieldset — accessible headless fieldset with legend
#
# Groups related fields with an optional legend. Disables all children
# when @disabled is set. Ships zero CSS.
#
# Usage:
#   Fieldset legend: "Shipping Address"
#     Field label: "Street"
#       Input value <=> street
#     Field label: "City"
#       Input value <=> city

export Fieldset = component
  @legend := ''
  @disabled := false

  render
    fieldset disabled: @disabled, $disabled: @disabled?!
      if @legend
        legend $legend: true
          @legend
      slot
