@wecodesolutions/shared-react-components-ts 0.12.0 → 0.12.2

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.
Files changed (28) hide show
  1. package/dist/components/buttons/SignInWithGoogle/SignInWithGoogle.d.ts +1 -1
  2. package/dist/components/passwordInput/PasswordInput.d.ts +1 -0
  3. package/dist/shared-react-components-ts.cjs.development.js +20 -17
  4. package/dist/shared-react-components-ts.cjs.development.js.map +1 -1
  5. package/dist/shared-react-components-ts.cjs.production.min.js +1 -1
  6. package/dist/shared-react-components-ts.cjs.production.min.js.map +1 -1
  7. package/dist/shared-react-components-ts.esm.js +20 -17
  8. package/dist/shared-react-components-ts.esm.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/components/bottomNavBar/BottomNavBar.module.css +0 -1
  11. package/src/components/bottomNavBar/BottomNavBar.tsx +27 -24
  12. package/src/components/buttons/IBtnOption.ts +9 -11
  13. package/src/components/buttons/SignInWithGoogle/SignInWithGoogle.module.css +0 -2
  14. package/src/components/buttons/SignInWithGoogle/SignInWithGoogle.tsx +50 -27
  15. package/src/components/buttons/button/Button.tsx +18 -13
  16. package/src/components/buttons/circleButton/CircleButton.tsx +11 -8
  17. package/src/components/buttons/roundButton/RoundButton.tsx +7 -7
  18. package/src/components/card/Card.tsx +29 -25
  19. package/src/components/formContainer/FormContainer.tsx +20 -20
  20. package/src/components/icons/AllCustomIcons.tsx +74 -25
  21. package/src/components/inputField/InputField.tsx +45 -40
  22. package/src/components/navBar/NavBar.module.css +0 -1
  23. package/src/components/navBar/NavBar.tsx +52 -37
  24. package/src/components/passwordInput/PasswordInput.tsx +45 -38
  25. package/src/components/protectedRoute/ProtectedRoute.tsx +7 -5
  26. package/src/components/validationMessage/ValidationMessage.tsx +15 -10
  27. package/src/global.d.ts +3 -3
  28. package/src/index.tsx +1 -1
@@ -2,48 +2,55 @@ import React, { useState } from 'react';
2
2
  import styles from './PasswordInput.module.css'; // Import the CSS module
3
3
 
4
4
  interface PasswordInputProps {
5
- label?: string; // Label for the input
6
- placeholder?: string; // Placeholder text
7
- value: string; // Controlled value
8
- onChange: (value: string) => void; // Change handler
5
+ label?: string; // Label for the input
6
+ placeholder?: string; // Placeholder text
7
+ value: string; // Controlled value
8
+ onChange: (value: string) => void; // Change handler
9
+ autoFill?: boolean;
9
10
  }
10
11
 
