datastake-daf 0.6.803 → 0.6.804

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.
@@ -12579,7 +12579,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
12579
12579
  hardcodedData: PropTypes__default["default"].array
12580
12580
  });
12581
12581
 
12582
- const Container$2 = styled__default["default"].div`
12582
+ const Container$1 = styled__default["default"].div`
12583
12583
  height: ${props => props.height || '300px'};
12584
12584
  width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
12585
12585
  `;
@@ -12853,7 +12853,7 @@ function LineChart({
12853
12853
  className: "flex flex-1 flex-column justify-content-center",
12854
12854
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
12855
12855
  className: "flex justify-content-center",
12856
- children: /*#__PURE__*/jsxRuntime.jsx(Container$2, {
12856
+ children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
12857
12857
  ref: containerRef,
12858
12858
  height: height,
12859
12859
  isPdf: isPdf,
@@ -14767,7 +14767,7 @@ function BarChart({
14767
14767
  className: "flex flex-1 flex-column justify-content-center",
14768
14768
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
14769
14769
  className: "flex justify-content-center",
14770
- children: /*#__PURE__*/jsxRuntime.jsx(Container$2, {
14770
+ children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
14771
14771
  ref: containerRef,
14772
14772
  height: height,
14773
14773
  isPdf: isPdf,
@@ -44748,7 +44748,7 @@ function RadialBarChart({
44748
44748
  className: "flex flex-1 flex-column justify-content-center",
44749
44749
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
44750
44750
  className: "flex justify-content-center",
44751
- children: /*#__PURE__*/jsxRuntime.jsx(Container$2, {
44751
+ children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
44752
44752
  ref: containerRef,
44753
44753
  isPdf: isPdf
44754
44754
  })
@@ -48526,6 +48526,218 @@ const VegetationContainer = styled__default["default"].div`
48526
48526
  }
