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

Commit e88f8b5

Browse files
Merge branch 'develop' into all-contributors/add-IHIutch
2 parents 016dafc + 494ed1e commit e88f8b5

File tree

28 files changed

+391
-49
lines changed

28 files changed

+391
-49
lines changed

.all-contributorsrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,35 @@
218218
"test",
219219
"doc"
220220
]
221+
},
222+
{
223+
"login": "HoukasaurusRex",
224+
"name": "JT Houk",
225+
"avatar_url": "https://avatars.githubusercontent.com/u/23695312?v=4",
226+
"profile": "https://jt.houk.space/",
227+
"contributions": [
228+
"doc",
229+
"platform"
230+
]
231+
},
232+
{
233+
"login": "vincentpalma",
234+
"name": "Vincent Palma",
235+
"avatar_url": "https://avatars.githubusercontent.com/u/10133632?v=4",
236+
"profile": "https://github.com/vincentpalma",
237+
"contributions": [
238+
"doc"
239+
]
240+
},
241+
{
242+
"login": "MWFIAE",
243+
"name": "Martin",
244+
"avatar_url": "https://avatars.githubusercontent.com/u/6072971?v=4",
245+
"profile": "https://github.com/MWFIAE",
246+
"contributions": [
247+
"code",
248+
"test"
249+
]
221250
}
222251
],
223252
"contributorsPerLine": 7,

.changeset/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"linked": [],
99
"access": "public",
1010
"baseBranch": "master",
11-
"updateInternalDependencies": "patch"
11+
"updateInternalDependencies": "patch",
12+
"ignore": []
1213
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
218218
<td align="center"><a href="https://github.com/odanado"><img src="https://avatars.githubusercontent.com/u/6040962?v=4?s=50" width="50px;" alt=""/><br /><sub><b>odanado</b></sub></a><br /><a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=odanado" title="Code">💻</a> <a href="#tool-odanado" title="Tools">🔧</a></td>
219219
</tr>
220220
<tr>
221-
<td align="center"><a href="https://github.com/IHIutch"><img src="https://avatars.githubusercontent.com/u/20825047?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Jonathan Hutchison</b></sub></a><br /><a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=IHIutch" title="Code">💻</a> <a href="https://github.com/chakra-ui/chakra-ui-vue/issues?q=author%3AIHIutch" title="Bug reports">🐛</a> <a href="#ideas-IHIutch" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=IHIutch" title="Tests">⚠️</a> <a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=IHIutch" title="Documentation">📖</a></td>
221+
<td align="center"><a href="https://jt.houk.space/"><img src="https://avatars.githubusercontent.com/u/23695312?v=4?s=50" width="50px;" alt=""/><br /><sub><b>JT Houk</b></sub></a><br /><a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=HoukasaurusRex" title="Documentation">📖</a> <a href="#platform-HoukasaurusRex" title="Packaging/porting to new platform">📦</a></td>
222+
<td align="center"><a href="https://github.com/vincentpalma"><img src="https://avatars.githubusercontent.com/u/10133632?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Vincent Palma</b></sub></a><br /><a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=vincentpalma" title="Documentation">📖</a></td>
223+
<td align="center"><a href="https://github.com/MWFIAE"><img src="https://avatars.githubusercontent.com/u/6072971?v=4?s=50" width="50px;" alt=""/><br /><sub><b>Martin</b></sub></a><br /><a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=MWFIAE" title="Code">💻</a> <a href="https://github.com/chakra-ui/chakra-ui-vue/commits?author=MWFIAE" title="Tests">⚠️</a></td>
222224
</tr>
223225
</table>
224226

packages/chakra-ui-core/CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Change Log
22

