@rio-cloud/rio-uikit 1.4.0 → 1.5.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.
Files changed (174) hide show
  1. package/.DS_Store +0 -0
  2. package/FadeExpander.d.ts +2 -0
  3. package/FadeExpander.js +2 -0
  4. package/FadeUp.d.ts +2 -0
  5. package/FadeUp.js +2 -0
  6. package/XAxis.d.ts +2 -0
  7. package/XAxis.js +2 -0
  8. package/YAxis.d.ts +2 -0
  9. package/YAxis.js +2 -0
  10. package/components/applicationLayout/ApplicationLayoutBody.d.ts +5 -0
  11. package/components/applicationLayout/ApplicationLayoutBody.js +10 -1
  12. package/components/charts/Area.d.ts +11 -3
  13. package/components/charts/Area.js +9 -1
  14. package/components/charts/AreaChart.d.ts +4 -3
  15. package/components/charts/AreaChart.js +9 -8
  16. package/components/charts/Bar.d.ts +6 -2
  17. package/components/charts/Bar.js +3 -4
  18. package/components/charts/BarChart.d.ts +2 -1
  19. package/components/charts/BarChart.js +8 -4
  20. package/components/charts/ComposedChart.d.ts +6 -5
  21. package/components/charts/ComposedChart.js +16 -11
  22. package/components/charts/Legend.js +1 -1
  23. package/components/charts/Line.d.ts +11 -3
  24. package/components/charts/Line.js +9 -1
  25. package/components/charts/LineChart.d.ts +6 -4
  26. package/components/charts/LineChart.js +10 -9
  27. package/components/charts/ReferenceLine.d.ts +8 -4
  28. package/components/charts/ReferenceLine.js +18 -2
  29. package/components/charts/XAxis.d.ts +7 -0
  30. package/components/charts/XAxis.js +18 -0
  31. package/components/charts/YAxis.d.ts +5 -0
  32. package/components/charts/YAxis.js +2 -0
  33. package/components/collapse/Collapse.js +3 -2
  34. package/components/dropdown/ButtonDropdown.d.ts +3 -1
  35. package/components/dropdown/ButtonDropdown.js +6 -5
  36. package/components/dropdown/DropdownToggleButton.d.ts +1 -0
  37. package/components/dropdown/DropdownToggleButton.js +4 -2
  38. package/components/fade/FadeExpander.d.ts +27 -0
  39. package/components/fade/FadeExpander.js +41 -0
  40. package/components/fade/FadeUp.d.ts +27 -0
  41. package/components/fade/FadeUp.js +28 -0
  42. package/components/listMenu/ListMenu.d.ts +7 -0
  43. package/components/listMenu/ListMenu.js +6 -3
  44. package/components/map/components/features/Route.d.ts +13 -2
  45. package/components/map/components/features/Route.js +19 -11
  46. package/components/map/components/features/basics/Polygon.d.ts +1 -0
  47. package/components/map/components/features/basics/Polygon.js +1 -0
  48. package/components/map/components/features/basics/Polyline.d.ts +3 -1
  49. package/components/map/components/features/basics/Polyline.js +5 -16
  50. package/components/map/components/features/basics/polygonColors.d.ts +252 -0
  51. package/components/map/components/features/basics/polygonColors.js +252 -0
  52. package/components/map/utils/mapTypes.d.ts +1 -1
  53. package/components/map/utils/mapTypes.js +2 -0
  54. package/components/mapMarker/SingleMapMarker.d.ts +3 -2
  55. package/components/mapMarker/SingleMapMarker.js +3 -3
  56. package/components/selects/BaseSelectDropdown.d.ts +0 -1
  57. package/components/selects/BaseSelectDropdown.js +7 -1
  58. package/components/selects/Multiselect.js +1 -4
  59. package/components/selects/Select.d.ts +1 -1
  60. package/components/selects/Select.js +1 -4
  61. package/components/smoothScrollbars/SmoothScrollbars.js +28 -3
  62. package/components/switch/Switch.d.ts +6 -5
  63. package/components/switch/Switch.js +5 -5
  64. package/components/tag/Tag.d.ts +2 -2
  65. package/components/tag/Tag.js +5 -6
  66. package/hooks/useDOMNodeCount.d.ts +2 -0
  67. package/hooks/useDOMNodeCount.js +29 -0
  68. package/hooks/useEventListenerCount.d.ts +5 -0
  69. package/hooks/useEventListenerCount.js +42 -0
  70. package/hooks/useSorting.d.ts +29 -0
  71. package/hooks/useSorting.js +41 -0
  72. package/lib/es/FadeExpander.d.ts +2 -0
  73. package/lib/es/FadeExpander.js +7 -0
  74. package/lib/es/FadeUp.d.ts +2 -0
  75. package/lib/es/FadeUp.js +7 -0
  76. package/lib/es/XAxis.d.ts +2 -0
  77. package/lib/es/XAxis.js +7 -0
  78. package/lib/es/YAxis.d.ts +2 -0
  79. package/lib/es/YAxis.js +7 -0
  80. package/lib/es/components/applicationLayout/ApplicationLayoutBody.d.ts +5 -0
  81. package/lib/es/components/applicationLayout/ApplicationLayoutBody.js +10 -1
  82. package/lib/es/components/charts/Area.d.ts +11 -3
  83. package/lib/es/components/charts/Area.js +11 -1
  84. package/lib/es/components/charts/AreaChart.d.ts +4 -3
  85. package/lib/es/components/charts/AreaChart.js +8 -7
  86. package/lib/es/components/charts/Bar.d.ts +6 -2
  87. package/lib/es/components/charts/Bar.js +5 -4
  88. package/lib/es/components/charts/BarChart.d.ts +2 -1
  89. package/lib/es/components/charts/BarChart.js +7 -3
  90. package/lib/es/components/charts/ComposedChart.d.ts +6 -5
  91. package/lib/es/components/charts/ComposedChart.js +15 -10
  92. package/lib/es/components/charts/Legend.js +1 -1
  93. package/lib/es/components/charts/Line.d.ts +11 -3
  94. package/lib/es/components/charts/Line.js +11 -1
  95. package/lib/es/components/charts/LineChart.d.ts +6 -4
  96. package/lib/es/components/charts/LineChart.js +9 -8
  97. package/lib/es/components/charts/ReferenceLine.d.ts +8 -4
  98. package/lib/es/components/charts/ReferenceLine.js +21 -2
  99. package/lib/es/components/charts/XAxis.d.ts +7 -0
  100. package/lib/es/components/charts/XAxis.js +23 -0
  101. package/lib/es/components/charts/YAxis.d.ts +5 -0
  102. package/lib/es/components/charts/YAxis.js +4 -0
  103. package/lib/es/components/collapse/Collapse.js +3 -2
  104. package/lib/es/components/dropdown/ButtonDropdown.d.ts +3 -1
  105. package/lib/es/components/dropdown/ButtonDropdown.js +5 -4
  106. package/lib/es/components/dropdown/DropdownToggleButton.d.ts +1 -0
  107. package/lib/es/components/dropdown/DropdownToggleButton.js +4 -2
  108. package/lib/es/components/fade/FadeExpander.d.ts +27 -0
  109. package/lib/es/components/fade/FadeExpander.js +43 -0
  110. package/lib/es/components/fade/FadeUp.d.ts +27 -0
  111. package/lib/es/components/fade/FadeUp.js +30 -0
  112. package/lib/es/components/listMenu/ListMenu.d.ts +7 -0
  113. package/lib/es/components/listMenu/ListMenu.js +6 -3
  114. package/lib/es/components/map/components/features/Route.d.ts +13 -2
  115. package/lib/es/components/map/components/features/Route.js +20 -12
  116. package/lib/es/components/map/components/features/basics/Polygon.d.ts +1 -0
  117. package/lib/es/components/map/components/features/basics/Polygon.js +10 -0
  118. package/lib/es/components/map/components/features/basics/Polyline.d.ts +3 -1
  119. package/lib/es/components/map/components/features/basics/Polyline.js +5 -16
  120. package/lib/es/components/map/components/features/basics/polygonColors.d.ts +252 -0
  121. package/lib/es/components/map/components/features/basics/polygonColors.js +255 -0
  122. package/lib/es/components/map/utils/mapTypes.d.ts +1 -1
  123. package/lib/es/components/map/utils/mapTypes.js +2 -0
  124. package/lib/es/components/mapMarker/SingleMapMarker.d.ts +3 -2
  125. package/lib/es/components/mapMarker/SingleMapMarker.js +3 -3
  126. package/lib/es/components/selects/BaseSelectDropdown.d.ts +0 -1
  127. package/lib/es/components/selects/BaseSelectDropdown.js +6 -0
  128. package/lib/es/components/selects/Multiselect.js +1 -4
  129. package/lib/es/components/selects/Select.d.ts +1 -1
  130. package/lib/es/components/selects/Select.js +1 -4
  131. package/lib/es/components/smoothScrollbars/SmoothScrollbars.js +27 -2
  132. package/lib/es/components/switch/Switch.d.ts +6 -5
  133. package/lib/es/components/switch/Switch.js +5 -5
  134. package/lib/es/components/tag/Tag.d.ts +2 -2
  135. package/lib/es/components/tag/Tag.js +5 -6
  136. package/lib/es/hooks/useDOMNodeCount.d.ts +2 -0
  137. package/lib/es/hooks/useDOMNodeCount.js +31 -0
  138. package/lib/es/hooks/useEventListenerCount.d.ts +5 -0
  139. package/lib/es/hooks/useEventListenerCount.js +45 -0
  140. package/lib/es/hooks/useSorting.d.ts +29 -0
  141. package/lib/es/hooks/useSorting.js +43 -0
  142. package/lib/es/storageUtils.d.ts +1 -0
  143. package/lib/es/storageUtils.js +4 -0
  144. package/lib/es/styles/variables/colors/colors.json +4 -3
  145. package/lib/es/urlFeatureToggles.d.ts +1 -0
  146. package/lib/es/urlFeatureToggles.js +4 -0
  147. package/lib/es/useDOMNodeCount.d.ts +2 -0
  148. package/lib/es/useDOMNodeCount.js +7 -0
  149. package/lib/es/useEventListenerCount.d.ts +2 -0
  150. package/lib/es/useEventListenerCount.js +7 -0
  151. package/lib/es/useSorting.d.ts +2 -0
  152. package/lib/es/useSorting.js +7 -0
  153. package/lib/es/utils/storageUtils.d.ts +5 -0
  154. package/lib/es/utils/storageUtils.js +32 -0
  155. package/lib/es/utils/urlFeatureToggles.d.ts +10 -0
  156. package/lib/es/utils/urlFeatureToggles.js +41 -0
  157. package/lib/es/version.json +1 -1
  158. package/package.json +4 -1
  159. package/storageUtils.d.ts +1 -0
  160. package/storageUtils.js +1 -0
  161. package/styles/variables/colors/colors.json +4 -3
  162. package/urlFeatureToggles.d.ts +1 -0
  163. package/urlFeatureToggles.js +1 -0
  164. package/useDOMNodeCount.d.ts +2 -0
  165. package/useDOMNodeCount.js +2 -0
  166. package/useEventListenerCount.d.ts +2 -0
  167. package/useEventListenerCount.js +2 -0
  168. package/useSorting.d.ts +2 -0
  169. package/useSorting.js +2 -0
  170. package/utils/storageUtils.d.ts +5 -0
  171. package/utils/storageUtils.js +29 -0
  172. package/utils/urlFeatureToggles.d.ts +10 -0
  173. package/utils/urlFeatureToggles.js +32 -0
  174. package/version.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect } from 'react';
