kelt-ui-kit-react 0.2.2 → 0.2.4

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": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/public/index.html CHANGED
@@ -1,43 +1,43 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
@@ -1,25 +1,25 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
package/public/robots.txt CHANGED
@@ -1,3 +1,3 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
package/src/App.css CHANGED
@@ -1,10 +1,10 @@
1
- .main-layout{
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex-direction: column;
6
- & .main-layout-content{
7
- flex : 1;
8
- padding : 2rem;
9
- }
1
+ .main-layout{
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex-direction: column;
6
+ & .main-layout-content{
7
+ flex : 1;
8
+ padding : 2rem;
9
+ }
10
10
  }
package/src/card/card.css CHANGED
@@ -117,7 +117,7 @@
117
117
  display: none;
118
118
  }
119
119
  }
120
- @container app (min-width: 992px) {
120
+ @container (min-width: 992px) {
121
121
  .card {
122
122
  .card-custom-action {
123
123
  justify-content: end;
@@ -12,7 +12,7 @@
12
12
  display: flex;
13
13
  flex-direction: column;
14
14
  background-color: #fff;
15
-
15
+ cursor: pointer;
16
16
  &:last-child {
17
17
  margin-bottom: 0;
18
18
  }
@@ -15,7 +15,7 @@ export const ColStyled = styled.div<ColStyledProps>`
15
15
  ${({ $sm }) =>
16
16
  $sm &&
17
17
  css`
18
- @media (min-width: 576px) {
18
+ @container (min-width: 576px) {
19
19
  flex: 0 0 ${getColWidth($sm)};
20
20
  max-width: ${getColWidth($sm)};
21
21
  }
@@ -24,7 +24,7 @@ export const ColStyled = styled.div<ColStyledProps>`
24
24
  ${({ $md }) =>
25
25
  $md &&
26
26
  css`
27
- @media (min-width: 768px) {
27
+ @container (min-width: 768px) {
28
28
  flex: 0 0 ${getColWidth($md)};
29
29
  max-width: ${getColWidth($md)};
30
30
  }
@@ -33,7 +33,7 @@ export const ColStyled = styled.div<ColStyledProps>`
33
33
  ${({ $lg }) =>
34
34
  $lg &&
35
35
  css`
36
- @media (min-width: 992px) {
36
+ @container (min-width: 992px) {
37
37
  flex: 0 0 ${getColWidth($lg)};
38
38
  max-width: ${getColWidth($lg)};
39
39
  }
@@ -8,7 +8,7 @@
8
8
  }
9
9
  }
10
10
 
11
- @media (min-width: 998px) {
11
+ @container (min-width: 998px) {
12
12
  .grid-row {
13
13
  &.scroll {
14
14
  overflow-x: auto;
@@ -4,7 +4,7 @@ import ReactDOM from "react-dom";
4
4
  import { Icon } from "../icon/Icon";
5
5
  import { useOverlayContext } from "./overlay.context";
6
6
  import "./overlayPanel.css";
7
- import { OverlayPanelStyled } from "./overlayPanelStyled/overlayPanelStyled";
7
+ import { OverlayPanelStyled } from "./overlayPanelStyled/OverlayPanelStyled";
8
8
 
9
9
  type Position =
10
10
  | "left"
@@ -29,35 +29,37 @@ export const Sidebar = ({
29
29
  const [isOpen, setIsOpen] = useState(open || false);
30
30
  const sidebarRef = useRef<HTMLDivElement | null>(null);
31
31
  const rootRef = useRef<HTMLDivElement | null>(null);
32
- if (!rootRef.current) {
33
- rootRef.current = document.createElement("div");
34
- rootRef.current.id = `sidebar-root-${
35
- id || Math.floor(Math.random() * 1000)
36
- }`;
37
- }
32
+
33
+ // Créer le conteneur une seule fois
38
34
  useEffect(() => {
39
- // Ajouter l'élément root au DOM
40
- const root = rootRef.current!;
41
- document.body.appendChild(root);
35
+ if (!rootRef.current) {
36
+ rootRef.current = document.createElement("div");
37
+ rootRef.current.id = `sidebar-root-${
38
+ id || Math.random().toString(36).substr(2, 9)
39
+ }`;
40
+ document.body.appendChild(rootRef.current);
41
+ }
42
42
 
43
- // Nettoyage lors du démontage
44
43
  return () => {
45
- document.body.removeChild(root);
44
+ // Nettoyage lors du démontage
45
+ if (rootRef.current && rootRef.current.parentNode) {
46
+ document.body.removeChild(rootRef.current);
47
+ rootRef.current = null;
48
+ }
46
49
  };
47
- }, []);
50
+ }, [id]);
51
+
52
+ // Synchroniser l'état `isOpen` avec la prop `open`
48
53
  useEffect(() => {
49
- if (open) {
50
- document.body.appendChild(rootRef.current!);
51
- }
52
54
  setIsOpen(open || false);
53
55
  }, [open]);
56
+
54
57
  const toggleSidebar = useCallback(() => {
55
58
  setIsOpen(false);
56
59
  if (onClose) {
57
60
  onClose(false);
58
- document.body.removeChild(rootRef.current!);
59
61
  }
60
- }, [setIsOpen, onClose]);
62
+ }, [onClose]);
61
63
 
62
64
  const handleClickOutside = useCallback(
63
65
  (event: MouseEvent) => {
@@ -69,8 +71,9 @@ export const Sidebar = ({
69
71
  toggleSidebar();
70
72
  }
71
73
  },
72
- [toggleSidebar]
74
+ [toggleSidebar, closeOnClickOutside]
73
75
  );
76
+
74
77
  useEffect(() => {
75
78
  if (isOpen) {
76
79
  document.addEventListener("mousedown", handleClickOutside);
@@ -83,6 +86,10 @@ export const Sidebar = ({
83
86
  };
84
87
  }, [isOpen, handleClickOutside]);
85
88
 
89
+ if (!rootRef.current) {
90
+ return <></>; // Ne pas tenter de rendre si le conteneur n'existe pas
91
+ }
92
+
86
93
  return ReactDOM.createPortal(
87
94
  <>
88
95
  {isOpen && displayOverlay && <div className="overlay"></div>}