Skip to content

Commit 11a6251

Browse files
EmilyyyLiu刘欢gemini-code-assist[bot]
authored
chore: migrate to @rc-component namespace and update (#294)
* chore: migrate to @rc-component namespace and update * Update package.json Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * chore: modify deploy path --------- Co-authored-by: 刘欢 <lh01217311@antgroup.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 9f90d64 commit 11a6251

File tree

8 files changed

+26
-28
lines changed

8 files changed

+26
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Checkbox ui component for react.
3737
## Usage
3838

3939
```js
40-
import checkbox from 'rc-checkbox';
40+
import checkbox from '@rc-component/checkbox';
4141

4242
export default () => <checkbox />;
4343
```

docs/demo/focus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { CheckboxRef } from 'rc-checkbox';
2-
import Checkbox from 'rc-checkbox';
1+
import type { CheckboxRef } from '@rc-component/checkbox';
2+
import Checkbox from '@rc-component/checkbox';
33
import { useLayoutEffect, useRef, useState } from 'react';
44
import '../../assets/index.less';
55

docs/demo/simple.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint no-console:0, jsx-a11y/label-has-for: 0, jsx-a11y/label-has-associated-control: 0 */
2+
import Checkbox from '@rc-component/checkbox';
23
import React from 'react';
3-
import Checkbox from 'rc-checkbox';
44
import '../../assets/index.less';
55

6-
import type { CheckboxProps } from 'rc-checkbox';
6+
import type { CheckboxProps } from '@rc-component/checkbox';
77

88
const onChange = (e: any) => {
99
console.log('Checkbox checked:', e.target.checked);

docs/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
hero:
3-
title: rc-checkbox
3+
title: @rc-component/checkbox
44
description: checkbox ui component for react
55
---
66

77
## 📦 Install
88

99
```bash
1010
# npm install
11-
npm install rc-checkbox --save
11+
npm install @rc-component/checkbox --save
1212

1313
# yarn install
14-
yarn add rc-checkbox
14+
yarn add @rc-component/checkbox
1515

1616
# pnpm install
17-
pnpm i rc-checkbox
17+
pnpm i @rc-component/checkbox
1818
```
1919

2020
## 🔨 Usage
2121

2222
```ts
23-
import Checkbox from 'rc-checkbox';
23+
import Checkbox from '@rc-component/checkbox';
2424

2525
export default () => {
2626
return <Checkbox />;

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "rc-checkbox",
3-
"version": "3.5.0",
2+
"name": "@rc-component/checkbox",
3+
"version": "1.0.0",
44
"description": "checkbox ui component for react",
55
"keywords": [
66
"react",
77
"react-component",
88
"react-checkbox",
99
"checkbox"
1010
],
11-
"homepage": "http://github.com/react-component/checkbox",
11+
"homepage": "https://react-component.github.io/checkbox",
1212
"bugs": {
1313
"url": "http://github.com/react-component/checkbox/issues"
1414
},
@@ -29,12 +29,13 @@
2929
"build": "dumi build",
3030
"compile": "father build && lessc assets/index.less assets/index.css",
3131
"coverage": "jest --coverage",
32-
"gh-pages": "npm run build && father doc deploy -d .docs",
32+
"gh-pages": "npm run build && father doc deploy -d dist",
3333
"lint": "eslint src/ --ext .tsx,.ts",
3434
"prepare": "husky install && dumi setup",
35-
"prepublishOnly": "npm run compile && np --yolo --no-publish",
35+
"prepublishOnly": "npm run compile && rc-np",
3636
"start": "dumi dev",
37-
"test": "jest"
37+
"test": "jest",
38+
"tsc": "bunx tsc --noEmit"
3839
},
3940
"lint-staged": {
4041
"*.{js,jsx,less,md,json}": [
@@ -45,14 +46,14 @@
4546
]
4647
},
4748
"dependencies": {
48-
"@babel/runtime": "^7.10.1",
49-
"classnames": "^2.3.2",
50-
"rc-util": "^5.25.2"
49+
"@rc-component/util": "^1.3.0",
50+
"classnames": "^2.3.2"
5151
},
5252
"devDependencies": {
53-
"@rc-component/father-plugin": "^1.0.1",
54-
"@testing-library/react": "^14.1.2 ",
53+
"@rc-component/father-plugin": "^2.1.3",
54+
"@rc-component/np": "^1.0.0",
5555
"@testing-library/jest-dom": "^6.1.5",
56+
"@testing-library/react": "^14.1.2",
5657
"@testing-library/user-event": "^14.4.3",
5758
"@types/classnames": "^2.3.1",
5859
"@types/jest": "^29.2.4",
@@ -71,7 +72,6 @@
7172
"jest-environment-jsdom": "^29.3.1",
7273
"less": "^4.2.0",
7374
"lint-staged": "^15.1.0",
74-
"np": "^9.0.0",
7575
"react": "^18.2.0",
7676
"react-dom": "^18.2.0",
7777
"ts-node": "^10.9.1",

src/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import useControlledState from '@rc-component/util/lib/hooks/useControlledState';
12
import classNames from 'classnames';
2-
import useMergedState from 'rc-util/lib/hooks/useMergedState';
33
import * as React from 'react';
44
import { forwardRef, useImperativeHandle, useRef } from 'react';
55

@@ -44,9 +44,7 @@ export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>((props, ref) => {
4444
const inputRef = useRef<HTMLInputElement>(null);
4545
const holderRef = useRef<HTMLElement>(null);
4646

47-
const [rawValue, setRawValue] = useMergedState(defaultChecked, {
48-
value: checked,
49-
});
47+
const [rawValue, setRawValue] = useControlledState(defaultChecked, checked);
5048

5149
useImperativeHandle(ref, () => ({
5250
focus: (options) => {

tests/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import KeyCode from '@rc-component/util/lib/KeyCode';
12
import { fireEvent, render } from '@testing-library/react';
2-
import KeyCode from 'rc-util/lib/KeyCode';
33
import * as React from 'react';
44
import Checkbox from '../src';
55

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"paths": {
1212
"@/*": ["src/*"],
1313
"@@/*": [".dumi/tmp/*"],
14-
"rc-checkbox": ["src/index.tsx"]
14+
"@rc-component/checkbox": ["src/index.tsx"]
1515
}
1616
},
1717
"include": [".dumirc.ts", "**/*.ts", "**/*.tsx"]

0 commit comments

Comments
 (0)