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

Commit 19741d8

Browse files
feat(c-radio): create scaffold
1 parent 1178174 commit 19741d8

File tree

10 files changed

+416
-713
lines changed

10 files changed

+416
-713
lines changed

packages/c-radio/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# `@chakra-ui/c-radio`
2+
3+
Radios are used when only one choice may be selected in a series of options
4+
5+
## Installation
6+
7+
```sh
8+
# with pnpm
9+
pnpm add @chakra-ui/c-radio
10+
# or with Yarn
11+
yarn i @chakra-ui/c-radio
12+
# or with npm
13+
npm i @chakra-ui/c-radio
14+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script setup lang="ts">
2+
import { CRadio } from "../src"
3+
</script>
4+
5+
<template>
6+
<c-radio> HELLO CRadio </c-radio>
7+
</template>

packages/c-radio/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./src"

packages/c-radio/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@chakra-ui/c-radio",
3+
"description": "Chakra UI Vue | Radios are used when only one choice may be selected in a series of options component",
4+
"version": "0.0.0-beta.0",
5+
"author": "Jonathan Bakebwa <[email protected]>",
6+
"homepage": "https://github.com/chakra-ui/chakra-ui-vue-next#readme",
7+
"license": "MIT",
8+
"main": "src/index.ts",
9+
"clean-package": "../../clean-package.config.json",
10+
"files": [
11+
"dist"
12+
],
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/chakra-ui/chakra-ui-vue-next/issues"
19+
},
20+
"sideEffects": false,
21+
"scripts": {
22+
"clean": "rimraf dist .turbo",
23+
"build": "tsup && pnpm build:types",
24+
"build:fast": "tsup",
25+
"build:types": "tsup src --dts-only",
26+
"types:check": "tsc --noEmit",
27+
"dev": "tsup --watch"
28+
},
29+
"dependencies": {
30+
"@chakra-ui/vue-system": "workspace:*",
31+
"@zag-js/radio-group": "0.7.0",
32+
"@zag-js/vue": "0.7.0"
33+
},
34+
"devDependencies": {
35+
"vue": "^3.2.37"
36+
},
37+
"peerDependencies": {
38+
"vue": "^3.1.4"
39+
},
40+
"publishConfig": {
41+
"access": "public"
42+
}
43+
}

packages/c-radio/src/c-radio.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Hey! Welcome to @chakra-ui/vue-next CRadio
3+
*
4+
* Radios are used when only one choice may be selected in a series of options
5+
*
6+
* @see Docs https://next.vue.chakra-ui.com/c-radio
7+
* @see Source https://github.com/chakra-ui/chakra-ui-vue-next/blob/main/packages/c-radio/src/c-radio/c-radio.ts
8+
* @see WAI-ARIA https://www.w3.org/TR/wai-aria-practices-1.2
9+
*/
10+
11+
import { defineComponent, h, Fragment, PropType } from "vue"
12+
import {
13+
chakra,
14+
DOMElements,
15+
} from "@chakra-ui/vue-system"
16+
17+
export interface CRadioProps {}
18+
19+
export const CRadio = defineComponent({
20+
props: {
21+
as: {
22+
type: [Object, String] as PropType<DOMElements>,
23+
default: "div",
24+
},
25+
},
26+
setup(props, { slots, attrs }) {
27+
return () => (
28+
<chakra.div as={props.as} {...attrs}>
29+
{slots}
30+
</chakra.div>
31+
)
32+
},
33+
})

packages/c-radio/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./c-radio"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { render } from "../../test-utils/src"
2+
import { CRadio } from "../src"
3+
4+
it("should render properly", () => {
5+
const { asFragment } = render(CRadio)
6+
expect(asFragment()).toMatchSnapshot()
7+
})

packages/c-radio/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", "./index.tsx"]
4+
}

packages/c-radio/tsup.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineConfig } from "tsup"
2+
import EsbuildPluginJSX from "unplugin-vue-jsx/esbuild"
3+
4+
export default defineConfig({
5+
clean: true,
6+
target: "es2019",
7+
esbuildPlugins: [
8+
EsbuildPluginJSX({
9+
include: [/.[jt]sx?$/],
10+
}) as any,
11+
],
12+
metafile: true,
13+
external: ["lodash.mergewith"],
14+
format: ["esm", "cjs"],
15+
entry: ["src/**/*.(ts|tsx)"],
16+
keepNames: true,
17+
})

0 commit comments

Comments
 (0)