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

Commit 57db1eb

Browse files
Merge pull request #60 from chakra-ui/bug/cflex-prop-object-notation
fix(component): fix c-flex prop to be also object
2 parents 2860f75 + 7e5c548 commit 57db1eb

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

.changeset/proud-apples-compare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chakra-ui/c-flex': patch
3+
---
4+
5+
Fix bug where it was not possible to use object as prop

packages/c-flex/examples/base-flex.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<c-flex align="center">
3-
<c-flex bg="green.50" align="flex-end">
3+
<c-flex :bg="{ base: 'green.50', sm: 'blue.50' }" align="flex-end">
44
<chakra.p>Box 1</chakra.p>
55
</c-flex>
66
<c-flex

packages/c-flex/src/flex.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,55 @@
11
import { h, defineComponent, PropType, reactive } from 'vue'
22
import type CSS from 'csstype'
3-
import { chakra, DOMElements, ThemingProps } from '@chakra-ui/vue-system'
4-
5-
type ArrayOrStringProp<T> = T | T[]
3+
import {
4+
chakra,
5+
DOMElements,
6+
ThemingProps,
7+
SystemStyleObject,
8+
} from '@chakra-ui/vue-system'
69

710
export interface FlexProps {
811
/**
912
* Shorthand for `alignItems` style prop
1013
* @type SystemStyleObject["alignItems"]
1114
* SystemStyleObject because prop can be String, Array or Object
1215
*/
13-
align?: ArrayOrStringProp<CSS.Properties['alignItems']>
16+
align?: SystemStyleObject['alignItems']
1417

1518
/**
1619
* Shorthand for `justifyContent` style prop
1720
* @type SystemStyleObject["justifyContent"]
1821
*/
19-
justify?: ArrayOrStringProp<CSS.Properties['justifyContent']>
22+
justify?: SystemStyleObject['justifyContent']
2023

2124
/**
2225
* Shorthand for `flexWrap` style prop
2326
* @type SystemStyleObject["flexWrap"]
2427
*/
25-
wrap?: ArrayOrStringProp<CSS.Properties['flexWrap']>
28+
wrap?: SystemStyleObject['flexWrap']
2629

2730
/**
2831
* Shorthand for `flexDirection` style prop
2932
* @type SystemStyleObject["flexDirection"]
3033
*/
31-
direction?: ArrayOrStringProp<CSS.Properties['flexDirection']>
34+
direction?: SystemStyleObject['flexDirection']
3235

3336
/**
3437
* Shorthand for `flexBasis` style prop
3538
* @type SystemStyleObject["flexBasis"]
3639
*/
37-
basis?: ArrayOrStringProp<CSS.Properties['flexBasis']>
40+
basis?: SystemStyleObject['flexBasis']
3841

3942
/**
4043
* Shorthand for `flexGrow` style prop
4144
* @type SystemStyleObject["flexGrow"]
4245
*/
43-
grow?: ArrayOrStringProp<CSS.Properties['flexGrow']>
46+
grow?: SystemStyleObject['flexGrow']
4447

4548
/**
4649
* Shorthand for `flexShrink` style prop
4750
* @type SystemStyleObject["flexShrink"]
4851
*/
49-
shrink?: ArrayOrStringProp<CSS.Properties['flexShrink']>
52+
shrink?: SystemStyleObject['flexShrink']
5053
}
5154

5255
const CFlex = defineComponent({

0 commit comments

Comments
 (0)