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
@@ -8,204 +8,202 @@ import { copyToClipboard } from "../../../../helpers/copyToClipboard";
8
8
  const configKeys = Object.keys(config);
9
9
 
10
10
  const groupIconsByTag = () => {
11
- const groupedIcons = {};
11
+ const groupedIcons = {};
12
12
 
13
- configKeys.forEach((iconName) => {
14
- const iconConfig = config[iconName];
15
- const tags = iconConfig.tag || ["other"];
13
+ configKeys.forEach((iconName) => {
14
+ const iconConfig = config[iconName];
15
+ const tags = iconConfig.tag || ["other"];
16
16
 
17
- tags.forEach((tag) => {
18
- if (!groupedIcons[tag]) {
19
- groupedIcons[tag] = [];
20
- }
21
- groupedIcons[tag].push(iconName);
22
- });
23
- });
17
+ tags.forEach((tag) => {
18
+ if (!groupedIcons[tag]) {
19
+ groupedIcons[tag] = [];
20
+ }
21
+ groupedIcons[tag].push(iconName);
22
+ });
23
+ });
24
24
 
25
- return groupedIcons;
25
+ return groupedIcons;
26
26
  };
27
27
 
28
28
  const groupedIcons = groupIconsByTag();
29
29
 
30
30
  const groupOptions = Object.keys(groupedIcons).map((tag) => ({
31
- label:
32
- tag === "other" ? "General Icons" : `${tag.charAt(0).toUpperCase() + tag.slice(1)} Icons`,
33
- value: tag,
31
+ label:
32
+ tag === "other"
33
+ ? "General Icons"
34
+ : `${tag.charAt(0).toUpperCase() + tag.slice(1)} Icons`,
35
+ value: tag,
34
36
  }));
35
37
 
