title: Button
fields:
  -
    handle: color
    field:
      swatches:
        - '#1D1D1D'
        - '#FFFFFF'
        - '#CE4B12'
        - '#004F59'
      allow_any: false
      default: '#1D1D1D'
      type: color
      display: Color
      localizable: false
      width: 33
      validate:
        - required
  -
    handle: filled
    field:
      type: toggle
      display: 'Button style'
      localizable: false
      width: 33
      inline_label: Outline
      inline_label_when_true: Filled
  -
    handle: align
    field:
      options:
        start: Left
        center: Center
        end: Right
      default: start
      type: select
      display: Align
      localizable: false
      width: 33
  -
    handle: button_link_type
    field:
      options:
        -
          key: url
          value: URL
        -
          key: collection
          value: Page/Story
        -
          key: download
          value: Download
      placeholder: 'Please select'
      type: select
      display: 'Link type'
      localizable: false
      width: 50
      validate:
        - 'required_with:text'
  -
    handle: target
    field:
      options:
        -
          key: _self
          value: 'Current tab / window'
        -
          key: _blank
          value: 'New tab / window'
      searchable: false
      default: _self
      type: select
      display: 'Link target'
      localizable: false
      width: 50
      validate:
        - required
  -
    handle: text
    field:
      type: text
      display: Text
      localizable: false
      validate:
        - required
  -
    handle: link
    field:
      type: text
      display: Link
      localizable: false
      if:
        button_link_type: 'equals url'
      validate:
        - sometimes
        - required
  -
    handle: download
    field:
      max_files: 1
      container: assets
      type: assets
      display: Download
      localizable: false
      validate:
        - sometimes
        - required
      if:
        button_link_type: 'equals download'
  -
    handle: page_story
    field:
      max_items: 1
      type: entries
      display: Page/Story
      localizable: false
      if:
        button_link_type: 'equals collection'
      validate:
        - sometimes
        - required
      collections:
        - pages
        - stories
