datastake-daf 0.6.168 → 0.6.170

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 (23) hide show
  1. package/dist/components/index.js +256 -130
  2. package/package.json +1 -1
  3. package/src/@daf/core/components/AvatarGroup/AvatarGroup.stories.jsx +1 -1
  4. package/src/@daf/core/components/Badge/Badge.stories.js +98 -94
  5. package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/CarouselWidget.stories.js +42 -0
  6. package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/index.jsx +72 -0
  7. package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/ImageCarousel.stories.js +93 -0
  8. package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx +132 -0
  9. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/ProjectWidget.stories.jsx +0 -3
  10. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/components/SdgList.jsx +9 -77
  11. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx +78 -80
  12. package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/style.js +47 -74
  13. package/src/@daf/core/components/EditForm/_index.scss +3 -3
  14. package/src/@daf/core/components/Icon/CustomIcon.stories.js +177 -179
  15. package/src/@daf/core/components/ProgressBar/MultiBarProgress/MultibarProgress.stories.jsx +48 -41
  16. package/src/@daf/core/components/ProgressBar/Progress.stories.jsx +31 -31
  17. package/src/@daf/core/components/Segment/Segment.stories.js +70 -64
  18. package/src/@daf/core/components/UI/SDGIcon/SGDIcon.stories.jsx +55 -0
  19. package/src/@daf/core/components/UI/SDGIcon/index.jsx +100 -0
  20. package/src/@daf/core/components/UI/SDGIcon/styles.js +26 -0
  21. package/src/@daf/core/components/ViewForm/_index.scss +1 -1
  22. package/src/index.js +2 -0
  23. package/src/@daf/core/components/Icon/Icon.stories.js +0 -27
@@ -1,78 +1,10 @@
1
- import { Label, SDGList } from "../style";
2
- import { Tooltip, Popover } from "antd";
3
- import { SDG_IMAGES } from "../../../../../../../constants/SDGs";
4
- import { useMemo } from "react";
5
-
6
- const SDG_IMAGE_WIDTH = 24;
7
- const GAP_BETWEEN_SDGS = 4;
8
- const TOTAL_SPACE_FOR_SDG = SDG_IMAGE_WIDTH + GAP_BETWEEN_SDGS;
9
-
10
- export default function SdgList({ sdgList = [], t, cardWidth }) {
11
- const maxSdgToShow = useMemo(() => {
12
- return Math.floor(cardWidth / TOTAL_SPACE_FOR_SDG);
13
- }, [cardWidth]);
14
-
15
- const { visibleSdgs, hiddenCount } = useMemo(() => {
16
- if (sdgList.length <= maxSdgToShow) {
17
- return { visibleSdgs: sdgList, hiddenCount: 0 };
18
- }
19
- return {
20
- visibleSdgs: sdgList.slice(0, maxSdgToShow - 1),
21
- hiddenCount: sdgList.length - (maxSdgToShow - 1),
22
- };
23
- }, [sdgList, maxSdgToShow]);
24
-
25
- return (
26
- <>
27
- <Label>SDGs:</Label>
28
- <SDGList>
29
- {visibleSdgs.map((sdg, index) => (
30
- <li key={index} className="project-widget-item">
31
- <Tooltip title={t(`SDGS::${sdg}`)}>
32
- <div
33
- style={{
34
- backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
35
- }}
36
- className="sdg-item-image"
37
- />
38
- </Tooltip>
39
- </li>
40
- ))}
41
- {hiddenCount > 0 && (
42
- <li className="project-widget-item">
43
- <Popover
44
- placement="top"
45
- content={
46
- <div
47
- style={{
48
- display: "flex",
49
- gap: "4px",
50
- flexWrap: "wrap",
51
- maxWidth: 200,
52
- }}
53
- >
54
- {sdgList.slice(visibleSdgs.length).map((sdg, idx) => (
55
- <Tooltip key={idx} title={t(`SDGS::${sdg}`)}>
56
- <div
57
- style={{
58
- width: SDG_IMAGE_WIDTH,
59
- height: SDG_IMAGE_WIDTH,
60
- backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
61
- backgroundSize: "cover",
62
- borderRadius: 4,
63
- }}
64
- title={t(`SDGS::${sdg}`)}
65
- />
66
- </Tooltip>
67
- ))}
68
- </div>
69
- }
70
- >
71
- <div className="sdg-item-image sdg-item-more">+{hiddenCount}</div>
72
- </Popover>
73
- </li>
74
- )}
75
- </SDGList>
76
- </>
77
- );
1
+ import { Label } from "../style";
2
+ import SDGIcons from "../../../../UI/SDGIcon/index.jsx";
3
+ export default function SdgList({ sdgList = [], t }) {
4
+ return (
5
+ <>
6
+ <Label>SDGs:</Label>
7
+ <SDGIcons sdgList={sdgList} t={t} />
8
+ </>
9
+ );
78
10
  }
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo } from "react";
2
- import { Card, theme } from "antd";
2
+ import { Card, theme, Empty } from "antd";
3
3
  import { ImageContainer, ProjectWidgetItems, Label } from "./style.js";
