@moda/om 15.9.0 → 15.10.0
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 +7 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +3 -1
- package/dist/index.cjs.js +8 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/PasswordInput/PasswordInput.tsx +28 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moda/om",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.10.0",
|
|
4
4
|
"description": "Moda Operandi design system",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@jedmao/semantic-release-npm-github-config": "^1.0.9",
|
|
70
70
|
"@moda/rollup-plugin-postcss": "^4.0.1",
|
|
71
71
|
"@rollup/plugin-babel": "^5.2.3",
|
|
72
|
-
"@rollup/plugin-commonjs": "^
|
|
72
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
73
73
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
74
74
|
"@storybook/addon-actions": "^6.2.1",
|
|
75
75
|
"@storybook/addon-essentials": "^6.2.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { forwardRef, useState } from 'react';
|
|
2
2
|
import { Clickable } from '../Clickable';
|
|
3
3
|
import { Input, FieldProps } from '../Field';
|
|
4
4
|
import { Text } from '../Text';
|
|
@@ -7,26 +7,31 @@ import './PasswordInput.scss';
|
|
|
7
7
|
|
|
8
8
|
export type PasswordInputProps = FieldProps;
|
|
9
9
|
|
|
10
|
-
export const PasswordInput
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export const PasswordInput = forwardRef(
|
|
11
|
+
({ ...rest }: PasswordInputProps, ref: React.Ref<HTMLInputElement>) => {
|
|
12
|
+
const [passwordShown, setPasswordShown] = useState(false);
|
|
13
|
+
const togglePasswordVisiblity = () => {
|
|
14
|
+
setPasswordShown(passwordShown ? false : true);
|
|
15
|
+
};
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
return (
|
|
18
|
+
<div className='PasswordInput'>
|
|
19
|
+
<Input type={passwordShown ? 'text' : 'password'} {...rest} ref={ref} />
|
|
20
|
+
|
|
21
|
+
<Clickable
|
|
22
|
+
className='PasswordInput__password-action'
|
|
23
|
+
onClick={togglePasswordVisiblity}
|
|
24
|
+
type='button'
|
|
25
|
+
>
|
|
26
|
+
{passwordShown ? (
|
|
27
|
+
<Text treatment='eyebrow'>HIDE</Text>
|
|
28
|
+
) : (
|
|
29
|
+
<Text treatment='eyebrow'>SHOW</Text>
|
|
30
|
+
)}
|
|
31
|
+
</Clickable>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
PasswordInput.displayName = 'PasswordInput';
|