datastake-daf 0.6.99 → 0.6.100

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 (56) hide show
  1. package/.vscode/settings.json +13 -0
  2. package/dist/components/index.js +114 -54
  3. package/dist/style/datastake/_index.css +5 -0
  4. package/dist/style/datastake/datastake.css +5081 -0
  5. package/dist/style/datastake/fonts/Outfit-Black.ttf +0 -0
  6. package/dist/style/datastake/fonts/Outfit-Bold.ttf +0 -0
  7. package/dist/style/datastake/fonts/Outfit-ExtraBold.ttf +0 -0
  8. package/dist/style/datastake/fonts/Outfit-ExtraLight.ttf +0 -0
  9. package/dist/style/datastake/fonts/Outfit-Light.ttf +0 -0
  10. package/dist/style/datastake/fonts/Outfit-Medium.ttf +0 -0
  11. package/dist/style/datastake/fonts/Outfit-Regular.ttf +0 -0
  12. package/dist/style/datastake/fonts/Outfit-SemiBold.ttf +0 -0
  13. package/dist/style/datastake/fonts/Outfit-Thin.ttf +0 -0
  14. package/dist/style/datastake/fonts/outfit.css +62 -0
  15. package/dist/style/datastake/fonts/sf-ui-display-black-58646a6b80d5a.woff +0 -0
  16. package/dist/style/datastake/fonts/sf-ui-display-bold-58646a511e3d9.woff +0 -0
  17. package/dist/style/datastake/fonts/sf-ui-display-heavy-586470160b9e5.woff +0 -0
  18. package/dist/style/datastake/fonts/sf-ui-display-light-58646b33e0551.woff +0 -0
  19. package/dist/style/datastake/fonts/sf-ui-display-medium-58646be638f96.woff +0 -0
  20. package/dist/style/datastake/fonts/sf-ui-display-semibold-58646eddcae92.woff +0 -0
  21. package/dist/style/datastake/fonts/sf-ui-display-thin-58646e9b26e8b.woff +0 -0
  22. package/dist/style/datastake/fonts/sf-ui-display-ultralight-58646b19bf205.woff +0 -0
  23. package/dist/style/datastake/fonts/sfDisplay.css +59 -0
  24. package/dist/style/datastake/leaflet.css +671 -0
  25. package/dist/style/datastake/leaflet.markercluster.css +60 -0
  26. package/dist/style/style.css +1 -0
  27. package/package.json +1 -1
  28. package/rollup.config.js +83 -41
  29. package/src/@daf/core/components/Dashboard/Map/helper.js +439 -434
  30. package/src/@daf/core/components/Dashboard/Map/storyConfig1.js +233 -230
  31. package/src/helpers/Map.js +82 -6
  32. package/src/styles/_index.scss +1 -1
  33. package/src/styles/datastake/_index.css +5 -0
  34. package/src/styles/datastake/datastake.css +5081 -0
  35. package/src/styles/datastake/fonts/Outfit-Black.ttf +0 -0
  36. package/src/styles/datastake/fonts/Outfit-Bold.ttf +0 -0
  37. package/src/styles/datastake/fonts/Outfit-ExtraBold.ttf +0 -0
  38. package/src/styles/datastake/fonts/Outfit-ExtraLight.ttf +0 -0
  39. package/src/styles/datastake/fonts/Outfit-Light.ttf +0 -0
  40. package/src/styles/datastake/fonts/Outfit-Medium.ttf +0 -0
  41. package/src/styles/datastake/fonts/Outfit-Regular.ttf +0 -0
  42. package/src/styles/datastake/fonts/Outfit-SemiBold.ttf +0 -0
  43. package/src/styles/datastake/fonts/Outfit-Thin.ttf +0 -0
  44. package/src/styles/datastake/fonts/outfit.css +62 -0
  45. package/src/styles/datastake/fonts/sf-ui-display-black-58646a6b80d5a.woff +0 -0
  46. package/src/styles/datastake/fonts/sf-ui-display-bold-58646a511e3d9.woff +0 -0
  47. package/src/styles/datastake/fonts/sf-ui-display-heavy-586470160b9e5.woff +0 -0
  48. package/src/styles/datastake/fonts/sf-ui-display-light-58646b33e0551.woff +0 -0
  49. package/src/styles/datastake/fonts/sf-ui-display-medium-58646be638f96.woff +0 -0
  50. package/src/styles/datastake/fonts/sf-ui-display-semibold-58646eddcae92.woff +0 -0
  51. package/src/styles/datastake/fonts/sf-ui-display-thin-58646e9b26e8b.woff +0 -0
  52. package/src/styles/datastake/fonts/sf-ui-display-ultralight-58646b19bf205.woff +0 -0
  53. package/src/styles/datastake/fonts/sfDisplay.css +59 -0
  54. package/src/styles/datastake/leaflet.css +671 -0
  55. package/src/styles/datastake/leaflet.markercluster.css +60 -0
  56. package/src/styles/datastake.scss +1 -4454
