Skip to content

Commit 5dc9094

Browse files
committed
refactor!: rename util functions to useForwardPropsWithout, useForwardPropsEmitsWithout
1 parent 7ab5648 commit 5dc9094

31 files changed

+111
-156
lines changed

.vitepress/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default defineConfig({
6868
{ text: 'Toggle', link: '/components/toggle' },
6969
{ text: 'Toggle Group', link: '/components/toggle-group' },
7070
{ text: 'Checkbox', link: '/components/checkbox' },
71+
{ text: 'Checkbox Group', link: '/components/checkbox-group' },
7172
{ text: 'Radio', link: '/components/radio' },
7273
{ text: 'Radio Group', link: '/components/radio-group' },
7374
{ text: 'TextField', link: '/components/text-field' },

src/components/accordion/AccordionRoot.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ export interface AccordionRootProps extends _AccordionRootProps {
1111

1212
<script setup lang="ts">
1313
import { AccordionRoot } from 'reka-ui'
14-
import { extractForwardPropsEmits } from '../util'
14+
import { useForwardPropsEmitsWithout, buildPropsClass } from '../util'
1515
1616
const props = withDefaults(defineProps<AccordionRootProps>(), {
1717
size: '1',
1818
})
1919
2020
const emits = defineEmits<AccordionRootEmits>()
2121
22-
const [forwarded, resetClass] = extractForwardPropsEmits(props, emits, ['size'])
22+
const forwarded = useForwardPropsEmitsWithout(props, emits, ['size'])
23+
const resetClass = buildPropsClass(props, ['size'])
2324
</script>
2425

2526
<template>

src/components/accordion/AccordionTrigger.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface AccordionTriggerProps extends PrimitiveProps {
1212

1313
<script setup lang="ts">
1414
import { AccordionTrigger } from 'reka-ui'
15-
import { extractForwardProps } from '../util'
15+
import { useForwardPropsWithout, buildPropsClass } from '../util'
1616
import PlusMinusIcon from '../icon/PlusMinusIcon.vue'
1717
import ChevronIcon from '../icon/ChevronIcon.vue'
1818
@@ -21,7 +21,8 @@ const props = withDefaults(defineProps<AccordionTriggerProps>(), {
2121
indicator: 'chevron',
2222
})
2323
24-
const [forwarded, resetClass] = extractForwardProps(props, ['size'])
24+
const forwarded = useForwardPropsWithout(props, ['size'])
25+
const resetClass = buildPropsClass(props, ['size'])
2526
</script>
2627

2728
<template>

src/components/alert/AlertDialogPopup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
AlertDialogContent,
1717
AlertDialogOverlay,
1818
} from 'reka-ui'
19-
import { useForwardPropsEmits } from '../util'
19+
import { useForwardPropsEmitsWithout } from '../util'
2020
2121
defineOptions({
2222
inheritAttrs: false,
@@ -25,7 +25,7 @@ defineOptions({
2525
const props = defineProps<AlertDialogPopupProps>()
2626
const emits = defineEmits<AlertDialogContentEmits>()
2727
28-
const forwarded = useForwardPropsEmits(props, emits, ['to', 'align', 'size'])
28+
const forwarded = useForwardPropsEmitsWithout(props, emits, ['to', 'align', 'size'])
2929
</script>
3030

3131
<template>

src/components/avatar/Avatar.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ import {
3535
AvatarImage,
3636
AvatarFallback,
3737
} from 'reka-ui'
38-
import { extractClass } from '../util'
38+
import { buildPropsClass } from '../util'
3939
4040
const props = withDefaults(defineProps<AvatarProps>(), {
4141
radius: 'small',
4242
variant: 'solid',
4343
size: '2',
4444
})
45-
const resetClass = computed(() => {
46-
return extractClass(props, ['size', 'variant'])
47-
})
45+
const resetClass = buildPropsClass(props, ['size', 'variant'])
46+
4847
const fallback = computed(() => {
4948
if (props.fallback) {
5049
return props.fallback

src/components/badge/Badge.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ export interface BadgeProps {
3232
</script>
3333

3434
<script setup lang="ts">
35-
import { computed } from 'vue'
3635
import { Primitive } from 'reka-ui'
37-
import { extractClass } from '../util'
36+
import { buildPropsClass } from '../util'
3837
3938
const props = withDefaults(defineProps<BadgeProps>(), {
4039
as: 'span',
@@ -44,9 +43,7 @@ const props = withDefaults(defineProps<BadgeProps>(), {
4443
highContrast: undefined,
4544
})
4645
47-
const resetClass = computed(() => {
48-
return extractClass(props, ['size', 'variant', 'highContrast'])
49-
})
46+
const resetClass = buildPropsClass(props, ['size', 'variant', 'highContrast'])
5047
</script>
5148

5249
<template>

src/components/button/Button.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ export interface ButtonProps {
3232
</script>
3333

3434
<script setup lang="ts">
35-
import { computed } from 'vue'
3635
import { Primitive } from 'reka-ui'
37-
import { extractClass } from '../util'
36+
import { buildPropsClass } from '../util'
3837
3938
const props = withDefaults(defineProps<ButtonProps>(), {
4039
as: 'button',
@@ -43,9 +42,7 @@ const props = withDefaults(defineProps<ButtonProps>(), {
4342
highContrast: false,
4443
})
4544
46-
const resetClass = computed(() => {
47-
return extractClass(props, ['size', 'variant', 'highContrast'])
48-
})
45+
const resetClass = buildPropsClass(props, ['size', 'variant', 'highContrast'])
4946
</script>
5047

5148
<template>

src/components/button/SocialButton.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ export interface SocialButtonProps extends PrimitiveProps {
3030
import { computed } from 'vue'
3131
import { Primitive } from 'reka-ui'
3232
import { Icon } from '@iconify/vue'
33-
import { extractClass } from '../util'
33+
import { buildPropsClass } from '../util'
3434
3535
const props = withDefaults(defineProps<SocialButtonProps>(), {
3636
as: 'button',
3737
size: '2',
3838
})
3939
40-
const resetClass = computed(() => {
41-
return extractClass(props, ['size', 'brand'])
42-
})
40+
const resetClass = buildPropsClass(props, ['size', 'brand'])
4341
4442
const brandIcon = computed(() => {
4543
return BRAND_ICONS[props.brand]

src/components/card/Card.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@ export interface CardProps extends PrimitiveProps {
1010
</script>
1111

1212
<script setup lang="ts">
13-
import { computed } from 'vue'
1413
import { Primitive } from 'reka-ui'
15-
import { extractClass } from '../util'
14+
import { buildPropsClass } from '../util'
1615
1716
const props = withDefaults(defineProps<CardProps>(), {
1817
as: 'div',
1918
variant: 'surface',
2019
size: '1',
2120
})
22-
const resetClass = computed(() => {
23-
return extractClass(props, ['size', 'variant'])
24-
})
21+
const resetClass = buildPropsClass(props, ['size', 'variant'])
2522
</script>
2623

2724
<template>

src/components/checkbox/Checkbox.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { CheckboxRootEmits, CheckboxRootProps } from 'reka-ui'
33
import type { ColorType } from '../types'
44
55
export interface CheckboxProps extends CheckboxRootProps {
6+
parent?: boolean
67
color?: ColorType
78
variant?: 'surface' | 'soft'
89
size?: '1' | '2' | '3'
@@ -12,15 +13,17 @@ export interface CheckboxProps extends CheckboxRootProps {
1213

1314
<script setup lang="ts">
1415
import { CheckboxRoot, CheckboxIndicator } from 'reka-ui'
15-
import { extractForwardPropsEmits } from '../util'
16+
import { useForwardPropsEmitsWithout, buildPropsClass } from '../util'
1617
1718
const emits = defineEmits<CheckboxRootEmits>()
1819
1920
const props = withDefaults(defineProps<CheckboxProps>(), {
2021
size: '2',
2122
variant: 'surface',
2223
})
23-
const [forwarded, resetClass] = extractForwardPropsEmits(props, emits, ['color', 'size', 'variant', 'highContrast'])
24+
25+
const forwarded = useForwardPropsEmitsWithout(props, emits, ['parent', 'color', 'size', 'variant', 'highContrast'])
26+
const resetClass = buildPropsClass(props, ['size', 'variant', 'highContrast'])
2427
</script>
2528

2629
<template>

0 commit comments

Comments
 (0)