@rio-cloud/rio-uikit 0.16.4-beta.2 → 0.16.4-beta.3

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/DeviceUtils.js CHANGED
@@ -1,2 +1,2 @@
1
- import { hasTouch as _hasTouch, isDesktop as _isDesktop, isMobile as _isMobile, isMobileScreen as _isMobileScreen, MOBILE_SCREEN as _MOBILE_SCREEN, SCREEN_SM as _SCREEN_SM, SCREEN_MD as _SCREEN_MD, SCREEN_LG as _SCREEN_LG, SCREEN_XL as _SCREEN_XL, inIframe as _inIframe, toggleZoomOnMobile as _toggleZoomOnMobile, } from './utils/deviceUtils';
2
- export { _hasTouch as hasTouch, _isDesktop as isDesktop, _isMobile as isMobile, _isMobileScreen as isMobileScreen, _MOBILE_SCREEN as MOBILE_SCREEN, _SCREEN_SM as SCREEN_SM, _SCREEN_MD as SCREEN_MD, _SCREEN_LG as SCREEN_LG, _SCREEN_XL as SCREEN_XL, _inIframe as inIframe, _toggleZoomOnMobile as toggleZoomOnMobile, };
1
+ import { hasTouch as _hasTouch, isDesktop as _isDesktop, isMobile as _isMobile, isMobileScreen as _isMobileScreen, isRetinaDevice as _isRetinaDevice, MOBILE_SCREEN as _MOBILE_SCREEN, SCREEN_SM as _SCREEN_SM, SCREEN_MD as _SCREEN_MD, SCREEN_LG as _SCREEN_LG, SCREEN_XL as _SCREEN_XL, inIframe as _inIframe, toggleZoomOnMobile as _toggleZoomOnMobile, } from './utils/deviceUtils';
2
+ export { _hasTouch as hasTouch, _isDesktop as isDesktop, _isMobile as isMobile, _isMobileScreen as isMobileScreen, _isRetinaDevice as isRetinaDevice, _MOBILE_SCREEN as MOBILE_SCREEN, _SCREEN_SM as SCREEN_SM, _SCREEN_MD as SCREEN_MD, _SCREEN_LG as SCREEN_LG, _SCREEN_XL as SCREEN_XL, _inIframe as inIframe, _toggleZoomOnMobile as toggleZoomOnMobile, };
@@ -1,18 +1,67 @@
1
1
  import React, { MutableRefObject, PropsWithChildren, ReactNode } from 'react';
2
2
  export type BottomSheetProps = {
3
+ /**
4
+ * Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen.
5
+ * Default value is: `false`
6
+ */
3
7
  show: boolean;
8
+ /**
9
+ * Callback for when the sheet closes.
10
+ */
4
11
  onClose?: (isShown: boolean) => void;
12
+ /**
13
+ * The width of the bottom sheet. This is useful for desktop when not using the entire screen width.
14
+ * When no width is given it will take the width of the content and maximum `100%` of the screen.
15
+ * So it this case you might want to apply a `max-width-xxx` via `className` to control it better.
16
+ */
5
17
  width?: number | string;
18
+ /**
19
+ * The height of the bottom sheet. If no height is given, the height is automatically
20
+ * calculated from the content.
21
+ */
6
22
  height?: number | string;
23
+ /**
24
+ * The title content shown in the header. If no title is given, the bottom sheet header is not shown.
25
+ */
7
26
  title?: string | ReactNode;
27
+ /**
28
+ * Defines whether or not the close button is shown.
29
+ * Default value is: `true`
30
+ */
8
31
  showCloseButton?: boolean;
32
+ /**
33
+ * Defines whether or not the maximize button in the header is shown.
34
+ * Default value is: `false`
35
+ */
9
36
  showMaximizeButton?: boolean;
37
+ /**
38
+ * The callback function triggered when the maximize button is clicked and the height changes.
39
+ */
10
40
  onHeightChange?: VoidFunction;
41
+ /**
42
+ * Set to `true` to detach the bottom sheet from the left side and the bottom and create a little offset.
43
+ * Default value is: `false`
44
+ */
11
45
  detach?: boolean;
46
+ /**
47
+ * Defines the amount of pixels for the sheet.
48
+ * Default value is: `15`
49
+ */
50
+ detachOffset?: number;
51
+ /**
52
+ * Set to `true` to render a modal like backdrop to emphasize the bottom sheet.
53
+ * Default value is: `false`
54
+ */
12
55
  useBackdrop?: boolean;
56
+ /**
57
+ * Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet.
58
+ */
13
59
  onBackdropClick?: VoidFunction;
14
- bodyRef?: MutableRefObject<HTMLDivElement>;
60
+ /** A react ref added to the bottom sheet body. */
61
+ bodyRef?: MutableRefObject<HTMLDivElement | null>;
62
+ /** Additional classes to be set on the body element. */
15
63
  bodyClassName?: string;
64
+ /** Additional classes to be set on the wrapping element. */
16
65
  className?: string;
17
66
  };
