@trackunit/filters-asset-filter-definitions 0.0.524 → 0.0.526

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/index.cjs.js CHANGED
@@ -10,6 +10,7 @@ var react = require('react');
10
10
  var client = require('@apollo/client');
11
11
  var filtersGraphqlHook = require('@trackunit/filters-graphql-hook');
12
12
  var utilizationIndicator = require('@trackunit/utilization-indicator');
13
+ var geoJsonUtils = require('@trackunit/geo-json-utils');
13
14
  var reactComponents = require('@trackunit/react-components');
14
15
  var sharedUtils = require('@trackunit/shared-utils');
15
16
  var stringTs = require('string-ts');
@@ -1612,9 +1613,9 @@ const RecentSearchesFooter = ({ count, onClearAll }) => {
1612
1613
  return (jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-x-2 border-t-2 border-slate-300 px-2 py-0.5", children: [jsxRuntime.jsx(reactComponents.Text, { className: "py-0.5", size: "small", subtle: true, children: t("filters.shared.recentSearches") }), count > 1 ? (jsxRuntime.jsx(reactComponents.Button, { onClick: onClearAll, size: "small", variant: "ghost", children: t("filters.shared.clearAll") })) : null] }));
1613
1614
  };
1614
1615
 
1615
- const areaFilterGeometrySchema = zod.z.union([sharedUtils.geoJsonPolygonSchema, sharedUtils.geoJsonPointSchema]);
1616
+ const areaFilterGeometrySchema = zod.z.union([geoJsonUtils.geoJsonPolygonSchema, geoJsonUtils.geoJsonPointSchema]);
1616
1617
  const areaFilterInternalSchema = zod.z.object({
1617
- bBox: sharedUtils.geoJsonBboxSchema,
1618
+ bBox: geoJsonUtils.geoJsonBboxSchema,
1618
1619
  geometry: areaFilterGeometrySchema,
1619
1620
  properties: zod.z.object({
1620
1621
  formattedAddress: zod.z.string(),
@@ -1642,7 +1643,7 @@ const AreaView = (props) => {
1642
1643
  var _a, _b;
1643
1644
  return ((_b = (_a = stableData === null || stableData === void 0 ? void 0 : stableData.findPlaces) === null || _a === void 0 ? void 0 : _a.map(place => {
1644
1645
  var _a, _b;
1645
- const parsedBbox = sharedUtils.geoJsonBboxSchema.safeParse(place.bbox);
1646
+ const parsedBbox = geoJsonUtils.geoJsonBboxSchema.safeParse(place.bbox);
1646
1647
  const parsedGeometry = areaFilterGeometrySchema.safeParse(((_a = place.geometry) === null || _a === void 0 ? void 0 : _a.type)
1647
1648
  ? {
1648
1649
  type: stringTs.titleCase(place.geometry.type),
@@ -1665,7 +1666,7 @@ const AreaView = (props) => {
1665
1666
  if (!props.value) {
1666
1667
  return null;
1667
1668
  }
1668
- const placeholderBbox = sharedUtils.getBboxFromGeoJsonPolygon(props.value);
1669
+ const placeholderBbox = geoJsonUtils.getBboxFromGeoJsonPolygon(props.value);
1669
1670
  return placeholderBbox
1670
1671
  ? {
1671
1672
  bBox: placeholderBbox,
@@ -1739,7 +1740,7 @@ const AreaView = (props) => {
1739
1740
  else {
1740
1741
  // All other geometries are stored by the filter as a
1741
1742
  // polygon derived from the features bbox
1742
- props.filterBarActions.setArea(sharedUtils.getPolygonFromBbox(bBox));
1743
+ props.filterBarActions.setArea(geoJsonUtils.getPolygonFromBbox(bBox));
1743
1744
  }
1744
1745
  setSearchString(""); // Clear search input after selection
1745
1746
  }, value: (_b = (_a = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.properties.formattedAddress) !== null && _a !== void 0 ? _a : placeholderOption === null || placeholderOption === void 0 ? void 0 : placeholderOption.properties.formattedAddress) !== null && _b !== void 0 ? _b : "", children: filterResult.map(({ properties, dateIsoString }, index) => {
@@ -1785,7 +1786,7 @@ const getSelectedOption = (value, options) => {
1785
1786
  // All other geometries are stored by the filter as a
1786
1787
  // polygon derived from the features bbox
1787
1788
  // therefore we need to compare by that here to reverse the conversion
1788
- return JSON.stringify(sharedUtils.getPolygonFromBbox(option.bBox).coordinates) === JSON.stringify(value === null || value === void 0 ? void 0 : value.coordinates);
1789
+ return JSON.stringify(geoJsonUtils.getPolygonFromBbox(option.bBox).coordinates) === JSON.stringify(value === null || value === void 0 ? void 0 : value.coordinates);
1789
1790
  });
1790
1791
  };
1791
1792
 
@@ -3188,9 +3189,9 @@ const useSetFilterStateFromUrl = ({ setters }) => {
3188
3189
  //TODO: Delete once we've fully moved to geoJsonPolygon in url instead of converting the bb.
3189
3190
  // Leaving this here for now to not break the url.
3190
3191
  // Can likely be deleted in a year-or-so
3191
- setters.setArea(() => sharedUtils.getGeoJsonPolygonFromBoundingBox(value));
3192
+ setters.setArea(() => geoJsonUtils.getGeoJsonPolygonFromBoundingBox(value));
3192
3193
  });
3193
- handleSearchParamAsFilter("area", "area", search, sharedUtils.geoJsonPolygonSchema, errorHandler, value => {
3194
+ handleSearchParamAsFilter("area", "area", search, geoJsonUtils.geoJsonPolygonSchema, errorHandler, value => {
3194
3195
  setters.setArea(() => value);
3195
3196
  });
3196
3197
  handleSearchParamAsFilter("groups", "groups", search, groupSchema, errorHandler, value => {
package/index.esm.js CHANGED
@@ -8,8 +8,9 @@ import { useMemo, useState, useCallback, useRef, useEffect } from 'react';
8
8
  import { useQuery } from '@apollo/client';
9
9
  import { useActiveAssetFilters, useAssetQueryFilters } from '@trackunit/filters-graphql-hook';
10
10
  import { ActivityIndicator } from '@trackunit/utilization-indicator';
11
+ import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonBboxSchema, getBboxFromGeoJsonPolygon, getPolygonFromBbox, getGeoJsonPolygonFromBoundingBox } from '@trackunit/geo-json-utils';
11
12
  import { Tooltip, IconButton, Icon, Text, Button, useLocalStorage, useDebounce, useGeometry, usePrevious, Popover, PopoverTrigger, PopoverContent, MenuList, MenuItem } from '@trackunit/react-components';
12
- import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonBboxSchema, nonNullable, getBboxFromGeoJsonPolygon, getPolygonFromBbox, objectValues, hourIntervals, enumFromValue, objectKeys, getGeoJsonPolygonFromBoundingBox } from '@trackunit/shared-utils';
13
+ import { nonNullable, objectValues, hourIntervals, enumFromValue, objectKeys } from '@trackunit/shared-utils';
13
14
  import { titleCase, lowerCase } from 'string-ts';
14
15
  import { z } from 'zod';
15
16
  import { useMachineTypeTranslations } from '@trackunit/translations-machine-type';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-asset-filter-definitions",
3
- "version": "0.0.524",
3
+ "version": "0.0.526",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -22,6 +22,7 @@
22
22
  "@trackunit/react-core-hooks": "*",
23
23
  "@trackunit/react-form-components": "*",
24
24
  "@trackunit/shared-utils": "*",
25
+ "@trackunit/geo-json-utils": "*",
25
26
  "@graphql-typed-document-node/core": "^3.2.0",
26
27
  "@trackunit/iris-app-api": "*",
27
28
  "@trackunit/react-core-contexts-test": "*",