@autobusal/common 0.0.36 → 0.0.38

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.
@@ -10,7 +10,7 @@ export const Item = styled.div<{
10
10
  gap: 10px;
11
11
  align-items: center;
12
12
  flex-basis: 100%;
13
- padding: 10px;
13
+ padding: 10px !important;
14
14
 
15
15
  ${ props => props.$column === false && css`
16
16
  background: none;
@@ -0,0 +1,33 @@
1
+ import { useState } from 'react';
2
+ import { TFunction } from 'i18next';
3
+ import { UseFormRegister } from 'react-hook-form';
4
+ import { AiFillEye, AiFillEyeInvisible } from 'react-icons/ai';
5
+ import { validate } from '@autobusal/utilities';
6
+ import { Container } from './styles';
7
+
8
+ interface Props {
9
+ name: string
10
+ t: TFunction<'common'>
11
+ refs: UseFormRegister<any>
12
+ }
13
+
14
+ const Password = ({ name, refs, t }: Props): JSX.Element => {
15
+ const [ show, setShow ] = useState<boolean>(false);
16
+
17
+ const toggle = (): void => {
18
+ setShow(!show)
19
+ };
20
+
21
+ return (
22
+ <Container>
23
+ <input type={ show ? 'text' : 'password' } { ...refs(name, validate('required|min_length:6|max_length:20', t)) } />
24
+
25
+ { show
26
+ ? <AiFillEye onClick={ toggle } />
27
+ : <AiFillEyeInvisible onClick={ toggle } />
28
+ }
29
+ </Container>
30
+ );
31
+ };
32
+
33
+ export default Password;
@@ -0,0 +1,19 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ position: relative;
5
+
6
+ & > svg {
7
+ display: block;
8
+ position: absolute;
9
+ top: 1px;
10
+ right: 1px;
11
+ width: 42px;
12
+ height: 36px;
13
+ padding: 0 11px;
14
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, ${ props => props.theme.inputs.background } 25%);
15
+ border-top-right-radius: ${ props => props.theme.borderRadius };
16
+ border-bottom-right-radius: ${ props => props.theme.borderRadius };
17
+ cursor: pointer;
18
+ }
19
+ `;
package/index.ts CHANGED
@@ -13,6 +13,7 @@ import Modal from './Modal/Modal';
13
13
  import Meta from './Meta';
14
14
  import Pagination from './Pagination/Pagination';
15
15
  import Passengers from './Passengers/Passengers';
16
+ import Password from './Password/Password';
16
17
  import Policy from './Policy/Policy';
17
18
  import RouteFeature from './RouteFeature/RouteFeature';
18
19
  import RouteItem from './RouteItem/RouteItem';
@@ -35,6 +36,7 @@ export {
35
36
  Pagination,
36
37
  Paragraph,
37
38
  Passengers,
39
+ Password,
38
40
  Policy,
39
41
  RouteFeature,
40
42
  RouteItem
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }