@audira/carbon-react-native 1.0.0-beta.15 → 1.0.0-beta.17
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/lib/commonjs/_internal/hooks/index.js +10 -0
- package/lib/commonjs/_internal/hooks/index.js.map +1 -0
- package/lib/commonjs/_internal/hooks/secure-text-entry-control/UseProps.js +2 -0
- package/lib/commonjs/_internal/hooks/secure-text-entry-control/UseProps.js.map +1 -0
- package/lib/commonjs/_internal/hooks/secure-text-entry-control/index.js +17 -0
- package/lib/commonjs/_internal/hooks/secure-text-entry-control/index.js.map +1 -0
- package/lib/commonjs/_internal/hooks/secure-text-entry-control/use.js +16 -0
- package/lib/commonjs/_internal/hooks/secure-text-entry-control/use.js.map +1 -0
- package/lib/commonjs/components/index.js +47 -11
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/password-input/PasswordInput.js +35 -0
- package/lib/commonjs/components/password-input/PasswordInput.js.map +1 -0
- package/lib/commonjs/components/password-input/PasswordInputProps.js +6 -0
- package/lib/commonjs/components/password-input/PasswordInputProps.js.map +1 -0
- package/lib/commonjs/components/password-input/PasswordInputRef.js +6 -0
- package/lib/commonjs/components/password-input/PasswordInputRef.js.map +1 -0
- package/lib/commonjs/components/password-input/index.js +17 -0
- package/lib/commonjs/components/password-input/index.js.map +1 -0
- package/lib/commonjs/components/password-input-field/PasswordInputField.js +35 -0
- package/lib/commonjs/components/password-input-field/PasswordInputField.js.map +1 -0
- package/lib/commonjs/components/password-input-field/PasswordInputFieldProps.js +6 -0
- package/lib/commonjs/components/password-input-field/PasswordInputFieldProps.js.map +1 -0
- package/lib/commonjs/components/password-input-field/PasswordInputFieldRef.js +6 -0
- package/lib/commonjs/components/password-input-field/PasswordInputFieldRef.js.map +1 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/GhostIcon.js +40 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/GhostIcon.js.map +1 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/GhostIconProps.js +6 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/GhostIconProps.js.map +1 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/GhostIconRef.js +6 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/GhostIconRef.js.map +1 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/index.js +17 -0
- package/lib/commonjs/components/password-input-field/_ghost-icon/index.js.map +1 -0
- package/lib/commonjs/components/password-input-field/index.js +17 -0
- package/lib/commonjs/components/password-input-field/index.js.map +1 -0
- package/lib/commonjs/components/password-input-fluid/PasswordInputFluid.js +33 -0
- package/lib/commonjs/components/password-input-fluid/PasswordInputFluid.js.map +1 -0
- package/lib/commonjs/components/password-input-fluid/PasswordInputFluidProps.js +6 -0
- package/lib/commonjs/components/password-input-fluid/PasswordInputFluidProps.js.map +1 -0
- package/lib/commonjs/components/password-input-fluid/PasswordInputFluidRef.js +6 -0
- package/lib/commonjs/components/password-input-fluid/PasswordInputFluidRef.js.map +1 -0
- package/lib/commonjs/components/password-input-fluid/index.js +17 -0
- package/lib/commonjs/components/password-input-fluid/index.js.map +1 -0
- package/lib/commonjs/components/text-area/TextArea.js +0 -2
- package/lib/commonjs/components/text-area/TextArea.js.map +1 -1
- package/lib/commonjs/components/text-input/TextInput.js +4 -0
- package/lib/commonjs/components/text-input/TextInput.js.map +1 -1
- package/lib/commonjs/components/text-input-fluid/TextInputFluid.js +21 -15
- package/lib/commonjs/components/text-input-fluid/TextInputFluid.js.map +1 -1
- package/lib/module/_internal/hooks/index.js +5 -0
- package/lib/module/_internal/hooks/index.js.map +1 -0
- package/lib/module/_internal/hooks/secure-text-entry-control/UseProps.js +2 -0
- package/lib/module/_internal/hooks/secure-text-entry-control/UseProps.js.map +1 -0
- package/lib/module/_internal/hooks/secure-text-entry-control/index.js +4 -0
- package/lib/module/_internal/hooks/secure-text-entry-control/index.js.map +1 -0
- package/lib/module/_internal/hooks/secure-text-entry-control/use.js +12 -0
- package/lib/module/_internal/hooks/secure-text-entry-control/use.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/password-input/PasswordInput.js +31 -0
- package/lib/module/components/password-input/PasswordInput.js.map +1 -0
- package/lib/module/components/password-input/PasswordInputProps.js +4 -0
- package/lib/module/components/password-input/PasswordInputProps.js.map +1 -0
- package/lib/module/components/password-input/PasswordInputRef.js +4 -0
- package/lib/module/components/password-input/PasswordInputRef.js.map +1 -0
- package/lib/module/components/password-input/index.js +4 -0
- package/lib/module/components/password-input/index.js.map +1 -0
- package/lib/module/components/password-input-field/PasswordInputField.js +31 -0
- package/lib/module/components/password-input-field/PasswordInputField.js.map +1 -0
- package/lib/module/components/password-input-field/PasswordInputFieldProps.js +4 -0
- package/lib/module/components/password-input-field/PasswordInputFieldProps.js.map +1 -0
- package/lib/module/components/password-input-field/PasswordInputFieldRef.js +4 -0
- package/lib/module/components/password-input-field/PasswordInputFieldRef.js.map +1 -0
- package/lib/module/components/password-input-field/_ghost-icon/GhostIcon.js +35 -0
- package/lib/module/components/password-input-field/_ghost-icon/GhostIcon.js.map +1 -0
- package/lib/module/components/password-input-field/_ghost-icon/GhostIconProps.js +4 -0
- package/lib/module/components/password-input-field/_ghost-icon/GhostIconProps.js.map +1 -0
- package/lib/module/components/password-input-field/_ghost-icon/GhostIconRef.js +4 -0
- package/lib/module/components/password-input-field/_ghost-icon/GhostIconRef.js.map +1 -0
- package/lib/module/components/password-input-field/_ghost-icon/index.js +4 -0
- package/lib/module/components/password-input-field/_ghost-icon/index.js.map +1 -0
- package/lib/module/components/password-input-field/index.js +4 -0
- package/lib/module/components/password-input-field/index.js.map +1 -0
- package/lib/module/components/password-input-fluid/PasswordInputFluid.js +29 -0
- package/lib/module/components/password-input-fluid/PasswordInputFluid.js.map +1 -0
- package/lib/module/components/password-input-fluid/PasswordInputFluidProps.js +4 -0
- package/lib/module/components/password-input-fluid/PasswordInputFluidProps.js.map +1 -0
- package/lib/module/components/password-input-fluid/PasswordInputFluidRef.js +4 -0
- package/lib/module/components/password-input-fluid/PasswordInputFluidRef.js.map +1 -0
- package/lib/module/components/password-input-fluid/index.js +4 -0
- package/lib/module/components/password-input-fluid/index.js.map +1 -0
- package/lib/module/components/text-area/TextArea.js +0 -2
- package/lib/module/components/text-area/TextArea.js.map +1 -1
- package/lib/module/components/text-input/TextInput.js +4 -0
- package/lib/module/components/text-input/TextInput.js.map +1 -1
- package/lib/module/components/text-input-fluid/TextInputFluid.js +22 -16
- package/lib/module/components/text-input-fluid/TextInputFluid.js.map +1 -1
- package/lib/typescript/commonjs/_internal/hooks/index.d.ts +3 -0
- package/lib/typescript/commonjs/_internal/hooks/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/_internal/hooks/secure-text-entry-control/UseProps.d.ts +5 -0
- package/lib/typescript/commonjs/_internal/hooks/secure-text-entry-control/UseProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/_internal/hooks/secure-text-entry-control/index.d.ts +3 -0
- package/lib/typescript/commonjs/_internal/hooks/secure-text-entry-control/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/_internal/hooks/secure-text-entry-control/use.d.ts +3 -0
- package/lib/typescript/commonjs/_internal/hooks/secure-text-entry-control/use.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/password-input/PasswordInput.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input/PasswordInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input/PasswordInputProps.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input/PasswordInputProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input/PasswordInputRef.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input/PasswordInputRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/PasswordInputField.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/PasswordInputField.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/PasswordInputFieldProps.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/PasswordInputFieldProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/PasswordInputFieldRef.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/PasswordInputFieldRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/GhostIcon.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/GhostIcon.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/GhostIconProps.d.ts +7 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/GhostIconProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/GhostIconRef.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/GhostIconRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/_ghost-icon/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-field/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-field/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-fluid/PasswordInputFluid.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-fluid/PasswordInputFluid.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-fluid/PasswordInputFluidProps.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-fluid/PasswordInputFluidProps.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-fluid/PasswordInputFluidRef.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-fluid/PasswordInputFluidRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/password-input-fluid/index.d.ts +4 -0
- package/lib/typescript/commonjs/components/password-input-fluid/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/components/text-area/TextArea.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/text-area-field/TextAreaFieldProps.d.ts +1 -1
- package/lib/typescript/commonjs/components/text-area-field/TextAreaFieldProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/text-input/TextInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/text-input/TextInputProps.d.ts +1 -1
- package/lib/typescript/commonjs/components/text-input/TextInputProps.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/text-input-fluid/TextInputFluid.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/text-input-fluid/TextInputFluidProps.d.ts +1 -1
- package/lib/typescript/commonjs/components/text-input-fluid/TextInputFluidProps.d.ts.map +1 -1
- package/lib/typescript/module/_internal/hooks/index.d.ts +3 -0
- package/lib/typescript/module/_internal/hooks/index.d.ts.map +1 -0
- package/lib/typescript/module/_internal/hooks/secure-text-entry-control/UseProps.d.ts +5 -0
- package/lib/typescript/module/_internal/hooks/secure-text-entry-control/UseProps.d.ts.map +1 -0
- package/lib/typescript/module/_internal/hooks/secure-text-entry-control/index.d.ts +3 -0
- package/lib/typescript/module/_internal/hooks/secure-text-entry-control/index.d.ts.map +1 -0
- package/lib/typescript/module/_internal/hooks/secure-text-entry-control/use.d.ts +3 -0
- package/lib/typescript/module/_internal/hooks/secure-text-entry-control/use.d.ts.map +1 -0
- package/lib/typescript/module/components/index.d.ts +3 -0
- package/lib/typescript/module/components/index.d.ts.map +1 -1
- package/lib/typescript/module/components/password-input/PasswordInput.d.ts +4 -0
- package/lib/typescript/module/components/password-input/PasswordInput.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input/PasswordInputProps.d.ts +4 -0
- package/lib/typescript/module/components/password-input/PasswordInputProps.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input/PasswordInputRef.d.ts +4 -0
- package/lib/typescript/module/components/password-input/PasswordInputRef.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input/index.d.ts +4 -0
- package/lib/typescript/module/components/password-input/index.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/PasswordInputField.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/PasswordInputField.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/PasswordInputFieldProps.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/PasswordInputFieldProps.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/PasswordInputFieldRef.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/PasswordInputFieldRef.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/GhostIcon.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/GhostIcon.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/GhostIconProps.d.ts +7 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/GhostIconProps.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/GhostIconRef.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/GhostIconRef.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/index.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/_ghost-icon/index.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-field/index.d.ts +4 -0
- package/lib/typescript/module/components/password-input-field/index.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-fluid/PasswordInputFluid.d.ts +4 -0
- package/lib/typescript/module/components/password-input-fluid/PasswordInputFluid.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-fluid/PasswordInputFluidProps.d.ts +4 -0
- package/lib/typescript/module/components/password-input-fluid/PasswordInputFluidProps.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-fluid/PasswordInputFluidRef.d.ts +4 -0
- package/lib/typescript/module/components/password-input-fluid/PasswordInputFluidRef.d.ts.map +1 -0
- package/lib/typescript/module/components/password-input-fluid/index.d.ts +4 -0
- package/lib/typescript/module/components/password-input-fluid/index.d.ts.map +1 -0
- package/lib/typescript/module/components/text-area/TextArea.d.ts.map +1 -1
- package/lib/typescript/module/components/text-area-field/TextAreaFieldProps.d.ts +1 -1
- package/lib/typescript/module/components/text-area-field/TextAreaFieldProps.d.ts.map +1 -1
- package/lib/typescript/module/components/text-input/TextInput.d.ts.map +1 -1
- package/lib/typescript/module/components/text-input/TextInputProps.d.ts +1 -1
- package/lib/typescript/module/components/text-input/TextInputProps.d.ts.map +1 -1
- package/lib/typescript/module/components/text-input-fluid/TextInputFluid.d.ts.map +1 -1
- package/lib/typescript/module/components/text-input-fluid/TextInputFluidProps.d.ts +1 -1
- package/lib/typescript/module/components/text-input-fluid/TextInputFluidProps.d.ts.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_internal/hooks/index.ts +5 -0
- package/src/_internal/hooks/secure-text-entry-control/UseProps.ts +4 -0
- package/src/_internal/hooks/secure-text-entry-control/index.ts +2 -0
- package/src/_internal/hooks/secure-text-entry-control/use.tsx +26 -0
- package/src/components/index.tsx +3 -0
- package/src/components/password-input/PasswordInput.tsx +61 -0
- package/src/components/password-input/PasswordInputProps.ts +6 -0
- package/src/components/password-input/PasswordInputRef.ts +6 -0
- package/src/components/password-input/index.ts +3 -0
- package/src/components/password-input-field/PasswordInputField.tsx +61 -0
- package/src/components/password-input-field/PasswordInputFieldProps.ts +6 -0
- package/src/components/password-input-field/PasswordInputFieldRef.tsx +6 -0
- package/src/components/password-input-field/_ghost-icon/GhostIcon.tsx +71 -0
- package/src/components/password-input-field/_ghost-icon/GhostIconProps.ts +12 -0
- package/src/components/password-input-field/_ghost-icon/GhostIconRef.ts +6 -0
- package/src/components/password-input-field/_ghost-icon/index.ts +3 -0
- package/src/components/password-input-field/index.ts +3 -0
- package/src/components/password-input-fluid/PasswordInputFluid.tsx +59 -0
- package/src/components/password-input-fluid/PasswordInputFluidProps.ts +6 -0
- package/src/components/password-input-fluid/PasswordInputFluidRef.ts +6 -0
- package/src/components/password-input-fluid/index.ts +3 -0
- package/src/components/text-area/TextArea.tsx +0 -2
- package/src/components/text-area-field/TextAreaFieldProps.ts +1 -1
- package/src/components/text-input/TextInput.tsx +4 -0
- package/src/components/text-input/TextInputProps.ts +0 -2
- package/src/components/text-input-fluid/TextInputFluid.tsx +10 -6
- package/src/components/text-input-fluid/TextInputFluidProps.ts +0 -2
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCallback,
|
|
3
|
+
useState,
|
|
4
|
+
} from "react"
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
UseProps,
|
|
8
|
+
} from "./UseProps"
|
|
9
|
+
|
|
10
|
+
export function use(secureTextEntryProp?: UseProps) {
|
|
11
|
+
|
|
12
|
+
const
|
|
13
|
+
[secureTextEntrySelf, setSecureTextEntrySelf] =
|
|
14
|
+
useState(true),
|
|
15
|
+
|
|
16
|
+
secureTextEntry =
|
|
17
|
+
secureTextEntryProp ?? secureTextEntrySelf,
|
|
18
|
+
|
|
19
|
+
toggleSecureTextEntrySelf =
|
|
20
|
+
useCallback(() => {
|
|
21
|
+
setSecureTextEntrySelf(bool => !bool)
|
|
22
|
+
}, [])
|
|
23
|
+
|
|
24
|
+
return [secureTextEntry, toggleSecureTextEntrySelf] as const
|
|
25
|
+
|
|
26
|
+
}
|
package/src/components/index.tsx
CHANGED
|
@@ -22,6 +22,9 @@ export * from "./layer"
|
|
|
22
22
|
export * from "./loading"
|
|
23
23
|
export * from "./modal"
|
|
24
24
|
export * from "./modal-content"
|
|
25
|
+
export * from "./password-input"
|
|
26
|
+
export * from "./password-input-field"
|
|
27
|
+
export * from "./password-input-fluid"
|
|
25
28
|
export * from "./radio-button"
|
|
26
29
|
export * from "./radio-button-group"
|
|
27
30
|
export * from "./radio-button-input"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
SecureTextEntryControlHook,
|
|
7
|
+
} from "../../_internal/hooks"
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
GhostIcon,
|
|
11
|
+
} from "../password-input-field/_ghost-icon"
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
TextInput,
|
|
15
|
+
} from "../text-input"
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
PasswordInputProps,
|
|
19
|
+
} from "./PasswordInputProps"
|
|
20
|
+
|
|
21
|
+
import type {
|
|
22
|
+
PasswordInputRef,
|
|
23
|
+
} from "./PasswordInputRef"
|
|
24
|
+
|
|
25
|
+
export const PasswordInput = forwardRef<PasswordInputRef, PasswordInputProps>(
|
|
26
|
+
function PasswordInput(
|
|
27
|
+
{
|
|
28
|
+
autoComplete = "current-password",
|
|
29
|
+
size = "medium",
|
|
30
|
+
secureTextEntry: secureTextEntryProp,
|
|
31
|
+
blockEndNode,
|
|
32
|
+
...props
|
|
33
|
+
},
|
|
34
|
+
ref,
|
|
35
|
+
) {
|
|
36
|
+
|
|
37
|
+
const
|
|
38
|
+
[secureTextEntry, toggleSecureTextEntrySelf] =
|
|
39
|
+
SecureTextEntryControlHook.use(secureTextEntryProp)
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<TextInput
|
|
43
|
+
ref={ ref }
|
|
44
|
+
{ ...props }
|
|
45
|
+
autoComplete={ autoComplete }
|
|
46
|
+
size={ size }
|
|
47
|
+
secureTextEntry={ secureTextEntry }
|
|
48
|
+
blockEndNode={ (<>
|
|
49
|
+
<GhostIcon
|
|
50
|
+
inputSize={ size }
|
|
51
|
+
secureTextEntry={ secureTextEntry }
|
|
52
|
+
onPress={ toggleSecureTextEntrySelf }
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
{ blockEndNode }
|
|
56
|
+
</>) }
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
SecureTextEntryControlHook,
|
|
7
|
+
} from "../../_internal/hooks"
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
TextInputField,
|
|
11
|
+
} from "../text-input-field"
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
PasswordInputFieldProps,
|
|
15
|
+
} from "./PasswordInputFieldProps"
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
PasswordInputFieldRef,
|
|
19
|
+
} from "./PasswordInputFieldRef"
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
GhostIcon,
|
|
23
|
+
} from "./_ghost-icon"
|
|
24
|
+
|
|
25
|
+
export const PasswordInputField = forwardRef<PasswordInputFieldRef, PasswordInputFieldProps>(
|
|
26
|
+
function PasswordInputField(
|
|
27
|
+
{
|
|
28
|
+
autoComplete = "current-password",
|
|
29
|
+
size = "medium",
|
|
30
|
+
secureTextEntry: secureTextEntryProp,
|
|
31
|
+
blockEndNode,
|
|
32
|
+
...props
|
|
33
|
+
},
|
|
34
|
+
ref,
|
|
35
|
+
) {
|
|
36
|
+
|
|
37
|
+
const
|
|
38
|
+
[secureTextEntry, toggleSecureTextEntrySelf] =
|
|
39
|
+
SecureTextEntryControlHook.use(secureTextEntryProp)
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<TextInputField
|
|
43
|
+
ref={ ref }
|
|
44
|
+
{ ...props }
|
|
45
|
+
autoComplete={ autoComplete }
|
|
46
|
+
size={ size }
|
|
47
|
+
secureTextEntry={ secureTextEntry }
|
|
48
|
+
blockEndNode={ (<>
|
|
49
|
+
<GhostIcon
|
|
50
|
+
inputSize={ size }
|
|
51
|
+
secureTextEntry={ secureTextEntry }
|
|
52
|
+
onPress={ toggleSecureTextEntrySelf }
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
{ blockEndNode }
|
|
56
|
+
</>) }
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
StyleSheet,
|
|
7
|
+
} from "react-native"
|
|
8
|
+
|
|
9
|
+
import IconViewOff from "@carbon/icons/svg/32/view--off.svg"
|
|
10
|
+
import IconView from "@carbon/icons/svg/32/view.svg"
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
CommonStyleSheet,
|
|
14
|
+
} from "../../../_internal/style-sheets"
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
GhostIcon as ButtonGhostIcon,
|
|
18
|
+
type GhostIconProps as ButtonGhostIconProps,
|
|
19
|
+
} from "../../button/ghost-icon"
|
|
20
|
+
|
|
21
|
+
import type {
|
|
22
|
+
GhostIconProps,
|
|
23
|
+
} from "./GhostIconProps"
|
|
24
|
+
|
|
25
|
+
import type {
|
|
26
|
+
GhostIconRef,
|
|
27
|
+
} from "./GhostIconRef"
|
|
28
|
+
|
|
29
|
+
export const GhostIcon = forwardRef<GhostIconRef, GhostIconProps>(
|
|
30
|
+
function GhostIcon(
|
|
31
|
+
{
|
|
32
|
+
inputSize,
|
|
33
|
+
secureTextEntry,
|
|
34
|
+
style,
|
|
35
|
+
...props
|
|
36
|
+
},
|
|
37
|
+
ref,
|
|
38
|
+
) {
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<ButtonGhostIcon
|
|
42
|
+
ref={ ref }
|
|
43
|
+
{ ...props }
|
|
44
|
+
size={ mapInputSizeToButtonSize[inputSize] }
|
|
45
|
+
Icon={ secureTextEntry ? IconView : IconViewOff }
|
|
46
|
+
style={ [
|
|
47
|
+
CommonStyleSheet.absolute,
|
|
48
|
+
styleSheet.ghostIcon,
|
|
49
|
+
style,
|
|
50
|
+
] }
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const
|
|
58
|
+
styleSheet =
|
|
59
|
+
StyleSheet.create({
|
|
60
|
+
ghostIcon: {
|
|
61
|
+
top: 0,
|
|
62
|
+
right: 0,
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
|
|
66
|
+
mapInputSizeToButtonSize: Record<GhostIconProps["inputSize"], ButtonGhostIconProps["size"]> =
|
|
67
|
+
{
|
|
68
|
+
small: "small",
|
|
69
|
+
medium: "medium",
|
|
70
|
+
large: "large_productive",
|
|
71
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GhostIconProps as Props,
|
|
3
|
+
} from "../../button/ghost-icon/GhostIconProps"
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
PasswordInputFieldProps,
|
|
7
|
+
} from "../PasswordInputFieldProps"
|
|
8
|
+
|
|
9
|
+
export interface GhostIconProps extends Omit<Props, "Icon" | "size"> {
|
|
10
|
+
inputSize: NonNullable<PasswordInputFieldProps["size"]>,
|
|
11
|
+
secureTextEntry: boolean,
|
|
12
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forwardRef,
|
|
3
|
+
} from "react"
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
SecureTextEntryControlHook,
|
|
7
|
+
} from "../../_internal/hooks"
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
GhostIcon,
|
|
11
|
+
} from "../password-input-field/_ghost-icon"
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
TextInputFluid,
|
|
15
|
+
} from "../text-input-fluid"
|
|
16
|
+
|
|
17
|
+
import type {
|
|
18
|
+
PasswordInputFluidProps,
|
|
19
|
+
} from "./PasswordInputFluidProps"
|
|
20
|
+
|
|
21
|
+
import type {
|
|
22
|
+
PasswordInputFluidRef,
|
|
23
|
+
} from "./PasswordInputFluidRef"
|
|
24
|
+
|
|
25
|
+
export const PasswordInputFluid = forwardRef<PasswordInputFluidRef, PasswordInputFluidProps>(
|
|
26
|
+
function PasswordInputFluid(
|
|
27
|
+
{
|
|
28
|
+
autoComplete = "current-password",
|
|
29
|
+
secureTextEntry: secureTextEntryProp,
|
|
30
|
+
blockEndNode,
|
|
31
|
+
...props
|
|
32
|
+
},
|
|
33
|
+
ref,
|
|
34
|
+
) {
|
|
35
|
+
|
|
36
|
+
const
|
|
37
|
+
[secureTextEntry, toggleSecureTextEntrySelf] =
|
|
38
|
+
SecureTextEntryControlHook.use(secureTextEntryProp)
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<TextInputFluid
|
|
42
|
+
ref={ ref }
|
|
43
|
+
{ ...props }
|
|
44
|
+
autoComplete={ autoComplete }
|
|
45
|
+
secureTextEntry={ secureTextEntry }
|
|
46
|
+
blockEndNode={ (<>
|
|
47
|
+
<GhostIcon
|
|
48
|
+
inputSize="medium"
|
|
49
|
+
secureTextEntry={ secureTextEntry }
|
|
50
|
+
onPress={ toggleSecureTextEntrySelf }
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
{ blockEndNode }
|
|
54
|
+
</>) }
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
},
|
|
59
|
+
)
|
|
@@ -83,7 +83,6 @@ export const TextArea = forwardRef<TextAreaRef, TextAreaProps>(
|
|
|
83
83
|
readOnly,
|
|
84
84
|
returnKeyType,
|
|
85
85
|
enterKeyHint,
|
|
86
|
-
secureTextEntry,
|
|
87
86
|
selectTextOnFocus,
|
|
88
87
|
selection,
|
|
89
88
|
selectionColor,
|
|
@@ -201,7 +200,6 @@ export const TextArea = forwardRef<TextAreaRef, TextAreaProps>(
|
|
|
201
200
|
readOnly={ readOnly }
|
|
202
201
|
returnKeyType={ returnKeyType }
|
|
203
202
|
enterKeyHint={ enterKeyHint }
|
|
204
|
-
secureTextEntry={ secureTextEntry }
|
|
205
203
|
selectTextOnFocus={ selectTextOnFocus }
|
|
206
204
|
selection={ selection }
|
|
207
205
|
selectionColor={ selectionColor }
|
|
@@ -2,5 +2,5 @@ import type {
|
|
|
2
2
|
TextInputFieldProps,
|
|
3
3
|
} from "../text-input-field/TextInputFieldProps"
|
|
4
4
|
|
|
5
|
-
export interface TextAreaFieldProps extends Omit<TextInputFieldProps, "size" | "multiline"> {
|
|
5
|
+
export interface TextAreaFieldProps extends Omit<TextInputFieldProps, "size" | "multiline" | "secureTextEntry"> {
|
|
6
6
|
}
|
|
@@ -45,6 +45,8 @@ export const TextInput = forwardRef<TextInputRef, TextInputProps>(
|
|
|
45
45
|
helperText,
|
|
46
46
|
|
|
47
47
|
// hoist the `TextInputFieldProps`
|
|
48
|
+
blockStartNode,
|
|
49
|
+
blockEndNode,
|
|
48
50
|
size = "medium",
|
|
49
51
|
interactiveState = "normal",
|
|
50
52
|
textInputStyle,
|
|
@@ -167,6 +169,8 @@ export const TextInput = forwardRef<TextInputRef, TextInputProps>(
|
|
|
167
169
|
|
|
168
170
|
<TextInputField
|
|
169
171
|
ref={ textInputFieldRef }
|
|
172
|
+
blockStartNode={ blockStartNode }
|
|
173
|
+
blockEndNode={ blockEndNode }
|
|
170
174
|
size={ size }
|
|
171
175
|
interactiveState={ interactiveState }
|
|
172
176
|
textInputStyle={ textInputStyle }
|
|
@@ -55,6 +55,8 @@ export const TextInputFluid = forwardRef<TextInputFluidRef, TextInputFluidProps>
|
|
|
55
55
|
interactiveState,
|
|
56
56
|
style,
|
|
57
57
|
textInputStyle,
|
|
58
|
+
blockStartNode,
|
|
59
|
+
blockEndNode,
|
|
58
60
|
...textInputFieldProps
|
|
59
61
|
},
|
|
60
62
|
ref,
|
|
@@ -71,14 +73,15 @@ export const TextInputFluid = forwardRef<TextInputFluidRef, TextInputFluidProps>
|
|
|
71
73
|
size="medium"
|
|
72
74
|
interactiveState={ interactiveState }
|
|
73
75
|
hideInteractiveStateIcon
|
|
74
|
-
blockStartNode={
|
|
76
|
+
blockStartNode={ (<>
|
|
75
77
|
<FormLabel
|
|
76
78
|
label={ label }
|
|
77
79
|
style={ styleSheet.label }
|
|
78
80
|
/>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
{ blockStartNode }
|
|
82
|
+
</>) }
|
|
83
|
+
blockEndNode={ (<>
|
|
84
|
+
{ !!helperText && (
|
|
82
85
|
<FormHelperText
|
|
83
86
|
text={ helperText }
|
|
84
87
|
style={ [
|
|
@@ -101,8 +104,9 @@ export const TextInputFluid = forwardRef<TextInputFluidRef, TextInputFluidProps>
|
|
|
101
104
|
) : undefined
|
|
102
105
|
}
|
|
103
106
|
/>
|
|
104
|
-
)
|
|
105
|
-
|
|
107
|
+
) }
|
|
108
|
+
{ blockEndNode }
|
|
109
|
+
</>) }
|
|
106
110
|
style={ [
|
|
107
111
|
styleSheet.textInputFluid,
|
|
108
112
|
helperText?.length
|