36
38
  export default {
37
- title: "Core/Icon",
38
- component: CustomIcon,
39
+ title: "Components/Icon",
40
+ component: CustomIcon,
39
41
 
40
- decorators: [
41
- () => {
42
- const [selectedGroups, setSelectedGroups] = useState([]);
43
- const [copiedIcon, setCopiedIcon] = useState(null);
42
+ decorators: [
43
+ () => {
44
+ const [selectedGroups, setSelectedGroups] = useState([]);
45
+ const [copiedIcon, setCopiedIcon] = useState(null);
44
46
 
45
- const handleGroupSelectionChange = (selectedValues) => {
46
- setSelectedGroups(selectedValues);
47
- };
47
+ const handleGroupSelectionChange = (selectedValues) => {
48
+ setSelectedGroups(selectedValues);
49
+ };
48
50
 
49
- const handleIconClick = (iconName) => {
50
- const tempInput = document.createElement("input");
51
- tempInput.value = iconName;
52
- tempInput.id = "temp-copy-input";
53
- tempInput.style.position = "absolute";
54
- tempInput.style.left = "-9999px";
55
- document.body.appendChild(tempInput);
51
+ const handleIconClick = (iconName) => {
52
+ const tempInput = document.createElement("input");
53
+ tempInput.value = iconName;
54
+ tempInput.id = "temp-copy-input";
55
+ tempInput.style.position = "absolute";
56
+ tempInput.style.left = "-9999px";
57
+ document.body.appendChild(tempInput);
56
58
 
57
- const success = copyToClipboard("temp-copy-input");
58
- document.body.removeChild(tempInput);
59
+ const success = copyToClipboard("temp-copy-input");
60
+ document.body.removeChild(tempInput);
59
61
 
60
- if (success) {
61
- setCopiedIcon(iconName);
62
- setTimeout(() => setCopiedIcon(null), 2000);
63
- }
64
- };
62
+ if (success) {
63
+ setCopiedIcon(iconName);
64
+ setTimeout(() => setCopiedIcon(null), 2000);
65
+ }
66
+ };
65
67
 
66
- const filteredGroupedIcons = {};
67
- Object.entries(groupedIcons).forEach(([tag, icons]) => {
68
- if (selectedGroups.length === 0 || selectedGroups.includes(tag)) {
69
- filteredGroupedIcons[tag] = icons;
70
- }
71
- });
68
+ const filteredGroupedIcons = {};
69
+ Object.entries(groupedIcons).forEach(([tag, icons]) => {
70
+ if (selectedGroups.length === 0 || selectedGroups.includes(tag)) {
71
+ filteredGroupedIcons[tag] = icons;
72
+ }
73
+ });
72
74
 
73
- return (
74
- <div style={{ margin: "3em" }}>
75
- <ThemeLayout>
76
- <div style={{ marginBottom: 30 }}>
77
- <h3 style={{ marginBottom: 15, fontSize: "1.1rem", fontWeight: "500" }}>
78
- Filter Icon Groups
79
- </h3>
80
- <Multiselect
81
- options={groupOptions}
82
- defaultSelected={selectedGroups}
83
- onChange={handleGroupSelectionChange}
84
- textWhenMultiple={`${selectedGroups.length} groups selected`}
85
- withCount={true}
86
- placeholder="Select icon groups to display (leave empty to show all)..."
87
- style={{ width: "100%" }}
88
- showSearch={true}
89
- selectionType="checkbox"
90
- />
91
- </div>
92
- <div style={{ display: "flex", flexDirection: "column", gap: 40 }}>
93
- {Object.entries(filteredGroupedIcons).map(([tag, icons]) => (
94
- <div key={tag}>
95
- <h2
96
- style={{
97
- marginBottom: 20,
98
- padding: "10px 0",
99
- borderBottom: "2px solid #e0e0e0",
100
- textTransform: "capitalize",
101
- fontSize: "1.5rem",
102
- fontWeight: "600",
103
- }}
104
- >
105
- {tag === "other" ? "General Icons" : `${tag} Icons`}
106
- </h2>
107
- <div
108
- style={{
109
- display: "grid",
110
- gridTemplateColumns:
111
- "repeat(auto-fill, minmax(120px, 1fr))",
112
- gap: 20,
113
- }}
114
- >
115
- {icons.map((iconName) => (
116
- <div
117
- key={iconName}
118
- onClick={() => handleIconClick(iconName)}
119
- style={{
120
- display: "flex",
121
- flexDirection: "column",
122
- alignItems: "center",
123
- padding: "15px",
124
- border: "1px solid #f0f0f0",
125
- borderRadius: "8px",
126
- backgroundColor:
127
- copiedIcon === iconName
128
- ? "#e8f5e8"
129
- : "#fafafa",
130
- cursor: "pointer",
131
- transition: "all 0.2s ease",
132
- position: "relative",
133
- }}
134
- >
135
- <div
136
- style={{
137
- display: "flex",
138
- justifyContent: "center",
139
- alignItems: "center",
140
- width: "45px",
141
- height: "45px",
142
- marginBottom: 8,
143
- }}
144
- >
145
- <CustomIcon
146
- name={iconName}
147
- size={28}
148
- color="black"
149
- />
150
- </div>
151
- <p
152
- style={{
153
- textAlign: "center",
154
- fontSize: "0.8rem",
155
- margin: 0,
156
- wordBreak: "break-word",
157
- lineHeight: "1.2",
158
- color:
159
- copiedIcon === iconName
160
- ? "#4CAF50"
161
- : "inherit",
162
- fontWeight:
163
- copiedIcon === iconName
164
- ? "600"
165
- : "normal",
166
- }}
167
- >
168
- {iconName}
169
- </p>
170
- {copiedIcon === iconName && (
171
- <div
172
- style={{
173
- position: "absolute",
174
- top: "5px",
175
- right: "5px",
176
- backgroundColor: "#4CAF50",
177
- color: "white",
178
- borderRadius: "50%",
179
- width: "20px",
180
- height: "20px",
181
- display: "flex",
182
- alignItems: "center",
183
- justifyContent: "center",
184
- fontSize: "12px",
185
- }}
186
- >
187
-
188
- </div>
189
- )}
190
- </div>
191
- ))}
192
- </div>
193
- </div>
194
- ))}
195
- </div>
196
- </ThemeLayout>
197
- </div>
198
- );
199
- },
200
- ],
75
+ return (
76
+ <div style={{ margin: "3em" }}>
77
+ <ThemeLayout>
78
+ <div style={{ marginBottom: 30 }}>
79
+ <h3
80
+ style={{
81
+ marginBottom: 15,
82
+ fontSize: "1.1rem",
83
+ fontWeight: "500",
84
+ }}
85
+ >
86
+ Filter Icon Groups
87
+ </h3>
88
+ <Multiselect
89
+ options={groupOptions}
90
+ defaultSelected={selectedGroups}
91
+ onChange={handleGroupSelectionChange}
92
+ textWhenMultiple={`${selectedGroups.length} groups selected`}
93
+ withCount={true}
94
+ placeholder="Select icon groups to display (leave empty to show all)..."
95
+ style={{ width: "100%" }}
96
+ showSearch={true}
97
+ selectionType="checkbox"
98
+ />
99
+ </div>
100
+ <div style={{ display: "flex", flexDirection: "column", gap: 40 }}>
101
+ {Object.entries(filteredGroupedIcons).map(([tag, icons]) => (
102
+ <div key={tag}>
103
+ <h2
104
+ style={{
105
+ marginBottom: 20,
106
+ padding: "10px 0",
107
+ borderBottom: "2px solid #e0e0e0",
108
+ textTransform: "capitalize",
109
+ fontSize: "1.5rem",
110
+ fontWeight: "600",
111
+ }}
112
+ >
113
+ {tag === "other" ? "General Icons" : `${tag} Icons`}
114
+ </h2>
115
+ <div
116
+ style={{
117
+ display: "grid",
118
+ gridTemplateColumns:
119
+ "repeat(auto-fill, minmax(120px, 1fr))",
120
+ gap: 20,
121
+ }}
122
+ >
123
+ {icons.map((iconName) => (
124
+ <div
125
+ key={iconName}
126
+ onClick={() => handleIconClick(iconName)}
127
+ style={{
128
+ display: "flex",
129
+ flexDirection: "column",
130
+ alignItems: "center",
131
+ padding: "15px",
132
+ border: "1px solid #f0f0f0",
133
+ borderRadius: "8px",
134
+ backgroundColor:
135
+ copiedIcon === iconName ? "#e8f5e8" : "#fafafa",
136
+ cursor: "pointer",
137
+ transition: "all 0.2s ease",
138
+ position: "relative",
139
+ }}
140
+ >
141
+ <div
142
+ style={{
143
+ display: "flex",
144
+ justifyContent: "center",
145
+ alignItems: "center",
146
+ width: "45px",
147
+ height: "45px",
148
+ marginBottom: 8,
149
+ }}
150
+ >
151
+ <CustomIcon name={iconName} size={28} color="black" />
152
+ </div>
153
+ <p
154
+ style={{
155
+ textAlign: "center",
156
+ fontSize: "0.8rem",
157
+ margin: 0,
158
+ wordBreak: "break-word",
159
+ lineHeight: "1.2",
160
+ color:
161
+ copiedIcon === iconName ? "#4CAF50" : "inherit",
162
+ fontWeight:
163
+ copiedIcon === iconName ? "600" : "normal",
164
+ }}
165
+ >
166
+ {iconName}
167
+ </p>
168
+ {copiedIcon === iconName && (
169
+ <div
170
+ style={{
171
+ position: "absolute",
172
+ top: "5px",
173
+ right: "5px",
174
+ backgroundColor: "#4CAF50",
175
+ color: "white",
176
+ borderRadius: "50%",
177
+ width: "20px",
178
+ height: "20px",
179
+ display: "flex",
180
+ alignItems: "center",
181
+ justifyContent: "center",
182
+ fontSize: "12px",
183
+ }}
184
+ >
185
+
186
+ </div>
187
+ )}
188
+ </div>
189
+ ))}
190
+ </div>
191
+ </div>
192
+ ))}
193
+ </div>
194
+ </ThemeLayout>
195
+ </div>
196
+ );
197
+ },
198
+ ],
201
199
  };
