Skip to content

Commit

Permalink
Merge branch 'v3' into feat/handle-prose-comp
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Jan 7, 2025
2 parents 66ec25d + cc50ef6 commit 698b2c4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/app/components/content/ComponentCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,23 @@ ${props.slots?.default}
}

const prop = meta?.meta?.props?.find((prop: any) => prop.name === key)
const propDefault = prop && (prop.default ?? prop.tags?.find(tag => tag.name === 'defaultValue')?.text ?? componentTheme?.defaultVariants?.[prop.name])
const name = kebabCase(key)

if (typeof value === 'boolean') {
if (value && prop?.default === 'true') {
if (value && (propDefault === 'true' || propDefault === '`true`' || propDefault === true)) {
continue
}
if (!value && (!prop?.default || prop.default === 'false')) {
if (!value && (!propDefault || propDefault === 'false' || propDefault === '`false`' || propDefault === false)) {
continue
}

code += value ? ` ${name}` : ` :${key}="false"`
code += value ? ` ${name}` : ` :${name}="false"`
} else if (typeof value === 'object') {
const parsedValue = !props.external?.includes(key) ? json5.stringify(value, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1') : key

code += ` :${name}="${parsedValue}"`
} else {
const propDefault = prop && (prop.default ?? prop.tags?.find(tag => tag.name === 'defaultValue')?.text ?? componentTheme?.defaultVariants?.[prop.name])
if (propDefault === value) {
continue
}
Expand Down
1 change: 1 addition & 0 deletions src/runtime/components/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ import UIcon from './Icon.vue'
const props = withDefaults(defineProps<AccordionProps<T>>(), {
type: 'single',
collapsible: true,
unmountOnHide: true,
labelKey: 'label'
})
const emits = defineEmits<AccordionEmits>()
Expand Down
4 changes: 3 additions & 1 deletion src/runtime/components/Collapsible.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ extendDevtoolsMeta({ example: 'CollapsibleExample' })
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from 'reka-ui'
import { reactivePick } from '@vueuse/core'
const props = defineProps<CollapsibleProps>()
const props = withDefaults(defineProps<CollapsibleProps>(), {
unmountOnHide: true
})
const emits = defineEmits<CollapsibleEmits>()
const slots = defineSlots<CollapsibleSlots>()
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/NavigationMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ import UCollapsible from './Collapsible.vue'
const props = withDefaults(defineProps<NavigationMenuProps<I>>(), {
orientation: 'horizontal',
delayDuration: 0,
labelKey: 'label',
unmountOnHide: true
unmountOnHide: true,
labelKey: 'label'
})
const emits = defineEmits<NavigationMenuEmits>()
const slots = defineSlots<NavigationMenuSlots<T>>()
Expand Down
1 change: 1 addition & 0 deletions src/runtime/components/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const props = withDefaults(defineProps<TabsProps<T>>(), {
content: true,
defaultValue: '0',
orientation: 'horizontal',
unmountOnHide: true,
labelKey: 'label'
})
const emits = defineEmits<TabsEmits>()
Expand Down

0 comments on commit 698b2c4

Please sign in to comment.