feat: 🎸 add helper text option to checkbox component
This commit is contained in:
6 files changed
+43
-13
No files matched your search
@@ -8,7 +8,7 @@
|
||||
disabled={{@disabled}}
|
||||
@type="checkbox"
|
||||
@checked={{if @checked true false}}
|
||||
aria-describedby="{{if @error (concat 'errors-' this.id)}}" />
|
||||
aria-describedby="{{if @helperText (concat 'helper-text-' this.id)}} {{if @error (concat 'errors-' this.id)}}" />
|
||||
|
||||
<label class="rose-form-checkbox-label" for={{this.id}}>
|
||||
<span class="rose-form-checkbox-label-text">{{@label}}</span>
|
||||
@@ -17,6 +17,12 @@
|
||||
{{/if}}
|
||||
</label>
|
||||
|
||||
{{#if @helperText}}
|
||||
<Rose::Form::HelperText @id="helper-text-{{this.id}}" @error={{@error}}>
|
||||
{{@helperText}}
|
||||
</Rose::Form::HelperText>
|
||||
{{/if}}
|
||||
|
||||
{{yield (hash
|
||||
errors=(component 'rose/form/errors' id=(concat 'errors-' this.id))
|
||||
)}}
|
||||
|
||||
@@ -26,6 +26,7 @@ Renders a form input checkbox.
|
||||
@name={{name}}
|
||||
@label={{label}}
|
||||
@description={{description}}
|
||||
@helperText={{helperText}}
|
||||
@checked={{checked}}
|
||||
@error={{error}}
|
||||
@disabled={{disabled}}
|
||||
@@ -33,7 +34,8 @@ Renders a form input checkbox.
|
||||
`,
|
||||
context: {
|
||||
label: text('text', 'Checkbox 🛎'),
|
||||
description: text('description', 'This is an optional description paragraph.'),
|
||||
description: text('description', 'Short description in label'),
|
||||
helperText: text('helperText', 'This is an optional help text.'),
|
||||
name: text('name', 'checkbox-1'),
|
||||
checked: boolean('checked', false),
|
||||
error: boolean('error', false),
|
||||
|
||||
@@ -13,16 +13,16 @@ export default Component.extend({
|
||||
}),
|
||||
cellShrink: computed(function () {
|
||||
if (this.shrink) {
|
||||
return 'rose-table-cell-shrink'
|
||||
return 'rose-table-cell-shrink';
|
||||
}
|
||||
}),
|
||||
cellAlignmentStyle: computed(function () {
|
||||
if (this.alignRight) {
|
||||
return 'align-right';
|
||||
}
|
||||
|
||||
|
||||
if (this.alignCenter) {
|
||||
return 'align-center';
|
||||
}
|
||||
})
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user