202
200
 
203
201
  export const Primary = {
204
- name: "Warning Icon",
205
- args: {
206
- name: "Warning",
207
- fill: "white",
208
- width: 20,
209
- height: 20,
210
- },
202
+ name: "Warning Icon",
203
+ args: {
204
+ name: "Warning",
205
+ fill: "white",
206
+ width: 20,
207
+ height: 20,
208
+ },
211
209
  };
@@ -2,51 +2,58 @@ import ProgressBar from "./index";
2
2
  import ThemeLayout from "../../ThemeLayout";
3
3
 
4
4
  export default {
5
- title: "Core/Progress/MultiBar Progress",
6
- component: ProgressBar,
7
- tags: ["autodocs"],
8
- decorators: [
9
- (Story) => (
10
- <div style={{ margin: "3em" }}>
11
- <ThemeLayout>
12
- <Story />
13
- </ThemeLayout>
14
- </div>
15
- ),
16
- ],
5
+ title: "Components/Progress/MultiBar Progress",
6
+ component: ProgressBar,
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
- name: "Default",
21
- args: {
22
- config: [
23
- { percentage: 30, color: "#FF99C3" },
24
- { percentage: 20, color: "#5AD8A6", placement: "bottom" },
25
- { percentage: 10, color: "#F6BD16" },
26
- ],
27
- },
28
- render: (args) => (
29
- <div>
30
- <ProgressBar {...args} />
31
- </div>
32
- ),
20
+ name: "Default",
21
+ args: {
22
+ config: [
23
+ { percentage: 30, color: "#FF99C3" },
24
+ { percentage: 20, color: "#5AD8A6", placement: "bottom" },
25
+ { percentage: 10, color: "#F6BD16" },
26
+ ],
27
+ },
28
+ render: (args) => (
29
+ <div>
30
+ <ProgressBar {...args} />
31
+ </div>
32
+ ),
33
33
  };
