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.
- package/dist/components/index.js +256 -130
- package/package.json +1 -1
- package/src/@daf/core/components/AvatarGroup/AvatarGroup.stories.jsx +1 -1
- package/src/@daf/core/components/Badge/Badge.stories.js +98 -94
- package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/CarouselWidget.stories.js +42 -0
- package/src/@daf/core/components/Dashboard/Widget/CarouselWidget/index.jsx +72 -0
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/ImageCarousel.stories.js +93 -0
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx +132 -0
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/ProjectWidget.stories.jsx +0 -3
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/components/SdgList.jsx +9 -77
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx +78 -80
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/style.js +47 -74
- package/src/@daf/core/components/EditForm/_index.scss +3 -3
- package/src/@daf/core/components/Icon/CustomIcon.stories.js +177 -179
- package/src/@daf/core/components/ProgressBar/MultiBarProgress/MultibarProgress.stories.jsx +48 -41
- package/src/@daf/core/components/ProgressBar/Progress.stories.jsx +31 -31
- package/src/@daf/core/components/Segment/Segment.stories.js +70 -64
- package/src/@daf/core/components/UI/SDGIcon/SGDIcon.stories.jsx +55 -0
- package/src/@daf/core/components/UI/SDGIcon/index.jsx +100 -0
- package/src/@daf/core/components/UI/SDGIcon/styles.js +26 -0
- package/src/@daf/core/components/ViewForm/_index.scss +1 -1
- package/src/index.js +2 -0
- package/src/@daf/core/components/Icon/Icon.stories.js +0 -27
|
@@ -2,78 +2,84 @@ import Segment from "./index.jsx";
|
|
|
2
2
|
import ThemeLayout from "../ThemeLayout/index.jsx";
|
|
3
3
|
import CustomIcon from "../Icon/CustomIcon.jsx";
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
title: "Components/Segment",
|
|
6
|
+
component: Segment,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<div style={{ margin: "3em" }}>
|
|
11
|
+
<ThemeLayout>
|
|
12
|
+
<Story />
|
|
13
|
+
</ThemeLayout>
|
|
14
|
+
</div>
|
|
15
|
+
),
|
|
16
|
+
],
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const Primary = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
name: "Default",
|
|
21
|
+
args: {
|
|
22
|
+
options: [
|
|
23
|
+
{ label: "Option 1", value: "option1" },
|
|
24
|
+
{ label: "Option 2", value: "option2", disabled: true },
|
|
25
|
+
{ label: "Option 3", value: "option3" },
|
|
26
|
+
],
|
|
27
|
+
defaultSelected: "option3",
|
|
28
|
+
},
|
|
29
|
+
render: (args) => (
|
|
30
|
+
<div style={{ display: "flex", gap: "1em" }}>
|
|
31
|
+
<Segment {...args} />
|
|
32
|
+
</div>
|
|
33
|
+
),
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const Icon = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
name: "Icons",
|
|
38
|
+
args: {
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
label: <CustomIcon name="DataPoints" width={17} height={17} />,
|
|
42
|
+
value: "option1",
|
|
43
|
+
tooltip: "OPTION 1",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: <CustomIcon name="DataFlow02" width={17} height={17} />,
|
|
47
|
+
value: "option2",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: <CustomIcon name="Arms" width={17} height={17} />,
|
|
51
|
+
value: "option3",
|
|
52
|
+
tooltip: false,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<div style={{ display: "flex", gap: "1em" }}>
|
|
58
|
+
<Segment {...args} />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
export const SameSize = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
name: "Same Width",
|
|
65
|
+
args: {
|
|
66
|
+
options: [
|
|
67
|
+
{
|
|
68
|
+
label: <CustomIcon name="DataPoints" width={17} height={17} />,
|
|
69
|
+
value: "option1",
|
|
70
|
+
},
|
|
71
|
+
{ label: "Option 2", value: "option2" },
|
|
72
|
+
{ label: "Option WITH LONG TEXT", value: "option3" },
|
|
73
|
+
],
|
|
74
|
+
optionStyle: {
|
|
75
|
+
padding: "1px 8px",
|
|
76
|
+
},
|
|
77
|
+
sameWidth: true,
|
|
78
|
+
},
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
render: (args) => (
|
|
81
|
+
<div style={{ display: "flex", gap: "1em" }}>
|
|
82
|
+
<Segment {...args} />
|
|
83
|
+
</div>
|
|
84
|
+
),
|
|
79
85
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import SDGIcon from "./index.jsx";
|
|
2
|
+
import ThemeLayout from "../../ThemeLayout/index.jsx";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/SDGIcon",
|
|
6
|
+
component: SDGIcon,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<div style={{ margin: "3em" }}>
|
|
11
|
+
<ThemeLayout>
|
|
12
|
+
<Story />
|
|
13
|
+
</ThemeLayout>
|
|
14
|
+
</div>
|
|
15
|
+
),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Primary = {
|
|
20
|
+
name: "SDGIcon",
|
|
21
|
+
args: {
|
|
22
|
+
sdgList: [
|
|
23
|
+
"noPoverty",
|
|
24
|
+
"zeroHunger",
|
|
25
|
+
"goodHealthWellbeing",
|
|
26
|
+
"qualityEducation",
|
|
27
|
+
"genderEquality",
|
|
28
|
+
"cleanWaterSanitation",
|
|
29
|
+
"affordableCleanEnergy",
|
|
30
|
+
"decentWorkEconomicGrowth",
|
|
31
|
+
"industryInnovationInfrastructure",
|
|
32
|
+
"reducedInequalities",
|
|
33
|
+
"sustainableCitiesCommunities",
|
|
34
|
+
"responsibleConsumptionProduction",
|
|
35
|
+
"climateAction",
|
|
36
|
+
"lifeBelowWater",
|
|
37
|
+
"lifeOnLand",
|
|
38
|
+
"peaceJusticeStrongInstitutions",
|
|
39
|
+
"partnershipsForGoals",
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const BiggerIcons = {
|
|
45
|
+
name: "BiggerIcons",
|
|
46
|
+
args: {
|
|
47
|
+
sdgList: [
|
|
48
|
+
"noPoverty",
|
|
49
|
+
"zeroHunger",
|
|
50
|
+
"goodHealthWellbeing",
|
|
51
|
+
"qualityEducation",
|
|
52
|
+
],
|
|
53
|
+
iconSize: 80,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Tooltip, Popover } from "antd";
|
|
3
|
+
import { SDG_IMAGES } from "../../../../../constants/SDGs";
|
|
4
|
+
import { SDGList } from "./styles";
|
|
5
|
+
|
|
6
|
+
const GAP_BETWEEN_SDGS = 4;
|
|
7
|
+
|
|
8
|
+
export default function SDGIcons({
|
|
9
|
+
sdgList = [],
|
|
10
|
+
t = (str) => str,
|
|
11
|
+
iconSize = 24,
|
|
12
|
+
}) {
|
|
13
|
+
const containerRef = React.useRef(null);
|
|
14
|
+
const [width, setWidth] = React.useState(0);
|
|
15
|
+
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (containerRef.current) {
|
|
18
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
19
|
+
for (let entry of entries) {
|
|
20
|
+
setWidth(entry.contentRect.width);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
resizeObserver.observe(containerRef.current);
|
|
24
|
+
|
|
25
|
+
return () => {
|
|
26
|
+
resizeObserver.disconnect();
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
const maxSdgToShow = React.useMemo(() => {
|
|
32
|
+
const TOTAL_SPACE_FOR_SDG = iconSize + GAP_BETWEEN_SDGS;
|
|
33
|
+
return Math.floor(width / TOTAL_SPACE_FOR_SDG);
|
|
34
|
+
}, [width, iconSize]);
|
|
35
|
+
|
|
36
|
+
const { visibleSdgs, hiddenCount } = React.useMemo(() => {
|
|
37
|
+
if (sdgList.length <= maxSdgToShow) {
|
|
38
|
+
return { visibleSdgs: sdgList, hiddenCount: 0 };
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
visibleSdgs: sdgList.slice(0, maxSdgToShow - 1),
|
|
42
|
+
hiddenCount: sdgList.length - (maxSdgToShow - 1),
|
|
43
|
+
};
|
|
44
|
+
}, [sdgList, maxSdgToShow]);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div ref={containerRef}>
|
|
48
|
+
<SDGList>
|
|
49
|
+
{visibleSdgs.map((sdg, index) => (
|
|
50
|
+
<li key={index} className="project-widget-item">
|
|
51
|
+
<Tooltip title={t(`SDGS::${sdg}`)}>
|
|
52
|
+
<div
|
|
53
|
+
style={{
|
|
54
|
+
backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
|
|
55
|
+
height: iconSize,
|
|
56
|
+
width: iconSize,
|
|
57
|
+
}}
|
|
58
|
+
className="sdg-item-image"
|
|
59
|
+
/>
|
|
60
|
+
</Tooltip>
|
|
61
|
+
</li>
|
|
62
|
+
))}
|
|
63
|
+
{hiddenCount > 0 && (
|
|
64
|
+
<li className="project-widget-item">
|
|
65
|
+
<Popover
|
|
66
|
+
placement="top"
|
|
67
|
+
content={
|
|
68
|
+
<div
|
|
69
|
+
style={{
|
|
70
|
+
display: "flex",
|
|
71
|
+
gap: "4px",
|
|
72
|
+
flexWrap: "wrap",
|
|
73
|
+
maxWidth: 200,
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{sdgList.slice(visibleSdgs.length).map((sdg, idx) => (
|
|
77
|
+
<Tooltip key={idx} title={t(`SDGS::${sdg}`)}>
|
|
78
|
+
<div
|
|
79
|
+
style={{
|
|
80
|
+
width: iconSize,
|
|
81
|
+
height: iconSize,
|
|
82
|
+
backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
|
|
83
|
+
backgroundSize: "cover",
|
|
84
|
+
borderRadius: 4,
|
|
85
|
+
}}
|
|
86
|
+
title={t(`SDGS::${sdg}`)}
|
|
87
|
+
/>
|
|
88
|
+
</Tooltip>
|
|
89
|
+
))}
|
|
90
|
+
</div>
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
<div className="sdg-item-image sdg-item-more">+{hiddenCount}</div>
|
|
94
|
+
</Popover>
|
|
95
|
+
</li>
|
|
96
|
+
)}
|
|
97
|
+
</SDGList>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const SDGList = styled.ul`
|
|
4
|
+
list-style: none;
|
|
5
|
+
padding: 0;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: nowrap;
|
|
10
|
+
gap: 4px;
|
|
11
|
+
margin: 0;
|
|
12
|
+
|
|
13
|
+
.sdg-item-image {
|
|
14
|
+
background-size: cover;
|
|
15
|
+
background-position: center;
|
|
16
|
+
background-repeat: no-repeat;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sdg-item-more {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
background: var(--base-gray-30);
|
|
24
|
+
color: var(--base-gray-90);
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
display: flex;
|
|
232
232
|
flex-direction: column;
|
|
233
233
|
overflow-y: auto;
|
|
234
|
-
padding: var(--size-lg) var(--size-lg)
|
|
234
|
+
padding: var(--size-lg) var(--size-lg) 60px var(--size-lg); // Added bottom padding for better scrolling
|
|
235
235
|
|
|
236
236
|
&.no-padding {
|
|
237
237
|
padding: 0px;
|
package/src/index.js
CHANGED
|
@@ -72,6 +72,8 @@ export { default as SDGWidget } from "./@daf/core/components/Dashboard/Widget/SD
|
|
|
72
72
|
export { default as ComponentWithFocus } from "./@daf/core/components/Dashboard/ComponentWithFocus/index.jsx";
|
|
73
73
|
export { default as ProjectWidget } from "./@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx";
|
|
74
74
|
export { default as WidgetCard } from "./@daf/core/components/Dashboard/Widget/WidgetCard/index.js";
|
|
75
|
+
export { default as CarouselWidget } from "./@daf/core/components/Dashboard/Widget/CarouselWidget/index.jsx";
|
|
76
|
+
export { default as ImageCarousel } from "./@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx";
|
|
75
77
|
// export { default as WidgetCatalogue } from "./@daf/core/components/Dashboard/Widget/WidgetCatalogue/index.jsx";
|
|
76
78
|
|
|
77
79
|
// Forms
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-filename-extension */
|
|
2
|
-
import Icon from './index'
|
|
3
|
-
|
|
4
|
-
import ThemeLayout from '../ThemeLayout'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Core/Icon/AntIcon',
|
|
8
|
-
component: Icon,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
decorators: [
|
|
11
|
-
(Story) => (
|
|
12
|
-
<div style={{ margin: '3em' }}>
|
|
13
|
-
<ThemeLayout>
|
|
14
|
-
<Story />
|
|
15
|
-
</ThemeLayout>
|
|
16
|
-
</div>
|
|
17
|
-
),
|
|
18
|
-
],
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Primary = {
|
|
22
|
-
name: 'Warning Icon',
|
|
23
|
-
args: {
|
|
24
|
-
icon: 'CloseOutlined',
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
|