2023-03-14 13:18:55 +00:00
|
|
|
{{!
|
|
|
|
Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
}}
|
|
|
|
|
2020-10-08 15:02:31 +00:00
|
|
|
{{#let (hash
|
|
|
|
|
|
|
|
Element=(component 'form-group/element' group=@group name=@name)
|
|
|
|
|
|
|
|
Text=(component 'form-group/element/text' didinsert=(action this.connect) name=this.name oninput=(action (mut this.touched) true))
|
|
|
|
Checkbox=(component 'form-group/element/checkbox' didinsert=(action this.connect) name=this.name onchange=(action (mut this.touched) true))
|
|
|
|
Radio=(component 'form-group/element/radio' didinsert=(action this.connect) name=this.name onchange=(action (mut this.touched) true))
|
|
|
|
|
|
|
|
|
|
|
|
Label=(component 'form-group/element/label')
|
|
|
|
Error=(component 'form-group/element/error')
|
|
|
|
|
|
|
|
state=state
|
|
|
|
)
|
|
|
|
as |el|}}
|
2022-06-08 15:07:51 +00:00
|
|
|
{{#if (includes this.type (array 'radiogroup' 'checkbox-group' 'checkboxgroup'))}}
|
2020-10-08 15:02:31 +00:00
|
|
|
<div
|
|
|
|
data-property={{this.prop}}
|
|
|
|
class="type-{{this.type}}{{if (state-matches state 'error') ' has-error'}}"
|
|
|
|
...attributes
|
|
|
|
>
|
|
|
|
{{yield el}}
|
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<label
|
|
|
|
data-property={{this.prop}}
|
|
|
|
class="type-{{this.type}}{{if (state-matches state 'error') ' has-error'}}"
|
|
|
|
...attributes
|
|
|
|
>
|
|
|
|
{{yield el}}
|
|
|
|
</label>
|
|
|
|
{{/if}}
|
|
|
|
{{/let}}
|