@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda/om",
3
- "version": "15.9.0",
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": "^20.0.0",
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: React.FC<PasswordInputProps> = ({ ...rest }) => {
11
- const [passwordShown, setPasswordShown] = useState(false);
12
- const togglePasswordVisiblity = () => {
13
- setPasswordShown(passwordShown ? false : true);
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
- return (
17
- <div className='PasswordInput'>
18
- <Input type={passwordShown ? 'text' : 'password'} {...rest} />
19
- <Clickable
20
- className='PasswordInput__password-action'
21
- onClick={togglePasswordVisiblity}
22
- type='button'
23
- >
24
- {passwordShown ? (
25
- <Text treatment='eyebrow'>HIDE</Text>
26
- ) : (
27
- <Text treatment='eyebrow'>SHOW</Text>
28
- )}
29
- </Clickable>
30
- </div>
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';