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

Commit 94af184

Browse files
committed
feat: add styled system package
1 parent 5f41560 commit 94af184

File tree

124 files changed

+7454
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+7454
-285
lines changed

_templates/generator/module/package.json.ejs.t

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
55
{
66
"name": "<%= '@chakra-ui/' + h.changeCase.paramCase(name)%>",
77
"version": "1.0.0",
8-
"main": "index.js",
8+
"main": "dist/cjs/index.js",
9+
"module": "dist/esm/index.js",
10+
"types": "dist/types/index.d.ts",
11+
"typings": "dist/types/index.d.ts",
12+
"files": [
13+
"dist"
14+
],
915
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.pascalCase(name) + ' module'%>",
1016
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
1117
"author": "Jonathan Bakebwa [email protected]",

package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
1414
"scaffold": "hygen",
1515
"playground:routes": "ts-node ./scripts/parse-routes.ts",
16-
"playground": "yarn playground:routes && NODE_ENV=development vite serve playground",
16+
"dev": "yarn playground:routes && NODE_ENV=development vite serve playground",
1717
"playground:build": "yarn playground:routes && NODE_ENV=production vite build playground",
1818
"c-alert": "yarn workspace @chakra-ui/c-alert",
1919
"c-box": "yarn workspace @chakra-ui/c-box",
@@ -49,11 +49,18 @@
4949
"recursive-readdir": "^2.2.2",
5050
"ts-node": "^9.0.0",
5151
"typescript": "^4.0.3",
52-
"vite": "^1.0.0-rc.4",
53-
"vue": "^3.0.0",
52+
"vite": "^1.0.0-rc.13",
53+
"vue": "^3",
5454
"vue-router": "4.0.0-beta.10"
5555
},
5656
"dependencies": {
57-
"change-case": "^4.1.1"
57+
"@chakra-ui/theme-vue": "^0.2.6",
58+
"@types/lodash.mergewith": "^4.6.6",
59+
"@types/tinycolor2": "^1.4.2",
60+
"change-case": "^4.1.1",
61+
"csstype": "^3.0.5",
62+
"lodash.mergewith": "^4.6.2",
63+
"object-assign": "^4.1.1",
64+
"tinycolor2": "^1.4.2"
5865
}
5966
}

packages/c-accordion/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@chakra-ui/c-accordion",
3+
"version": "1.0.0",
4+
"main": "dist/cjs/index.js",
5+
"module": "dist/esm/index.js",
6+
"types": "dist/types/index.d.ts",
7+
"typings": "dist/types/index.d.ts",
8+
"files": [
9+
"dist"
10+
],
11+
"description": "Chakra UI Vue | CAccordion component",
12+
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
13+
"author": "Jonathan Bakebwa [email protected]",
14+
"license": "MIT",
15+
"scripts": {
16+
"build": "concurrently yarn:build:*",
17+
"build:esm": "cross-env swc src --out-dir dist/esm/",
18+
"build:cjs": "cross-env swc -C module.type=commonjs src --out-dir dist/cjs/",
19+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
20+
}
21+
}

packages/c-accordion/src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { h, defineComponent, PropType } from 'vue'
2+
3+
const CAccordion = defineComponent({
4+
props: {
5+
as: {
6+
type: Object as PropType<string>,
7+
default: 'div',
8+
},
9+
},
10+
setup(props, { slots, attrs }) {
11+
return h(props?.as, { ...attrs }, slots.default?.())
12+
},
13+
})
14+
15+
export default CAccordion
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { render } from '@chakra-ui/vue-test-utils'
2+
import CAccordion from '../'
3+
4+
it('should render properly', () => {
5+
const { html } = render(CAccordion)
6+
expect(html()).toMatchSnapshot()
7+
})

packages/c-accordion/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": ["src"]
4+
}

packages/c-alert/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"build:esm": "cross-env swc src --out-dir dist/esm/",
1818
"build:cjs": "cross-env swc -C module.type=commonjs src --out-dir dist/cjs/",
1919
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
20+
},
21+
"dependencies": {
22+
"@chakra-ui/vue-styled-system": "1.0.0"
2023
}
2124
}

packages/c-alert/src/index.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
import { h, defineComponent, Component } from 'vue'
1+
import {
2+
h,
3+
defineComponent,
4+
VNodeProps,
5+
VNode,
6+
Component,
7+
Fragment,
8+
Teleport,
9+
Suspense,
10+
DefineComponent,
11+
onMounted,
12+
} from 'vue'
13+
14+
import { css } from '@chakra-ui/vue-styled-system'
15+
import theme from '@chakra-ui/vue-theme'
16+
17+
type Tag =
18+
| string
19+
| typeof Fragment
20+
| typeof Teleport
21+
| typeof Suspense
22+
| Component
223

324
const CAlert = defineComponent({
425
props: {
@@ -7,6 +28,17 @@ const CAlert = defineComponent({
728
default: 'div',
829
},
930
},
31+
setup() {
32+
onMounted(() => {
33+
console.log(
34+
css({
35+
bg: 'blue.400',
36+
p: 4,
37+
color: 'white',
38+
})({ theme })
39+
)
40+
})
41+
},
1042
render() {
1143
return h(
1244
this.as,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<template>
22
<div>
33
<h2>Base Box</h2>
4-
<p>{{ val }}</p>
4+
<c-box>{{ val }}</c-box>
55
</div>
66
</template>
77

88
<script lang="ts">
99
import { defineComponent, ref } from 'vue'
10-
import CBox from '@chakra-ui/c-box/src'
10+
import CBox from '../src'
1111
1212
export default defineComponent({
13+
components: { CBox },
1314
setup() {
1415
const val = ref('Hello box')
1516
console.log('Base box setup ')
16-
return {
17-
val,
18-
}
17+
18+
return { val }
1919
},
2020
})
2121
</script>

packages/c-box/src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { h, defineComponent, PropType } from 'vue'
1+
import { h, defineComponent, PropType, onMounted } from 'vue'
2+
import theme from '@chakra-ui/vue-theme'
23

34
const CBox = defineComponent({
45
props: {
@@ -7,6 +8,11 @@ const CBox = defineComponent({
78
default: 'div',
89
},
910
},
11+
setup() {
12+
onMounted(() => {
13+
console.log(theme.components)
14+
})
15+
},
1016
render() {
1117
return h(this?.as, { ...this.$props, ...this.$attrs }, this.$slots)
1218
},

0 commit comments

Comments
 (0)