Skip to content

Commit

Permalink
feat(BaseCheckboxAnimated): update app.config.ts and BaseCheckboxAnim…
Browse files Browse the repository at this point in the history
…ated.vue
  • Loading branch information
driss-chelouati committed Dec 18, 2023
1 parent 45e06dd commit 23158c8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export default defineAppConfig({
rounded: 'sm',
color: 'default',
},
BaseCheckboxAnimated: {
color: 'primary',
},
BaseDropdown: {
variant: 'button',
buttonColor: 'default',
Expand Down
13 changes: 9 additions & 4 deletions components/form/BaseCheckboxAnimated.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const props = withDefaults(
*/
falseValue?: T
/** The color of the checkbox. Can be 'default', 'primary', 'info', 'success', 'warning', or 'danger' */
/** The color of the checkbox.
*
* @default 'primary'
*/
color?:
| 'primary'
| 'info'
Expand Down Expand Up @@ -99,15 +102,17 @@ const checked = computed(() => {
: value.value === props.value
})
const colorStyle = {
const color = useNuiDefaultProperty(props, 'BaseCheckboxAnimated', 'color')
const colors = {
primary: 'text-primary-500',
info: 'text-info-500',
success: 'text-success-500',
warning: 'text-warning-500',
danger: 'text-danger-500',
light: 'text-light-100',
muted: 'text-muted-400',
}
} as Record<string, string>
const updateCheckbox = () => {
if (element.value && innerElement.value) {
Expand Down Expand Up @@ -174,7 +179,7 @@ const id = useNinjaId(() => props.id)
<label
class="peer-disabled:opacity-75"
:for="id"
:class="[props.color && colorStyle[props.color], props.classes?.label]"
:class="[color && colors[color], props.classes?.label]"
>
<div ref="innerElement"></div>
<IconCheckCircle />
Expand Down
8 changes: 8 additions & 0 deletions nuxt.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ export default defineNuxtSchema({
*/
color: 'default',
},
BaseCheckboxAnimated: {
/**
* Default color for the BaseCheckbox component
*
* @type {'light' | 'muted' | 'primary' | 'info' | 'success' | 'warning' | 'danger'}
*/
color: 'primary',
},
BaseDropdown: {
/**
* The variant of the dropdown.
Expand Down

0 comments on commit 23158c8

Please sign in to comment.