11
12
  export const PasswordInput: React.FC<PasswordInputProps> = ({
12
- label = "Password",
13
- placeholder = "Enter your password",
14
- value,
15
- onChange,
13
+ label = 'Password',
14
+ placeholder = 'Enter your password',
15
+ value,
16
+ onChange,
17
+ autoFill = true,
16
18
  }) => {
17
- const [isPasswordVisible, setIsPasswordVisible] = useState(false);
19
+ const [isPasswordVisible, setIsPasswordVisible] = useState(false);
18
20
 
19
- const togglePasswordVisibility = () => {
20
- setIsPasswordVisible(!isPasswordVisible);
21
- };
21
+ const togglePasswordVisibility = () => {
22
+ setIsPasswordVisible(!isPasswordVisible);
23
+ };
22
24
 
23
- return (
24
- <div className={styles.container}>
25
- {label && <label className={styles.label}>{label}</label>}
26
- <div className={styles.wrapper}>
27
- <input
28
- type={isPasswordVisible ? "text" : "password"}
29
- value={value}
30
- onChange={(e) => onChange(e.target.value)}
31
- placeholder={placeholder}
32
- className={styles.input}
33
- />
34
- <button
35
- type="button"
36
- className={styles.toggle}
37
- onClick={togglePasswordVisibility}
38
- aria-label={isPasswordVisible ? "Hide password" : "Show password"}
39
- >
40
- {isPasswordVisible ? (
41
- <span role="img" aria-label="Hide">🙈</span>
42
- ) : (
43
- <span role="img" aria-label="Show">👁️</span>
44
- )}
45
- </button>
46
- </div>
47
- </div>
48
- );
25
+ return (
26
+ <div className={styles.container}>
27
+ {label && <label className={styles.label}>{label}</label>}
28
+ <div className={styles.wrapper}>
29
+ <input
30
+ type={isPasswordVisible ? 'text' : 'password'}
31
+ value={value}
32
+ onChange={e => onChange(e.target.value)}
33
+ placeholder={placeholder}
34
+ className={styles.input}
35
+ autoComplete={autoFill ? 'on' : 'off'}
36
+ />
37
+ <button
38
+ type="button"
39
+ className={styles.toggle}
40
+ onClick={togglePasswordVisibility}
41
+ aria-label={isPasswordVisible ? 'Hide password' : 'Show password'}
42
+ >
43
+ {isPasswordVisible ? (
44
+ <span role="img" aria-label="Hide">
45
+ 👁️
46
+ </span>
47
+ ) : (
48
+ <span role="img" aria-label="Show">
49
+ 🙈
50
+ </span>
51
+ )}
52
+ </button>
53
+ </div>
54
+ </div>
55
+ );
49
56
  };
@@ -3,11 +3,13 @@ import React from 'react';
3
3
  import { Navigate } from 'react-router-dom';
4
4
 
5
5
  interface ProtectedRouteProps {
6
- children: JSX.Element;
7
- isAuthenticated: boolean;
6
+ children: JSX.Element;
7
+ isAuthenticated: boolean;
8
8
  }
9
9
 
10
- export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({ children, isAuthenticated = false }) => {
11
- return isAuthenticated ? children : <Navigate to="/" replace />;
10
+ export const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
11
+ children,
12
+ isAuthenticated = false,
13
+ }) => {
14
+ return isAuthenticated ? children : <Navigate to="/" replace />;
12
15
  };
13
-
@@ -1,15 +1,20 @@
1
1
  import React from 'react';
2
2
 
3
3
  interface ValidationMessageProps {
4
- message: string;
5
- type: 'error' | 'success' | 'info';
4
+ message: string;
5
+ type: 'error' | 'success' | 'info';
6
6
  }
7
7
 
8
- export const ValidationMessage: React.FC<ValidationMessageProps> = ({ message, type }) => {
9
- const colorSpan = {
10
- color: `${type == 'error' ? 'red' : (type == 'info' ? 'blue' : 'black')}`
11
- };
12
- return (
13
- <span style={colorSpan} className={`validation-message ${type}`}>{message}</span>
14
- );
15
- }
8
+ export const ValidationMessage: React.FC<ValidationMessageProps> = ({
9
+ message,
10
+ type,
11
+ }) => {
12
+ const colorSpan = {
13
+ color: `${type === 'error' ? 'red' : type === 'info' ? 'blue' : 'black'}`,
14
+ };
15
+ return (
16
+ <span style={colorSpan} className={`validation-message ${type}`}>
17
+ {message}
18
+ </span>
19
+ );
20
+ };
package/src/global.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  declare module '*.module.css' {
2
- const classes: { [key: string]: string };
3
- export default classes;
4
- }
2
+ const classes: { [key: string]: string };
3
+ export default classes;
4
+ }
package/src/index.tsx CHANGED
@@ -10,4 +10,4 @@ export * from './components/inputField/InputField';
10
10
  export * from './components/navBar/NavBar';
11
11
  export * from './components/passwordInput/PasswordInput';
12
12
  export * from './components/protectedRoute/ProtectedRoute';
13
- export * from './components/validationMessage/ValidationMessage';
13
+ export * from './components/validationMessage/ValidationMessage';