3
+ // biome-ignore lint/style/useImportType: <explanation>
4
+ import { useState, useEffect, forwardRef } from 'react';
4
5
  import ReactDOM from 'react-dom';
5
6
  import { usePopper } from 'react-popper';
6
7
  import classNames from 'classnames';
@@ -25,8 +26,8 @@ const getPlacement = (pullRight, dropup) => {
25
26
  }
26
27
  return 'bottom-start';
27
28
  };
28
- const ButtonDropdown = (props) => {
29
- const { id = Math.random().toString(36).substr(2, 16), items = [], bsSize = 'md', bsStyle = 'default', variant, disabled = false, iconOnly = false, title, splitButton = false, customDropdown, open, dropup = false, pullRight = false, noCaret = false, onOpen = noop, onClose = noop, onLabelButtonClick = noop, usePortal = false, popperConfig, toggleClassName = '', dropdownClassName, className = '' } = props, remainingProps = __rest(props, ["id", "items", "bsSize", "bsStyle", "variant", "disabled", "iconOnly", "title", "splitButton", "customDropdown", "open", "dropup", "pullRight", "noCaret", "onOpen", "onClose", "onLabelButtonClick", "usePortal", "popperConfig", "toggleClassName", "dropdownClassName", "className"]);
29
+ const ButtonDropdown = forwardRef((props, ref) => {
30
+ const { id = Math.random().toString(36).slice(2, 16), items = [], bsSize = 'md', bsStyle = 'default', variant, disabled = false, iconOnly = false, title, splitButton = false, customDropdown, open, dropup = false, pullRight = false, noCaret = false, onOpen = noop, onClose = noop, onLabelButtonClick = noop, usePortal = false, popperConfig, toggleClassName = '', dropdownClassName, className = '' } = props, remainingProps = __rest(props, ["id", "items", "bsSize", "bsStyle", "variant", "disabled", "iconOnly", "title", "splitButton", "customDropdown", "open", "dropup", "pullRight", "noCaret", "onOpen", "onClose", "onLabelButtonClick", "usePortal", "popperConfig", "toggleClassName", "dropdownClassName", "className"]);
30
31
  const [internalOpen, setInternalOpen] = useState(open);
31
32
  const [refDropdownToggle, setRefDropdownToggle] = useState(null);
32
33
  const [refDropdownMenu, setRefDropdownMenu] = useState(null);
@@ -89,6 +90,6 @@ const ButtonDropdown = (props) => {
89
90
  const wrapperClasses = classNames('dropdown', 'btn-group', isOpen && 'open', className);
90
91
  const dropdownClasses = classNames(usePortal && 'dropdown-portal', splitButton && pullRight && 'pull-right', dropdownClassName);
91
92
  const dropdownMenu = (_jsx(MenuItemList, Object.assign({ className: dropdownClasses, ref: setRefDropdownMenu, style: styles.popper }, attributes.popper, { children: customDropdown ? customDropdown : _jsx(MenuItems, { items: items, closeMenu: toggleOpen }) })));
92
- return (_jsxs("div", Object.assign({}, remainingProps, { className: wrapperClasses, ref: wrapperRef }, { children: [_jsx(DropdownToggleButton, Object.assign({ id: id, splitButton: splitButton, bsStyle: bsStyle, bsSize: bsSize, variant: variant, iconOnly: iconOnly, disabled: disabled, ref: setRefDropdownToggle, onClick: handleDropdownButtonClick, className: toggleClassName }, { children: _jsxs(_Fragment, { children: [title, shouldShowCaret && _jsx(Caret, {})] }) })), splitButton && (_jsx(SplitCaretButton, { id: id, bsStyle: bsStyle, bsSize: bsSize, disabled: disabled, className: toggleClassName, onClick: toggleOpen, ref: setRefSplitButtonToggle })), isOpen && usePortal && ReactDOM.createPortal(dropdownMenu, dropdownRoot), isOpen && !usePortal && dropdownMenu] })));
93
- };
93
+ return (_jsxs("div", Object.assign({}, remainingProps, { className: wrapperClasses, ref: wrapperRef }, { children: [_jsx(DropdownToggleButton, Object.assign({ id: id, splitButton: splitButton, bsStyle: bsStyle, bsSize: bsSize, variant: variant, iconOnly: iconOnly, disabled: disabled, ref: setRefDropdownToggle, onClick: handleDropdownButtonClick, outerRef: ref, className: toggleClassName }, { children: _jsxs(_Fragment, { children: [title, shouldShowCaret && _jsx(Caret, {})] }) })), splitButton && (_jsx(SplitCaretButton, { id: id, bsStyle: bsStyle, bsSize: bsSize, disabled: disabled, className: toggleClassName, onClick: toggleOpen, ref: setRefSplitButtonToggle })), isOpen && usePortal && ReactDOM.createPortal(dropdownMenu, dropdownRoot), isOpen && !usePortal && dropdownMenu] })));
94
+ });
94
95
  export default ButtonDropdown;
@@ -9,6 +9,7 @@ export type DropdownToggleButtonProps = HTMLProps<HTMLButtonElement> & {
9
9
  bsSize: BUTTON_SIZE;
10
10
  bsStyle: BUTTON_STYLE;
11
11
  variant?: BUTTON_VARIANT;
12
+ outerRef?: React.Ref<HTMLButtonElement>;
12
13
  className?: string;
13
14
  };
14
15
  declare const DropdownToggleButton: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<DropdownToggleButtonProps>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -3,9 +3,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { forwardRef } from 'react';
4
4
  import classNames from 'classnames';
5
5
  import Button from '../button/Button';
6
+ import useMergeRefs from '../../hooks/useMergeRefs';
6
7
  const DropdownToggleButton = forwardRef((props, ref) => {
7
- const { id, disabled, bsSize, bsStyle, variant, splitButton = false, onClick, className = '', children } = props, remainingProps = __rest(props, ["id", "disabled", "bsSize", "bsStyle", "variant", "splitButton", "onClick", "className", "children"]);
8
+ const { id, disabled, bsSize, bsStyle, variant, splitButton = false, onClick, className = '', children, outerRef } = props, remainingProps = __rest(props, ["id", "disabled", "bsSize", "bsStyle", "variant", "splitButton", "onClick", "className", "children", "outerRef"]);
9
+ const toggleRef = useMergeRefs(outerRef, ref);
8
10
  const labelButtonClasses = classNames(!splitButton && 'dropdown-toggle', !splitButton && className);
9
- return (_jsx(Button, Object.assign({}, remainingProps, { id: splitButton ? `button-${id}` : id, type: 'button', ref: ref, disabled: disabled, bsStyle: bsStyle, bsSize: bsSize, variant: variant, onClick: onClick, className: labelButtonClasses }, { children: children })));
11
+ return (_jsx(Button, Object.assign({}, remainingProps, { id: splitButton ? `button-${id}` : id, type: 'button', ref: toggleRef, disabled: disabled, bsStyle: bsStyle, bsSize: bsSize, variant: variant, onClick: onClick, className: labelButtonClasses }, { children: children })));
10
12
  });
11
13
  export default DropdownToggleButton;
@@ -0,0 +1,27 @@
1
+ import { type PropsWithChildren } from 'react';
2
+ type FadeExpanderProps = {
3
+ /**
4
+ * Defines if the content is shown or not.
5
+ *
6
+ * @default false
7
+ */
8
+ show: boolean;
9
+ /**
10
+ * Allows customization of animation duration.
11
+ *
12
+ * @default 0.2
13
+ */
14
+ duration?: number;
15
+ /**
16
+ * Delay in seconds before starting the animation.
17
+ *
18
+ * @default 0
19
+ */
20
+ delay?: number;
21
+ /**
22
+ * Additional classes set to the wrapper element.
23
+ */
24
+ className?: string;
25
+ };
26
+ declare const FadeExpander: (props: PropsWithChildren<FadeExpanderProps>) => import("react/jsx-runtime").JSX.Element;
27
+ export default FadeExpander;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect, useRef } from 'react';
3
+ import { motion, AnimatePresence } from 'framer-motion';
4
+ const THRESHOLD_TIMEOUT_MS = 200;
5
+ const FadeExpander = (props) => {
6
+ const { children, show = false, duration = 0.2, delay = 0, className = '' } = props;
7
+ const [isVisible, setIsVisible] = useState(show);
8
+ const [overflow, setOverflow] = useState('hidden'); // Start with hidden overflow
9
+ const durationRef = useRef(duration);
10
+ // Effect to manage visibility based on show prop
11
+ useEffect(() => {
12
+ if (show) {
13
+ // Set to visible when show is true
14
+ setIsVisible(true);
15
+ }
16
+ else {
17
+ // Set overflow to hidden immediately when show is false
18
+ setOverflow('hidden');
19
+ // Delay setting isVisible to false so the overflow can change before
20
+ setTimeout(() => {
21
+ setIsVisible(false);
22
+ }, 0);
23
+ }
24
+ }, [show]);
25
+ const handleAnimationComplete = () => {
26
+ if (show) {
27
+ // Set overflow to visible after animation is done
28
+ setTimeout(() => setOverflow('visible'), durationRef.current * 1000 + THRESHOLD_TIMEOUT_MS);
29
+ }
30
+ };
31
+ return (
32
+ // @ts-ignore
33
+ _jsx(AnimatePresence, Object.assign({ onExitComplete: () => setOverflow('hidden') }, { children: isVisible && (_jsx(motion.div, Object.assign({ initial: { height: 0, opacity: 0 }, animate: { height: 'auto', opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: {
34
+ height: { duration, delay },
35
+ opacity: { duration, delay },
36
+ ease: 'easeIn',
37
+ },
38
+ // To ensures smooth height transition, the overflow should be "hidden" during the animation
39
+ style: { overflow }, onAnimationComplete: handleAnimationComplete, className: className }, { children: children }))) })));
40
+ };
41
+ export default FadeExpander;
@@ -0,0 +1,27 @@
1
+ import { type ComponentProps, type PropsWithChildren } from 'react';
2
+ type FadeUpProps = Omit<ComponentProps<'div'>, 'onAnimationStart' | 'onDragStart' | 'onDragEnd' | 'onDrag'> & {
3
+ /**
4
+ * Defines the time the animation should wait until it starts.
5
+ *
6
+ * @default 0
7
+ */
8
+ delay?: number;
9
+ /**
10
+ * Defines the duration in seconds of the fade up animation.
11
+ *
12
+ * @default 0.4
13
+ */
14
+ duration?: number;
15
+ /**
16
+ * Defines the y offset from the bottom where the element starts to fade in.
17
+ *
18
+ * @default 15
19
+ */
20
+ offset?: number;
21
+ /**
22
+ * Additional classes names added to the motion div wrapper.
23
+ */
24
+ className?: string;
25
+ };
26
+ declare const FadeUp: (props: PropsWithChildren<FadeUpProps>) => import("react/jsx-runtime").JSX.Element;
27
+ export default FadeUp;
@@ -0,0 +1,28 @@
1
+ import { __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { motion } from 'framer-motion';
5
+ import useOnScreen from '../../hooks/useOnScreen';
6
+ const FadeUp = (props) => {
7
+ const { delay = 0, duration = 0.4, className = '', offset = 15, children } = props, remainingProps = __rest(props, ["delay", "duration", "className", "offset", "children"]);
8
+ const ref = useRef(null);
9
+ const isInView = useOnScreen(ref);
10
+ const [isVisible, setIsVisible] = useState(false);
11
+ const variants = {
12
+ hidden: {
13
+ opacity: 0,
14
+ y: offset,
15
+ },
16
+ visible: {
17
+ opacity: 1,
18
+ y: 0,
19
+ },
20
+ };
21
+ useEffect(() => {
22
+ if (isInView && !isVisible) {
23
+ setIsVisible(true);
24
+ }
25
+ }, [isInView, isVisible]);
26
+ return (_jsx(motion.div, Object.assign({ ref: ref, variants: variants, initial: 'hidden', animate: isVisible ? 'visible' : 'hidden', transition: { delay, type: 'spring', duration } }, remainingProps, { className: className }, { children: children })));
27
+ };
28
+ export default FadeUp;
@@ -27,6 +27,13 @@ export type ListMenuProps<T extends ListMenuNavItem> = {
27
27
  * The placeholder text for the filter input.
28
28
  */
29
29
  filterPlaceholder?: string;
30
+ /**
31
+ * Gets called when the filter input changes.
32
+ *
33
+ * @param value
34
+ * @returns
35
+ */
36
+ onFilterChange?: (value: string) => void;
30
37
  /**
31
38
  * A localized message to be shown when the filter result is empty.
32
39
  */
@@ -16,7 +16,7 @@ const MOBILE_MAX_WIDTH = 580;
16
16
  const filterMenuItems = (items, value, filterKey) => items.map(item => (Object.assign(Object.assign({}, item), { navItems: item.navItems.filter(navItem => navItem[filterKey].toLowerCase().includes(value.toLowerCase())) })));
17
17
  const hasMenuItems = (items) => items.find(({ navItems }) => !isEmpty(navItems));
18
18
  const ListMenu = (props) => {
19
- const { menuItems, focusFilter = false, enableFilter = false, filterPlaceholder, notFoundMessage, className = '', groupClassName = '', responsive = true, autoClose = true, filterKey = 'key', trailingInputAddon } = props, remainingProps = __rest(props, ["menuItems", "focusFilter", "enableFilter", "filterPlaceholder", "notFoundMessage", "className", "groupClassName", "responsive", "autoClose", "filterKey", "trailingInputAddon"]);
19
+ const { menuItems, focusFilter = false, enableFilter = false, filterPlaceholder, onFilterChange = () => { }, notFoundMessage, className = '', groupClassName = '', responsive = true, autoClose = true, filterKey = 'key', trailingInputAddon } = props, remainingProps = __rest(props, ["menuItems", "focusFilter", "enableFilter", "filterPlaceholder", "onFilterChange", "notFoundMessage", "className", "groupClassName", "responsive", "autoClose", "filterKey", "trailingInputAddon"]);
20
20
  const [filterValue, setFilterValue] = useState('');
21
21
  const [isMobileMode, setIsMobileMode] = useState(false);
22
22
  const [isExpanderOpen, setIsExpanderOpen] = useState(false);
@@ -57,7 +57,10 @@ const ListMenu = (props) => {
57
57
  });
58
58
  useLayoutEffect(() => buildMobileHeader, [menuItems]);
59
59
  const handleClear = () => focusFilter && focusInput();
60
- const handleFilterChange = (value) => setFilterValue(value);
60
+ const handleFilterChange = (value) => {
61
+ setFilterValue(value);
62
+ onFilterChange(value);
63
+ };
61
64
  const filteredMenuItems = filterMenuItems(menuItems, filterValue, filterKey);
62
65
  const handleExpanderBodyClick = (event) => {
63
66
  var _a;
@@ -66,7 +69,7 @@ const ListMenu = (props) => {
66
69
  setIsExpanderOpen(false);
67
70
  }
68
71
  };
69
- const formClassNames = classNames('form-group', 'margin-top-5', 'margin-bottom-5', 'padding-left-15', 'padding-right-15', 'padding-bottom-15', 'position-sticky', 'top-0');
72
+ const formClassNames = classNames('form-group', 'margin-bottom-5', 'padding-left-15', 'padding-right-15', 'padding-bottom-15', 'position-sticky', 'top-0');
70
73
  const listMenu = (_jsxs("div", Object.assign({}, remainingProps, { className: `ListMenu ${className}`, ref: listRef }, { children: [enableFilter && (_jsx("div", Object.assign({ className: formClassNames }, { children: _jsxs("div", Object.assign({ className: 'input-group width-100pct' }, { children: [_jsx("span", Object.assign({ className: 'input-group-addon' }, { children: _jsx("span", { className: 'rioglyph rioglyph-search', "aria-hidden": 'true' }) })), _jsx(ClearableInput, { value: filterValue, inputRef: inputRef, placeholder: filterPlaceholder, onChange: handleFilterChange, onClear: handleClear }), trailingInputAddon && trailingInputAddon] })) }))), !hasMenuItems(filteredMenuItems) && (_jsx("div", Object.assign({ className: 'padding-top-25 text-center text-color-gray' }, { children: notFoundMessage }))), filteredMenuItems.map(menuGroup => (_jsx(ListMenuGroup, { className: groupClassName, menuGroup: menuGroup }, crypto.randomUUID())))] })));
71
74
  if (responsive && isMobileMode) {
72
75
  return (_jsx(ExpanderPanel, Object.assign({ title: mobileHeader, bsStyle: 'default', open: isExpanderOpen, onToggle: () => setIsExpanderOpen(!isExpanderOpen), unmountOnExit: false, className: 'shadow-default' }, { children: _jsx("div", Object.assign({ onClick: handleExpanderBodyClick }, { children: listMenu })) })));
@@ -1,10 +1,20 @@
1
1
  /// <reference types="react" />
2
+ import { type ArrowStyle } from './basics/Polyline';
2
3
  import type { Position } from '../../utils/mapTypes';
3
4
  import type { EventListenerMap } from '../../utils/eventHandling';
4
5
  export declare const MISSING_POSITIONS_EXCEPTION_MSG = "Route requires a minimum of 1 positions";
5
6
  export declare const TO_LESS_LINE_WIDTH_EXCEPTION_MSG = "If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth";
7
+ export declare const DEFAULT_LINE_STROKE_COLOR = "rgba(48, 194, 255, 1)";
8
+ export declare const DEFAULT_LINE_STROKE_COLOR_REDUCED = "rgba(48, 194, 255, 0.5)";
9
+ export declare const DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE = "rgb(200, 243, 247)";
10
+ export declare const DEFAULT_BORDER_STROKE_COLOR = "rgba(22, 100, 141, 1)";
11
+ export declare const DEFAULT_BORDER_STROKE_COLOR_REDUCED = "rgba(255, 255, 255, 0)";
12
+ export declare const ROUTE_COLOR_DANGER = "#e22837";
13
+ export declare const ROUTE_COLOR_WARNING = "#ff8e3c";
14
+ export declare const ROUTE_COLOR_SUCCESS = "#5cb85c";
15
+ export declare const ROUTE_COLOR_WHITE = "rgba(255, 255, 255, 1)";
6
16
  export type RouteStyle = {
7
- width: number;
17
+ width?: number;
8
18
  color?: string;
9
19
  borderWidth?: number;
10
20
  borderColor?: string;
@@ -12,7 +22,7 @@ export type RouteStyle = {
12
22
  lineDash?: number[];
13
23
  };
14
24
  export type RouteProps = {
15
- arrowStyle?: object;
25
+ arrowStyle?: ArrowStyle;
16
26
  hasArrows?: boolean;
17
27
  positions: Position[];
18
28
  style?: RouteStyle;
@@ -23,6 +33,7 @@ export type RouteProps = {
23
33
  middleIcon?: JSX.Element;
24
34
  endIcon?: JSX.Element;
25
35
  markers?: JSX.Element[];
36
+ customData?: object;
26
37
  };
27
38
  declare const Route: (props: RouteProps) => import("react/jsx-runtime").JSX.Element | null;
28
39
  export default Route;
@@ -7,21 +7,29 @@ import Marker from './basics/Marker';
7
7
  import MapException from '../../exceptions/MapException';
8
8
  export const MISSING_POSITIONS_EXCEPTION_MSG = 'Route requires a minimum of 1 positions';
9
9
  export const TO_LESS_LINE_WIDTH_EXCEPTION_MSG = 'If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth';
10
- const LINE_STROKE_COLOR = 'rgba(48, 194, 255, 1)';
11
- const LINE_STROKE_COLOR_REDUCED = 'rgba(48, 194, 255, 0.5)';
12
- const BORDER_STROKE_COLOR_REDUCED = 'rgba(255, 255, 255, 0)';
10
+ export const DEFAULT_LINE_STROKE_COLOR = 'rgba(48, 194, 255, 1)';
11
+ export const DEFAULT_LINE_STROKE_COLOR_REDUCED = 'rgba(48, 194, 255, 0.5)';
12
+ export const DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE = 'rgb(200, 243, 247)';
13
+ export const DEFAULT_BORDER_STROKE_COLOR = 'rgba(22, 100, 141, 1)';
14
+ export const DEFAULT_BORDER_STROKE_COLOR_REDUCED = 'rgba(255, 255, 255, 0)';
15
+ // Both works, rgb or hex - keep in mind that these state colors may change
16
+ // so use this constants instead of actual color values in the service
17
+ export const ROUTE_COLOR_DANGER = '#e22837';
18
+ export const ROUTE_COLOR_WARNING = '#ff8e3c';
19
+ export const ROUTE_COLOR_SUCCESS = '#5cb85c';
20
+ export const ROUTE_COLOR_WHITE = 'rgba(255, 255, 255, 1)';
13
21
  const DEFAULT_WIDTH = 5;
14
22
  const DEFAULT_BORDER_WIDTH = 2;
15
23
  const defaultStyle = {
16
24
  width: DEFAULT_WIDTH,
17
- color: LINE_STROKE_COLOR,
25
+ color: DEFAULT_LINE_STROKE_COLOR,
18
26
  borderWidth: DEFAULT_BORDER_WIDTH,
19
- borderColor: 'rgba(54, 144, 174, 1)',
27
+ borderColor: DEFAULT_BORDER_STROKE_COLOR,
20
28
  isBorderIncludedInWidth: false,
21
29
  };
22
- const alternativeRouteStyle = Object.assign(Object.assign({}, defaultStyle), { color: 'rgb(218,253,255)' });
30
+ const alternativeRouteStyle = Object.assign(Object.assign({}, defaultStyle), { color: DEFAULT_LINE_STROKE_COLOR_ALTERNATIVE });
23
31
  const Route = (props) => {
24
- const { style, isReduced = false, isRouteAlternative = false, positions, startIcon, middleIcon, endIcon, arrowStyle = {}, hasArrows = true, markers = [], eventListenerMap, } = props;
32
+ const { style, isReduced = false, isRouteAlternative = false, positions, startIcon, middleIcon, endIcon, arrowStyle = {}, hasArrows = true, markers = [], customData, eventListenerMap, } = props;
25
33
  const [lineString, setLineString] = useState();
26
34
  const [routeStyle, setRouteStyle] = useState();
27
35
  const [borderStyle, setBorderStyle] = useState();
@@ -51,17 +59,17 @@ const Route = (props) => {
51
59
  };
52
60
  const updateStyle = (updatedStyle, isReducedStyle, isRouteAlternativeStyle) => {
53
61
  const mergedStyle = Object.assign(Object.assign({}, (isRouteAlternativeStyle ? alternativeRouteStyle : defaultStyle)), updatedStyle);
54
- const { color, width, borderColor, borderWidth: mergedBorderWidth = 0, isBorderIncludedInWidth, lineDash, } = mergedStyle;
62
+ const { color, width = DEFAULT_WIDTH, borderColor, borderWidth: mergedBorderWidth = 0, isBorderIncludedInWidth, lineDash, } = mergedStyle;
55
63
  setBorderWidth(isReducedStyle ? 0 : mergedBorderWidth);
56
64
  if (isBorderIncludedInWidth && mergedBorderWidth >= width) {
57
65
  throw new MapException(TO_LESS_LINE_WIDTH_EXCEPTION_MSG);
58
66
  }
59
- setRouteStyle(new H.map.SpatialStyle(Object.assign({ strokeColor: isReducedStyle ? LINE_STROKE_COLOR_REDUCED : color, lineWidth: isReducedStyle ? mergedBorderWidth + width : width, lineCap: 'round', lineJoin: 'bevel' }, (lineDash && lineDash))));
60
- setBorderStyle(new H.map.SpatialStyle(Object.assign({ strokeColor: isReduced ? BORDER_STROKE_COLOR_REDUCED : borderColor, lineWidth: mergedBorderWidth + width, lineCap: 'round', lineJoin: 'bevel' }, (lineDash && lineDash))));
67
+ setRouteStyle(new H.map.SpatialStyle(Object.assign({ strokeColor: isReducedStyle ? DEFAULT_LINE_STROKE_COLOR_REDUCED : color, lineWidth: isReducedStyle ? mergedBorderWidth + width : width, lineCap: 'round', lineJoin: 'bevel' }, (lineDash && lineDash))));
68
+ setBorderStyle(new H.map.SpatialStyle(Object.assign({ strokeColor: isReduced ? DEFAULT_BORDER_STROKE_COLOR_REDUCED : borderColor, lineWidth: mergedBorderWidth + width, lineCap: 'round', lineJoin: 'bevel' }, (lineDash && lineDash))));
61
69
  };
62
70
  if (!lineString) {
63
71
  return null;
64
72
  }
65
- return (_jsxs("div", { children: [borderWidth > 0 && (_jsx(Polyline, { eventListenerMap: eventListenerMap, geometry: lineString, style: borderStyle })), _jsx(Polyline, { hasArrows: hasArrows, arrowStyle: arrowStyle, eventListenerMap: eventListenerMap, geometry: lineString, style: routeStyle }), startIcon && _jsx(Marker, { position: positions[0], icon: startIcon }, 'startIcon'), middleIcon && (_jsx(Marker, { position: positions[Math.floor(positions.length / 2)], icon: middleIcon }, 'middleIcon')), endIcon && _jsx(Marker, { position: positions[positions.length - 1], icon: endIcon }, 'endIcon'), isArray(markers) && markers.map(marker => marker)] }));
73
+ return (_jsxs("div", { children: [borderWidth > 0 && (_jsx(Polyline, { eventListenerMap: eventListenerMap, geometry: lineString, style: borderStyle, customData: customData })), _jsx(Polyline, { hasArrows: hasArrows, arrowStyle: arrowStyle, eventListenerMap: eventListenerMap, geometry: lineString, style: routeStyle, customData: customData }), startIcon && _jsx(Marker, { position: positions[0], icon: startIcon }, 'startIcon'), middleIcon && (_jsx(Marker, { position: positions[Math.floor(positions.length / 2)], icon: middleIcon }, 'middleIcon')), endIcon && _jsx(Marker, { position: positions[positions.length - 1], icon: endIcon }, 'endIcon'), isArray(markers) && markers.map(marker => marker)] }));
66
74
  };
67
75
  export default Route;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="heremaps" />
2
2
  import type { Position } from '../../../utils/mapTypes';
3
3
  import type { EventListenerMap } from '../../../utils/eventHandling';
4
+ export { colorMapColdplay, colorMapWarmup, colorMapGray, colorMapBrand, colorMapStatus, colorMapMarker, colorMapRating, colorMapHighlight, } from './polygonColors';
4
5
  export type PolygonPoints = Position[] & Record<string, any>;
5
6
  export type PolygonProps = {
6
7
  points: PolygonPoints;
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
2
2
  import isNil from 'lodash/fp/isNil';
3
3
  import { useMapContext } from '../../MapContext';
4
4
  import { useUpdateProp, useUpdateEventListenerMap } from '../../../utils/hooks';
5
+ export { colorMapColdplay, colorMapWarmup, colorMapGray, colorMapBrand, colorMapStatus, colorMapMarker, colorMapRating, colorMapHighlight, } from './polygonColors';
5
6
  const createGeometry = (points) => {
6
7
  const lineString = new H.geo.LineString();
7
8
  points.forEach(p => {
@@ -2,11 +2,13 @@
2
2
  import { type EventListenerMap } from '../../../utils/eventHandling';
3
3
  export declare const MISSING_GEOMETRY_PROPS_EXCEPTION_MSG = "Error in Polyline: Polyline without geometry makes no sense";
4
4
  export declare const WRONG_GEOMETRY_PROPS_EXCEPTION_MSG = "Error in Polyline: property geometry must be of type H.geo.LineString";
5
+ export type ArrowStyle = H.map.Polyline.Options;
5
6
  export type PolylineProps = {
6
7
  hasArrows?: boolean;
7
- arrowStyle?: object;
8
+ arrowStyle?: ArrowStyle;
8
9
  geometry: H.geo.LineString;
9
10
  style?: H.map.SpatialStyle;
11
+ customData?: object;
10
12
  eventListenerMap?: EventListenerMap;
11
13
  };
12
14
  declare const Polyline: (props: PolylineProps) => null;
@@ -7,7 +7,7 @@ import { isVectorBased } from '../../../utils/rendering';
7
7
  export const MISSING_GEOMETRY_PROPS_EXCEPTION_MSG = 'Error in Polyline: Polyline without geometry makes no sense';
8
8
  export const WRONG_GEOMETRY_PROPS_EXCEPTION_MSG = 'Error in Polyline: property geometry must be of type H.geo.LineString';
9
9
  const Polyline = (props) => {
10
- const { geometry, hasArrows, arrowStyle, style = H.map.SpatialStyle.DEFAULT_STYLE, eventListenerMap } = props;
10
+ const { geometry, hasArrows, arrowStyle, style = H.map.SpatialStyle.DEFAULT_STYLE, customData, eventListenerMap, } = props;
11
11
  const { api, enableWebGL, baseLayer } = useMapContext();
12
12
  const [polyline, setPolyline] = useState();
13
13
  if (!geometry) {
@@ -18,32 +18,21 @@ const Polyline = (props) => {
18
18
  }
19
19
  useEffect(() => {
20
20
  var _a;
21
- const lineGroup = new H.map.Group();
21
+ const lineGroup = new H.map.Group({ data: customData });
22
22
  const line = new H.map.Polyline(geometry, { style });
23
23
  if (hasArrows) {
24
24
  let routeArrows;
25
25
  if (isVectorBased(enableWebGL, baseLayer)) {
26
26
  // WebGL way - Create a patterned polyline
27
27
  routeArrows = new H.map.Polyline(geometry, {
28
- style: {
29
- strokeColor: 'rgba(42, 55, 64, 1)',
30
- lineWidth: 5,
31
- lineDash: [1.8, 4],
28
+ style: Object.assign({ strokeColor: 'rgba(42, 55, 64, 1)', lineWidth: 5, lineDash: [1.8, 4],
32
29
  // @ts-ignore-next-line - the types are outdated here
33
- lineDashImage: H.map.SpatialStyle.DashImage.ARROW,
34
- },
30
+ lineDashImage: H.map.SpatialStyle.DashImage.ARROW }, arrowStyle),
35
31
  });
36
32
  }
37
33
  else {
38
34
  // Pixel map way - Create a patterned polyline
39
- const defaultArrowStyle = {
40
- lineWidth: 2,
41
- fillColor: 'rgba(42, 55, 64, 1)',
42
- strokeColor: 'rgba(0, 0, 0, 0.8)',
43
- lineDash: [0, 4],
44
- lineTailCap: 'arrow-tail',
45
- lineHeadCap: 'arrow-head',
46
- };
35
+ const defaultArrowStyle = Object.assign({ lineWidth: 2, fillColor: 'rgba(42, 55, 64, 1)', strokeColor: 'rgba(0, 0, 0, 0.8)', lineDash: [0, 4], lineTailCap: 'arrow-tail', lineHeadCap: 'arrow-head' }, arrowStyle);
47
36
  const arrowLineStyle = new H.map.SpatialStyle({
48
37
  lineWidth: 10,
49
38
  strokeColor: 'rgba(255, 255, 255, 0)',