const { h } = globalThis.ami

export function Wrapper ({ field, children }) {
  const labelText = field.hide_label === '1' ? '' : field.label
  const label = field.required === '1' ? `${labelText} *` : labelText
  return h('div',
    h('label', { for: field.attrs.id, className: 'block font-bold' }, label),
    children,
    field.description && h('span', { className: 'text-sm' }, field.description)
  )
}