@@ -0,0 +1,13 @@
1
+ {
2
+ "cSpell.words": ["cukura"],
3
+ "files.autoSave": "afterDelay",
4
+ "editor.wordWrap": "on",
5
+ "editor.autoClosingBrackets": "always",
6
+ "editor.autoClosingComments": "always",
7
+ "editor.autoClosingQuotes": "always",
8
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
9
+ "editor.formatOnPaste": true,
10
+ "editor.formatOnSave": true,
11
+ "notebook.defaultFormatter": "esbenp.prettier-vscode",
12
+ "javascript.format.semicolons": "insert"
13
+ }
@@ -13220,6 +13220,16 @@ const AjaxSelectRenderer = ({
13220
13220
  });
13221
13221
  };
13222
13222
 
13223
+ const EVENT_COLORS = {
13224
+ MAJOR: "#cf1322",
13225
+ // Red for major incidents
13226
+ MODERATE: "#fa8c16",
13227
+ // Orange for moderate incidents
13228
+ MINOR: "#fadb14",
13229
+ // Yellow for minor incidents
13230
+ CORRECTIVE: "#12b76a" // Green for corrective actions
13231
+ };
13232
+
13223
13233
  /**
13224
13234
  * Converts a latitude or longitude coordinate to degrees, minutes and seconds.
13225
13235
  *
@@ -13248,14 +13258,71 @@ const toDegreesMinutesAndSeconds = coordinate => {
13248
13258
  */
13249
13259
  const convertDMS = (lat, lng) => {
13250
13260
  const latitude = toDegreesMinutesAndSeconds(lat);
13251
- const latitudeCardinal = lat >= 0 ? 'N' : 'S';
13261
+ const latitudeCardinal = lat >= 0 ? "N" : "S";
13252
13262
  const longitude = toDegreesMinutesAndSeconds(lng);
13253
- const longitudeCardinal = lng >= 0 ? 'E' : 'W';
13263
+ const longitudeCardinal = lng >= 0 ? "E" : "W";
13254
13264
  return [latitude + '"' + latitudeCardinal, longitude + '"' + longitudeCardinal];
13255
13265
  };
13256
13266
  const southWest = L__default["default"].latLng(85, -180),
13257
13267
  northEast = L__default["default"].latLng(-85, 180),
13258
13268
  maxBounds = L__default["default"].latLngBounds(southWest, northEast);
