File tree 5 files changed +17
-23
lines changed
5 files changed +17
-23
lines changed Original file line number Diff line number Diff line change 1
1
import '../../assets/index.less' ;
2
2
import React , { useState } from 'react' ;
3
- import type { SwitchChangeEventHandler } from 'rc-switch' ;
4
- import Switch from 'rc-switch' ;
3
+ import type { SwitchChangeEventHandler } from '@ rc-component/ switch' ;
4
+ import Switch from '@ rc-component/ switch' ;
5
5
6
6
const onChange : SwitchChangeEventHandler = ( value , event ) => {
7
7
// eslint-disable-next-line no-console
8
8
console . log ( `switch checked: ${ value } ` , event ) ;
9
- }
9
+ } ;
10
10
11
11
export default ( ) => {
12
12
const [ disabled , setDisabled ] = useState ( false ) ;
13
13
14
14
const toggle = ( ) => {
15
15
setDisabled ( ( prev ) => ! prev ) ;
16
- }
16
+ } ;
17
17
18
18
return (
19
19
< div style = { { margin : 20 } } >
20
- < Switch
21
- onChange = { onChange }
22
- disabled = { disabled }
23
- checkedChildren = "开"
24
- unCheckedChildren = "关"
25
- />
20
+ < Switch onChange = { onChange } disabled = { disabled } checkedChildren = "开" unCheckedChildren = "关" />
26
21
< div style = { { marginTop : 20 } } >
27
22
< button type = "button" onClick = { toggle } >
28
23
toggle disabled
29
24
</ button >
30
25
</ div >
31
26
</ div >
32
- )
33
- }
27
+ ) ;
28
+ } ;
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " rc-switch" ,
3
- "version" : " 4.1 .0" ,
2
+ "name" : " @ rc-component/ switch" ,
3
+ "version" : " 1.0 .0" ,
4
4
"description" : " switch ui component for react" ,
5
5
"keywords" : [
6
6
" react" ,
32
32
"lint" : " eslint ." ,
33
33
"lint-staged" : " lint-staged" ,
34
34
"prepare" : " husky install && dumi setup" ,
35
- "prepublishOnly" : " npm run compile && np --yolo --no-publish " ,
35
+ "prepublishOnly" : " npm run compile && rc-np " ,
36
36
"postpublish" : " npm run gh-pages" ,
37
37
"start" : " dumi dev" ,
38
38
"test" : " umi-test"
43
43
]
44
44
},
45
45
"dependencies" : {
46
- "@babel/runtime" : " ^7.21.0" ,
47
46
"classnames" : " ^2.2.1" ,
48
- "rc-util" : " ^5.30 .0"
47
+ "@ rc-component/ util" : " ^1.2 .0"
49
48
},
50
49
"devDependencies" : {
51
- "@rc-component/father-plugin" : " ^1 .0.0" ,
50
+ "@rc-component/father-plugin" : " ^2 .0.0" ,
52
51
"@types/classnames" : " ^2.2.10" ,
53
52
"@types/jest" : " ^29.4.0" ,
54
53
"@umijs/fabric" : " ^3.0.0" ,
65
64
"husky" : " ^8.0.1" ,
66
65
"less" : " ^4.1.3" ,
67
66
"lint-staged" : " ^15.1.0" ,
68
- "np" : " ^9 .0.0 " ,
67
+ "@rc-component/ np" : " ^1 .0.3 " ,
69
68
"prettier" : " ^3.1.0" ,
70
69
"react" : " ^16.0.0" ,
71
70
"react-dom" : " ^16.0.0" ,
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
import classNames from 'classnames' ;
3
- import useMergedState from 'rc-util/lib/hooks/useMergedState' ;
4
- import KeyCode from 'rc-util/lib/KeyCode' ;
3
+ import useMergedState from '@ rc-component/ util/lib/hooks/useMergedState' ;
4
+ import KeyCode from '@ rc-component/ util/lib/KeyCode' ;
5
5
6
6
export type SwitchChangeEventHandler = (
7
7
checked : boolean ,
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import KeyCode from 'rc-util/lib/KeyCode' ;
2
+ import KeyCode from '@ rc-component/ util/lib/KeyCode' ;
3
3
import { mount } from 'enzyme' ;
4
4
import Switch from '..' ;
5
5
Original file line number Diff line number Diff line change 13
13
"skipLibCheck" : true ,
14
14
"declaration" : true ,
15
15
"paths" : {
16
- "rc-switch" : [" src/index.tsx " ],
16
+ "@ rc-component/ switch" : [" src/" ],
17
17
"@@/*" : [" .dumi/tmp/*" ]
18
18
}
19
19
}
You can’t perform that action at this time.
0 commit comments