-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from marceloatg/feature/checkbox-output-group
SldsCheckboxOutputGroup created
- Loading branch information
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/components/slds-checkbox-output-group/slds-checkbox-output-group-option.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="slds-checkbox"> | ||
|
||
<!-- Checked icon --> | ||
<slds-icon | ||
v-if="value" | ||
class="slds-align-middle" | ||
x-small | ||
icon-name="utility:check" | ||
/> | ||
|
||
<!-- Unchecked icon --> | ||
<slds-icon | ||
v-else | ||
class="slds-align-middle" | ||
x-small | ||
icon-name="utility:steps" | ||
/> | ||
|
||
<label class="slds-checkbox__label"> | ||
|
||
<span class="slds-m-right--x-small"/> | ||
|
||
<span class="slds-form-element__label"> | ||
{{ label }} | ||
</span> | ||
|
||
</label> | ||
|
||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import SldsIcon from "../slds-icon/slds-icon.vue" | ||
import { defineComponent } from "vue" | ||
export default defineComponent({ | ||
name: "SldsCheckboxOutputGroupOption", | ||
components: { SldsIcon }, | ||
props: { | ||
borderless: Boolean, | ||
/** | ||
* Input label. | ||
*/ | ||
label: String, | ||
/** | ||
* Indicates whether the input is stacked among other inputs. | ||
*/ | ||
stacked: Boolean, | ||
/** | ||
* Input value. | ||
*/ | ||
value: null, | ||
}, | ||
}) | ||
</script> | ||
|
||
|
46 changes: 46 additions & 0 deletions
46
src/components/slds-checkbox-output-group/slds-checkbox-output-group.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<template> | ||
<slds-form-element :label="label" :stacked="stacked" :bordered="!borderless"> | ||
<template #default> | ||
<slds-checkbox-output-group-option | ||
v-for="option in options" | ||
:key="option.value" | ||
:borderless="borderless" | ||
:label="option.label" | ||
stacked | ||
:value="value.includes(option.value)" | ||
/> | ||
</template> | ||
</slds-form-element> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import SldsFormElement from "../slds-form-element/slds-form-element.vue" | ||
import { defineComponent, type PropType } from "vue" | ||
import type { CheckboxGroupOption } from "../slds-checkbox-group/checkbox-group-option" | ||
import SldsCheckboxOutputGroupOption from "../slds-checkbox-output-group/slds-checkbox-output-group-option.vue" | ||
export default defineComponent({ | ||
name: "SldsCheckboxOutputGroup", | ||
components: { SldsCheckboxOutputGroupOption, SldsFormElement }, | ||
props: { | ||
borderless: Boolean, | ||
/** | ||
* Input label. | ||
*/ | ||
label: String, | ||
value: { type: Array as PropType<string[]>, default: () => [] }, | ||
options: { type: Array as PropType<CheckboxGroupOption[]>, default: () => [] }, | ||
/** | ||
* Indicates whether the input is stacked among other inputs. | ||
*/ | ||
stacked: Boolean, | ||
}, | ||
}) | ||
</script> | ||
|