datastake-daf 0.6.122 → 0.6.123

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.
@@ -20066,202 +20066,6 @@ const DetailsSection = _ref => {
20066
20066
  });
20067
20067
  };
20068
20068
 
20069
- const SDG_CONFIG = {
20070
- 1: {
20071
- name: "No Poverty",
20072
- color: "#E5243B",
20073
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-01.jpg"
20074
- },
20075
- 2: {
20076
- name: "Zero Hunger",
20077
- color: "#DDA63A",
20078
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-02.jpg"
20079
- },
20080
- 3: {
20081
- name: "Good Health and Well-being",
20082
- color: "#4C9F38",
20083
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-03.jpg"
20084
- },
20085
- 4: {
20086
- name: "Quality Education",
20087
- color: "#C5192D",
20088
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-04.jpg"
20089
- },
20090
- 6: {
20091
- name: "Clean Water and Sanitation",
20092
- color: "#26BDE2",
20093
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-06.jpg"
20094
- },
20095
- 8: {
20096
- name: "Decent Work and Economic Growth",
20097
- color: "#A21942",
20098
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-08.jpg"
20099
- },
20100
- 13: {
20101
- name: "Climate Action",
20102
- color: "#48773E",
20103
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-13.jpg"
20104
- },
20105
- 15: {
20106
- name: "Life on Land",
20107
- color: "#3EB049",
20108
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-15.jpg"
20109
- }
20110
- };
20111
-
20112
- // Default SDGs to show (matching the image)
20113
- const DEFAULT_SDGS = [1, 2, 3, 4, 6, 8, 13, 15];
20114
-
20115
- // Individual Project Card Component
20116
- const ProjectCard = _ref => {
20117
- let {
20118
- title,
20119
- image,
20120
- imgAlt,
20121
- country,
20122
- countryFlag,
20123
- sectoralScope,
20124
- methodology,
20125
- sdgs = []
20126
- } = _ref;
20127
- return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, {
20128
- style: {
20129
- minWidth: 280,
20130
- width: "100%",
20131
- borderRadius: "12px",
20132
- overflow: "hidden",
20133
- border: "1px solid #e5e7eb",
20134
- boxShadow: "0 1px 3px rgba(0,0,0,0.08)"
20135
- },
20136
- cover: /*#__PURE__*/jsxRuntime.jsx("div", {
20137
- className: "relative w-full h-40 overflow-hidden",
20138
- children: image ? /*#__PURE__*/jsxRuntime.jsx("img", {
20139
- alt: imgAlt || "".concat(title, " image"),
20140
- src: image,
20141
- style: {
20142
- width: "100%",
20143
- height: "100%",
20144
- objectFit: "cover"
20145
- }
20146
- }) : /*#__PURE__*/jsxRuntime.jsx("div", {
20147
- className: "w-full h-full flex items-center justify-center bg-gray-100",
20148
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
20149
- image: antd.Empty.PRESENTED_IMAGE_SIMPLE
20150
- })
20151
- })
20152
- }),
20153
- bodyStyle: {
20154
- padding: "16px"
20155
- },
20156
- children: [title && /*#__PURE__*/jsxRuntime.jsx("h3", {
20157
- className: "text-md font-semibold text-gray-900 mb-3",
20158
- children: title
20159
- }), country && /*#__PURE__*/jsxRuntime.jsxs("div", {
20160
- className: "flex items-center justify-between py-2 border-b border-gray-200",
20161
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
20162
- className: "text-sm text-gray-600",
20163
- children: "Country"
20164
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
20165
- className: "flex items-center gap-1",
20166
- children: [countryFlag && /*#__PURE__*/jsxRuntime.jsx("img", {
20167
- src: countryFlag,
20168
- alt: "".concat(country, " flag"),
20169
- style: {
20170
- width: "16px",
20171
- height: "12px"
20172
- }
20173
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
20174
- className: "text-sm font-medium text-gray-900",
20175
- children: country
20176
- })]
20177
- })]
20178
- }), sectoralScope && /*#__PURE__*/jsxRuntime.jsxs("div", {
20179
- className: "flex items-center justify-between py-2 border-b border-gray-200",
20180
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
20181
- className: "text-sm text-gray-600",
20182
- children: "Sectoral Scope"
20183
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
20184
- className: "text-sm font-medium text-gray-900",
20185
- children: sectoralScope
20186
- })]
20187
- }), methodology && /*#__PURE__*/jsxRuntime.jsxs("div", {
20188
- className: "flex items-center justify-between py-2 border-b border-gray-200",
20189
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
20190
- className: "text-sm text-gray-600",
20191
- children: "Methodology"
20192
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
20193
- className: "text-sm font-medium text-gray-900",
20194
- children: methodology
20195
- })]
20196
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
20197
- className: "pt-2",
20198
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
20199
- className: "text-sm text-gray-600",
20200
- children: "SDGs"
20201
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
20202
- className: "flex flex-wrap gap-1 mt-2",
20203
- children: (sdgs.length > 0 ? sdgs : DEFAULT_SDGS).map((sdg, index) => {
20204
- const sdgConfig = typeof sdg === "number" ? SDG_CONFIG[sdg] : sdg;
20205
- return /*#__PURE__*/jsxRuntime.jsx("img", {
20206
- src: sdgConfig === null || sdgConfig === void 0 ? void 0 : sdgConfig.icon,
20207
- alt: sdgConfig === null || sdgConfig === void 0 ? void 0 : sdgConfig.name,
20208
- style: {
20209
- width: "22px",
20210
- height: "22px",
20211
- objectFit: "cover"
20212
- }
20213
- }, index);
20214
- })
20215
- })]
20216
- })]
20217
- });
20218
- };
20219
-
20220
- // Main Widget Catalogue Component
20221
- function WidgetCatalogue(_ref2) {
20222
- let {
20223
- title = "Project Catalogue",
20224
- projects = [],
20225
- loading = false,
20226
- className = ""
20227
- } = _ref2;
20228
- if (loading) {
20229
- return /*#__PURE__*/jsxRuntime.jsx(Widget, {
20230
- title: title,
20231
- className: "with-border-header",
20232
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
20233
- className: "flex justify-center items-center h-64",
20234
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
20235
- size: "large"
20236
- })
20237
- })
20238
- });
20239
- }
20240
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
20241
- children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
20242
- title: title,
20243
- className: "with-border-header",
20244
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
20245
- style: {
20246
- display: "flex",
20247
- gap: "16px",
20248
- justifyContent: "space-between"
20249
- },
20250
- children: projects.slice(0, 3).map((project, idx) => /*#__PURE__*/jsxRuntime.jsx("div", {
20251
- style: {
20252
- flex: "1 1 0",
20253
- // make each card take equal width
20254
- maxWidth: "calc(33.333% - 16px)"
20255
- },
20256
- children: /*#__PURE__*/jsxRuntime.jsx(ProjectCard, {
20257
- project: project
20258
- })
20259
- }, idx))
20260
- })
20261
- })
20262
- });
20263
- }
20264
-
20265
20069
  var Style$w = dt.div`
20266
20070
  border: 1px solid var(--base-gray-40);
20267
20071
  padding: 12px;
@@ -59640,7 +59444,6 @@ exports.ViewForm = Content;
59640
59444
  exports.ViewFormInput = Input;
59641
59445
  exports.ViewFormNavigation = Navigation;
59642
59446
  exports.Widget = Widget;
59643
- exports.WidgetCatalogue = WidgetCatalogue;
59644
59447
  exports.WidgetImage = ImageWidget;
59645
59448
  exports.WidgetLoader = Loader;
59646
59449
  exports.WidgetPlaceholder = WidgetPlaceholder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.122",
3
+ "version": "0.6.123",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -6,42 +6,6 @@
6
6
  position: relative;
7
7
  flex-direction: column;
8
8
 
9
- // Widget Catalogue specific styles
10
- &.widget-catalogue {
11
- padding: var(--size-lg);
12
-
13
- @media (max-width: 850px) {
14
- padding: var(--size);
15
- }
16
-
17
- .grid {
18
- display: grid;
19
- gap: 1.5rem;
20
-
21
- @media (min-width: 768px) {
22
- grid-template-columns: repeat(2, 1fr);
23
- }
24
-
25
- @media (min-width: 1024px) {
26
- grid-template-columns: repeat(3, 1fr);
27
- }
28
-
29
- @media (min-width: 1280px) {
30
- grid-template-columns: repeat(4, 1fr);
31
- }
32
- }
33
-
34
- .ant-card {
35
- transition: all 0.2s ease-in-out;
36
- border: 1px solid #e5e7eb;
37
-
38
- &:hover {
39
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
40
- transform: translateY(-2px);
41
- }
42
- }
43
- }
44
-
45
9
  .month-select {
46
10
  min-width: 165px;
47
11
  max-width: 165px;
package/src/index.js CHANGED
@@ -69,7 +69,6 @@ export { default as DafDashboardDetails } from "./@daf/core/components/Dashboard
69
69
  export { default as KeyIndicatorsDetails } from "./@daf/core/components/Dashboard/Widget/Details/KeyIndicatorsDetails.jsx";
70
70
  export { default as DetailsSection } from "./@daf/core/components/Dashboard/Widget/DetailsSection/index.jsx";
71
71
  export { default as ComponentWithFocus } from "./@daf/core/components/Dashboard/ComponentWithFocus/index.jsx";
72
- export { default as WidgetCatalogue } from "./@daf/core/components/Dashboard/Widget/WidgetCatalogue/index.jsx";
73
72
 
74
73
  // Forms
75
74
  export { default as ViewForm } from "./@daf/core/components/ViewForm/content.jsx";
@@ -1,109 +0,0 @@
1
- import React from "react";
2
- import WidgetCatalogue from "./index.jsx";
3
-
4
- // Sample projects data matching the image exactly
5
- const sampleProjects = [
6
- {
7
- title: "ABC Mangrove Senegal",
8
- image:
9
- "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop",
10
- country: "Senegal",
11
- countryFlag: "https://flagcdn.com/w40/sn.png",
12
- sectoralScope: "AFOLU",
13
- methodology: "VM0033",
14
- imgAlt: "Mangrove landscape with calm water reflecting green trees",
15
- },
16
- {
17
- title: "IFM Jujuy",
18
- image:
19
- "https://images.unsplash.com/photo-1559827260-dc66d52bef19?w=400&h=200&fit=crop",
20
- country: "Argentina",
21
- countryFlag: "https://flagcdn.com/w40/ar.png",
22
- sectoralScope: "AFOLU",
23
- methodology: "VM0033",
24
- imgAlt: "White-faced whistling ducks in shallow water with green grass",
25
- },
26
- {
27
- title: "Sur del Meta",
28
- image:
29
- "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=200&fit=crop",
30
- country: "Colombia",
31
- countryFlag: "https://flagcdn.com/w40/co.png",
32
- sectoralScope: "AFOLU",
33
- methodology: "VM0033",
34
- imgAlt: "Aerial view of braided river channels through green landscape",
35
- },
36
- ];
37
-
38
- export default {
39
- title: "Dashboard/Widgets/WidgetCatalogue",
40
- component: WidgetCatalogue,
41
- parameters: {
42
- layout: "padded",
43
- docs: {
44
- description: {
45
- component:
46
- "A widget component that displays multiple project cards in a responsive grid layout, mapping over an array of project data. Each card shows project details including image, title, country, sectoral scope, methodology, and SDGs.",
47
- },
48
- },
49
- },
50
- argTypes: {
51
- title: {
52
- control: "text",
53
- description: "Widget title displayed at the top",
54
- },
55
- projects: {
56
- control: "object",
57
- description: "Array of project objects to display",
58
- },
59
- loading: {
60
- control: "boolean",
61
- description: "Loading state - shows spinner when true",
62
- },
63
- className: {
64
- control: "text",
65
- description: "Additional CSS classes for styling",
66
- },
67
- },
68
- };
69
-
70
- // Template for the story
71
- const Template = (args) => (
72
- <div
73
- style={{ padding: "20px", backgroundColor: "#f5f5f5", minHeight: "100vh" }}
74
- >
75
- <WidgetCatalogue {...args} />
76
- </div>
77
- );
78
-
79
- // Populated state - matches the image exactly
80
- export const Populated = Template.bind({});
81
- Populated.args = {
82
- title: "Project Catalogue",
83
- projects: sampleProjects,
84
- loading: false,
85
- };
86
- Populated.parameters = {
87
- docs: {
88
- description: {
89
- story:
90
- "Widget with multiple project cards, matching the design from the reference image. Shows three projects with images, country flags, and SDG icons.",
91
- },
92
- },
93
- };
94
-
95
- // Single project
96
- export const SingleProject = Template.bind({});
97
- SingleProject.args = {
98
- title: "Featured Project",
99
- projects: [sampleProjects[0]],
100
- loading: false,
101
- };
102
- SingleProject.parameters = {
103
- docs: {
104
- description: {
105
- story:
106
- "Widget with a single project card - shows how the grid adapts to fewer items.",
107
- },
108
- },
109
- };
@@ -1,197 +0,0 @@
1
- import React from "react";
2
- import { Image, Empty, Spin } from "antd";
3
- import { ExpandOutlined } from "@ant-design/icons";
4
- import { Card } from "antd";
5
- import Widget from "../index.jsx";
6
-
7
- // SDG configuration with proper colors and icons
8
- const SDG_CONFIG = {
9
- 1: {
10
- name: "No Poverty",
11
- color: "#E5243B",
12
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-01.jpg",
13
- },
14
- 2: {
15
- name: "Zero Hunger",
16
- color: "#DDA63A",
17
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-02.jpg",
18
- },
19
- 3: {
20
- name: "Good Health and Well-being",
21
- color: "#4C9F38",
22
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-03.jpg",
23
- },
24
- 4: {
25
- name: "Quality Education",
26
- color: "#C5192D",
27
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-04.jpg",
28
- },
29
- 6: {
30
- name: "Clean Water and Sanitation",
31
- color: "#26BDE2",
32
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-06.jpg",
33
- },
34
- 8: {
35
- name: "Decent Work and Economic Growth",
36
- color: "#A21942",
37
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-08.jpg",
38
- },
39
- 13: {
40
- name: "Climate Action",
41
- color: "#48773E",
42
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-13.jpg",
43
- },
44
- 15: {
45
- name: "Life on Land",
46
- color: "#3EB049",
47
- icon: "https://sdgs.un.org/sites/default/files/goals/E_SDG_Icons-15.jpg",
48
- },
49
- };
50
-
51
- // Default SDGs to show (matching the image)
52
- const DEFAULT_SDGS = [1, 2, 3, 4, 6, 8, 13, 15];
53
-
54
- // Individual Project Card Component
55
- const ProjectCard = ({
56
- title,
57
- image,
58
- imgAlt,
59
- country,
60
- countryFlag,
61
- sectoralScope,
62
- methodology,
63
- sdgs = [],
64
- }) => {
65
- return (
66
- <Card
67
- style={{
68
- minWidth: 280,
69
- width: "100%",
70
- borderRadius: "12px",
71
- overflow: "hidden",
72
- border: "1px solid #e5e7eb",
73
- boxShadow: "0 1px 3px rgba(0,0,0,0.08)",
74
- }}
75
- cover={
76
- <div className="relative w-full h-40 overflow-hidden">
77
- {image ? (
78
- <img
79
- alt={imgAlt || `${title} image`}
80
- src={image}
81
- style={{ width: "100%", height: "100%", objectFit: "cover" }}
82
- />
83
- ) : (
84
- <div className="w-full h-full flex items-center justify-center bg-gray-100">
85
- <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
86
- </div>
87
- )}
88
- </div>
89
- }
90
- bodyStyle={{ padding: "16px" }}
91
- >
92
- {/* Title */}
93
- {title && (
94
- <h3 className="text-md font-semibold text-gray-900 mb-3">{title}</h3>
95
- )}
96
-
97
- {/* Country */}
98
- {country && (
99
- <div className="flex items-center justify-between py-2 border-b border-gray-200">
100
- <span className="text-sm text-gray-600">Country</span>
101
- <div className="flex items-center gap-1">
102
- {countryFlag && (
103
- <img
104
- src={countryFlag}
105
- alt={`${country} flag`}
106
- style={{ width: "16px", height: "12px" }}
107
- />
108
- )}
109
- <span className="text-sm font-medium text-gray-900">{country}</span>
110
- </div>
111
- </div>
112
- )}
113
-
114
- {/* Sectoral Scope */}
115
- {sectoralScope && (
116
- <div className="flex items-center justify-between py-2 border-b border-gray-200">
117
- <span className="text-sm text-gray-600">Sectoral Scope</span>
118
- <span className="text-sm font-medium text-gray-900">
119
- {sectoralScope}
120
- </span>
121
- </div>
122
- )}
123
-
124
- {/* Methodology */}
125
- {methodology && (
126
- <div className="flex items-center justify-between py-2 border-b border-gray-200">
127
- <span className="text-sm text-gray-600">Methodology</span>
128
- <span className="text-sm font-medium text-gray-900">
129
- {methodology}
130
- </span>
131
- </div>
132
- )}
133
-
134
- {/* SDGs */}
135
- <div className="pt-2">
136
- <span className="text-sm text-gray-600">SDGs</span>
137
- <div className="flex flex-wrap gap-1 mt-2">
138
- {(sdgs.length > 0 ? sdgs : DEFAULT_SDGS).map((sdg, index) => {
139
- const sdgConfig = typeof sdg === "number" ? SDG_CONFIG[sdg] : sdg;
140
- return (
141
- <img
142
- key={index}
143
- src={sdgConfig?.icon}
144
- alt={sdgConfig?.name}
145
- style={{ width: "22px", height: "22px", objectFit: "cover" }}
146
- />
147
- );
148
- })}
149
- </div>
150
- </div>
151
- </Card>
152
- );
153
- };
154
-
155
- // Main Widget Catalogue Component
156
- export default function WidgetCatalogue({
157
- title = "Project Catalogue",
158
- projects = [],
159
- loading = false,
160
- className = "",
161
- }) {
162
- if (loading) {
163
- return (
164
- <Widget title={title} className="with-border-header">
165
- <div className="flex justify-center items-center h-64">
166
- <Spin size="large" />
167
- </div>
168
- </Widget>
169
- );
170
- }
171
-
172
- return (
173
- <>
174
- <Widget title={title} className="with-border-header">
175
- <div
176
- style={{
177
- display: "flex",
178
- gap: "16px",
179
- justifyContent: "space-between",
180
- }}
181
- >
182
- {projects.slice(0, 3).map((project, idx) => (
183
- <div
184
- key={idx}
185
- style={{
186
- flex: "1 1 0", // make each card take equal width
187
- maxWidth: "calc(33.333% - 16px)",
188
- }}
189
- >
190
- <ProjectCard project={project} />
191
- </div>
192
- ))}
193
- </div>
194
- </Widget>
195
- </>
196
- );
197
- }