4
4
  import CustomIcon from "../../../Icon/CustomIcon.jsx";
5
5
  import SdgList from "./components/SdgList.jsx";
@@ -7,87 +7,85 @@ const { Meta } = Card;
7
7
  const { useToken } = theme;
8
8
 
9
9
  export default function ProjectWidget({
10
- title,
11
- description,
12
- onLinkClick,
13
- image,
14
- linkIcon = "Link",
15
- sdgList,
16
- items,
17
- onCardClick,
18
- hideSDGList = false,
19
- t = (x) => x,
20
- ...props
10
+ title,
11
+ description,
12
+ onLinkClick,
13
+ image,
14
+ linkIcon = "Link",
15
+ sdgList,
16
+ items,
17
+ onCardClick,
18
+ hideSDGList = false,
19
+ t = (x) => x,
20
+ ...props
21
21
  }) {
22
- const [isHovered, setIsHovered] = React.useState(false);
23
- const { token } = useToken();
22
+ const [isHovered, setIsHovered] = React.useState(false);
23
+ const { token } = useToken();
24
24
 
25
- const cardRef = React.useRef(null);
26
- const [cardWidth, setCardWidth] = React.useState(0);
25
+ return (
26
+ <Card
27
+ style={{
28
+ flex: 1,
29
+ width: "100%",
30
+ minWidth: "200px",
31
+ }}
32
+ hoverable
33
+ onMouseEnter={() => setIsHovered(true)}
34
+ onMouseLeave={() => setIsHovered(false)}
35
+ onClick={onCardClick}
36
+ cover={
37
+ <ImageContainer>
38
+ {image ? (
39
+ <div
40
+ className="image"
41
+ style={{
42
+ backgroundImage: `url(${image})`,
43
+ }}
44
+ />
45
+ ) : (
46
+ <div
47
+ style={{
48
+ height: "103px",
49
+ }}
50
+ >
51
+ <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
52
+ </div>
53
+ )}
27
54
 
28
- React.useEffect(() => {
29
- const resizeObserver = new ResizeObserver((entries) => {
30
- setCardWidth(entries[0].contentRect.width);
31
- });
55
+ {onLinkClick && (
56
+ <div className="icon-container" onClick={onLinkClick}>
57
+ <CustomIcon
58
+ name={linkIcon}
59
+ width={16}
60
+ height={16}
61
+ color={isHovered ? token.colorPrimary7 : "black"}
62
+ />
63
+ </div>
64
+ )}
65
+ </ImageContainer>
66
+ }
67
+ {...props}
68
+ >
69
+ <Meta title={title || undefined} description={description || undefined} />
70
+ <ProjectWidgetItems>
71
+ {items.map((item, index) => (
72
+ <li key={index} className="project-widget-item">
73
+ <Label>{item.label}</Label>
74
+ {item.render()}
75
+ </li>
76
+ ))}
77
+ </ProjectWidgetItems>
32
78
 
33
- resizeObserver.observe(cardRef.current);
34
- return () => resizeObserver.disconnect();
35
- }, [cardRef]);
36
-
37
- return (
38
- <Card
39
- style={{
40
- flex: 1,
41
- width: "100%",
42
- minWidth: "200px",
43
- }}
44
- hoverable
45
- onMouseEnter={() => setIsHovered(true)}
46
- onMouseLeave={() => setIsHovered(false)}
47
- onClick={onCardClick}
48
- cover={
49
- <ImageContainer>
50
- <div
51
- className="image"
52
- style={{
53
- backgroundImage: `url(${image})`,
54
- }}
55
- />
56
- {onLinkClick && (
57
- <div className="icon-container" onClick={onLinkClick}>
58
- <CustomIcon
59
- name={linkIcon}
60
- width={16}
61
- height={16}
62
- color={isHovered ? token.colorPrimary7 : "black"}
63
- />
64
- </div>
65
- )}
66
- </ImageContainer>
67
- }
68
- {...props}
69
- >
70
- <Meta title={title || undefined} description={description || undefined} />
71
- <ProjectWidgetItems>
72
- {items.map((item, index) => (
73
- <li key={index} className="project-widget-item">
74
- <Label>{item.label}</Label>
75
- {item.render()}
76
- </li>
77
- ))}
78
- </ProjectWidgetItems>
79
-
80
- {!hideSDGList && (
81
- <div
82
- style={{
83
- borderTop: "1px solid var(--base-gray-30)",
84
- paddingTop: "10px",
85
- }}
86
- ref={cardRef}
87
- >
88
- <SdgList sdgList={sdgList} t={t} cardWidth={cardWidth} />
89
- </div>
90
- )}
91
- </Card>
92
- );
79
+ {!hideSDGList && (
80
+ <div
81
+ style={{
82
+ borderTop: "1px solid var(--base-gray-30)",
83
+ paddingTop: "10px",
84
+ }}
85
+ >
86
+ <SdgList sdgList={sdgList} t={t} />
87
+ </div>
88
+ )}
89
+ </Card>
90
+ );
93
91
  }