3+
## 0.9.0
4+
5+
### Minor Changes
6+
7+
- [`5552440`](https://github.com/chakra-ui/chakra-ui-vue/commit/5552440eb8e0f1fb283c7dc263888bf09dcfa7b9) [#438](https://github.com/chakra-ui/chakra-ui-vue/pull/438) Thanks [@codebender828](https://github.com/codebender828)! - - This changeset adds a srcset support to the CImage component.
8+
- Fixes merging of Popper.js modifiers
9+
- Adds CGridItems components to the core 👏🏾
10+
11+
## 0.8.1
12+
13+
### Patch Changes
14+
15+
- [`e640030`](https://github.com/chakra-ui/chakra-ui-vue/commit/e640030d277966a384261d1a90a1820335c4c007) [#418](https://github.com/chakra-ui/chakra-ui-vue/pull/418) Thanks [@codebender828](https://github.com/codebender828)! - Fix for close button to change color
16+
17+
## 0.8.0
18+
19+
### Minor Changes
20+
21+
- [`8af1c07`](https://github.com/chakra-ui/chakra-ui-vue/commit/8af1c07404d2cfa94bb338e4268c5e0869a50776) Thanks [@codebender828](https://github.com/codebender828)! - Adds type definitions, aspect-ratio-box fixes, switch fixes and collapse fixes
22+
- feat: add type definition of component #380 by @odanado
23+
- feat: CCollapse now renders with collapsed height if initially closed by @codebender828 . closes #269
24+
- fix: Set ccollapse height to auto on enter complete, unless finalHeight wa... #384 by @IHIutch
25+
- fix: Add position: relative to switch label #396 by @IHIutch
26+
- fix: Deeply nested aspect-ratio by @IHIutch
27+
328
## 0.7.4
429

530
### Patch Changes

packages/chakra-ui-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chakra-ui/vue",
3-
"version": "0.7.4",
3+
"version": "0.9.0",
44
"description": "Build Accessible and Responsive Vue.js websites and applications with speed ⚡️",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

packages/chakra-ui-core/src/CBox/CBox.stories.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { storiesOf } from '@storybook/vue'
2-
import { CBox } from '..'
2+
import CBox from '../CBox'
33

44
storiesOf('UI | Box', module)
55
.add('Box', () => ({
@@ -28,13 +28,26 @@ storiesOf('UI | Box', module)
2828
template: `
2929
<div>
3030
<CBox
31+
position="relative"
3132
w="300px"
3233
h="200px"
33-
font-family="body"
34-
objectFit="contain"
35-
bgImg="url(https://lh3.googleusercontent.com/proxy/vG0O53R9-vPA2WpuC5lXWCHIVuIQiQ1R7bpQ1UcDsHnHVlz2BJMeSeJx1I1n4huq_SeB39iegxgQl1zXcnNqpq2IJfCgQwwWXpdRG9pNdA)"
34+
overflow="hidden"
35+
rounded="20px"
3636
>
37-
<CBox h="full" bg="red.200" :w="1/2" />
37+
<CBox
38+
as="img"
39+
font-family="body"
40+
objectFit="contain"
41+
src="https://images.unsplash.com/photo-1600002415506-dd06090d3480?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1650&q=80"
42+
/>
43+
<CBox px="5" display="flex" flex-direction="column" justify-content="center" py="3" h="full" pos="absolute" top="0" left="0" bg="pink.200" w="50%">
44+
<CBox as="h1" font-size="xl" font-weight="bold">
45+
Tempations
46+
</CBox>
47+
<CBox as="p" font-size="md">
48+
Spacial cakes for special moments.
49+
</CBox>
50+
</CBox>
3851
</CBox>
3952
</div>
4053
`

packages/chakra-ui-core/src/CCloseButton/CCloseButton.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ const CCloseButton = {
7878
}
7979
}, [h(CIcon, {
8080
props: {
81-
color: props.color,
8281
name: 'close',
8382
size: iconSize
8483
},

packages/chakra-ui-core/src/CCloseButton/utils/closebutton.props.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ export default {
88
type: Boolean,
99
default: false
1010
},
11-
color: {
12-
type: String,
13-
default: 'currentColor'
14-
},
1511
ariaLabel: {
1612
type: String,
1713
default: 'Close'

packages/chakra-ui-core/src/CGrid/CGrid.js

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,65 @@
1010
*/
1111

1212
import { createStyledAttrsMixin } from '../utils'
13-
import { SNA } from '../config/props/props.types'
13+
import { SNA, StringArray } from '../config/props/props.types'
14+
15+
/**
16+
* @description Map "span" values to accommodate breakpoint values
17+
* @param {Array} value
18+
* @returns {(String|Array)} String or Array of breakpoint values
19+
*/
20+
const spanFn = (value) => {
21+
if (Array.isArray(value)) {
22+
return value.map(v =>
23+
v === 'auto' ? 'auto' : `span ${v}/span ${v}`
24+
)
25+
} else {
26+
return value === 'auto' ? 'auto' : `span ${value}/span ${value}`
27+
}
28+
}
29+
30+
/**
31+
* CGridItem component
32+
*
33+
* A primitive component useful for grid layouts.
34+
*
35+
* @extends CBox
36+
* @see Docs https://vue.chakra-ui.com/grid
37+
*/
38+
39+
const CGridItem = {
40+
name: 'CGridItem',
41+
mixins: [createStyledAttrsMixin('CGridItem')],
42+
props: {
43+
colSpan: { type: StringArray },
44+
rowSpan: { type: StringArray },
45+
colStart: { type: StringArray },
46+
colEnd: { type: StringArray },
47+
rowStart: { type: StringArray },
48+
rowEnd: { type: StringArray }
49+
},
50+
computed: {
51+
componentStyles () {
52+
return {
53+
gridColumn: this.colSpan ? spanFn(this.colSpan) : null,
54+
gridRow: this.rowSpan ? spanFn(this.rowSpan) : null,
55+
gridColumnStart: this.colStart,
56+
gridColumnEnd: this.colEnd,
57+
gridRowStart: this.rowStart,
58+
gridRowEnd: this.rowEnd
59+
}
60+
}
61+
},
62+
render (h) {
63+
return h('div',
64+
{
65+
class: this.className,
66+
attrs: this.computedAttrs
67+
},
68+
this.$slots.default
69+
)
70+
}
71+
}
1472

1573
/**
1674
* CGrid component
@@ -61,11 +119,18 @@ const CGrid = {
61119
}
62120
},
63121
render (h) {
64-
return h(this.as, {
65-
class: this.className,
66-
attrs: this.computedAttrs
67-
}, this.$slots.default)
122+
return h(
123+
this.as,
124+
{
125+
class: this.className,
126+
attrs: this.computedAttrs
127+
},
128+
this.$slots.default
129+
)
68130
}
69131
}
70132

71-
export default CGrid
133+
export {
134+
CGrid,
135+
CGridItem
136+
}

packages/chakra-ui-core/src/CGrid/CGrid.stories.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { storiesOf } from '@storybook/vue'
2-
import { CReset, CGrid, CBox } from '..'
2+
import { CReset, CGrid, CGridItem, CBox } from '..'
33

44
storiesOf('UI | Grid', module)
55
.add('Default Grid', () => ({
@@ -17,3 +17,17 @@ storiesOf('UI | Grid', module)
1717
</div>
1818
`
1919
}))
20+
21+
storiesOf('UI | Grid', module)
22+
.add('Grid Items', () => ({
23+
components: { CReset, CGrid, CGridItem },
24+
template: `
25+
<div>
26+
<CReset />
27+
<CGrid w="600px" template-columns="repeat(5, 1fr)" gap="6">
28+
<CGridItem col-span="2" h="10" bg="blue.500" />
29+
<CGridItem col-start="4" col-end="6" h="10" bg="red.500" />
30+
</CGrid>
31+
</div>
32+
`
33+
}))
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import CGrid from './CGrid'
2-
export default CGrid
1+
export * from './CGrid'

packages/chakra-ui-core/src/CGrid/test/CGrid.test.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import CGrid from '..'
1+
import { CGrid, CGridItem } from '..'
22
import { render } from '@/tests/test-utils'
33

44
const renderComponent = (props) => {
55
const inlineAttrs = (props && props.inlineAttrs) || ''
66
const base = {
7-
components: { CGrid },
7+
components: { CGrid, CGridItem },
88
template: `<CGrid ${inlineAttrs}>Grid Me</CGrid>`,
99
...props
1010
}
@@ -23,3 +23,25 @@ it('should change gap', () => {
2323

2424
expect(asFragment()).toMatchSnapshot()
2525
})
26+
27+
it('should offset columns', () => {
28+
const inlineAttrs = 'col-start="4" col-end="6"'
29+
const { asFragment } = renderComponent({
30+
template: `
31+
<CGrid w="600px" template-columns="repeat(5, 1fr)" gap="6">
32+
<CGridItem ${inlineAttrs}>I'm in a grid item</CGridItem>
33+
</CGrid>`
34+
})
35+
expect(asFragment()).toMatchSnapshot()
36+
})
37+
38+
it('should span columns', () => {
39+
const inlineAttrs = 'col-span="2"'
40+
const { asFragment } = renderComponent({
41+
template: `
42+
<CGrid w="600px" template-columns="repeat(5, 1fr)" gap="6">
43+
<CGridItem ${inlineAttrs}>I'm in a grid item</CGridItem>
44+
</CGrid>`
45+
})
46+
expect(asFragment()).toMatchSnapshot()
47+
})

packages/chakra-ui-core/src/CGrid/test/__snapshots__/CGrid.test.js.snap

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ exports[`should change gap 1`] = `
1111
</DocumentFragment>
1212
`;
1313

14+
exports[`should offset columns 1`] = `
15+
<DocumentFragment>
16+
<div
17+
class="css-12kxrxg"
18+
data-chakra-component="CGrid"
19+
>
20+
<div
21+
class="css-1i8ejg0"
22+
data-chakra-component="CGridItem"
23+
>
24+
I'm in a grid item
25+
</div>
26+
</div>
27+
</DocumentFragment>
28+
`;
29+
1430
exports[`should render correctly 1`] = `
1531
<DocumentFragment>
1632
<div
@@ -21,3 +37,19 @@ exports[`should render correctly 1`] = `
2137
</div>
2238
</DocumentFragment>
2339
`;
40+
41+
exports[`should span columns 1`] = `
42+
<DocumentFragment>
43+
<div
44+
class="css-12kxrxg"
45+
data-chakra-component="CGrid"
46+
>
47+
<div
48+
class="css-tuh9u2"
49+
data-chakra-component="CGridItem"
50+
>
51+
I'm in a grid item
52+
</div>
53+
</div>
54+
</DocumentFragment>
55+
`;

packages/chakra-ui-core/src/CImage/CImage.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const CImage = {
2525
mixins: [createStyledAttrsMixin('CImage')],
2626
props: {
2727
src: String,
28+
srcset: String,
2829
fallbackSrc: String,
2930
ignoreFalback: Boolean,
3031
htmlWidth: String,
@@ -48,12 +49,13 @@ const CImage = {
4849
created () {
4950
// Should only invoke window.Image in the browser.
5051
if (process.browser) {
51-
this.loadImage(this.src)
52+
this.loadImage(this.src, this.srcset)
5253
}
5354
},
5455
methods: {
55-
loadImage (src) {
56+
loadImage (src, srcset) {
5657
const image = new window.Image()
58+
image.srcset = srcset
5759
image.src = src
5860

5961
image.onload = (event) => {
@@ -70,9 +72,9 @@ const CImage = {
7072
render (h) {
7173
let imageProps
7274
if (this.ignoreFallback) {
73-
imageProps = { src: this.src }
75+
imageProps = { src: this.src, srcset: this.srcset }
7476
} else {
75-
imageProps = { src: this.hasLoaded ? this.src : this.fallbackSrc }
77+
imageProps = { src: this.hasLoaded ? this.src : this.fallbackSrc, srcset: this.srcset }
7678
}
7779
return h(CNoSsr, [
7880
h('img', {

0 commit comments

Comments
 (0)