48527
48527
  `;
48528
48528
 
48529
+ const getFaunaConfig = () => {
48530
+ return [{
48531
+ img: "/Biodiversity/birds.svg",
48532
+ key: "birds",
48533
+ disabled: "/Biodiversity/birds-default.svg"
48534
+ }, {
48535
+ img: "/Biodiversity/crabs.svg",
48536
+ key: "crabs",
48537
+ disabled: "/Biodiversity/crabs-default.svg"
48538
+ }, {
48539
+ img: "/Biodiversity/cymbium.svg",
48540
+ key: "cymbium",
48541
+ disabled: "/Biodiversity/cymbium-default.svg"
48542
+ }, {
48543
+ img: "/Biodiversity/fish.svg",
48544
+ key: "fish",
48545
+ disabled: "/Biodiversity/fish-default.svg"
48546
+ }, {
48547
+ img: "/Biodiversity/juveniles.svg",
48548
+ key: "juveniles",
48549
+ disabled: "/Biodiversity/juveniles-default.svg"
48550
+ }, {
48551
+ img: "/Biodiversity/mollusks.svg",
48552
+ key: "mollusks",
48553
+ disabled: "/Biodiversity/mollusks-default.svg"
48554
+ }, {
48555
+ img: "/Biodiversity/mongooses.svg",
48556
+ key: "mongooses",
48557
+ disabled: "/Biodiversity/mongooses-default.svg"
48558
+ }, {
48559
+ img: "/Biodiversity/monkeys.svg",
48560
+ key: "monkeys",
48561
+ disabled: "/Biodiversity/monkeys-default.svg"
48562
+ }, {
48563
+ img: "/Biodiversity/oysters.svg",
48564
+ key: "oysters",
48565
+ disabled: "/Biodiversity/oysters-default.svg"
48566
+ }, {
48567
+ img: "/Biodiversity/snails.svg",
48568
+ key: "snails",
48569
+ disabled: "/Biodiversity/snails-default.svg"
48570
+ }];
48571
+ };
48572
+
48573
+ function FaunaWidget({
48574
+ title = "Observed Fauna",
48575
+ faunaPresent = [],
48576
+ filterKeys = null,
48577
+ columnsPerRow = 5,
48578
+ itemWidth = 100,
48579
+ itemHeight = 100,
48580
+ t = key => key,
48581
+ ...props
48582
+ }) {
48583
+ let faunaConfig = getFaunaConfig();
48584
+
48585
+ // Filter to show only specific keys if filterKeys is provided
48586
+ if (filterKeys && Array.isArray(filterKeys)) {
48587
+ faunaConfig = faunaConfig.filter(item => filterKeys.includes(item.key));
48588
+ }
48589
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
48590
+ title: title,
48591
+ className: `with-border-header no-p-body`,
48592
+ ...props,
48593
+ children: /*#__PURE__*/jsxRuntime.jsx(FaunaWrapper, {
48594
+ $columnsPerRow: columnsPerRow,
48595
+ children: /*#__PURE__*/jsxRuntime.jsx(FaunaContainer, {
48596
+ $columnsPerRow: columnsPerRow,
48597
+ $itemWidth: itemWidth,
48598
+ $itemHeight: itemHeight,
48599
+ children: faunaConfig.map(item => {
48600
+ // Use colored SVG if the item's key exists in faunaPresent array
48601
+ // Otherwise use default SVG
48602
+ const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(item.key);
48603
+ const shouldUseColored = isPresent;
48604
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
48605
+ title: t(`straatos::${item.key}`),
48606
+ children: /*#__PURE__*/jsxRuntime.jsx("img", {
48607
+ src: shouldUseColored ? item.img : item.disabled,
48608
+ className: `fauna-item`,
48609
+ alt: item.key
48610
+ }, item.key)
48611
+ }, item.key);
48612
+ })
48613
+ })
48614
+ })
48615
+ });
48616
+ }
48617
+ const FaunaWrapper = styled__default["default"].div`
48618
+ padding: 24px;
48619
+ width: 100%;
48620
+ ${props => props.$columnsPerRow ? `
48621
+ overflow-x: auto;
48622
+ ` : ''}
48623
+ `;
48624
+ const FaunaContainer = styled__default["default"].div`
48625
+ display: grid;
48626
+ grid-template-columns: ${props => props.$columnsPerRow ? `repeat(${props.$columnsPerRow}, 1fr)` : `repeat(auto-fit, minmax(${props.$itemWidth}px, 1fr))`};
48627
+ gap: 24px;
48628
+ width: 100%;
48629
+
48630
+ .fauna-item {
48631
+ width: 100%;
48632
+ aspect-ratio: ${props => props.$itemWidth / props.$itemHeight};
48633
+ border-radius: 7px;
48634
+ flex-shrink: 0;
48635
+ display: block;
48636
+ margin: 0;
48637
+ padding: 0;
48638
+ object-fit: contain;
48639
+ }
48640
+ `;
48641
+
48642
+ const getInvasiveSpeciesConfig = () => {
48643
+ return [{
48644
+ img: "/Biodiversity/spiders.svg",
48645
+ key: "spiders",
48646
+ disabled: "/Biodiversity/spiders-default.svg"
48647
+ }, {
48648
+ img: "/Biodiversity/scale-insects.svg",
48649
+ key: "scaleInsects",
48650
+ disabled: "/Biodiversity/scale-insects-default.svg"
48651
+ }, {
48652
+ img: "/Biodiversity/caterpillars.svg",
48653
+ key: "caterpillars",
48654
+ disabled: "/Biodiversity/caterpillars-default.svg"
48655
+ }, {
48656
+ img: "/Biodiversity/ants.svg",
48657
+ key: "ants",
48658
+ disabled: "/Biodiversity/ants-default.svg"
48659
+ }, {
48660
+ img: "/Biodiversity/unidentified-pests.svg",
48661
+ key: "unidentifiedPests",
48662
+ disabled: "/Biodiversity/unidentified-pests-default.svg"
48663
+ }, {
48664
+ img: "/Biodiversity/others.svg",
48665
+ key: "other",
48666
+ disabled: "/Biodiversity/others-default.svg"
48667
+ }];
48668
+ };
48669
+
48670
+ function InvasiveSpeciesWidget({
48671
+ title = "Invasive Species",
48672
+ invasiveSpecies = [],
48673
+ hasInvasiveSpecies,
48674
+ filterKeys = null,
48675
+ columnsPerRow = 3,
48676
+ itemWidth = 100,
48677
+ itemHeight = 100,
48678
+ t = key => key,
48679
+ ...props
48680
+ }) {
48681
+ let invasiveSpeciesConfig = getInvasiveSpeciesConfig();
48682
+
48683
+ // Filter to show only specific keys if filterKeys is provided
48684
+ if (filterKeys && Array.isArray(filterKeys)) {
48685
+ invasiveSpeciesConfig = invasiveSpeciesConfig.filter(item => filterKeys.includes(item.key));
48686
+ }
48687
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
48688
+ title: title,
48689
+ className: `with-border-header no-p-body`,
48690
+ ...props,
48691
+ children: /*#__PURE__*/jsxRuntime.jsx(InvasiveSpeciesWrapper, {
48692
+ $columnsPerRow: columnsPerRow,
48693
+ children: /*#__PURE__*/jsxRuntime.jsx(InvasiveSpeciesContainer, {
48694
+ $columnsPerRow: columnsPerRow,
48695
+ $itemWidth: itemWidth,
48696
+ $itemHeight: itemHeight,
48697
+ children: invasiveSpeciesConfig.map(item => {
48698
+ // If hasInvasiveSpecies is 'no', show all as inactive
48699
+ // If hasInvasiveSpecies is 'yes', show present ones as active
48700
+ const shouldShowAllAsNotPresent = hasInvasiveSpecies === 'no';
48701
+ const isPresent = !shouldShowAllAsNotPresent && Array.isArray(invasiveSpecies) && invasiveSpecies.includes(item.key);
48702
+ const shouldUseColored = isPresent;
48703
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
48704
+ title: t(`straatos::${item.key}`),
48705
+ children: /*#__PURE__*/jsxRuntime.jsx("img", {
48706
+ src: shouldUseColored ? item.img : item.disabled,
48707
+ className: `invasive-species-item`,
48708
+ alt: item.key
48709
+ }, item.key)
48710
+ }, item.key);
48711
+ })
48712
+ })
48713
+ })
48714
+ });
48715
+ }
48716
+ const InvasiveSpeciesWrapper = styled__default["default"].div`
48717
+ padding: 24px;
48718
+ width: 100%;
48719
+ ${props => props.$columnsPerRow ? `
48720
+ overflow-x: auto;
48721
+ ` : ''}
48722
+ `;
48723
+ const InvasiveSpeciesContainer = styled__default["default"].div`
48724
+ display: grid;
48725
+ grid-template-columns: ${props => props.$columnsPerRow ? `repeat(${props.$columnsPerRow}, 1fr)` : `repeat(auto-fit, minmax(${props.$itemWidth}px, 1fr))`};
48726
+ gap: 24px;
48727
+ width: 100%;
48728
+
48729
+ .invasive-species-item {
48730
+ width: 100%;
48731
+ aspect-ratio: ${props => props.$itemWidth / props.$itemHeight};
48732
+ border-radius: 7px;
48733
+ flex-shrink: 0;
48734
+ display: block;
48735
+ margin: 0;
48736
+ padding: 0;
48737
+ object-fit: contain;
48738
+ }
48739
+ `;
48740
+
48529
48741
  const RepeatableGroup = ({
48530
48742
  name = null,
48531
48743
  config = {},
@@ -50283,7 +50495,7 @@ function ColumnChart({
50283
50495
  className: "flex flex-1 flex-column justify-content-center",
50284
50496
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50285
50497
  className: "flex justify-content-center",
50286
- children: /*#__PURE__*/jsxRuntime.jsx(Container$2, {
50498
+ children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50287
50499
  ref: containerRef,
50288
50500
  height: height,
50289
50501
  isPdf: isPdf,
@@ -50441,7 +50653,7 @@ function DonutPie({
50441
50653
  className: "flex flex-1 flex-column justify-content-center",
50442
50654
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50443
50655
  className: "flex justify-content-center",
50444
- children: /*#__PURE__*/jsxRuntime.jsx(Container$2, {
50656
+ children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50445
50657
  ref: containerRef,
50446
50658
  style: {
50447
50659
  height
@@ -57349,7 +57561,7 @@ const SeedlingsHeight = ({
57349
57561
  });
57350
57562
  };
57351
57563
 
57352
- const Container$1 = styled__default["default"].div`
57564
+ const Container = styled__default["default"].div`
57353
57565
  display: grid;
57354
57566
  grid-template-columns: repeat(3, 1fr);
57355
57567
  gap: 24px;
@@ -57386,7 +57598,7 @@ const MangroveGrowthAndSurvival = ({
57386
57598
  title: t("Mangrove Growth and Survival"),
57387
57599
  className: "with-border-header h-w-btn-header",
57388
57600
  children: /*#__PURE__*/jsxRuntime.jsxs("section", {
57389
- children: [/*#__PURE__*/jsxRuntime.jsxs(Container$1, {
57601
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Container, {
57390
57602
  children: [/*#__PURE__*/jsxRuntime.jsx(PlantedSpecies, {
57391
57603
  plantedSpecies: activityData?.plantedSpecies,
57392
57604
  mangroveSpecies: options?.mangroveSpecies,
@@ -57432,57 +57644,22 @@ const MangroveGrowthAndSurvival = ({
57432
57644
  });
57433
57645
  };
57434
57646
 
57435
- const FAUNA_KEYS = ['birds', 'juveniles', 'crabs', 'cymbium', 'fish', 'mongooses', 'mollusks', 'monkeys', 'oysters', 'snails', 'caterpillars', 'animal_tracks', 'other'];
57436
- const INVASIVE_SPECIES_KEYS = ['spiders', 'scaleInsects', 'caterpillars', 'unidentifiedPests', 'other'];
57437
- const formatFaunaLabel = key => {
57438
- return key.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
57439
- };
57440
- const formatInvasiveSpeciesLabel = key => {
57441
- return key.replace(/([A-Z])/g, ' $1').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
57442
- };
57443
- const createFaunaIndicatorConfig = (key, faunaPresent, t) => {
57444
- const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(key);
57445
- const label = formatFaunaLabel(key);
57446
- return {
57447
- label: t(label),
57448
- type: isPresent ? 'compliant' : 'notCompliant',
57449
- statusIcon: isPresent ? 'Check' : 'Close',
57450
- statusIconColor: isPresent ? '#12B76A' : '#6C737F',
57451
- statusBadgeBackgroundColor: isPresent ? undefined : '#F9FAFB',
57452
- statusBadgeBorderColor: isPresent ? undefined : '#E5E7EB'
57453
- };
57454
- };
57455
- const createInvasiveSpeciesIndicatorConfig = (key, invasiveSpecies, hasInvasiveSpecies, t) => {
57456
- const shouldShowAllAsNotPresent = hasInvasiveSpecies === 'no';
57457
- const shouldShowRedForPresent = hasInvasiveSpecies === 'yes';
57458
- const isPresent = !shouldShowAllAsNotPresent && Array.isArray(invasiveSpecies) && invasiveSpecies.includes(key);
57459
- const isRedBadge = isPresent && shouldShowRedForPresent;
57460
- const label = formatInvasiveSpeciesLabel(key);
57461
- return {
57462
- label: t(label),
57463
- type: isPresent ? 'compliant' : 'notCompliant',
57464
- statusIcon: isPresent ? 'Check' : 'Close',
57465
- statusIconColor: isRedBadge ? '#D92D20' : isPresent ? '#12B76A' : '#6C737F',
57466
- statusBadgeBackgroundColor: isRedBadge ? '#FEE4E2' : isPresent ? undefined : '#F9FAFB',
57467
- statusBadgeBorderColor: isRedBadge ? '#FDA29B' : isPresent ? undefined : '#E5E7EB'
57468
- };
57469
- };
57470
- const generateFaunaConfig = (faunaPresent, t) => {
57471
- return FAUNA_KEYS.map(key => createFaunaIndicatorConfig(key, faunaPresent, t));
57472
- };
57473
- const generateInvasiveSpeciesConfig = (invasiveSpecies, hasInvasiveSpecies, t) => {
57474
- return INVASIVE_SPECIES_KEYS.map(key => createInvasiveSpeciesIndicatorConfig(key, invasiveSpecies, hasInvasiveSpecies, t));
57475
- };
57476
-
57477
- const Container = styled__default["default"].div`
57478
- display: grid;
57479
- grid-template-columns: 70% 28.5%;
57647
+ const BiodiversityContainer = styled__default["default"].div`
57648
+ display: flex;
57480
57649
  gap: 24px;
57481
57650
  width: 100%;
57651
+
57482
57652
  @media (max-width: 768px) {
57483
- grid-template-columns: 1fr;
57653
+ flex-direction: column;
57484
57654
  }
57485
57655
  `;