13269
+ const getEventMarkerStyle = data => {
13270
+ const incidents = data?.data || [];
13271
+ const totals = {
13272
+ major: incidents.filter(d => d.type === "major_incident").length,
13273
+ minor: incidents.filter(d => d.type === "minor_incident").length,
13274
+ moderate: incidents.filter(d => d.type === "moderate_incident").length,
13275
+ correctiveActions: incidents.filter(d => d.type === "correctiveActions").length
13276
+ };
13277
+ const total = incidents.length;
13278
+ let background = "#f1f1f1";
13279
+ if (total > 0) {
13280
+ // Build a dynamic array of categories with colors & percentages
13281
+ const categories = [{
13282
+ key: "major",
13283
+ value: totals.major,
13284
+ color: EVENT_COLORS.MAJOR
13285
+ }, {
13286
+ key: "moderate",
13287
+ value: totals.moderate,
13288
+ color: EVENT_COLORS.MODERATE
13289
+ }, {
13290
+ key: "minor",
13291
+ value: totals.minor,
13292
+ color: EVENT_COLORS.MINOR
13293
+ }, {
13294
+ key: "corrective",
13295
+ value: totals.correctiveActions,
13296
+ color: EVENT_COLORS.CORRECTIVE
13297
+ }].filter(c => c.value > 0).map(c => ({
13298
+ ...c,
13299
+ perc: c.value / total * 100
13300
+ }));
13301
+ if (categories.length === 1) {
13302
+ background = categories[0].color;
13303
+ } else {
13304
+ const gradientStops = categories.map((cat, index) => {
13305
+ const stop = categories.slice(0, index).reduce((acc, c) => acc + c.perc, 0);
13306
+ return `${cat.color} ${Math.round(stop)}%`;
13307
+ });
13308
+ background = `radial-gradient(circle, ${gradientStops.join(", ")})`;
13309
+ }
13310
+ }
13311
+ let radius = 35;
13312
+ if (data.total > 20) {
13313
+ radius = 65;
13314
+ } else if (data.total > 10) {
13315
+ radius = 50;
13316
+ } else {
13317
+ radius = 40;
13318
+ }
13319
+ return {
13320
+ radius,
13321
+ background,
13322
+ totals,
13323
+ total
13324
+ };
13325
+ };
13259
13326
 
