Skip to content

Commit a7174c3

Browse files
committed
feat: remove the passwordMask prop in favor of placeholder
1 parent 6369e17 commit a7174c3

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ A verification code input, autocompletion friendly
2323
"styled-components": ">=5.0.0"
2424
}
2525
```
26+
2627
## Install
2728

2829
```bash
@@ -48,16 +49,15 @@ export default function App() {
4849

4950
### Props
5051

51-
| Key | Type | Default | Required | Description |
52-
| ----------- | ---------- | ---------- | -------- | --------------------------------------------------------- |
53-
| autoFocus | `boolean` | false | false | Focus on render |
54-
| length | `number` | `4` | false | How many items will be rendered |
55-
| onChange | `function` | `() => {}` | false | Function called when the value changes |
56-
| onCompleted | `function` | `() => {}` | false | Function called when the code is completed |
57-
| placeholder | `string` | `·` | false | String rendered in each item when no value has been typed |
58-
| value | `string` | `() => {}` | false | Control internal input value |
59-
| type | `text` or `password` | `text` | false | Display the item value or a password mask |
60-
| passwordMask | `string` | `` | false | Password mask |
52+
| Key | Type | Default | Required | Description |
53+
| ----------- | -------------------- | ---------- | -------- | --------------------------------------------------------- |
54+
| autoFocus | `boolean` | false | false | Focus on render |
55+
| length | `number` | `4` | false | How many items will be rendered |
56+
| onChange | `function` | `() => {}` | false | Function called when the value changes |
57+
| onCompleted | `function` | `() => {}` | false | Function called when the code is completed |
58+
| placeholder | `string` | `·` | false | String rendered in each item when no value has been typed |
59+
| value | `string` | `() => {}` | false | Control internal input value |
60+
| type | `text` or `password` | `text` | false | Display the item value or a password mask |
6161

6262
### CSS Properties
6363

src/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export interface ReactInputVerificationCodeProps {
1717
value?: string;
1818
dataCy?: string;
1919
type?: 'text' | 'password';
20-
passwordMask?: string;
2120
}
2221

2322
const ReactInputVerificationCode = ({
@@ -29,7 +28,6 @@ const ReactInputVerificationCode = ({
2928
value: pValue,
3029
dataCy = 'verification-code',
3130
type = 'text',
32-
passwordMask = '•',
3331
}: ReactInputVerificationCodeProps) => {
3432
const emptyValue = new Array(length).fill(placeholder);
3533

@@ -173,7 +171,7 @@ const ReactInputVerificationCode = ({
173171

174172
const renderItemText = (itemValue: string) => {
175173
if (itemValue === placeholder) return placeholder;
176-
return type === 'password' ? passwordMask : itemValue;
174+
return type === 'password' ? placeholder : itemValue;
177175
};
178176

179177
return (

0 commit comments

Comments
 (0)