@startupjs-ui/password-input 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.mdx +44 -0
- package/index.d.ts +32 -0
- package/index.tsx +67 -0
- package/package.json +20 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [0.1.3](https://github.com/startupjs/startupjs-ui/compare/v0.1.2...v0.1.3) (2025-12-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/password-input
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.2](https://github.com/startupjs/startupjs-ui/compare/v0.1.1...v0.1.2) (2025-12-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add mdx and docs packages. Refactor docs to get rid of any @startupjs/ui usage and use startupjs-ui instead ([703c926](https://github.com/startupjs/startupjs-ui/commit/703c92636efb0421ffd11783f692fc892b74018f))
|
|
20
|
+
* **password-input:** refactor PasswordInput component ([f0b711c](https://github.com/startupjs/startupjs-ui/commit/f0b711ce72fd372a8569a39c6d9b636a73a9c67a))
|
package/README.mdx
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import PasswordInput, { _PropsJsonSchema as PasswordInputPropsJsonSchema } from './index'
|
|
3
|
+
import { Sandbox } from '@startupjs-ui/docs'
|
|
4
|
+
|
|
5
|
+
# PasswordInput
|
|
6
|
+
|
|
7
|
+
PasswordInput provides a text field for entering a password with a button to hide the entered text.
|
|
8
|
+
PasswordInput inherits the properties of the [TextInput](/docs/forms/TextInput).
|
|
9
|
+
|
|
10
|
+
```jsx
|
|
11
|
+
import { PasswordInput } from 'startupjs-ui'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Simple example
|
|
15
|
+
|
|
16
|
+
```jsx example
|
|
17
|
+
const [password, setPassword] = useState()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<PasswordInput
|
|
21
|
+
value={password}
|
|
22
|
+
onChangeText={setPassword}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Disabled
|
|
28
|
+
|
|
29
|
+
```jsx example
|
|
30
|
+
return (
|
|
31
|
+
<PasswordInput
|
|
32
|
+
disabled
|
|
33
|
+
value='Disabled'
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Sandbox
|
|
39
|
+
|
|
40
|
+
<Sandbox
|
|
41
|
+
Component={PasswordInput}
|
|
42
|
+
propsJsonSchema={PasswordInputPropsJsonSchema}
|
|
43
|
+
block
|
|
44
|
+
/>
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// DO NOT MODIFY THIS FILE - IT IS AUTOMATICALLY GENERATED ON COMMITS.
|
|
3
|
+
|
|
4
|
+
import { type RefObject } from 'react';
|
|
5
|
+
import { type UITextInputProps } from '@startupjs-ui/text-input';
|
|
6
|
+
export declare const _PropsJsonSchema: {};
|
|
7
|
+
export interface PasswordInputProps extends UITextInputProps {
|
|
8
|
+
/** Ref to access the underlying TextInput */
|
|
9
|
+
ref?: RefObject<any>;
|
|
10
|
+
/** Custom styles for the wrapper element */
|
|
11
|
+
style?: UITextInputProps['style'];
|
|
12
|
+
/** Custom styles for the input element */
|
|
13
|
+
inputStyle?: UITextInputProps['inputStyle'];
|
|
14
|
+
/** Placeholder text */
|
|
15
|
+
placeholder?: UITextInputProps['placeholder'];
|
|
16
|
+
/** Input value @default '' */
|
|
17
|
+
value?: string;
|
|
18
|
+
/** Size preset @default 'm' */
|
|
19
|
+
size?: 'l' | 'm' | 's';
|
|
20
|
+
/** Disable input interactions @default false */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Focus event handler */
|
|
23
|
+
onFocus?: UITextInputProps['onFocus'];
|
|
24
|
+
/** Blur event handler */
|
|
25
|
+
onBlur?: UITextInputProps['onBlur'];
|
|
26
|
+
/** Change text handler */
|
|
27
|
+
onChangeText?: UITextInputProps['onChangeText'];
|
|
28
|
+
/** Error flag @private */
|
|
29
|
+
_hasError?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const _default: import("react").ComponentType<PasswordInputProps>;
|
|
32
|
+
export default _default;
|
package/index.tsx
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useState,
|
|
3
|
+
type ReactNode,
|
|
4
|
+
type RefObject
|
|
5
|
+
} from 'react'
|
|
6
|
+
import { pug, observer } from 'startupjs'
|
|
7
|
+
import { themed } from '@startupjs-ui/core'
|
|
8
|
+
import TextInput, { type UITextInputProps } from '@startupjs-ui/text-input'
|
|
9
|
+
import { faEye } from '@fortawesome/free-solid-svg-icons/faEye'
|
|
10
|
+
import { faEyeSlash } from '@fortawesome/free-solid-svg-icons/faEyeSlash'
|
|
11
|
+
|
|
12
|
+
export const _PropsJsonSchema = {/* PasswordInputProps */}
|
|
13
|
+
|
|
14
|
+
export interface PasswordInputProps extends UITextInputProps {
|
|
15
|
+
/** Ref to access the underlying TextInput */
|
|
16
|
+
ref?: RefObject<any>
|
|
17
|
+
/** Custom styles for the wrapper element */
|
|
18
|
+
style?: UITextInputProps['style']
|
|
19
|
+
/** Custom styles for the input element */
|
|
20
|
+
inputStyle?: UITextInputProps['inputStyle']
|
|
21
|
+
/** Placeholder text */
|
|
22
|
+
placeholder?: UITextInputProps['placeholder']
|
|
23
|
+
/** Input value @default '' */
|
|
24
|
+
value?: string
|
|
25
|
+
/** Size preset @default 'm' */
|
|
26
|
+
size?: 'l' | 'm' | 's'
|
|
27
|
+
/** Disable input interactions @default false */
|
|
28
|
+
disabled?: boolean
|
|
29
|
+
/** Focus event handler */
|
|
30
|
+
onFocus?: UITextInputProps['onFocus']
|
|
31
|
+
/** Blur event handler */
|
|
32
|
+
onBlur?: UITextInputProps['onBlur']
|
|
33
|
+
/** Change text handler */
|
|
34
|
+
onChangeText?: UITextInputProps['onChangeText']
|
|
35
|
+
/** Error flag @private */
|
|
36
|
+
_hasError?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function PasswordInput ({
|
|
40
|
+
value = '',
|
|
41
|
+
size = 'm',
|
|
42
|
+
disabled = false,
|
|
43
|
+
ref,
|
|
44
|
+
...props
|
|
45
|
+
}: PasswordInputProps): ReactNode {
|
|
46
|
+
const [textHidden, setTextHidden] = useState(true)
|
|
47
|
+
|
|
48
|
+
return pug`
|
|
49
|
+
TextInput(
|
|
50
|
+
...props
|
|
51
|
+
ref=ref
|
|
52
|
+
autoComplete='password'
|
|
53
|
+
secureTextEntry=textHidden
|
|
54
|
+
icon=textHidden ? faEye : faEyeSlash
|
|
55
|
+
iconPosition='right'
|
|
56
|
+
numberOfLines=1
|
|
57
|
+
resize=false
|
|
58
|
+
readonly=false
|
|
59
|
+
value=value
|
|
60
|
+
size=size
|
|
61
|
+
disabled=disabled
|
|
62
|
+
onIconPress=() => setTextHidden(!textHidden)
|
|
63
|
+
)
|
|
64
|
+
`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default observer(themed('PasswordInput', PasswordInput))
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@startupjs-ui/password-input",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"main": "index.tsx",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@startupjs-ui/core": "^0.1.3",
|
|
12
|
+
"@startupjs-ui/text-input": "^0.1.3"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"react": "*",
|
|
16
|
+
"react-native": "*",
|
|
17
|
+
"startupjs": "*"
|
|
18
|
+
},
|
|
19
|
+
"gitHead": "fd964ebc3892d3dd0a6c85438c0af619cc50c3f0"
|
|
20
|
+
}
|