Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit e966bd7

Browse files
committed
feat(layout): export Box, Square, Circle with theming props
1 parent a3ff167 commit e966bd7

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

packages/layout/src/box.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ import {
33
DOMElements,
44
SystemStyleObject,
55
HTMLChakraProps,
6+
DeepPartial,
7+
ComponentWithProps,
68
} from '@chakra-ui/vue-system'
79
import { computed, defineComponent, h, PropType } from '@vue/runtime-core'
810

911
export interface BoxProps extends HTMLChakraProps<'div'> {}
1012

11-
/**
12-
* Box is the most abstract component on top of which other chakra
13-
* components are built. It renders a `div` element by default.
14-
*
15-
* @see Docs https://vue.chakra-ui.com/docs/layout/box
16-
*/
17-
export const CBox = defineComponent({
13+
const CBoxImpl = defineComponent({
1814
props: {
1915
as: {
2016
type: [String, Object] as PropType<DOMElements>,
@@ -35,6 +31,14 @@ export const CBox = defineComponent({
3531
},
3632
})
3733

34+
/**
35+
* Box is the most abstract component on top of which other chakra
36+
* components are built. It renders a `div` element by default.
37+
*
38+
* @see Docs https://vue.chakra-ui.com/docs/layout/box
39+
*/
40+
export const CBox = CBoxImpl as ComponentWithProps<DeepPartial<BoxProps>>
41+
3842
/**
3943
* As a constraint, you can't pass size related props
4044
* Only `size` would be allowed
@@ -52,7 +56,7 @@ export interface SquareProps extends Omit<BoxProps, Omitted> {
5256
centerContent?: boolean
5357
}
5458

55-
export const CSquare = defineComponent({
59+
const CSquareImpl = defineComponent({
5660
props: {
5761
size: [Object, String, Number] as PropType<SquareProps['size']>,
5862
centerContent: {
@@ -85,7 +89,11 @@ export const CSquare = defineComponent({
8589
},
8690
})
8791

88-
export const CCircle = defineComponent({
92+
export const CSquare = CSquareImpl as ComponentWithProps<
93+
DeepPartial<SquareProps>
94+
>
95+
96+
const CCircleImpl = defineComponent({
8997
setup(_, { slots, attrs }) {
9098
return () => {
9199
return h(
@@ -100,3 +108,7 @@ export const CCircle = defineComponent({
100108
}
101109
},
102110
})
111+
112+
export const CCircle = CCircleImpl as ComponentWithProps<
113+
DeepPartial<SquareProps>
114+
>

0 commit comments

Comments
 (0)