18
67
  declare const BottomSheet: (props: BottomSheetProps & PropsWithChildren) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -3,12 +3,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useEffect, useState } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import classNames from 'classnames';
6
- import { motion } from 'framer-motion';
7
6
  import isFunction from 'lodash/fp/isFunction';
7
+ import { motion } from 'framer-motion';
8
8
  import { getOrCreatePortalRoot } from '../../utils/portalRoot';
9
9
  const OFFSET_POSITION = -1000;
10
+ const DEFAULT_OFFSET_PX = 15;
10
11
  const BottomSheet = (props) => {
11
- const { show = false, onClose, width, height, title, detach = false, useBackdrop = false, showCloseButton = true, showMaximizeButton = false, onHeightChange = () => { }, bodyRef, bodyClassName, className, children, onBackdropClick = () => { } } = props, remainingProps = __rest(props, ["show", "onClose", "width", "height", "title", "detach", "useBackdrop", "showCloseButton", "showMaximizeButton", "onHeightChange", "bodyRef", "bodyClassName", "className", "children", "onBackdropClick"]);
12
+ const { show = false, onClose, width, height, title, detach = false, detachOffset = DEFAULT_OFFSET_PX, useBackdrop = false, showCloseButton = true, showMaximizeButton = false, onHeightChange = () => { }, bodyRef, bodyClassName, className, children, onBackdropClick = () => { } } = props, remainingProps = __rest(props, ["show", "onClose", "width", "height", "title", "detach", "detachOffset", "useBackdrop", "showCloseButton", "showMaximizeButton", "onHeightChange", "bodyRef", "bodyClassName", "className", "children", "onBackdropClick"]);
12
13
  const [isShown, setIsShown] = useState(show);
13
14
  const [isMaxHeight, setIsMaxHeight] = useState(false);
14
15
  useEffect(() => setIsShown(show), [show]);
@@ -31,14 +32,18 @@ const BottomSheet = (props) => {
31
32
  setIsMaxHeight(newValue);
32
33
  onHeightChange();
33
34
  };
34
- const sheetClasses = classNames('bottom-sheet', 'position-fixed left-0', !width && 'width-100pct', !height && !isMaxHeight && 'height-auto', 'bg-white', 'shadow-hard', detach ? 'margin-15 rounded' : 'rounded-top-left rounded-top-right', className && className);
35
+ const sheetClasses = classNames('bottom-sheet', 'position-fixed left-0', !height && !isMaxHeight && 'height-auto', 'bg-white', 'shadow-hard', detach ? 'rounded' : 'rounded-top-left rounded-top-right', className && className);
35
36
  const sheetBodyClasses = classNames('bottom-sheet-body', 'height-100pct', bodyClassName && bodyClassName);
36
37
  const sheetHeight = isMaxHeight ? window.innerHeight : height;
37
38
  // Note: we always have to kep the body element in the DOM as there might be a ref assigned to it.
38
39
  // Unmounting it will lead to losing the reference and breaking the functionality that is implemented on that ref.
39
40
  // That is the reason why there is no "AnimatePresence" with an "exit" animation here.
40
41
  // Instead, we change the "animate" values.
41
- return createPortal(_jsxs(_Fragment, { children: [_jsxs(motion.div, Object.assign({}, remainingProps, { className: sheetClasses, style: { width }, initial: { opacity: 0 }, animate: {
42
+ return createPortal(_jsxs(_Fragment, { children: [_jsxs(motion.div, Object.assign({}, remainingProps, { className: sheetClasses, style: {
43
+ width,
44
+ maxWidth: detach ? `calc(100% - ${DEFAULT_OFFSET_PX * 2}px)` : '100%',
45
+ margin: detach ? `${DEFAULT_OFFSET_PX}px` : 0,
46
+ }, initial: { opacity: 0 }, animate: {
42
47
  opacity: isShown ? 1 : 0,
43
48
  y: 0,
44
49
  bottom: isShown ? 0 : OFFSET_POSITION,
@@ -1,3 +1,13 @@
1
+ export function createEnhancedMapEvent(event: any, mapApi: any): EnhancedMapEvent | {
2
+ map: any;
3
+ };
4
+ export function createEnhancedListener(listener: any, mapApi: any): (event: any) => any;
5
+ export function addEventListenerMap(hMapObject: any, eventListenerMap: {} | undefined, mapApi: any): void;
6
+ export function removeEventListenerMap(hMapObject: any): any;
7
+ export function checkAndUpdateEventListenerMap(hMapObject: any, props: any, nextProps: any): void;
8
+ export function createTapOnDblTapPreventer(eventListenerMap: any, delayBetweenTaps?: number): any;
9
+ export function getMouseButton(event: any): any;
10
+ export function isRightClick(event: any): boolean;
1
11
  export namespace EventUtils {
2
12
  export namespace MOUSE_BUTTONS {
3
13
  const LEFT: number;
@@ -27,16 +37,6 @@ export namespace EventUtils {
27
37
  export { getMouseButton };
28
38
  export { isRightClick };
29
39
  }
30
- export function createEnhancedMapEvent(event: any, mapApi: any): EnhancedMapEvent | {
31
- map: any;
32
- };
33
- export function createEnhancedListener(listener: any, mapApi: any): (event: any) => any;
34
- export function addEventListenerMap(hMapObject: any, eventListenerMap: {} | undefined, mapApi: any): void;
35
- export function removeEventListenerMap(hMapObject: any): any;
36
- export function checkAndUpdateEventListenerMap(hMapObject: any, props: any, nextProps: any): void;
37
- export function createTapOnDblTapPreventer(eventListenerMap: any, delayBetweenTaps?: number): any;
38
- export function getMouseButton(event: any): any;
39
- export function isRightClick(event: any): boolean;
40
40
  declare class EnhancedMapEvent {
41
41
  constructor(event: any, mapApi: any);
42
42
  viewportX: any;
@@ -1,32 +1,3 @@
1
- export const EventUtils = {
2
- MOUSE_BUTTONS: {
3
- LEFT: 0,
4
- MIDDLE: 1,
5
- RIGHT: 2,
6
- },
7
- POINTER_DOWN: 'pointerdown',
8
- POINTER_UP: 'pointerup',
9
- POINTER_MOVE: 'pointermove',
10
- POINTER_ENTER: 'pointerenter',
11
- POINTER_LEAVE: 'pointerleave',
12
- POINTER_CANCEL: 'pointercancel',
13
- DRAG_START: 'dragstart',
14
- DRAG: 'drag',
15
- DRAG_END: 'dragend',
16
- TAP: 'tap',
17
- DBL_TAP: 'dbltap',
18
- LONGPRESS: 'longpress',
19
- CONTEXTMENU: 'contextmenu',
20
- CONTEXTMENU_CLOSE: 'contextmenuclose',
21
- MAP_VIEW_CHANGE_START: 'mapviewchangestart',
22
- MAP_VIEW_CHANGE: 'mapviewchange',
23
- MAP_VIEW_CHANGE_END: 'mapviewchangeend',
24
- BASE_LAYER_CHANGE: 'baselayerchange',
25
- ENGINE_CHANGE: 'enginechange',
26
- createTapOnDblTapPreventer,
27
- getMouseButton,
28
- isRightClick,
29
- };
30
1
  class MapTimeGuard {
31
2
  constructor(delay = 250) {
32
3
  this.delayTime = delay;
@@ -112,3 +83,32 @@ export const getMouseButton = event => {
112
83
  export const isRightClick = event => {
113
84
  return getMouseButton(event) === EventUtils.MOUSE_BUTTONS.RIGHT;
114
85
  };
86
+ export const EventUtils = {
87
+ MOUSE_BUTTONS: {
88
+ LEFT: 0,
89
+ MIDDLE: 1,
90
+ RIGHT: 2,
91
+ },
92
+ POINTER_DOWN: 'pointerdown',
93
+ POINTER_UP: 'pointerup',
94
+ POINTER_MOVE: 'pointermove',
95
+ POINTER_ENTER: 'pointerenter',
96
+ POINTER_LEAVE: 'pointerleave',
97
+ POINTER_CANCEL: 'pointercancel',
98
+ DRAG_START: 'dragstart',
99
+ DRAG: 'drag',
100
+ DRAG_END: 'dragend',
101
+ TAP: 'tap',
102
+ DBL_TAP: 'dbltap',
103
+ LONGPRESS: 'longpress',
104
+ CONTEXTMENU: 'contextmenu',
105
+ CONTEXTMENU_CLOSE: 'contextmenuclose',
106
+ MAP_VIEW_CHANGE_START: 'mapviewchangestart',
107
+ MAP_VIEW_CHANGE: 'mapviewchange',
108
+ MAP_VIEW_CHANGE_END: 'mapviewchangeend',
109
+ BASE_LAYER_CHANGE: 'baselayerchange',
110
+ ENGINE_CHANGE: 'enginechange',
111
+ createTapOnDblTapPreventer,
112
+ getMouseButton,
113
+ isRightClick,
114
+ };
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toggleZoomOnMobile = exports.inIframe = exports.SCREEN_XL = exports.SCREEN_LG = exports.SCREEN_MD = exports.SCREEN_SM = exports.MOBILE_SCREEN = exports.isMobileScreen = exports.isMobile = exports.isDesktop = exports.hasTouch = void 0;
3
+ exports.toggleZoomOnMobile = exports.inIframe = exports.SCREEN_XL = exports.SCREEN_LG = exports.SCREEN_MD = exports.SCREEN_SM = exports.MOBILE_SCREEN = exports.isRetinaDevice = exports.isMobileScreen = exports.isMobile = exports.isDesktop = exports.hasTouch = void 0;
4
4
  const deviceUtils_1 = require("./utils/deviceUtils");
5
5
  Object.defineProperty(exports, "hasTouch", { enumerable: true, get: function () { return deviceUtils_1.hasTouch; } });
6
6
  Object.defineProperty(exports, "isDesktop", { enumerable: true, get: function () { return deviceUtils_1.isDesktop; } });
7
7
  Object.defineProperty(exports, "isMobile", { enumerable: true, get: function () { return deviceUtils_1.isMobile; } });
8
8
  Object.defineProperty(exports, "isMobileScreen", { enumerable: true, get: function () { return deviceUtils_1.isMobileScreen; } });
9
+ Object.defineProperty(exports, "isRetinaDevice", { enumerable: true, get: function () { return deviceUtils_1.isRetinaDevice; } });
9
10
  Object.defineProperty(exports, "MOBILE_SCREEN", { enumerable: true, get: function () { return deviceUtils_1.MOBILE_SCREEN; } });
10
11
  Object.defineProperty(exports, "SCREEN_SM", { enumerable: true, get: function () { return deviceUtils_1.SCREEN_SM; } });
11
12
  Object.defineProperty(exports, "SCREEN_MD", { enumerable: true, get: function () { return deviceUtils_1.SCREEN_MD; } });
@@ -1,18 +1,67 @@
1
1
  import React, { MutableRefObject, PropsWithChildren, ReactNode } from 'react';
2
2
  export type BottomSheetProps = {
3
+ /**
4
+ * Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen.
5
+ * Default value is: `false`
6
+ */
3
7
  show: boolean;
8
+ /**
9
+ * Callback for when the sheet closes.
10
+ */
4
11
  onClose?: (isShown: boolean) => void;
12
+ /**
13
+ * The width of the bottom sheet. This is useful for desktop when not using the entire screen width.
14
+ * When no width is given it will take the width of the content and maximum `100%` of the screen.
15
+ * So it this case you might want to apply a `max-width-xxx` via `className` to control it better.
16
+ */
5
17
  width?: number | string;
18
+ /**
19
+ * The height of the bottom sheet. If no height is given, the height is automatically
20
+ * calculated from the content.
21
+ */
6
22
  height?: number | string;
23
+ /**
24
+ * The title content shown in the header. If no title is given, the bottom sheet header is not shown.
25
+ */
7
26
  title?: string | ReactNode;
27
+ /**
28
+ * Defines whether or not the close button is shown.
29
+ * Default value is: `true`
30
+ */
8
31
  showCloseButton?: boolean;
32
+ /**
33
+ * Defines whether or not the maximize button in the header is shown.
34
+ * Default value is: `false`
35
+ */
9
36
  showMaximizeButton?: boolean;
37
+ /**
38
+ * The callback function triggered when the maximize button is clicked and the height changes.
39
+ */
10
40
  onHeightChange?: VoidFunction;
41
+ /**
42
+ * Set to `true` to detach the bottom sheet from the left side and the bottom and create a little offset.
43
+ * Default value is: `false`
44
+ */
11
45
  detach?: boolean;
46
+ /**
47
+ * Defines the amount of pixels for the sheet.
48
+ * Default value is: `15`
49
+ */
50
+ detachOffset?: number;
51
+ /**
52
+ * Set to `true` to render a modal like backdrop to emphasize the bottom sheet.
53
+ * Default value is: `false`
54
+ */
12
55
  useBackdrop?: boolean;
56
+ /**
57
+ * Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet.
58
+ */
13
59
  onBackdropClick?: VoidFunction;
14
- bodyRef?: MutableRefObject<HTMLDivElement>;
60
+ /** A react ref added to the bottom sheet body. */
61
+ bodyRef?: MutableRefObject<HTMLDivElement | null>;
62
+ /** Additional classes to be set on the body element. */
15
63
  bodyClassName?: string;
64
+ /** Additional classes to be set on the wrapping element. */
16
65
  className?: string;
17
66
  };
18
67
  declare const BottomSheet: (props: BottomSheetProps & PropsWithChildren) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -5,12 +5,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_dom_1 = require("react-dom");
7
7
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
8
- const framer_motion_1 = require("framer-motion");
9
8
  const isFunction_1 = tslib_1.__importDefault(require("lodash/fp/isFunction"));
9
+ const framer_motion_1 = require("framer-motion");
10
10
  const portalRoot_1 = require("../../utils/portalRoot");
11
11
  const OFFSET_POSITION = -1000;
12
+ const DEFAULT_OFFSET_PX = 15;
12
13
  const BottomSheet = (props) => {
13
- const { show = false, onClose, width, height, title, detach = false, useBackdrop = false, showCloseButton = true, showMaximizeButton = false, onHeightChange = () => { }, bodyRef, bodyClassName, className, children, onBackdropClick = () => { } } = props, remainingProps = tslib_1.__rest(props, ["show", "onClose", "width", "height", "title", "detach", "useBackdrop", "showCloseButton", "showMaximizeButton", "onHeightChange", "bodyRef", "bodyClassName", "className", "children", "onBackdropClick"]);
14
+ const { show = false, onClose, width, height, title, detach = false, detachOffset = DEFAULT_OFFSET_PX, useBackdrop = false, showCloseButton = true, showMaximizeButton = false, onHeightChange = () => { }, bodyRef, bodyClassName, className, children, onBackdropClick = () => { } } = props, remainingProps = tslib_1.__rest(props, ["show", "onClose", "width", "height", "title", "detach", "detachOffset", "useBackdrop", "showCloseButton", "showMaximizeButton", "onHeightChange", "bodyRef", "bodyClassName", "className", "children", "onBackdropClick"]);
14
15
  const [isShown, setIsShown] = (0, react_1.useState)(show);
15
16
  const [isMaxHeight, setIsMaxHeight] = (0, react_1.useState)(false);
16
17
  (0, react_1.useEffect)(() => setIsShown(show), [show]);
@@ -33,14 +34,18 @@ const BottomSheet = (props) => {
33
34
  setIsMaxHeight(newValue);
34
35
  onHeightChange();
35
36
  };
36
- const sheetClasses = (0, classnames_1.default)('bottom-sheet', 'position-fixed left-0', !width && 'width-100pct', !height && !isMaxHeight && 'height-auto', 'bg-white', 'shadow-hard', detach ? 'margin-15 rounded' : 'rounded-top-left rounded-top-right', className && className);
37
+ const sheetClasses = (0, classnames_1.default)('bottom-sheet', 'position-fixed left-0', !height && !isMaxHeight && 'height-auto', 'bg-white', 'shadow-hard', detach ? 'rounded' : 'rounded-top-left rounded-top-right', className && className);
37
38
  const sheetBodyClasses = (0, classnames_1.default)('bottom-sheet-body', 'height-100pct', bodyClassName && bodyClassName);
38
39
  const sheetHeight = isMaxHeight ? window.innerHeight : height;
39
40
  // Note: we always have to kep the body element in the DOM as there might be a ref assigned to it.
40
41
  // Unmounting it will lead to losing the reference and breaking the functionality that is implemented on that ref.
41
42
  // That is the reason why there is no "AnimatePresence" with an "exit" animation here.
42
43
  // Instead, we change the "animate" values.
43
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, Object.assign({}, remainingProps, { className: sheetClasses, style: { width }, initial: { opacity: 0 }, animate: {
44
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(framer_motion_1.motion.div, Object.assign({}, remainingProps, { className: sheetClasses, style: {
45
+ width,
46
+ maxWidth: detach ? `calc(100% - ${DEFAULT_OFFSET_PX * 2}px)` : '100%',
47
+ margin: detach ? `${DEFAULT_OFFSET_PX}px` : 0,
48
+ }, initial: { opacity: 0 }, animate: {
44
49
  opacity: isShown ? 1 : 0,
45
50
  y: 0,
46
51
  bottom: isShown ? 0 : OFFSET_POSITION,
@@ -1,3 +1,13 @@
1
+ export function createEnhancedMapEvent(event: any, mapApi: any): EnhancedMapEvent | {
2
+ map: any;
3
+ };
4
+ export function createEnhancedListener(listener: any, mapApi: any): (event: any) => any;
5
+ export function addEventListenerMap(hMapObject: any, eventListenerMap: {} | undefined, mapApi: any): void;
6
+ export function removeEventListenerMap(hMapObject: any): any;
7
+ export function checkAndUpdateEventListenerMap(hMapObject: any, props: any, nextProps: any): void;
8
+ export function createTapOnDblTapPreventer(eventListenerMap: any, delayBetweenTaps?: number): any;
9
+ export function getMouseButton(event: any): any;
10
+ export function isRightClick(event: any): boolean;
1
11
  export namespace EventUtils {
2
12
  export namespace MOUSE_BUTTONS {
3
13
  const LEFT: number;
@@ -27,16 +37,6 @@ export namespace EventUtils {
27
37
  export { getMouseButton };
28
38
  export { isRightClick };
29
39
  }
30
- export function createEnhancedMapEvent(event: any, mapApi: any): EnhancedMapEvent | {
31
- map: any;
32
- };
33
- export function createEnhancedListener(listener: any, mapApi: any): (event: any) => any;
34
- export function addEventListenerMap(hMapObject: any, eventListenerMap: {} | undefined, mapApi: any): void;
35
- export function removeEventListenerMap(hMapObject: any): any;
36
- export function checkAndUpdateEventListenerMap(hMapObject: any, props: any, nextProps: any): void;
37
- export function createTapOnDblTapPreventer(eventListenerMap: any, delayBetweenTaps?: number): any;
38
- export function getMouseButton(event: any): any;
39
- export function isRightClick(event: any): boolean;
40
40
  declare class EnhancedMapEvent {
41
41
  constructor(event: any, mapApi: any);
42
42
  viewportX: any;
@@ -1,35 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isRightClick = exports.getMouseButton = exports.createTapOnDblTapPreventer = exports.checkAndUpdateEventListenerMap = exports.removeEventListenerMap = exports.addEventListenerMap = exports.createEnhancedListener = exports.createEnhancedMapEvent = exports.EventUtils = void 0;
4
- exports.EventUtils = {
5
- MOUSE_BUTTONS: {
6
- LEFT: 0,
7
- MIDDLE: 1,
8
- RIGHT: 2,
9
- },
10
- POINTER_DOWN: 'pointerdown',
11
- POINTER_UP: 'pointerup',
12
- POINTER_MOVE: 'pointermove',
13
- POINTER_ENTER: 'pointerenter',
14
- POINTER_LEAVE: 'pointerleave',
15
- POINTER_CANCEL: 'pointercancel',
16
- DRAG_START: 'dragstart',
17
- DRAG: 'drag',
18
- DRAG_END: 'dragend',
19
- TAP: 'tap',
20
- DBL_TAP: 'dbltap',
21
- LONGPRESS: 'longpress',
22
- CONTEXTMENU: 'contextmenu',
23
- CONTEXTMENU_CLOSE: 'contextmenuclose',
24
- MAP_VIEW_CHANGE_START: 'mapviewchangestart',
25
- MAP_VIEW_CHANGE: 'mapviewchange',
26
- MAP_VIEW_CHANGE_END: 'mapviewchangeend',
27
- BASE_LAYER_CHANGE: 'baselayerchange',
28
- ENGINE_CHANGE: 'enginechange',
29
- createTapOnDblTapPreventer: exports.createTapOnDblTapPreventer,
30
- getMouseButton: exports.getMouseButton,
31
- isRightClick: exports.isRightClick,
32
- };
3
+ exports.EventUtils = exports.isRightClick = exports.getMouseButton = exports.createTapOnDblTapPreventer = exports.checkAndUpdateEventListenerMap = exports.removeEventListenerMap = exports.addEventListenerMap = exports.createEnhancedListener = exports.createEnhancedMapEvent = void 0;
33
4
  class MapTimeGuard {
34
5
  constructor(delay = 250) {
35
6
  this.delayTime = delay;
@@ -123,3 +94,32 @@ const isRightClick = event => {
123
94
  return (0, exports.getMouseButton)(event) === exports.EventUtils.MOUSE_BUTTONS.RIGHT;
124
95
  };
125
96
  exports.isRightClick = isRightClick;
97
+ exports.EventUtils = {
98
+ MOUSE_BUTTONS: {
99
+ LEFT: 0,
100
+ MIDDLE: 1,
101
+ RIGHT: 2,
102
+ },
103
+ POINTER_DOWN: 'pointerdown',
104
+ POINTER_UP: 'pointerup',
105
+ POINTER_MOVE: 'pointermove',
106
+ POINTER_ENTER: 'pointerenter',
107
+ POINTER_LEAVE: 'pointerleave',
108
+ POINTER_CANCEL: 'pointercancel',
109
+ DRAG_START: 'dragstart',
110
+ DRAG: 'drag',
111
+ DRAG_END: 'dragend',
112
+ TAP: 'tap',
113
+ DBL_TAP: 'dbltap',
114
+ LONGPRESS: 'longpress',
115
+ CONTEXTMENU: 'contextmenu',
116
+ CONTEXTMENU_CLOSE: 'contextmenuclose',
117
+ MAP_VIEW_CHANGE_START: 'mapviewchangestart',
118
+ MAP_VIEW_CHANGE: 'mapviewchange',
119
+ MAP_VIEW_CHANGE_END: 'mapviewchangeend',
120
+ BASE_LAYER_CHANGE: 'baselayerchange',
121
+ ENGINE_CHANGE: 'enginechange',
122
+ createTapOnDblTapPreventer: exports.createTapOnDblTapPreventer,
123
+ getMouseButton: exports.getMouseButton,
124
+ isRightClick: exports.isRightClick,
125
+ };
@@ -14,7 +14,8 @@ const createButtonRipple = (event, target = null) => {
14
14
  }
15
15
  // The TouchEvent does not contain clientX/clientY by definition. Most browsers will emulate/add it, though.
16
16
  // Nevertheless, we read the client values from the first touch object to be compliant.
17
- if (event instanceof TouchEvent) {
17
+ // Note: some browsers don't provide the global "TouchEvent" constructor!
18
+ if (!!TouchEvent && event instanceof TouchEvent) {
18
19
  const firstTouch = event.touches[0];
19
20
  circle.style.left = `${firstTouch.clientX - buttonRect.left - radius}px`;
20
21
  circle.style.top = `${firstTouch.clientY - buttonRect.top - radius}px`;
@@ -7,5 +7,6 @@ export const SCREEN_XL: 1700;
7
7
  export function isMobileScreen(): boolean;
8
8
  export function isMobile(): boolean;
9
9
  export function isDesktop(): boolean;
10
+ export function isRetinaDevice(): boolean;
10
11
  export function inIframe(): boolean;
11
12
  export function toggleZoomOnMobile(): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toggleZoomOnMobile = exports.inIframe = exports.isDesktop = exports.isMobile = exports.isMobileScreen = exports.SCREEN_XL = exports.SCREEN_LG = exports.SCREEN_MD = exports.SCREEN_SM = exports.MOBILE_SCREEN = exports.hasTouch = void 0;
3
+ exports.toggleZoomOnMobile = exports.inIframe = exports.isRetinaDevice = exports.isDesktop = exports.isMobile = exports.isMobileScreen = exports.SCREEN_XL = exports.SCREEN_LG = exports.SCREEN_MD = exports.SCREEN_SM = exports.MOBILE_SCREEN = exports.hasTouch = void 0;
4
4
  const cssuseragent_1 = require("./cssuseragent");
5
5
  // As "cssuseragent" is accessing the html dom object directly without checking whether it exists or not,
6
6
  // we need to initialize only when html really exists. This avoids issues when running the UIKIT in a web-worker
@@ -40,6 +40,8 @@ const isMobile = () => document && document.documentElement.classList.contains('
40
40
  exports.isMobile = isMobile;
41
41
  const isDesktop = () => document && document.documentElement.classList.contains('ua-desktop');
42
42
  exports.isDesktop = isDesktop;
43
+ const isRetinaDevice = () => window.devicePixelRatio > 1;
44
+ exports.isRetinaDevice = isRetinaDevice;
43
45
  const inIframe = () => {
44
46
  try {
45
47
  return window.self !== window.top;
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.16.4-beta.2"
2
+ "version": "0.16.4-beta.3"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio-cloud/rio-uikit",
3
- "version": "0.16.4-beta.2",
3
+ "version": "0.16.4-beta.3",
4
4
  "description": "The RIO UIKIT component library",
5
5
  "repository": "https://collaboration.msi.audi.com/stash/projects/RIOFRONT/repos/uikit-web/browse",
6
6
  "scripts": {
@@ -11,7 +11,8 @@ export const createButtonRipple = (event, target = null) => {
11
11
  }
12
12
  // The TouchEvent does not contain clientX/clientY by definition. Most browsers will emulate/add it, though.
13
13
  // Nevertheless, we read the client values from the first touch object to be compliant.
14
- if (event instanceof TouchEvent) {
14
+ // Note: some browsers don't provide the global "TouchEvent" constructor!
15
+ if (!!TouchEvent && event instanceof TouchEvent) {
15
16
  const firstTouch = event.touches[0];
16
17
  circle.style.left = `${firstTouch.clientX - buttonRect.left - radius}px`;
17
18
  circle.style.top = `${firstTouch.clientY - buttonRect.top - radius}px`;
@@ -7,5 +7,6 @@ export const SCREEN_XL: 1700;
7
7
  export function isMobileScreen(): boolean;
8
8
  export function isMobile(): boolean;
9
9
  export function isDesktop(): boolean;
10
+ export function isRetinaDevice(): boolean;
10
11
  export function inIframe(): boolean;
11
12
  export function toggleZoomOnMobile(): void;
@@ -33,6 +33,7 @@ export const SCREEN_XL = 1700;
33
33
  export const isMobileScreen = () => window.matchMedia(`(max-width: ${MOBILE_SCREEN}px)`).matches;
34
34
  export const isMobile = () => document && document.documentElement.classList.contains('ua-mobile');
35
35
  export const isDesktop = () => document && document.documentElement.classList.contains('ua-desktop');
36
+ export const isRetinaDevice = () => window.devicePixelRatio > 1;
36
37
  export const inIframe = () => {
37
38
  try {
38
39
  return window.self !== window.top;
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.16.4-beta.2"
2
+ "version": "0.16.4-beta.3"
3
3
  }