File tree Expand file tree Collapse file tree 8 files changed +35
-31
lines changed Expand file tree Collapse file tree 8 files changed +35
-31
lines changed Original file line number Diff line number Diff line change 1- # react-verification-code
1+ # react-input- verification-code
22
33A verification code input, autocompletion friendly
44
5- [ ![ NPM] ( https://img.shields.io/npm/v/react-verification-code.svg )] ( https://www.npmjs.com/package/react-verification-code ) [ ![ JavaScript Style Guide] ( https://img.shields.io/badge/code_style-standard-brightgreen.svg )] ( https://standardjs.com )
5+ [ ![ NPM] ( https://img.shields.io/npm/v/react-input- verification-code.svg )] ( https://www.npmjs.com/package/react-input -verification-code ) [ ![ JavaScript Style Guide] ( https://img.shields.io/badge/code_style-standard-brightgreen.svg )] ( https://standardjs.com )
66
77## Examples
88
9- - Basic - [ CodeSandbox] ( https://codesandbox.io/s/basic-6ejdp ) - [ Source] ( https://github.com/ugogo/react-verification-code/tree/master/example/src/Basic.tsx )
9+ - Basic - [ CodeSandbox] ( https://codesandbox.io/s/basic-6ejdp ) - [ Source] ( https://github.com/ugogo/react-input- verification-code/tree/master/example/src/Basic.tsx )
1010
1111## Install
1212
1313``` bash
14- npm install --save react-verification-code
14+ npm install --save react-input- verification-code
1515```
1616
1717``` bash
18- yarn add react-verification-code
18+ yarn add react-input- verification-code
1919```
2020
2121## Usage
2222
2323``` tsx
2424import * as React from ' react' ;
25- import ReactVerificationCode from ' react-verification-code' ;
26- import ' react-verification-code/dist/index.css' ;
25+ import ReactInputVerificationCode from ' react-input -verification-code' ;
26+ import ' react-input- verification-code/dist/index.css' ;
2727
2828export default function App() {
29- return <ReactVerificationCode />;
29+ return <ReactInputVerificationCode />;
3030}
3131```
3232
Original file line number Diff line number Diff line change 11This example was bootstrapped with [ Create React App] ( https://github.com/facebook/create-react-app ) .
22
3- It is linked to the react-verification-code package in the parent directory for development purposes.
3+ It is linked to the react-input- verification-code package in the parent directory for development purposes.
44
55You can run ` yarn install ` and then ` yarn start ` to test your package.
Original file line number Diff line number Diff line change 11{
2- "name" : " react-verification-code-example" ,
2+ "name" : " react-input- verification-code-example" ,
33 "homepage" : " ." ,
44 "version" : " 0.0.0" ,
55 "private" : true ,
1616 "react-dom" : " link:../node_modules/react-dom" ,
1717 "react-scripts" : " link:../node_modules/react-scripts" ,
1818 "typescript" : " link:../node_modules/typescript" ,
19- "react-verification-code" : " link:.."
19+ "react-input- verification-code" : " link:.."
2020 },
2121 "devDependencies" : {
2222 "@babel/plugin-syntax-object-rest-spread" : " ^7.8.3"
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
2- import ReactVerificationCode from 'react-verification-code' ;
3- import 'react-verification-code/dist/index.css' ;
2+ import ReactInputVerificationCode from 'react-input -verification-code' ;
3+ import 'react-input- verification-code/dist/index.css' ;
44
5- export default ( ) => < ReactVerificationCode /> ;
5+ export default ( ) => < ReactInputVerificationCode /> ;
Original file line number Diff line number Diff line change @@ -8518,6 +8518,10 @@ react-error-overlay@^6.0.7:
85188518 resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108"
85198519 integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA==
85208520
8521+ " react-input-verification-code@link:.. " :
8522+ version "0.0.0"
8523+ uid ""
8524+
85218525react-is@^16.8.1, react-is@^16.8.4 :
85228526 version "16.13.1"
85238527 resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
@@ -8527,10 +8531,6 @@ react-is@^16.8.1, react-is@^16.8.4:
85278531 version "0.0.0"
85288532 uid ""
85298533
8530- " react-verification-code@link:.. " :
8531- version "0.0.0"
8532- uid ""
8533-
85348534" react@link:../node_modules/react " :
85358535 version "0.0.0"
85368536 uid ""
Original file line number Diff line number Diff line change 11{
2- "name" : " react-verification-code" ,
2+ "name" : " react-input- verification-code" ,
33 "version" : " 0.1.0" ,
44 "description" : " A verification code input, autocompletion friendly" ,
55 "author" : " ugogo" ,
66 "license" : " MIT" ,
7- "repository" : " ugogo/react-verification-code" ,
7+ "repository" : " ugogo/react-input- verification-code" ,
88 "main" : " dist/index.js" ,
99 "module" : " dist/index.modern.js" ,
1010 "source" : " src/index.tsx" ,
1111 "engines" : {
1212 "node" : " >=10"
1313 },
14+ "publishConfig" : {
15+ "registry" : " https://npm.pkg.github.com/"
16+ },
1417 "scripts" : {
1518 "build" : " microbundle-crl --no-compress --format modern,cjs --css-modules false" ,
1619 "start" : " microbundle-crl watch --no-compress --format modern,cjs --css-modules false" ,
Original file line number Diff line number Diff line change 1- .ReactVerificationCode__container {
1+ .ReactInputVerificationCode__container {
22 display : flex;
33 position : relative;
44 width : calc (
88 justify-content : space-between;
99}
1010
11- .ReactVerificationCode__input ,
12- .ReactVerificationCode__item {
11+ .ReactInputVerificationCode__input ,
12+ .ReactInputVerificationCode__item {
1313 width : var (--itemWidth );
1414 height : var (--itemHeight );
1515 padding : 0 ;
2121 border : 0 ;
2222}
2323
24- .ReactVerificationCode__item {
24+ .ReactInputVerificationCode__item {
2525 --boxShadowColor : # ccc ;
2626 --boxShadowSize : 1px ;
2727 box-shadow : inset 0 0 0 var (--boxShadowSize ) var (--boxShadowColor );
2828 transition : box-shadow 0.2s ease-out;
2929}
3030
31- .ReactVerificationCode__item .is-active {
31+ .ReactInputVerificationCode__item .is-active {
3232 --boxShadowColor : # 888 ;
3333 --boxShadowSize : 2px ;
3434}
3535
36- .ReactVerificationCode__input {
36+ .ReactInputVerificationCode__input {
3737 position : absolute;
3838 top : 0 ;
3939 left : calc (
Original file line number Diff line number Diff line change @@ -95,7 +95,8 @@ export default ({ length = 4, placeholder = '·' }) => {
9595 . composedPath ( )
9696 . reduce (
9797 ( bool : boolean , path : HTMLElement ) =>
98- bool || path . dataset ?. reactVerificationCodeId === CONTAINER_DATA_ID ,
98+ bool ||
99+ path . dataset ?. reactInputVerificationCodeId === CONTAINER_DATA_ID ,
99100 false
100101 ) ;
101102
@@ -111,8 +112,8 @@ export default ({ length = 4, placeholder = '·' }) => {
111112
112113 return (
113114 < div
114- data-react-verification-code-id = { CONTAINER_DATA_ID }
115- className = 'ReactVerificationCode__container '
115+ data-react-input- verification-code-id = { CONTAINER_DATA_ID }
116+ className = 'ReactInputVerificationCode__container '
116117 style = {
117118 {
118119 '--activeIndex' : activeIndex ,
@@ -125,7 +126,7 @@ export default ({ length = 4, placeholder = '·' }) => {
125126 >
126127 < input
127128 ref = { codeInputRef }
128- className = 'ReactVerificationCode__input '
129+ className = 'ReactInputVerificationCode__input '
129130 autoComplete = 'one-time-code'
130131 type = 'text'
131132 inputMode = 'decimal'
@@ -143,7 +144,7 @@ export default ({ length = 4, placeholder = '·' }) => {
143144 ref = { ref }
144145 role = 'button'
145146 tabIndex = { 0 }
146- className = { `ReactVerificationCode__item ${
147+ className = { `ReactInputVerificationCode__item ${
147148 activeIndex === i ? 'is-active' : ''
148149 } `}
149150 onFocus = { onItemFocus ( i ) }
You can’t perform that action at this time.
0 commit comments