57656
+ const FaunaSection = styled__default["default"].section`
57657
+ width: 60%;
57658
+ min-width: 0;
57659
+ `;
57660
+ const InvasiveSpeciesSection = styled__default["default"].section`
57661
+ width: 38.5%;
57662
+ `;
57486
57663
  const BiodiversityAndHabitat = ({
57487
57664
  faunaPresent = [],
57488
57665
  invasiveSpecies = [],
@@ -57490,28 +57667,32 @@ const BiodiversityAndHabitat = ({
57490
57667
  loading = false,
57491
57668
  t = s => s
57492
57669
  }) => {
57493
- const observedFaunaConfig = React.useMemo(() => generateFaunaConfig(faunaPresent, t), [faunaPresent, t]);
57494
- const invasiveSpeciesConfig = React.useMemo(() => generateInvasiveSpeciesConfig(invasiveSpecies, hasInvasiveSpecies, t), [invasiveSpecies, hasInvasiveSpecies, t]);
57495
57670
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
57496
57671
  title: t("Biodiversity & Habitat"),
57497
57672
  className: "with-border-header h-w-btn-header",
57498
- children: /*#__PURE__*/jsxRuntime.jsx("section", {
57499
- children: /*#__PURE__*/jsxRuntime.jsxs(Container, {
57500
- children: [/*#__PURE__*/jsxRuntime.jsx(ActivityIndicatorsWidget, {
57673
+ children: /*#__PURE__*/jsxRuntime.jsxs(BiodiversityContainer, {
57674
+ children: [/*#__PURE__*/jsxRuntime.jsx(FaunaSection, {
57675
+ children: /*#__PURE__*/jsxRuntime.jsx(FaunaWidget, {
57501
57676
  title: t("Observed Fauna"),
57502
- config: observedFaunaConfig,
57677
+ faunaPresent: faunaPresent,
57678
+ columnsPerRow: 5,
57679
+ itemWidth: 120,
57680
+ itemHeight: 120,
57503
57681
  loading: loading,
57504
- widgetClassName: "h-w-btn-header",
57505
57682
  t: t
57506
- }), /*#__PURE__*/jsxRuntime.jsx(ActivityIndicatorsWidget, {
57683
+ })
57684
+ }), /*#__PURE__*/jsxRuntime.jsx(InvasiveSpeciesSection, {
57685
+ children: /*#__PURE__*/jsxRuntime.jsx(InvasiveSpeciesWidget, {
57507
57686
  title: t("Invasive Species"),
57508
- config: invasiveSpeciesConfig,
57687
+ invasiveSpecies: invasiveSpecies,
57688
+ hasInvasiveSpecies: hasInvasiveSpecies,
57689
+ columnsPerRow: 3,
57690
+ itemWidth: 100,
57691
+ itemHeight: 100,
57509
57692
  loading: loading,
57510
- className: "single-column",
57511
- widgetClassName: "h-w-btn-header",
57512
57693
  t: t
57513
- })]
57514
- })
57694
+ })
57695
+ })]
57515
57696
  })
57516
57697
  });
57517
57698
  };