@@ -1,84 +1,57 @@
1
1
  import styled from "styled-components";
2
2
 
3
3
  export const ImageContainer = styled.div`
4
- overflow: hidden;
5
- position: relative;
6
-
7
- .image {
8
- width: 100%;
9
- height: 151px;
10
- background-size: cover;
11
- background-position: center;
12
- background-repeat: no-repeat;
13
-
14
- border-bottom-left-radius: 3px;
15
- border-bottom-right-radius: 3px;
16
- }
17
-
18
- .icon-container {
19
- position: absolute;
20
- top: 10px;
21
- right: 10px;
22
- background: white;
23
- padding: 10px;
24
- border-radius: 6px;
25
- cursor: pointer;
26
- }
4
+ overflow: hidden;
5
+ position: relative;
6
+
7
+ .image {
8
+ width: 100%;
9
+ height: 151px;
10
+ background-size: cover;
11
+ background-position: center;
12
+ background-repeat: no-repeat;
13
+
14
+ border-bottom-left-radius: 3px;
15
+ border-bottom-right-radius: 3px;
16
+ }
17
+
18
+ .icon-container {
19
+ position: absolute;
20
+ top: 10px;
21
+ right: 10px;
22
+ background: white;
23
+ padding: 10px;
24
+ border-radius: 6px;
25
+ cursor: pointer;
26
+ }
27
27
  `;
28
28
 
29
29
  export const ProjectWidgetItems = styled.ul`
30
- list-style: none;
31
- padding: 0;
32
- padding-top: 10px;
33
- margin: 0;
34
-
35
- .project-widget-item {
36
- display: flex;
37
- justify-content: space-between;
38
- align-items: center;
39
- border-bottom: 1px solid var(--base-gray-30);
40
- padding: 10px 0;
41
-
42
- &:last-of-type {
43
- border-bottom: 0;
44
- }
45
- }
46
- `;
47
-
48
- export const SDGList = styled.ul`
49
- list-style: none;
50
- padding: 0;
51
- width: 100%;
52
- overflow-x: hidden;
53
- display: flex;
54
- flex-wrap: nowrap;
55
- gap: 4px;
56
- margin: 0;
57
-
58
- .sdg-item-image {
59
- width: 24px;
60
- height: 24px;
61
- background-size: cover;
62
- background-position: center;
63
- background-repeat: no-repeat;
64
- }
65
-
66
- .sdg-item-more {
67
- display: flex;
68
- align-items: center;
69
- justify-content: center;
70
- background: var(--base-gray-30);
71
- color: var(--base-gray-90);
72
- }
30
+ list-style: none;
31
+ padding: 0;
32
+ padding-top: 10px;
33
+ margin: 0;
34
+
35
+ .project-widget-item {
36
+ display: flex;
37
+ justify-content: space-between;
38
+ align-items: center;
39
+ border-bottom: 1px solid var(--base-gray-30);
40
+ padding: 10px 0;
41
+
42
+ &:last-of-type {
43
+ border-bottom: 0;
44
+ }
45
+ }
73
46
  `;
74
47
 
75
48
  export const Label = styled.span`
76
- font-family: SF UI Display;
77
- font-weight: 500;
78
- font-style: Medium;
79
- font-size: 14px;
80
- leading-trim: NONE;
81
- line-height: 26px;
82
- letter-spacing: 0%;
83
- color: #6c737f;
49
+ font-family: SF UI Display;
50
+ font-weight: 500;
51
+ font-style: Medium;
52
+ font-size: 14px;
53
+ leading-trim: NONE;
54
+ line-height: 26px;
55
+ letter-spacing: 0%;
56
+ color: #6c737f;
84
57
  `;
@@ -164,7 +164,7 @@
164
164
  flex-direction: column;
165
165
  overflow-y: auto;
166
166
  height: 100%; // Ensure content takes full height
167
- padding: 20px 20px 20px 20px; // Add bottom padding for better scrolling
167
+ padding: 20px 20px 60px 20px; // Increased bottom padding for better scrolling
168
168
 
169
169
  &.risk-template.no-padding {
170
170
  padding: 0;
@@ -354,7 +354,7 @@
354
354
  padding-top: var(--size-lg);
355
355
  overflow: auto;
356
356
  flex-direction: column;
357
- padding: 20px 100px 0 100px;
357
+ padding: 20px 100px 60px 100px; // Added bottom padding for better scrolling
358
358
  &.has-section {
359
359
  width: calc(100% - 200px);
360
360
  }
@@ -1229,7 +1229,7 @@
1229
1229
  padding-top: var(--size-lg);
1230
1230
  overflow: auto;
1231
1231
  flex-direction: column;
1232
- padding: var(--size-lg) var(--size-lg) 0 var(--size-lg);
1232
+ padding: var(--size-lg) var(--size-lg) 60px var(--size-lg); // Added bottom padding for better scrolling
1233
1233
 
1234
1234
  .main-form {
1235
1235
  min-width: 400px;