@redus/georedus-ui 0.15.0 → 0.17.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @orioro/template-react
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - expose leftPanel.categoryIcons
8
+
9
+ ## 0.16.0
10
+
11
+ ### Minor Changes
12
+
13
+ - expose leftPanel props
14
+
3
15
  ## 0.15.0
4
16
 
5
17
  ### Minor Changes
@@ -1,4 +1,5 @@
1
- export function LeftPanel({ viewConfState, viewConfDispatch, viewSpecs, resolvedViews, open, onSetOpen, syncedMapsRef, mapContainerRef, }: {
1
+ export const LeftPanel: React.MemoExoticComponent<typeof LeftPanelInner>;
2
+ declare function LeftPanelInner({ viewConfState, viewConfDispatch, viewSpecs, resolvedViews, open, onSetOpen, syncedMapsRef, mapContainerRef, categoryIcons, header: customHeader, footer: customFooter, }: {
2
3
  viewConfState: any;
3
4
  viewConfDispatch: any;
4
5
  viewSpecs: any;
@@ -7,5 +8,9 @@ export function LeftPanel({ viewConfState, viewConfDispatch, viewSpecs, resolved
7
8
  onSetOpen: any;
8
9
  syncedMapsRef: any;
9
10
  mapContainerRef: any;
11
+ categoryIcons?: undefined;
12
+ header?: undefined;
13
+ footer?: undefined;
10
14
  }): React.JSX.Element;
11
15
  import React from 'react';
16
+ export {};
@@ -1,4 +1,4 @@
1
- export function ViewMenu({ viewSpecs, viewConfState, resolvedViews, onSetView, onDeactivateView, style, ...props }: {
1
+ export function ViewMenu({ viewSpecs, viewConfState, resolvedViews, onSetView, onDeactivateView, style, categoryIcons, ...props }: {
2
2
  [x: string]: any;
3
3
  viewSpecs: any;
4
4
  viewConfState: any;
@@ -6,5 +6,13 @@ export function ViewMenu({ viewSpecs, viewConfState, resolvedViews, onSetView, o
6
6
  onSetView: any;
7
7
  onDeactivateView: any;
8
8
  style: any;
9
+ categoryIcons?: {
10
+ 'populacao-e-domicilios': React.JSX.Element;
11
+ educacao: React.JSX.Element;
12
+ 'infraestrutura-e-servicos-urbanos': React.JSX.Element;
13
+ saude: React.JSX.Element;
14
+ 'emergencias-climaticas': React.JSX.Element;
15
+ 'divisoes-territoriais': React.JSX.Element;
16
+ } | undefined;
9
17
  }): React.JSX.Element;
10
18
  import React from 'react';
package/dist/main.js CHANGED
@@ -16,7 +16,7 @@ import { scaleQuantile } from 'd3-scale';
16
16
  import { csvParse } from 'd3-dsv';
17
17
  import { strAutoCast } from '@orioro/cast';
18
18
  import { fmtLayerAbsoluteId, waves_1, makeSyncedMaps, LayeredMap, svgImageGenerator, SVG_PATTERNS, useMapRegistry, useTilesLoading, HoverTooltip, layeredMapOnClickHandler, DynamicImages, ControlContainer, InspectControl, MapWindow, TerrainControl, fitGeometry } from '@orioro/react-maplibre-util';
19
- import React$1, { useState, useMemo, useCallback, useContext, createContext, useReducer, useEffect, useRef } from 'react';
19
+ import React$1, { useState, useMemo, useCallback, useContext, createContext, memo, useReducer, useEffect, useRef } from 'react';
20
20
  import styled, { keyframes } from 'styled-components';
21
21
  import { colord } from 'colord';
22
22
  import { Heading, Portal, Badge, Tabs, Tooltip, IconButton, Theme, Text, Popover, Dialog } from '@radix-ui/themes';
@@ -8202,9 +8202,9 @@ function ViewControl(_ref8) {
8202
8202
  }))));
8203
8203
  }
8204
8204
 
8205
- var _excluded$3 = ["viewSpecs", "viewConfState", "resolvedViews", "onSetView", "onDeactivateView", "style"];
8205
+ var _excluded$3 = ["viewSpecs", "viewConfState", "resolvedViews", "onSetView", "onDeactivateView", "style", "categoryIcons"];
8206
8206
  var _templateObject$3, _templateObject2$1;
8207
- var STATIC_NODE_ICONS = {
8207
+ var CATEGORY_ICONS = {
8208
8208
  'populacao-e-domicilios': /*#__PURE__*/React$1.createElement(Icon, {
8209
8209
  path: mdiAccountGroup
8210
8210
  }),
@@ -8350,6 +8350,8 @@ function ViewMenu(_ref4) {
8350
8350
  onSetView = _ref4.onSetView,
8351
8351
  onDeactivateView = _ref4.onDeactivateView,
8352
8352
  style = _ref4.style,
8353
+ _ref4$categoryIcons = _ref4.categoryIcons,
8354
+ categoryIcons = _ref4$categoryIcons === void 0 ? CATEGORY_ICONS : _ref4$categoryIcons,
8353
8355
  props = _objectWithoutProperties(_ref4, _excluded$3);
8354
8356
  var viewSpecsById = useMemo(function () {
8355
8357
  return Object.fromEntries(viewSpecs.map(function (spec) {
@@ -8385,7 +8387,7 @@ function ViewMenu(_ref4) {
8385
8387
  style: {
8386
8388
  position: 'relative'
8387
8389
  }
8388
- }, STATIC_NODE_ICONS[node.id], activeViewsCount > 0 && /*#__PURE__*/React$1.createElement(ActiveCounter, null, activeViewsCount));
8390
+ }, categoryIcons[node.id] || node.id, activeViewsCount > 0 && /*#__PURE__*/React$1.createElement(ActiveCounter, null, activeViewsCount));
8389
8391
  }
8390
8392
  }, props))));
8391
8393
  }
@@ -8646,7 +8648,7 @@ var OPEN_WIDTH = {
8646
8648
  var CLOSED_WIDTH = '60px';
8647
8649
  var HEADER_HEIGHT = 60;
8648
8650
  var LogoContainer = styled(Flex)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n height: 100%;\n\n svg {\n height: 100%;\n width: auto;\n }\n"])));
8649
- function LeftPanel(_ref) {
8651
+ function LeftPanelInner(_ref) {
8650
8652
  var viewConfState = _ref.viewConfState,
8651
8653
  viewConfDispatch = _ref.viewConfDispatch,
8652
8654
  viewSpecs = _ref.viewSpecs,
@@ -8654,8 +8656,54 @@ function LeftPanel(_ref) {
8654
8656
  open = _ref.open,
8655
8657
  onSetOpen = _ref.onSetOpen,
8656
8658
  syncedMapsRef = _ref.syncedMapsRef,
8657
- mapContainerRef = _ref.mapContainerRef;
8659
+ mapContainerRef = _ref.mapContainerRef,
8660
+ _ref$categoryIcons = _ref.categoryIcons,
8661
+ categoryIcons = _ref$categoryIcons === void 0 ? undefined : _ref$categoryIcons,
8662
+ _ref$header = _ref.header,
8663
+ customHeader = _ref$header === void 0 ? undefined : _ref$header,
8664
+ _ref$footer = _ref.footer,
8665
+ customFooter = _ref$footer === void 0 ? undefined : _ref$footer;
8658
8666
  var dialogs = useDialogs();
8667
+ var header = typeof customHeader !== 'undefined' ? customHeader : /*#__PURE__*/React$1.createElement(Flex, {
8668
+ px: "12px",
8669
+ py: "10px",
8670
+ height: HEADER_HEIGHT,
8671
+ alignItems: "center",
8672
+ direction: "row",
8673
+ style: {
8674
+ backgroundColor: 'var(--accent-9)',
8675
+ whiteSpace: 'nowrap',
8676
+ flexShrink: 0,
8677
+ flexGrow: 0
8678
+ }
8679
+ }, /*#__PURE__*/React$1.createElement(LogoContainer, {
8680
+ direction: "row",
8681
+ gap: "8px"
8682
+ }, /*#__PURE__*/React$1.createElement(GeoReDUSLogoSymbol, null), /*#__PURE__*/React$1.createElement("div", {
8683
+ style: {
8684
+ transition: open ? 'opacity .7s ease-out' : 'opacity .1s ease-out',
8685
+ opacity: open ? 1 : 0
8686
+ }
8687
+ }, /*#__PURE__*/React$1.createElement(GeoReDUSLogoText, null))));
8688
+ var footer = typeof customFooter !== 'undefined' ? customFooter : /*#__PURE__*/React$1.createElement(Flex, {
8689
+ p: "2",
8690
+ style: {
8691
+ backgroundColor: 'white'
8692
+ },
8693
+ direction: "row",
8694
+ justifyContent: "center"
8695
+ }, /*#__PURE__*/React$1.createElement("img", {
8696
+ style: {
8697
+ transition: 'opacity .1s ease-out',
8698
+ opacity: open ? 1 : 0,
8699
+ height: 48,
8700
+ width: 'auto'
8701
+
8702
+ // height: 'auto',
8703
+ // width: '100%',
8704
+ },
8705
+ src: "/georedus/assets/parcerias.png"
8706
+ }));
8659
8707
  return /*#__PURE__*/React$1.createElement("div", {
8660
8708
  style: {
8661
8709
  position: 'fixed',
@@ -8727,31 +8775,12 @@ function LeftPanel(_ref) {
8727
8775
  onClick: function onClick(e) {
8728
8776
  return onSetOpen(true);
8729
8777
  }
8730
- }, /*#__PURE__*/React$1.createElement(Flex, {
8731
- px: "12px",
8732
- py: "10px",
8733
- height: HEADER_HEIGHT,
8734
- alignItems: "center",
8735
- direction: "row",
8736
- style: {
8737
- backgroundColor: 'var(--accent-9)',
8738
- whiteSpace: 'nowrap',
8739
- flexShrink: 0,
8740
- flexGrow: 0
8741
- }
8742
- }, /*#__PURE__*/React$1.createElement(LogoContainer, {
8743
- direction: "row",
8744
- gap: "8px"
8745
- }, /*#__PURE__*/React$1.createElement(GeoReDUSLogoSymbol, null), /*#__PURE__*/React$1.createElement("div", {
8746
- style: {
8747
- transition: open ? 'opacity .7s ease-out' : 'opacity .1s ease-out',
8748
- opacity: open ? 1 : 0
8749
- }
8750
- }, /*#__PURE__*/React$1.createElement(GeoReDUSLogoText, null)))), Array.isArray(viewSpecs) ? /*#__PURE__*/React$1.createElement(ViewMenu, {
8778
+ }, header, Array.isArray(viewSpecs) ? /*#__PURE__*/React$1.createElement(ViewMenu, {
8751
8779
  style: {
8752
8780
  flexGrow: 1,
8753
8781
  height: '1px'
8754
8782
  },
8783
+ categoryIcons: categoryIcons,
8755
8784
  viewSpecs: viewSpecs,
8756
8785
  viewConfState: viewConfState,
8757
8786
  resolvedViews: resolvedViews,
@@ -8831,26 +8860,9 @@ function LeftPanel(_ref) {
8831
8860
  }
8832
8861
  }, /*#__PURE__*/React$1.createElement(LoadingOverlay, {
8833
8862
  message: null
8834
- })), /*#__PURE__*/React$1.createElement(Flex, {
8835
- p: "2",
8836
- style: {
8837
- backgroundColor: 'white'
8838
- },
8839
- direction: "row",
8840
- justifyContent: "center"
8841
- }, /*#__PURE__*/React$1.createElement("img", {
8842
- style: {
8843
- transition: 'opacity .1s ease-out',
8844
- opacity: open ? 1 : 0,
8845
- height: 48,
8846
- width: 'auto'
8847
-
8848
- // height: 'auto',
8849
- // width: '100%',
8850
- },
8851
- src: "/georedus/assets/parcerias.png"
8852
- }))));
8863
+ })), footer));
8853
8864
  }
8865
+ var LeftPanel = /*#__PURE__*/memo(LeftPanelInner);
8854
8866
 
8855
8867
  var ViewLayoutControlContext = /*#__PURE__*/createContext(null);
8856
8868
  var DRAG_HANDLE_BORDER_RADIUS = 10;
@@ -11286,6 +11298,7 @@ function HoverLegend(_ref) {
11286
11298
  }
11287
11299
  var DEFAULT_MAP_PROPS = {};
11288
11300
  var DEFAULT_SVG_IMAGES = {};
11301
+ var DEFAULT_LEFT_PANEL_PROPS = {};
11289
11302
  function GeoReDUSInner(_ref2) {
11290
11303
  var globalState = _ref2.state,
11291
11304
  onSetGlobalState = _ref2.onSetState,
@@ -11296,7 +11309,9 @@ function GeoReDUSInner(_ref2) {
11296
11309
  _ref2$mapProps = _ref2.mapProps,
11297
11310
  mapProps = _ref2$mapProps === void 0 ? DEFAULT_MAP_PROPS : _ref2$mapProps,
11298
11311
  _ref2$svgImages = _ref2.svgImages,
11299
- svgImages = _ref2$svgImages === void 0 ? DEFAULT_SVG_IMAGES : _ref2$svgImages;
11312
+ svgImages = _ref2$svgImages === void 0 ? DEFAULT_SVG_IMAGES : _ref2$svgImages,
11313
+ _ref2$leftPanel = _ref2.leftPanel,
11314
+ leftPanelProps = _ref2$leftPanel === void 0 ? DEFAULT_LEFT_PANEL_PROPS : _ref2$leftPanel;
11300
11315
  var MAP_SVG_IMAGE_GENERATOR = useMemo(function () {
11301
11316
  return svgImageGenerator(_objectSpread2(_objectSpread2({
11302
11317
  mdiTree: mdiTree,
@@ -11656,7 +11671,7 @@ function GeoReDUSInner(_ref2) {
11656
11671
  }
11657
11672
  });
11658
11673
  }, []);
11659
- return /*#__PURE__*/React$1.createElement(Flex, null, /*#__PURE__*/React$1.createElement(LeftPanel, {
11674
+ return /*#__PURE__*/React$1.createElement(Flex, null, /*#__PURE__*/React$1.createElement(LeftPanel, _extends({
11660
11675
  open: leftPanelOpen,
11661
11676
  onSetOpen: setLeftPanelOpen,
11662
11677
  viewSpecs: resolvedViewSpecs,
@@ -11664,7 +11679,7 @@ function GeoReDUSInner(_ref2) {
11664
11679
  viewConfDispatch: viewConfDispatch,
11665
11680
  resolvedViews: resolvedViews,
11666
11681
  syncedMapsRef: syncedMapsRef
11667
- }), /*#__PURE__*/React$1.createElement(Flex, {
11682
+ }, leftPanelProps)), /*#__PURE__*/React$1.createElement(Flex, {
11668
11683
  style: {
11669
11684
  position: 'fixed',
11670
11685
  zIndex: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redus/georedus-ui",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "packageManager": "yarn@4.0.2",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",