@longline/aqua-ui 1.0.140 → 1.0.142

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.
@@ -14,6 +14,11 @@ interface IMapControlProps {
14
14
  * @default 0
15
15
  */
16
16
  y?: number;
17
+ /**
18
+ * If set, control positioning takes into account the current map padding.
19
+ * @default false
20
+ */
21
+ respectPadding?: boolean;
17
22
  }
18
23
  /**
19
24
  * `MapControl` positions a control of top of a map, taking Mapbox `padding`
@@ -30,7 +35,7 @@ interface IMapControlProps {
30
35
  * controls that must not capture pointer events, such as `MapLoader`
31
36
  * and `ScaleControl`.
32
37
  */
33
- declare const MapControl: ({ x, y, ...props }: IMapControlProps & {
38
+ declare const MapControl: ({ x, y, respectPadding, ...props }: IMapControlProps & {
34
39
  children?: React.ReactNode;
35
40
  }) => React.JSX.Element;
36
41
  export { MapControl, IMapControlProps };
@@ -31,10 +31,10 @@ var MapControlBase = function (props) {
31
31
  var viewState = useViewState();
32
32
  return (React.createElement("div", { className: props.className, style: {
33
33
  // Must calculate this style dynamically, because it needs local state.
34
- left: props.x >= 0 ? "".concat(props.x + viewState.padding.left, "px") : 'auto',
35
- right: props.x < 0 ? "".concat(viewState.padding.right - props.x, "px") : 'auto',
36
- top: props.y >= 0 ? "".concat(props.y + viewState.padding.top, "px") : 'auto',
37
- bottom: props.y < 0 ? "".concat(-props.y - -viewState.padding.bottom, "px") : 'auto'
34
+ left: props.x >= 0 ? "".concat(props.x + (props.respectPadding ? viewState.padding.left : 0), "px") : 'auto',
35
+ right: props.x < 0 ? "".concat((props.respectPadding ? viewState.padding.right : 0) - props.x, "px") : 'auto',
36
+ top: props.y >= 0 ? "".concat(props.y + (props.respectPadding ? viewState.padding.top : 0), "px") : 'auto',
37
+ bottom: props.y < 0 ? "".concat(-props.y - -(props.respectPadding ? viewState.padding.bottom : 0), "px") : 'auto'
38
38
  } }, props.children));
39
39
  };
40
40
  var MapControlStyled = styled(MapControlBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n z-index: 100;\n box-sizing: border-box;\n pointer-events: none;\n"], ["\n position: absolute;\n z-index: 100;\n box-sizing: border-box;\n pointer-events: none;\n"
@@ -70,8 +70,8 @@ var MapControlStyled = styled(MapControlBase)(templateObject_1 || (templateObjec
70
70
  * and `ScaleControl`.
71
71
  */
72
72
  var MapControl = function (_a) {
73
- var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, props = __rest(_a, ["x", "y"]);
74
- return React.createElement(MapControlStyled, __assign({ x: x, y: y }, props));
73
+ var _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.respectPadding, respectPadding = _d === void 0 ? false : _d, props = __rest(_a, ["x", "y", "respectPadding"]);
74
+ return React.createElement(MapControlStyled, __assign({ x: x, y: y, respectPadding: respectPadding }, props));
75
75
  };
76
76
  export { MapControl };
77
77
  var templateObject_1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longline/aqua-ui",
3
- "version": "1.0.140",
3
+ "version": "1.0.142",
4
4
  "description": "AquaUI",
5
5
  "author": "Alexander van Oostenrijk / Longline Environment",
6
6
  "license": "Commercial",