kelt-ui-kit-react 1.3.7 → 1.3.9

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,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "1.3.7",
4
+ "version": "1.3.9",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/src/App.tsx CHANGED
@@ -14,7 +14,7 @@ const App: React.FC = () => (
14
14
  <Router>
15
15
  <div className="main-layout">
16
16
  <Toaster />
17
- <Header />
17
+ <Header showBackNavigation={true} />
18
18
  <div className="d-flex h-100">
19
19
  <AppMenu />
20
20
  <div className="main-layout-content">
@@ -1,4 +1,4 @@
1
- import { useState } from "react";
1
+ import { forwardRef, useState } from "react";
2
2
  import { Icon } from "../../icon/Icon";
3
3
  import { TypeInputEnum } from "../form.enum";
4
4
  import "./input.css";
@@ -18,7 +18,6 @@ export interface InputProps {
18
18
  minLength?: number;
19
19
  maxLength?: number;
20
20
  autoComplete?: "on" | "off";
21
- ref?: React.Ref<HTMLInputElement>;
22
21
  step?: string;
23
22
  tabIndex?: number;
24
23
  checked?: boolean;
@@ -26,58 +25,62 @@ export interface InputProps {
26
25
  onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
27
26
  }
28
27
 
29
- export const Input = ({
30
- id,
31
- name,
32
- type = TypeInputEnum.TEXT,
33
- value,
34
- onInvalid,
35
- placeholder,
36
- className,
37
- inputMode,
38
- minLength,
39
- maxLength,
40
- autoFocus = false,
41
- disabled = false,
42
- required = false,
43
- autoComplete = "off",
44
- ref,
45
- tabIndex = 0,
46
- step,
47
- checked,
48
- onChange,
49
- onBlur,
50
- }: InputProps) => {
51
- // Si le type est password, on utilise l'input de type password
52
- const [showPassword, setShowPassword] = useState(false);
53
- return (
54
- <div className="input-container">
55
- <input name={`hide-${name}`} type="text" style={{ display: "none" }} />
28
+ export const Input = forwardRef<HTMLInputElement, InputProps>(
29
+ (
30
+ {
31
+ id,
32
+ name,
33
+ type = TypeInputEnum.TEXT,
34
+ value,
35
+ onInvalid,
36
+ placeholder,
37
+ className,
38
+ inputMode,
39
+ minLength,
40
+ maxLength,
41
+ autoFocus = false,
42
+ disabled = false,
43
+ required = false,
44
+ autoComplete = "off",
45
+ tabIndex = 0,
46
+ step,
47
+ checked,
48
+ onChange,
49
+ onBlur,
50
+ },
51
+ ref
52
+ ) => {
53
+ // Si le type est password, on utilise l'input de type password
54
+ const [showPassword, setShowPassword] = useState(false);
55
+
56
+ return (
57
+ <div className="input-container">
58
+ <input name={`hide-${name}`} type="text" style={{ display: "none" }} />
59
+
60
+ <input
61
+ ref={ref} // 👈 le vrai ref est bien transmis au HTMLInputElement
62
+ id={id}
63
+ name={name}
64
+ inputMode={inputMode ?? (type === "number" ? "numeric" : "text")}
65
+ type={showPassword ? TypeInputEnum.TEXT : type}
66
+ spellCheck="false"
67
+ value={value}
68
+ placeholder={placeholder}
69
+ disabled={disabled}
70
+ required={required}
71
+ autoComplete={autoComplete === "off" ? "fake" : autoComplete}
72
+ step={step}
73
+ tabIndex={tabIndex}
74
+ autoFocus={autoFocus}
75
+ minLength={minLength}
76
+ maxLength={maxLength}
77
+ onChange={onChange}
78
+ checked={checked}
79
+ onBlur={onBlur}
80
+ className={`input-field ${className ?? ""}`}
81
+ onInvalid={onInvalid}
82
+ />
56
83
 
57
- <input
58
- ref={ref}
59
- id={id}
60
- name={name}
61
- inputMode={inputMode ?? (type === "number" ? "numeric" : "text")}
62
- type={showPassword ? TypeInputEnum.TEXT : type}
63
- spellCheck="false"
64
- value={value}
65
- placeholder={placeholder}
66
- disabled={disabled}
67
- required={required}
68
- autoComplete={autoComplete === "off" ? "fake" : autoComplete}
69
- step={step}
70
- tabIndex={tabIndex}
71
- autoFocus={autoFocus}
72
- minLength={minLength}
73
- maxLength={maxLength}
74
- onChange={onChange}
75
- checked={checked}
76
- onBlur={onBlur}
77
- className={`input-field ${className ?? ""}`}
78
- onInvalid={onInvalid}
79
- />
80
- <>
81
84
  {type === TypeInputEnum.PASSWORD && (
82
85
  <div
83
86
  onClick={() => setShowPassword(!showPassword)}
@@ -86,7 +89,9 @@ export const Input = ({
86
89
  <Icon classIcon={showPassword ? "bi-eye-slash" : "bi-eye"} />
87
90
  </div>
88
91
  )}
89
- </>
90
- </div>
91
- );
92
- };
92
+ </div>
93
+ );
94
+ }
95
+ );
96
+
97
+ Input.displayName = "Input";
@@ -12,6 +12,8 @@ export const Header = ({
12
12
  userChildren,
13
13
  positionFixed,
14
14
  onClickLogo,
15
+ showBackNavigation,
16
+ onClickBackNavigation,
15
17
  }: HeaderInterface): JSX.Element => {
16
18
  const refButton = useRef<HTMLDivElement>(null);
17
19
  const [openOverlay, setOpenOverlay] = useState(false);
@@ -24,6 +26,15 @@ export const Header = ({
24
26
  <span onClick={onClickMenu}>
25
27
  <Icon size={IconSizeEnum.MEDIUM} classIcon="bi-list"></Icon>
26
28
  </span>
29
+ {showBackNavigation && (
30
+ <span className="chevron-back" onClick={onClickBackNavigation}>
31
+ <Icon
32
+ size={IconSizeEnum.EXTRA_SMALL}
33
+ classIcon="bi-caret-left-fill"
34
+ ></Icon>
35
+ </span>
36
+ )}
37
+
27
38
  <span
28
39
  className={`header-logo ${onClickLogo && "cursor-pointer"} `}
29
40
  onClick={onClickLogo}
@@ -1,5 +1,5 @@
1
1
  import { Header } from "./Header";
2
2
 
3
3
  export const HeaderView = (): JSX.Element => {
4
- return <Header />;
4
+ return <Header showBackNavigation={true} />;
5
5
  };
@@ -5,4 +5,6 @@ export interface HeaderInterface {
5
5
  onClickMenu?: () => void;
6
6
  userChildren?: React.ReactNode;
7
7
  onClickLogo?: () => void;
8
+ showBackNavigation?: boolean;
9
+ onClickBackNavigation?: () => void;
8
10
  }
@@ -19,7 +19,7 @@
19
19
  top: 2px;
20
20
  display: flex;
21
21
  align-items: center;
22
- z-index: 5;
22
+ z-index: 2;
23
23
  justify-content: center;
24
24
  bottom: 0;
25
25
  right: 30px;