13260
13327
  const Styles$a = dt.div`
13261
13328
  display: flex;
@@ -16894,15 +16961,6 @@ function StakeholderIcon({
16894
16961
  });
16895
16962
  }
16896
16963
 
16897
- const EVENT_COLORS = {
16898
- MAJOR: "#cf1322",
16899
- // Red for major incidents
16900
- MODERATE: "#fa8c16",
16901
- // Orange for moderate incidents
16902
- MINOR: "#fadb14",
16903
- // Yellow for minor incidents
16904
- CORRECTIVE: "#12b76a" // Green for corrective actions
16905
- };
16906
16964
  function useMapHelper$1({
16907
16965
  type,
16908
16966
  mapRef,
@@ -16999,11 +17057,6 @@ function useMapHelper$1({
16999
17057
  return null;
17000
17058
  }, [mapRef, renderMarker]);
17001
17059
 
17002
- // console.log({
17003
- // activeMarker,
17004
- // mapMarkers,
17005
- // });
17006
-
17007
17060
  // Draws the marker in the map and saves it in mapMarkers state
17008
17061
  const addIconToMapInitialy = React.useCallback((coordinates, groupName, markerName, data, maxTotal = 0, i = 0) => {
17009
17062
  if (mapRef) {
@@ -17013,55 +17066,62 @@ function useMapHelper$1({
17013
17066
  let iconSize = [25, 25];
17014
17067
  if (type === "event") {
17015
17068
  iconClassName = "incident rounded";
17016
- const incidents = data?.data || [];
17069
+
17070
+ /* const incidents = data?.data || [];
17017
17071
  const totals = {
17018
- major: incidents.filter(d => d.type === "major_incident").length,
17019
- minor: incidents.filter(d => d.type === "minor_incident").length,
17020
- moderate: incidents.filter(d => d.type === "moderate_incident").length,
17021
- correctiveActions: incidents.filter(d => d.type === "correctiveActions").length
17072
+ major: incidents.filter((d) => d.type === "major_incident").length,
17073
+ minor: incidents.filter((d) => d.type === "minor_incident").length,
17074
+ moderate: incidents.filter((d) => d.type === "moderate_incident").length,
17075
+ correctiveActions: incidents.filter((d) => d.type === "correctiveActions")
17076
+ .length,
17022
17077
  };
17023
17078
  const total = incidents.length;
17024
17079
  let background = "#f1f1f1";
17025
17080
  if (total > 0) {
17026
- // Build a dynamic array of categories with colors & percentages
17027
- const categories = [{
17028
- key: "major",
17029
- value: totals.major,
17030
- color: EVENT_COLORS.MAJOR
17031
- }, {
17032
- key: "moderate",
17033
- value: totals.moderate,
17034
- color: EVENT_COLORS.MODERATE
17035
- }, {
17036
- key: "minor",
17037
- value: totals.minor,
17038
- color: EVENT_COLORS.MINOR
17039
- }, {
17040
- key: "corrective",
17041
- value: totals.correctiveActions,
17042
- color: EVENT_COLORS.CORRECTIVE
17043
- }].filter(c => c.value > 0).map(c => ({
17044
- ...c,
17045
- perc: c.value / total * 100
17046
- }));
17047
- if (categories.length === 1) {
17048
- background = categories[0].color;
17049
- } else {
17050
- const gradientStops = categories.map((cat, index) => {
17051
- const stop = categories.slice(0, index).reduce((acc, c) => acc + c.perc, 0);
17052
- return `${cat.color} ${Math.round(stop)}%`;
17053
- });
17054
- background = `radial-gradient(circle, ${gradientStops.join(", ")})`;
17055
- }
17081
+ const categories = [
17082
+ { key: "major", value: totals.major, color: EVENT_COLORS.MAJOR },
17083
+ {
17084
+ key: "moderate",
17085
+ value: totals.moderate,
17086
+ color: EVENT_COLORS.MODERATE,
17087
+ },
17088
+ { key: "minor", value: totals.minor, color: EVENT_COLORS.MINOR },
17089
+ {
17090
+ key: "corrective",
17091
+ value: totals.correctiveActions,
17092
+ color: EVENT_COLORS.CORRECTIVE,
17093
+ },
17094
+ ]
17095
+ .filter((c) => c.value > 0)
17096
+ .map((c) => ({ ...c, perc: (c.value / total) * 100 }));
17097
+ if (categories.length === 1) {
17098
+ background = categories[0].color;
17099
+ } else {
17100
+ let currentStop = 0;
17101
+ const gradientStops = categories.map((cat, index) => {
17102
+ const stop = categories
17103
+ .slice(0, index)
17104
+ .reduce((acc, c) => acc + c.perc, 0);
17105
+ return `${cat.color} ${Math.round(stop)}%`;
17106
+ });
17107
+ background = `radial-gradient(circle, ${gradientStops.join(", ")})`;
17108
+ }
17056
17109
  }
17057
17110
  let radius = 35;
17058
17111
  if (data.total > 20) {
17059
- radius = 65;
17112
+ radius = 65;
17060
17113
  } else if (data.total > 10) {
17061
- radius = 50;
17114
+ radius = 50;
17062
17115
  } else {
17063
- radius = 40;
17116
+ radius = 40;
17064
17117
  }
17118
+ */
17119
+
17120
+ const {
17121
+ background,
17122
+ radius,
17123
+ totals
17124
+ } = getEventMarkerStyle(data);
17065
17125
  innerHtml = `
17066
17126
  <div class="main" style="background: ${background}; border: 2px solid white; width: ${radius}px; height: ${radius}px;">
17067
17127
  <span>${data.total || 0}</span>
@@ -0,0 +1,5 @@
1
+ @import "./fonts/outfit.css";
2
+ @import "./fonts/sfDisplay.css";
3
+ @import "./datastake.css";
4
+ @import "./leaflet.css";
5
+ @import "./leaflet.markercluster.css";