34
34
 
35
35
  export const CustomTooltip = {
36
- name: "Custom Tooltip",
37
- args: {
38
- config: [
39
- { percentage: 30, color: "#FF99C3", tooltipTitle: "Red LABEL" },
40
- { percentage: 20, color: "#5AD8A6", tooltipTitle: "Blue LABEL", placement: "bottom" },
41
- { percentage: 10, color: "#F6BD16", tooltipTitle: "Green LABEL" },
42
- ],
43
- renderTooltip: (item) => (
44
- <div style={{ color: item.color }}>{`${item.tooltipTitle} ${item.percentage}%`}</div>
45
- ),
46
- },
47
- render: (args) => (
48
- <div>
49
- <ProgressBar {...args} />
50
- </div>
51
- ),
36
+ name: "Custom Tooltip",
37
+ args: {
38
+ config: [
39
+ { percentage: 30, color: "#FF99C3", tooltipTitle: "Red LABEL" },
40
+ {
41
+ percentage: 20,
42
+ color: "#5AD8A6",
43
+ tooltipTitle: "Blue LABEL",
44
+ placement: "bottom",
45
+ },
46
+ { percentage: 10, color: "#F6BD16", tooltipTitle: "Green LABEL" },
47
+ ],
48
+ renderTooltip: (item) => (
49
+ <div
50
+ style={{ color: item.color }}
51
+ >{`${item.tooltipTitle} ${item.percentage}%`}</div>
52
+ ),
53
+ },
54
+ render: (args) => (
55
+ <div>
56
+ <ProgressBar {...args} />
57
+ </div>
58
+ ),
52
59
  };
@@ -2,38 +2,38 @@ import ProgressBar from "./index";
2
2
  import ThemeLayout from "../ThemeLayout";
3
3
 
4
4
  export default {
5
- title: "Core/Progress/Single Progress Bar",
6
- component: ProgressBar,
7
- tags: ["autodocs"],
8
- args: {
9
- percentage: 50,
10
- isSubmitted: true,
11
- },
12
- argTypes: {
13
- percentage: {
14
- control: {
15
- type: "range",
16
- min: 0,
17
- max: 100,
18
- },
19
- },
20
- },
21
- decorators: [
22
- (Story) => (
23
- <div style={{ margin: "3em" }}>
24
- <ThemeLayout>
25
- <Story />
26
- </ThemeLayout>
27
- </div>
28
- ),
29
- ],
5
+ title: "Components/Progress/Single Progress Bar",
6
+ component: ProgressBar,
7
+ tags: ["autodocs"],
8
+ args: {
9
+ percentage: 50,
10
+ isSubmitted: true,
11
+ },
12
+ argTypes: {
13
+ percentage: {
14
+ control: {
15
+ type: "range",
16
+ min: 0,
17
+ max: 100,
18
+ },
19
+ },
20
+ },
21
+ decorators: [
22
+ (Story) => (
23
+ <div style={{ margin: "3em" }}>
24
+ <ThemeLayout>
25
+ <Story />
26
+ </ThemeLayout>
27
+ </div>
28
+ ),
29
+ ],
30
30
  };
31
31
 
32
32
  export const Primary = {
33
- name: "Default",
34
- render: (args) => (
35
- <div>
36
- <ProgressBar {...args} />
37
- </div>
38
- ),
33
+ name: "Default",
34
+ render: (args) => (
35
+ <div>
36
+ <ProgressBar {...args} />
37
+ </div>
38
+ ),
39
39
  };