@ssplib/react-components 0.0.268 → 0.0.270

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.
@@ -1,4 +1,5 @@
1
1
  import { BoxProps } from '@mui/material';
2
+ import React from 'react';
2
3
  import 'leaflet-defaulticon-compatibility';
3
4
  import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.css';
4
5
  import 'leaflet/dist/leaflet.css';
@@ -10,5 +11,6 @@ export interface MapProps {
10
11
  pulseMarkerList?: LatLngExpression[];
11
12
  popupContent?: ReactElement;
12
13
  style?: BoxProps;
14
+ mapStyle?: React.CSSProperties;
13
15
  }
14
16
  export declare function Map(props: MapProps): JSX.Element;
@@ -15,7 +15,7 @@ require("leaflet/dist/leaflet.css");
15
15
  const AnimatedMarker_1 = __importDefault(require("./AnimatedMarker"));
16
16
  function Map(props) {
17
17
  return (react_1.default.createElement(material_1.Box, Object.assign({ borderRadius: 2, border: '2px solid #c7c7c7', overflow: 'hidden' }, props.style),
18
- react_1.default.createElement(react_leaflet_1.MapContainer, { center: props.firstCoords, zoom: 19, scrollWheelZoom: true, style: { height: '75vh', width: '100%' } },
18
+ react_1.default.createElement(react_leaflet_1.MapContainer, { center: props.firstCoords, zoom: 19, scrollWheelZoom: true, style: props.mapStyle },
19
19
  react_1.default.createElement(react_leaflet_1.TileLayer, { attribution: '\u00A9 <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' }),
20
20
  props.pulseMarkerList && props.pulseMarkerList.map((coord, idx) => react_1.default.createElement(AnimatedMarker_1.default, { key: JSON.stringify(coord) + idx, coords: coord })),
21
21
  react_1.default.createElement(DraggableMarker_1.default, { startCoord: props.firstCoords, onChange: props.onCoordsChange, showPopup: typeof props.popupContent !== 'undefined' }, props.popupContent))));
@@ -11,6 +11,6 @@ export default function NavBar({ links, title, img, pos, next, el, menuItems, pa
11
11
  next?: boolean;
12
12
  el?: JSX.Element;
13
13
  logoutMsg?: string;
14
- logoutFunc?: () => void;
14
+ logoutFunc?: () => Promise<void>;
15
15
  pos?: 'fixed' | 'inherit';
16
16
  }): JSX.Element;
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
25
34
  var __rest = (this && this.__rest) || function (s, e) {
26
35
  var t = {};
27
36
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -135,18 +144,19 @@ function NavBar(_a) {
135
144
  react_1.default.createElement(material_1.Avatar, { sx: { width: 30, height: 30 }, src: user.image }),
136
145
  react_1.default.createElement(material_1.Menu, { open: avatarMenu, onClose: (e) => setAvatarAnchor(null), anchorEl: avatarAnchor, disableScrollLock: true, transformOrigin: { horizontal: 'right', vertical: 'top' }, anchorOrigin: { horizontal: 'right', vertical: 'bottom' }, sx: { '.MuiMenu-paper': { borderRadius: 4 } } },
137
146
  menuItems,
138
- react_1.default.createElement(material_1.MenuItem, { onClick: (e) => {
147
+ react_1.default.createElement(material_1.MenuItem, { onClick: (e) => __awaiter(this, void 0, void 0, function* () {
139
148
  setAvatarAnchor(null);
140
149
  if (!!logoutFunc)
141
- logoutFunc();
142
- logout();
143
- } },
150
+ logoutFunc()
151
+ .catch((error) => console.error(error))
152
+ .finally(() => logout());
153
+ }) },
144
154
  react_1.default.createElement(material_1.Stack, { direction: 'row', spacing: 1 },
145
155
  react_1.default.createElement(LogoutOutlined_1.default, { sx: { fill: '#545454' } }),
146
156
  react_1.default.createElement(material_1.Typography, { textTransform: 'capitalize' }, logoutMsg))))),
147
157
  react_1.default.createElement(material_1.Stack, { direction: 'row', spacing: 0.4, alignItems: 'center', onClick: (e) => setAvatarAnchor(e.currentTarget), sx: { userSelect: 'none' } },
148
158
  react_1.default.createElement(material_1.Typography, null, "Ol\u00E1,"),
149
- react_1.default.createElement(material_1.Typography, { fontWeight: 600 }, user.given_name),
159
+ react_1.default.createElement(material_1.Typography, { fontWeight: 600 }, user === null || user === void 0 ? void 0 : user.given_name),
150
160
  react_1.default.createElement(KeyboardArrowDown_1.default, null)))) : type === 'govbr' ? (react_1.default.createElement(material_1.Button, { variant: 'contained', size: 'small', startIcon: react_1.default.createElement(Person_1.default, null), onClick: login, sx: { color: 'white', textTransform: 'inherit', borderRadius: 50, paddingX: 2 } },
151
161
  react_1.default.createElement(material_1.Typography, { fontWeight: 600, fontSize: 15, padding: 0.4 }, "Entrar com o gov.br"))) : (react_1.default.createElement(material_1.Button, { variant: 'contained', size: 'small', startIcon: react_1.default.createElement(Person_1.default, null), onClick: login, sx: { color: 'white', textTransform: 'inherit', borderRadius: 50, paddingX: 2 } },
152
162
  react_1.default.createElement(material_1.Typography, { fontWeight: 600, fontSize: 15, padding: 0.4 }, "Entrar"))))))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.268",
3
+ "version": "0.0.270",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",