Skip to content

Commit e8694b0

Browse files
committed
feat(modal): initialize component
1 parent bb8648a commit e8694b0

File tree

9 files changed

+94
-1
lines changed

9 files changed

+94
-1
lines changed

_templates/generator/component/README.md.ejs.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
to: tooling/<%=h.changeCase.paramCase(name)%>/README.md
2+
to: packages/<%=h.changeCase.paramCase(name)%>/README.md
33
---
44

55
# @chakra-ui/<%=h.changeCase.paramCase(name)%>

packages/c-modal/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# @chakra-ui/c-modal
2+
3+
An accessible dialog modal component for Chakra UI Vue
4+
5+
## Installation
6+
7+
```sh
8+
yarn add @chakra-ui/c-modal
9+
# or
10+
npm i @chakra-ui/c-modal
11+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<c-modal> HELLO CModal </c-modal>
3+
</template>

packages/c-modal/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './src'

packages/c-modal/package.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "@chakra-ui/c-modal",
3+
"description": "Chakra UI Vue | An accessible dialog modal component for chakra ui vue component",
4+
"version": "1.0.0",
5+
"main": "dist/cjs/index.js",
6+
"module": "dist/esm/index.js",
7+
"types": "dist/types/index.d.ts",
8+
"typings": "dist/types/index.d.ts",
9+
"author": "Jonathan Bakebwa <[email protected]>",
10+
"homepage": "https://github.com/chakra-ui/chakra-ui-vue-next#readme",
11+
"license": "MIT",
12+
"files": [
13+
"dist"
14+
],
15+
"exports": {
16+
".": {
17+
"require": "./dist/cjs/index.js",
18+
"default": "./dist/esm/index.js"
19+
}
20+
},
21+
"publishConfig": {
22+
"access": "public"
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/chakra-ui/chakra-ui-vue-next/issues"
30+
},
31+
"sideEffects": false,
32+
"scripts": {
33+
"build": "rimraf ./dist && concurrently yarn:build:*",
34+
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps",
35+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps",
36+
"build:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
37+
"watch": "concurrently yarn:watch:*",
38+
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts,.tsx -d dist/esm --source-maps --watch",
39+
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts,.tsx -d dist/cjs --source-maps --watch",
40+
"watch:types": "cross-env tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch --incremental"
41+
},
42+
"dependencies": {
43+
"@chakra-ui/styled-system": "^1.9.0",
44+
"@chakra-ui/vue-system": "*",
45+
"@chakra-ui/vue-utils": "*"
46+
},
47+
"peerDependencies": {
48+
"vue": ">=3.0.5"
49+
}
50+
}

packages/c-modal/src/c-modal.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { h, defineComponent, PropType } from 'vue'
2+
import { chakra, DOMElements } from '@chakra-ui/vue-system'
3+
4+
const CModal = defineComponent({
5+
props: {
6+
as: {
7+
type: [Object, String] as PropType<DOMElements>,
8+
default: 'div',
9+
},
10+
},
11+
setup(props, { slots, attrs }) {
12+
return () => h(chakra(props.as), { ...attrs }, slots)
13+
},
14+
})
15+
16+
export default CModal

packages/c-modal/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as CModal } from './c-modal'
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { render } from '../../test-utils/src'
2+
import { CModal } from '../src'
3+
4+
it('should render properly', () => {
5+
const { asFragment } = render(CModal)
6+
expect(asFragment()).toMatchSnapshot()
7+
})

packages/c-modal/tsconfig.json

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

0 commit comments

Comments
 (0)