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

Commit c33b198

Browse files
Merge pull request #9 from chakra-ui/feature/icon-component
feature: icon component
2 parents e70f92f + 41209a6 commit c33b198

Some content is hidden

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

44 files changed

+1189
-84
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
to: packages/<%=h.changeCase.paramCase(name)%>/README.md
3+
---
4+
5+
# @chakra-ui/<%=h.changeCase.paramCase(name)%>
6+
7+
<%=h.changeCase.sentence(description)%>
8+
9+
## Installation
10+
11+
```sh
12+
yarn add @chakra-ui/<%=h.changeCase.paramCase(name)%>
13+
# or
14+
npm i @chakra-ui/<%=h.changeCase.paramCase(name)%>
15+
```

_templates/generator/component/component.ts.ejs.t

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ to: packages/<%=h.changeCase.paramCase(name)%>/src/index.ts
33
---
44

55
import { h, defineComponent, PropType } from 'vue'
6+
import { chakra, DOMElements } from '@chakra-ui/vue-system'
67

7-
const <%= h.changeCase.pascalCase(name) %> = defineComponent({
8+
export const <%= h.changeCase.pascalCase(name) %> = defineComponent({
89
props: {
910
as: {
10-
type: Object as PropType<string>,
11+
type: [Object, String] as PropType<DOMElements>,
1112
default: 'div',
1213
},
1314
},
1415
setup(props, { slots, attrs }) {
15-
return h(props?.as, { ...attrs }, slots.default?.())
16+
return () => h(chakra(props.as), { ...attrs }, slots)
1617
},
1718
})
18-
19-
export default <%= h.changeCase.pascalCase(name) %>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
to: packages/<%=h.changeCase.paramCase(name)%>/examples/base-<%=h.changeCase.paramCase(name)%>.vue
3+
---
4+
5+
<template>
6+
<<%=h.changeCase.pascalCase(name)%>> HELLO <%=h.changeCase.pascalCase(name)%> <<%=h.changeCase.pascalCase(name)%>>
7+
</template>
8+
9+
<script lang="ts">
10+
import { <%=h.changeCase.pascalCase(name)%> } from '@chakra-ui/<%=h.changeCase.paramCase(name)%>/src'
11+
import { defineComponent } from 'vue'
12+
13+
export default defineComponent({
14+
name: 'Base<%= h.changeCase.pascalCase(name) %>Example',
15+
components: { <%= h.changeCase.pascalCase(name) %> },
16+
})
17+
</script>

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

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,35 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
44

55
{
66
"name": "<%= '@chakra-ui/' + h.changeCase.paramCase(name)%>",
7+
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.sentence(description) + ' component'%>",
78
"version": "1.0.0",
89
"main": "dist/cjs/index.js",
910
"module": "dist/esm/index.js",
1011
"types": "dist/types/index.d.ts",
1112
"typings": "dist/types/index.d.ts",
13+
"author": "Jonathan Bakebwa <codebender828@gmail.com>",
14+
"homepage": "https://github.com/chakra-ui/chakra-ui-vue-next#readme",
15+
"license": "MIT",
1216
"files": [
1317
"dist"
1418
],
15-
"description": "<%= 'Chakra UI Vue | ' + h.changeCase.pascalCase(name) + ' component'%>",
16-
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next.git",
17-
"author": "Jonathan Bakebwa [email protected]",
18-
"license": "MIT",
19+
"exports": {
20+
".": {
21+
"require": "./dist/cjs/index.js",
22+
"default": "./dist/esm/index.js"
23+
}
24+
},
25+
"publishConfig": {
26+
"access": "public"
27+
},
28+
"repository": {
29+
"type": "git",
30+
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
31+
},
32+
"bugs": {
33+
"url": "https://github.com/chakra-ui/chakra-ui=vue-next/issues"
34+
},
35+
"sideEffects": false,
1936
"scripts": {
2037
"build": "concurrently yarn:build:*",
2138
"build:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts -d dist/esm --source-maps",
@@ -25,5 +42,13 @@ to: packages/<%=h.changeCase.paramCase(name)%>/package.json
2542
"watch:esm": "cross-env BABEL_ENV=esm babel src --root-mode upward --extensions .ts -d dist/esm --source-maps --watch",
2643
"watch:cjs": "cross-env BABEL_ENV=cjs babel src --root-mode upward --extensions .ts -d dist/cjs --source-maps --watch",
2744
"watch:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types --watch"
45+
},
46+
"dependencies": {
47+
"@chakra-ui/styled-system": "^1.4.1",
48+
"@chakra-ui/vue-system": "*",
49+
"@chakra-ui/vue-utils": "*"
50+
},
51+
"peerDependencies": {
52+
"vue": ">=3.0.5"
2853
}
2954
}

_templates/generator/component/test-file.test.ts.ejs.t

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
to: packages/<%=h.changeCase.paramCase(name)%>/tests/<%=h.changeCase.paramCase(name)%>.test.ts
33
---
44
import { render } from '../../test-utils/src'
5-
import <%= h.changeCase.pascalCase(name) %> from '../'
6-
5+
import { <%= h.changeCase.pascalCase(name) %> } from '../src'
76

87
it('should render properly', () => {
9-
const { html } = render(<%= h.changeCase.pascalCase(name) %>)
10-
expect(html()).toMatchSnapshot()
8+
const { asFragment } = render(<%= h.changeCase.pascalCase(name) %>)
9+
expect(asFragment()).toMatchSnapshot()
1110
})

nodemon.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"watch": ["packages", "scripts/parse-routes.ts"],
3+
"ext": "vue",
4+
"ignore": ["packages/**/*.test.ts"],
5+
"exec": "yarn playground:routes"
6+
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"bootstrap": "yarn run lerna bootstrap",
1414
"scaffold": "hygen",
1515
"build": "lerna run build --no-private --stream",
16-
"dev": "yarn playground:routes && NODE_ENV=development vite serve playground --config ./vite.config.ts",
16+
"dev": "concurrently 'NODE_ENV=development vite serve playground --config ./vite.config.ts' 'yarn playground:routes'",
1717
"playground:routes": "ts-node ./scripts/parse-routes.ts",
1818
"playground:build": "yarn install && yarn build && yarn playground:routes && NODE_ENV=production vite build playground --config ./vite.config.ts",
1919
"test": "jest",
@@ -23,7 +23,8 @@
2323
"c-theme-provider": "yarn workspace @chakra-ui/c-theme-provider",
2424
"c-box": "yarn workspace @chakra-ui/c-box",
2525
"c-button": "yarn workspace @chakra-ui/c-button",
26-
"system": "yarn workspace @chakra-ui/system-vue",
26+
"c-icon": "yarn workspace @chakra-ui/c-icon",
27+
"system": "yarn workspace @chakra-ui/vue-system",
2728
"theme": "yarn workspace @chakra-ui/vue-theme",
2829
"nuxt": "yarn workspace @chakra-ui/nuxt-next",
2930
"test-utils": "yarn workspace @chakra-ui/vue-test-utils"
@@ -62,13 +63,15 @@
6263
"eslint-plugin-promise": "^4.2.1",
6364
"eslint-plugin-standard": "^4.0.1",
6465
"eslint-plugin-vue": "^7.0.0",
66+
"feather-icons-paths": "^1.0.8",
6567
"fs-extra": "^9.0.1",
6668
"husky": "^4.3.8",
6769
"hygen": "^6.0.4",
6870
"jest": "^26.6.3",
6971
"jest-transform-stub": "^2.0.0",
7072
"lerna": "^3.22.1",
7173
"lint-staged": "^10.5.3",
74+
"nodemon": "^2.0.7",
7275
"prettier": "^2.1.2",
7376
"pretty": "^2.0.0",
7477
"recursive-readdir": "^2.2.2",

packages/c-accordion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types"
2020
},
2121
"dependencies": {
22-
"@chakra-ui/system-vue": "1.0.0"
22+
"@chakra-ui/vue-system": "*"
2323
}
2424
}

packages/c-accordion/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { h, defineComponent, PropType } from 'vue'
2-
import { chakra, DOMElements } from '@chakra-ui/system-vue'
2+
import { chakra, DOMElements } from '@chakra-ui/vue-system'
33

44
const CAccordion = defineComponent({
55
props: {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<chakra.div
3+
bg="blue.400"
4+
:_hover="{ bg: 'yellow.500' }"
5+
font-weight="bold"
6+
color="white"
7+
px="4"
8+
py="3"
9+
>
10+
Fixing pseudo styles
11+
</chakra.div>
12+
</template>

0 commit comments

Comments
 (0)