@rio-cloud/rio-uikit 0.16.1 → 0.16.2-beta.11
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/.DS_Store +0 -0
- package/ColorScheme.d.ts +4 -0
- package/ColorScheme.js +2 -0
- package/Colors.js +1 -1
- package/TruckLayer.js +1 -1
- package/components/.DS_Store +0 -0
- package/components/applicationHeader/AppMenu.js +6 -3
- package/components/applicationHeader/AppMenuDropdown.js +6 -2
- package/components/applicationHeader/ApplicationHeader.js +10 -5
- package/components/applicationHeader/MobileAppMenu.js +8 -4
- package/components/assetTree/Tree.js +1 -1
- package/components/autosuggest/AutoSuggest.js +2 -2
- package/components/charts/chartHelper.js +1 -1
- package/components/clearableInput/ClearableInput.js +2 -1
- package/components/datepicker/DatePicker.js +8 -4
- package/components/filepicker/FilePicker.js +5 -4
- package/components/map/.DS_Store +0 -0
- package/components/map/assets/icon_map_settings_maptype_night_active.svg +12 -0
- package/components/map/assets/icon_map_settings_maptype_night_inactive.svg +12 -0
- package/components/map/components/.DS_Store +0 -0
- package/components/map/components/Map.js +167 -140
- package/components/map/components/constants.js +1 -0
- package/components/map/components/features/Route.js +6 -7
- package/components/map/components/features/basics/Polyline.js +10 -5
- package/components/map/components/features/layers/RoadRestrictionLayer.js +27 -0
- package/components/map/components/features/layers/TrafficLayer.js +19 -5
- package/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +19 -0
- package/components/map/components/features/layers/baselayers/DefaultVectorLayer.js +15 -0
- package/components/map/components/features/layers/baselayers/FleetStyleLayer.js +13 -17
- package/components/map/components/features/layers/baselayers/NightLayer.js +17 -0
- package/components/map/components/features/layers/baselayers/SatelliteLayer.js +13 -17
- package/components/map/components/features/layers/baselayers/TerrainLayer.js +13 -17
- package/components/map/components/features/layers/baselayers/useBaseLayer.js +53 -0
- package/components/map/components/features/settings/builtinSettings/MapClusterSettings.js +1 -1
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +9 -3
- package/components/map/components/mapUtils.js +44 -8
- package/components/map/icons/MapIcon.js +64 -0
- package/components/mapMarker/ClusterMapMarker.js +2 -2
- package/components/mapMarker/SingleMapMarker.js +8 -2
- package/components/numberControl/NumberControl.js +43 -14
- package/components/numberInput/NumberInput.js +75 -55
- package/components/sidebars/Sidebar.js +2 -2
- package/hooks/useDarkMode.js +30 -0
- package/hooks/useElementSize.js +1 -1
- package/hooks/useFullscreen.js +37 -41
- package/hooks/useHereMap.ts +23 -0
- package/hooks/useMutationObserver.js +38 -0
- package/hooks/useScripts.ts +52 -0
- package/hooks/useScrollPosition.js +72 -0
- package/index.js +6 -1
- package/lib/.DS_Store +0 -0
- package/lib/es/.DS_Store +0 -0
- package/lib/es/ColorScheme.d.ts +4 -0
- package/lib/es/ColorScheme.js +18 -0
- package/lib/es/Colors.js +1 -1
- package/lib/es/TruckLayer.js +2 -2
- package/lib/es/components/.DS_Store +0 -0
- package/lib/es/components/applicationHeader/AppMenu.js +6 -3
- package/lib/es/components/applicationHeader/AppMenuDropdown.js +6 -2
- package/lib/es/components/applicationHeader/ApplicationHeader.js +10 -5
- package/lib/es/components/applicationHeader/MobileAppMenu.js +8 -4
- package/lib/es/components/assetTree/Tree.js +1 -1
- package/lib/es/components/autosuggest/AutoSuggest.js +2 -2
- package/lib/es/components/charts/chartHelper.js +1 -1
- package/lib/es/components/clearableInput/ClearableInput.js +2 -1
- package/lib/es/components/datepicker/DatePicker.js +7 -3
- package/lib/es/components/filepicker/FilePicker.js +5 -4
- package/lib/es/components/map/assets/icon_map_settings_maptype_night_active.svg +12 -0
- package/lib/es/components/map/assets/icon_map_settings_maptype_night_inactive.svg +12 -0
- package/lib/es/components/map/components/Map.js +165 -135
- package/lib/es/components/map/components/constants.js +3 -1
- package/lib/es/components/map/components/features/Route.js +6 -7
- package/lib/es/components/map/components/features/basics/Polyline.js +10 -7
- package/lib/es/components/map/components/features/layers/RoadRestrictionLayer.js +35 -0
- package/lib/es/components/map/components/features/layers/TrafficLayer.js +18 -5
- package/lib/es/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +25 -0
- package/lib/es/components/map/components/features/layers/baselayers/DefaultVectorLayer.js +22 -0
- package/lib/es/components/map/components/features/layers/baselayers/FleetStyleLayer.js +12 -17
- package/lib/es/components/map/components/features/layers/baselayers/NightLayer.js +23 -0
- package/lib/es/components/map/components/features/layers/baselayers/SatelliteLayer.js +12 -17
- package/lib/es/components/map/components/features/layers/baselayers/TerrainLayer.js +12 -17
- package/lib/es/components/map/components/features/layers/baselayers/useBaseLayer.js +61 -0
- package/lib/es/components/map/components/features/settings/builtinSettings/MapClusterSettings.js +1 -1
- package/lib/es/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +7 -1
- package/lib/es/components/map/components/mapUtils.js +44 -10
- package/lib/es/components/map/icons/MapIcon.js +67 -1
- package/lib/es/components/mapMarker/ClusterMapMarker.js +2 -2
- package/lib/es/components/mapMarker/SingleMapMarker.js +8 -2
- package/lib/es/components/numberControl/NumberControl.js +42 -13
- package/lib/es/components/numberInput/NumberInput.js +75 -55
- package/lib/es/components/sidebars/Sidebar.js +2 -2
- package/lib/es/hooks/useDarkMode.js +38 -0
- package/lib/es/hooks/useElementSize.js +1 -1
- package/lib/es/hooks/useFullscreen.js +37 -41
- package/lib/es/hooks/useHereMap.ts +23 -0
- package/lib/es/hooks/useMutationObserver.js +46 -0
- package/lib/es/hooks/useScripts.ts +52 -0
- package/lib/es/hooks/useScrollPosition.js +80 -0
- package/lib/es/index.js +40 -1
- package/lib/es/mapIndex.js +2 -2
- package/lib/es/styles/.DS_Store +0 -0
- package/lib/es/styles/components/Activity.less +9 -10
- package/lib/es/styles/components/ApplicationHeader.less +24 -29
- package/lib/es/styles/components/ApplicationLayout.less +7 -7
- package/lib/es/styles/components/AssetTree.less +30 -28
- package/lib/es/styles/components/AutoSuggest.less +2 -2
- package/lib/es/styles/components/BottomSheet.less +1 -2
- package/lib/es/styles/components/Carousel.less +13 -9
- package/lib/es/styles/components/Checkbox.less +15 -16
- package/lib/es/styles/components/ClearableInput.less +3 -3
- package/lib/es/styles/components/Counter.less +12 -12
- package/lib/es/styles/components/DataTabs.less +2 -2
- package/lib/es/styles/components/DatePicker.less +27 -27
- package/lib/es/styles/components/Dialog.less +15 -11
- package/lib/es/styles/components/Dropdown.less +11 -11
- package/lib/es/styles/components/Expander.less +7 -7
- package/lib/es/styles/components/ListMenu.less +8 -8
- package/lib/es/styles/components/MapHere.less +3 -2
- package/lib/es/styles/components/MapMarker.less +16 -17
- package/lib/es/styles/components/MapSettings.less +5 -5
- package/lib/es/styles/components/NoData.less +1 -1
- package/lib/es/styles/components/Notification.less +12 -12
- package/lib/es/styles/components/RadioButton.less +11 -12
- package/lib/es/styles/components/Resizer.less +1 -1
- package/lib/es/styles/components/Select.less +16 -26
- package/lib/es/styles/components/Sidebar.less +29 -21
- package/lib/es/styles/components/Slider.less +18 -18
- package/lib/es/styles/components/Spinner.less +6 -6
- package/lib/es/styles/components/StatsWidget.less +5 -5
- package/lib/es/styles/components/SteppedProgressBar.less +32 -29
- package/lib/es/styles/components/SupportMarker.less +1 -1
- package/lib/es/styles/components/Switch.less +8 -8
- package/lib/es/styles/components/TableSettingsDialog.less +7 -7
- package/lib/es/styles/components/TableToolbar.less +1 -1
- package/lib/es/styles/components/Tag.less +10 -10
- package/lib/es/styles/components/Timeline.less +3 -3
- package/lib/es/styles/components/Tooltip.less +10 -10
- package/lib/es/styles/design/badges.less +10 -10
- package/lib/es/styles/design/border.less +1 -1
- package/lib/es/styles/design/breadcrumbs.less +2 -2
- package/lib/es/styles/design/button-groups.less +25 -1
- package/lib/es/styles/design/buttons.less +53 -109
- package/lib/es/styles/design/callouts.less +3 -3
- package/lib/es/styles/design/code.less +4 -6
- package/lib/es/styles/design/colors.less +20 -20
- package/lib/es/styles/design/form-input-groups.less +4 -4
- package/lib/es/styles/design/form-inputs.less +33 -31
- package/lib/es/styles/design/images.less +2 -2
- package/lib/es/styles/design/labels.less +11 -11
- package/lib/es/styles/design/list-group.less +14 -12
- package/lib/es/styles/design/navs.less +27 -27
- package/lib/es/styles/design/normalize.less +0 -9
- package/lib/es/styles/design/pagination.less +10 -10
- package/lib/es/styles/design/panels.less +10 -10
- package/lib/es/styles/design/popovers.less +8 -8
- package/lib/es/styles/design/progress-bars.less +8 -8
- package/lib/es/styles/design/shadows.less +14 -7
- package/lib/es/styles/design/tables.less +68 -106
- package/lib/es/styles/design/text.less +5 -19
- package/lib/es/styles/design/theme.less +10 -10
- package/lib/es/styles/design/thumbnails.less +2 -2
- package/lib/es/styles/design/type.less +4 -4
- package/lib/es/styles/design/wells.less +1 -1
- package/lib/es/styles/mapping/color-map.less +76 -75
- package/lib/es/styles/mixins/_imports.less +14 -0
- package/lib/es/styles/mixins/buttons.less +24 -56
- package/lib/es/styles/mixins/forms.less +19 -55
- package/lib/es/styles/mixins/hsl.less +19 -0
- package/lib/es/styles/mixins/panels.less +2 -2
- package/lib/es/styles/print/print.less +7 -7
- package/lib/es/styles/rio-uikit-core.less +2 -2
- package/lib/es/styles/rio-uikit-print-utilities.less +2 -2
- package/lib/es/styles/rio-uikit-responsive-utilities.less +2 -2
- package/lib/es/styles/variables/_index.less +196 -0
- package/lib/es/styles/variables/colors.json +67 -0
- package/lib/es/styles/variables/concated_css_variables.less +66 -0
- package/lib/es/styles/variables/dark_colors.less +88 -0
- package/lib/es/styles/variables/dark_css_variables.less +28 -0
- package/lib/es/styles/variables/dark_css_variables_map.less +96 -0
- package/lib/es/styles/variables/light_colors.less +92 -0
- package/lib/es/styles/variables/light_css_variables.less +17 -0
- package/lib/es/styles/variables/light_css_variables_map.less +100 -0
- package/lib/es/styles/variables/screens.less +7 -0
- package/lib/es/styles/variables/text.less +23 -0
- package/lib/es/themes/.DS_Store +0 -0
- package/lib/es/themes/BuyButton/styles/rio-buyButton.less +13 -8
- package/lib/es/themes/MAN/styles/man-uikit.less +3 -0
- package/lib/es/themes/SCANIA/styles/scania-uikit.less +3 -0
- package/lib/es/themes/Volkswagen/styles/vw-uikit.less +21 -30
- package/lib/es/themes/Website/styles/rio-website.less +154 -124
- package/lib/es/themes/Xmas/styles/rio-xmas.less +59 -29
- package/lib/es/types.ts +30 -5
- package/lib/es/useDarkMode.d.ts +4 -0
- package/lib/es/useDarkMode.js +13 -0
- package/lib/es/useMutationObserver.d.ts +4 -0
- package/lib/es/useMutationObserver.js +13 -0
- package/lib/es/useScrollPosition.d.ts +4 -0
- package/lib/es/useScrollPosition.js +13 -0
- package/lib/es/utils/colorScheme.js +69 -0
- package/lib/es/utils/init.js +34 -34
- package/lib/es/version.json +1 -1
- package/mapIndex.js +1 -1
- package/package.json +34 -33
- package/styles/.DS_Store +0 -0
- package/styles/components/Activity.less +9 -10
- package/styles/components/ApplicationHeader.less +24 -29
- package/styles/components/ApplicationLayout.less +7 -7
- package/styles/components/AssetTree.less +30 -28
- package/styles/components/AutoSuggest.less +2 -2
- package/styles/components/BottomSheet.less +1 -2
- package/styles/components/Carousel.less +13 -9
- package/styles/components/Checkbox.less +15 -16
- package/styles/components/ClearableInput.less +3 -3
- package/styles/components/Counter.less +12 -12
- package/styles/components/DataTabs.less +2 -2
- package/styles/components/DatePicker.less +27 -27
- package/styles/components/Dialog.less +15 -11
- package/styles/components/Dropdown.less +11 -11
- package/styles/components/Expander.less +7 -7
- package/styles/components/ListMenu.less +8 -8
- package/styles/components/MapHere.less +3 -2
- package/styles/components/MapMarker.less +16 -17
- package/styles/components/MapSettings.less +5 -5
- package/styles/components/NoData.less +1 -1
- package/styles/components/Notification.less +12 -12
- package/styles/components/RadioButton.less +11 -12
- package/styles/components/Resizer.less +1 -1
- package/styles/components/Select.less +16 -26
- package/styles/components/Sidebar.less +29 -21
- package/styles/components/Slider.less +18 -18
- package/styles/components/Spinner.less +6 -6
- package/styles/components/StatsWidget.less +5 -5
- package/styles/components/SteppedProgressBar.less +32 -29
- package/styles/components/SupportMarker.less +1 -1
- package/styles/components/Switch.less +8 -8
- package/styles/components/TableSettingsDialog.less +7 -7
- package/styles/components/TableToolbar.less +1 -1
- package/styles/components/Tag.less +10 -10
- package/styles/components/Timeline.less +3 -3
- package/styles/components/Tooltip.less +10 -10
- package/styles/design/badges.less +10 -10
- package/styles/design/border.less +1 -1
- package/styles/design/breadcrumbs.less +2 -2
- package/styles/design/button-groups.less +25 -1
- package/styles/design/buttons.less +53 -109
- package/styles/design/callouts.less +3 -3
- package/styles/design/code.less +4 -6
- package/styles/design/colors.less +20 -20
- package/styles/design/form-input-groups.less +4 -4
- package/styles/design/form-inputs.less +33 -31
- package/styles/design/images.less +2 -2
- package/styles/design/labels.less +11 -11
- package/styles/design/list-group.less +14 -12
- package/styles/design/navs.less +27 -27
- package/styles/design/normalize.less +0 -9
- package/styles/design/pagination.less +10 -10
- package/styles/design/panels.less +10 -10
- package/styles/design/popovers.less +8 -8
- package/styles/design/progress-bars.less +8 -8
- package/styles/design/shadows.less +14 -7
- package/styles/design/tables.less +68 -106
- package/styles/design/text.less +5 -19
- package/styles/design/theme.less +10 -10
- package/styles/design/thumbnails.less +2 -2
- package/styles/design/type.less +4 -4
- package/styles/design/wells.less +1 -1
- package/styles/mapping/color-map.less +76 -75
- package/styles/mixins/_imports.less +14 -0
- package/styles/mixins/buttons.less +24 -56
- package/styles/mixins/forms.less +19 -55
- package/styles/mixins/hsl.less +19 -0
- package/styles/mixins/panels.less +2 -2
- package/styles/print/print.less +7 -7
- package/styles/rio-uikit-core.less +2 -2
- package/styles/rio-uikit-print-utilities.less +2 -2
- package/styles/rio-uikit-responsive-utilities.less +2 -2
- package/styles/variables/_index.less +196 -0
- package/styles/variables/colors.json +67 -0
- package/styles/variables/concated_css_variables.less +66 -0
- package/styles/variables/dark_colors.less +88 -0
- package/styles/variables/dark_css_variables.less +28 -0
- package/styles/variables/dark_css_variables_map.less +96 -0
- package/styles/variables/light_colors.less +92 -0
- package/styles/variables/light_css_variables.less +17 -0
- package/styles/variables/light_css_variables_map.less +100 -0
- package/styles/variables/screens.less +7 -0
- package/styles/variables/text.less +23 -0
- package/themes/.DS_Store +0 -0
- package/themes/BuyButton/styles/rio-buyButton.less +13 -8
- package/themes/MAN/styles/man-uikit.less +3 -0
- package/themes/SCANIA/styles/scania-uikit.less +3 -0
- package/themes/Volkswagen/.DS_Store +0 -0
- package/themes/Volkswagen/styles/vw-uikit.less +21 -30
- package/themes/Website/.DS_Store +0 -0
- package/themes/Website/styles/rio-website.less +154 -124
- package/themes/Xmas/styles/rio-xmas.less +59 -29
- package/types.ts +30 -5
- package/useDarkMode.d.ts +4 -0
- package/useDarkMode.js +2 -0
- package/useMutationObserver.d.ts +4 -0
- package/useMutationObserver.js +2 -0
- package/useScrollPosition.d.ts +4 -0
- package/useScrollPosition.js +2 -0
- package/utils/colorScheme.js +55 -0
- package/utils/init.js +34 -34
- package/version.json +1 -1
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["unit", "inputAddon", "className", "bsSize", "disabled", "onValueChanged", "min", "max", "value", "step", "
|
|
4
|
+
var _excluded = ["unit", "inputAddon", "className", "bsSize", "disabled", "onChange", "onValueChanged", "min", "max", "value", "step", "digitPrecision", "placeholder"];
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import useAfterMount from '../../hooks/useAfterMount';
|
|
9
|
+
var DEFAULT_DIGIT_PRECISION = 3;
|
|
10
|
+
var DEFAULT_VALUE = 0;
|
|
11
|
+
var DEFAULT_STEP = 1;
|
|
12
|
+
|
|
13
|
+
// Note: even if limits are set and input type is number, many browsers allow to enter invalid data
|
|
14
|
+
// like entering characters or values outside the boundaries, hence we have to check the input here
|
|
15
|
+
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
|
|
16
|
+
|
|
9
17
|
export var defaultProps = {
|
|
10
18
|
min: 0,
|
|
11
19
|
max: Number.MAX_VALUE,
|
|
12
|
-
|
|
13
|
-
step: 1
|
|
20
|
+
step: DEFAULT_STEP
|
|
14
21
|
};
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
var getValueFromProps = function getValueFromProps(val, min, max, placeholder) {
|
|
23
|
+
// Show placeholders if given instead of 0
|
|
24
|
+
if (val === undefined && placeholder) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
return clampNumber(Number(val), min, max) || DEFAULT_VALUE;
|
|
20
28
|
};
|
|
21
29
|
var clampNumber = function clampNumber(value, min, max) {
|
|
22
30
|
if (value < min) {
|
|
@@ -26,13 +34,10 @@ var clampNumber = function clampNumber(value, min, max) {
|
|
|
26
34
|
}
|
|
27
35
|
return value;
|
|
28
36
|
};
|
|
29
|
-
var
|
|
30
|
-
return /^(-)?([1-9]\d*)?$/.test(value) || value === '0';
|
|
31
|
-
};
|
|
32
|
-
export var convertNonIntegerToDefault = function convertNonIntegerToDefault(value, min) {
|
|
37
|
+
export var convertNonIntegerToDefault = function convertNonIntegerToDefault(value) {
|
|
33
38
|
var currentValue = value;
|
|
34
|
-
if (!Number.
|
|
35
|
-
currentValue =
|
|
39
|
+
if (!Number.isFinite(currentValue)) {
|
|
40
|
+
currentValue = DEFAULT_VALUE;
|
|
36
41
|
}
|
|
37
42
|
return currentValue;
|
|
38
43
|
};
|
|
@@ -42,21 +47,24 @@ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
42
47
|
className = props.className,
|
|
43
48
|
bsSize = props.bsSize,
|
|
44
49
|
disabled = props.disabled,
|
|
50
|
+
onChange = props.onChange,
|
|
45
51
|
_props$onValueChanged = props.onValueChanged,
|
|
46
52
|
onValueChanged = _props$onValueChanged === void 0 ? function () {} : _props$onValueChanged,
|
|
47
53
|
propMin = props.min,
|
|
48
54
|
propMax = props.max,
|
|
49
55
|
propValue = props.value,
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
_props$step = props.step,
|
|
57
|
+
step = _props$step === void 0 ? DEFAULT_STEP : _props$step,
|
|
58
|
+
_props$digitPrecision = props.digitPrecision,
|
|
59
|
+
digitPrecision = _props$digitPrecision === void 0 ? DEFAULT_DIGIT_PRECISION : _props$digitPrecision,
|
|
60
|
+
placeholder = props.placeholder,
|
|
52
61
|
remainingProps = _objectWithoutProperties(props, _excluded);
|
|
53
62
|
|
|
54
|
-
//
|
|
55
|
-
var
|
|
56
|
-
var min = Number.
|
|
57
|
-
var max = Number.
|
|
58
|
-
var value = getValueFromProps(propValue, min, max,
|
|
59
|
-
var step = getStepFromProps(propStep, defaultProps.step, max, min);
|
|
63
|
+
// Note, "onChange" should replace "onValueChanged" in the future but it's widely used
|
|
64
|
+
var callback = onChange || onValueChanged;
|
|
65
|
+
var min = Number.isFinite(propMin) ? propMin : defaultProps.min;
|
|
66
|
+
var max = Number.isFinite(propMax) ? propMax : defaultProps.max;
|
|
67
|
+
var value = getValueFromProps(propValue, min, max, placeholder);
|
|
60
68
|
|
|
61
69
|
// Define local state and define initial values
|
|
62
70
|
var _useState = useState({
|
|
@@ -71,57 +79,62 @@ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
71
79
|
// Update internal value whenever the value prop from outside changes
|
|
72
80
|
useAfterMount(function () {
|
|
73
81
|
setState({
|
|
74
|
-
value: getValueFromProps(propValue, min, max,
|
|
82
|
+
value: getValueFromProps(propValue, min, max, placeholder),
|
|
75
83
|
enteredValue: value,
|
|
76
84
|
isValid: true
|
|
77
85
|
});
|
|
78
86
|
}, [propValue, clampNumber]);
|
|
79
87
|
var applyValue = function applyValue(newValue) {
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
} else {
|
|
88
|
-
var enteredValue = Number(newValue);
|
|
89
|
-
var isValid = enteredValue >= min && enteredValue <= max;
|
|
90
|
-
var newValidValue = clampNumber(enteredValue, min, max);
|
|
91
|
-
setState({
|
|
92
|
-
value: newValidValue,
|
|
93
|
-
enteredValue: enteredValue,
|
|
94
|
-
isValid: isValid
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Only call back the caller for valid values
|
|
98
|
-
isValid && onValueChanged(newValidValue);
|
|
99
|
-
}
|
|
88
|
+
if (newValue === '-' || newValue === '') {
|
|
89
|
+
setState({
|
|
90
|
+
value: newValue,
|
|
91
|
+
enteredValue: newValue,
|
|
92
|
+
isValid: true
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
100
95
|
}
|
|
96
|
+
var enteredValue = Number(newValue);
|
|
97
|
+
var isValid = !isNaN(enteredValue) && enteredValue >= min && enteredValue <= max;
|
|
98
|
+
var newValidValue = clampNumber(enteredValue, min, max);
|
|
99
|
+
setState({
|
|
100
|
+
value: newValidValue,
|
|
101
|
+
enteredValue: enteredValue,
|
|
102
|
+
isValid: isValid
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Only call back the caller for valid values
|
|
106
|
+
isValid && callback(newValidValue);
|
|
101
107
|
};
|
|
102
108
|
var handleOnChange = function handleOnChange(event) {
|
|
103
|
-
|
|
109
|
+
applyValue(event.target.value);
|
|
104
110
|
};
|
|
105
|
-
var handleBlur = function handleBlur(event) {
|
|
106
|
-
// console.log({enteredValue: state.enteredValue, event: Number(event.target.value)});
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
// Prevent entering exponent to avoide side effects
|
|
113
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1398528
|
|
114
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
115
|
+
if (event.key === 'e' || event.key === 'E') {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var handleBlur = function handleBlur(event) {
|
|
120
|
+
// When the value is removed, keep the input empty but trigger the outside callback
|
|
109
121
|
// since the user has finished his input
|
|
110
122
|
var lastEnteredValue = state.enteredValue;
|
|
111
123
|
if (lastEnteredValue === '') {
|
|
112
|
-
|
|
124
|
+
callback(lastEnteredValue);
|
|
113
125
|
return;
|
|
114
126
|
}
|
|
115
127
|
|
|
116
|
-
// Otherwise, validate the input
|
|
117
|
-
|
|
118
|
-
var
|
|
128
|
+
// Otherwise, validate the input, round it according to digitPrecision,
|
|
129
|
+
// and clamp the value if the entered value exeeds the limitations
|
|
130
|
+
var convertedEnteredValue = convertNonIntegerToDefault(Number(lastEnteredValue));
|
|
131
|
+
var validNumber = clampNumber(Number(convertedEnteredValue).toFixed(digitPrecision), min, max);
|
|
119
132
|
applyValue(validNumber);
|
|
120
133
|
};
|
|
121
134
|
var inputGroupClassNames = classNames('input-group', bsSize === 'sm' && 'input-group-sm', bsSize === 'lg' && 'input-group-lg');
|
|
122
135
|
var inputClassNames = classNames('form-control', 'no-controls', bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', className);
|
|
123
136
|
var input = /*#__PURE__*/React.createElement("input", _extends({}, remainingProps, {
|
|
124
|
-
type:
|
|
137
|
+
type: "number",
|
|
125
138
|
step: step,
|
|
126
139
|
min: min,
|
|
127
140
|
max: max,
|
|
@@ -130,8 +143,13 @@ var NumberInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
130
143
|
disabled: disabled,
|
|
131
144
|
onBlur: handleBlur,
|
|
132
145
|
onChange: handleOnChange,
|
|
146
|
+
onKeyDown: handleKeyDown,
|
|
133
147
|
ref: ref,
|
|
134
|
-
"aria-label":
|
|
148
|
+
"aria-label": "number-input",
|
|
149
|
+
placeholder: placeholder,
|
|
150
|
+
onWheel: function onWheel(event) {
|
|
151
|
+
return event.target.blur();
|
|
152
|
+
}
|
|
135
153
|
}));
|
|
136
154
|
return unit || inputAddon ? /*#__PURE__*/React.createElement("div", {
|
|
137
155
|
className: inputGroupClassNames
|
|
@@ -148,12 +166,14 @@ NumberInput.propTypes = {
|
|
|
148
166
|
max: PropTypes.number,
|
|
149
167
|
value: PropTypes.number,
|
|
150
168
|
step: PropTypes.number,
|
|
151
|
-
type: PropTypes.string,
|
|
152
169
|
disabled: PropTypes.bool,
|
|
170
|
+
onChange: PropTypes.func,
|
|
153
171
|
onValueChanged: PropTypes.func,
|
|
154
172
|
bsSize: PropTypes.oneOf(['sm', 'lg', 'small', 'large']),
|
|
155
173
|
className: PropTypes.string,
|
|
156
174
|
unit: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
157
|
-
inputAddon: PropTypes.string
|
|
175
|
+
inputAddon: PropTypes.string,
|
|
176
|
+
digitPrecision: PropTypes.number,
|
|
177
|
+
placeholder: PropTypes.string
|
|
158
178
|
};
|
|
159
179
|
export default NumberInput;
|
|
@@ -234,7 +234,7 @@ var Sidebar = /*#__PURE__*/function (_Component) {
|
|
|
234
234
|
var headerClassNames = classNames('SidebarHeader', headerClassName && headerClassName, showHeaderBorder && 'show-border');
|
|
235
235
|
var titleClassNames = classNames('SidebarTitle', titleClassName && titleClassName);
|
|
236
236
|
var bodyClassNames = classNames('SidebarBody', bodyClassName && bodyClassName);
|
|
237
|
-
var backdropClassNames = classNames('SidebarBackdrop', makeBackdropVisible && '
|
|
237
|
+
var backdropClassNames = classNames('SidebarBackdrop', makeBackdropVisible && 'sidebar-backdrop-bg', backdropClassName && backdropClassName);
|
|
238
238
|
var fullscreenIconClasses = classNames('rioglyph', isFullscreen ? 'rioglyph-resize-small' : 'rioglyph-resize-full');
|
|
239
239
|
var resizeLimitClasses = classNames('SidebarResizeLimit', isResize && 'display-block');
|
|
240
240
|
var isRight = position === Sidebar.RIGHT;
|
|
@@ -359,7 +359,7 @@ Sidebar.propTypes = {
|
|
|
359
359
|
makeBackdropVisible: PropTypes.bool,
|
|
360
360
|
onBackdropClick: PropTypes.func,
|
|
361
361
|
backdropClassName: PropTypes.string,
|
|
362
|
-
bodyRef: PropTypes.
|
|
362
|
+
bodyRef: PropTypes.object,
|
|
363
363
|
headerButtons: PropTypes.node
|
|
364
364
|
};
|
|
365
365
|
export default Sidebar;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { THEME_DARK, THEME_DATA_ATTRIBUTE } from './../utils/colorScheme';
|
|
4
|
+
import useMutationObserver from './useMutationObserver';
|
|
5
|
+
var useDarkMode = function useDarkMode() {
|
|
6
|
+
var _useState = useState(false),
|
|
7
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8
|
+
isDarkMode = _useState2[0],
|
|
9
|
+
setIsDarkMode = _useState2[1];
|
|
10
|
+
var handleMutation = useCallback(function (mutationList) {
|
|
11
|
+
mutationList.map(function (mutation) {
|
|
12
|
+
if (mutation.type === 'attributes' && mutation.attributeName === THEME_DATA_ATTRIBUTE) {
|
|
13
|
+
var _mutation$target$attr;
|
|
14
|
+
var scheme = (_mutation$target$attr = mutation.target.attributes[THEME_DATA_ATTRIBUTE]) === null || _mutation$target$attr === void 0 ? void 0 : _mutation$target$attr.value;
|
|
15
|
+
setIsDarkMode(scheme === THEME_DARK);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// if (mutation.type === 'classList') {
|
|
19
|
+
// console.log({ classList: mutation });
|
|
20
|
+
// }
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
useMutationObserver(document.documentElement, handleMutation, {
|
|
24
|
+
attributes: true,
|
|
25
|
+
childList: false,
|
|
26
|
+
subtree: false
|
|
27
|
+
});
|
|
28
|
+
return isDarkMode;
|
|
29
|
+
};
|
|
30
|
+
export default useDarkMode;
|
package/hooks/useElementSize.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
3
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
export default function useElementSize(elementRef) {
|
|
7
7
|
var _useState = useState(),
|
package/hooks/useFullscreen.js
CHANGED
|
@@ -114,25 +114,23 @@ var useFullscreen = function useFullscreen() {
|
|
|
114
114
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newTargetElement) {
|
|
115
115
|
var isHtmlElement, target;
|
|
116
116
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
117
|
-
while (1) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return _context.stop();
|
|
135
|
-
}
|
|
117
|
+
while (1) switch (_context.prev = _context.next) {
|
|
118
|
+
case 0:
|
|
119
|
+
// check whether the new target element is a real DOm node or just a function
|
|
120
|
+
isHtmlElement = newTargetElement instanceof HTMLElement;
|
|
121
|
+
_context.prev = 1;
|
|
122
|
+
target = newTargetElement && isHtmlElement ? newTargetElement : defaultFullscreenElement;
|
|
123
|
+
_context.next = 5;
|
|
124
|
+
return target[getRequestFunctionName(target)](requestFullscreenOptions);
|
|
125
|
+
case 5:
|
|
126
|
+
return _context.abrupt("return", _context.sent);
|
|
127
|
+
case 8:
|
|
128
|
+
_context.prev = 8;
|
|
129
|
+
_context.t0 = _context["catch"](1);
|
|
130
|
+
console.log(_context.t0);
|
|
131
|
+
case 11:
|
|
132
|
+
case "end":
|
|
133
|
+
return _context.stop();
|
|
136
134
|
}
|
|
137
135
|
}, _callee, null, [[1, 8]]);
|
|
138
136
|
}));
|
|
@@ -142,29 +140,27 @@ var useFullscreen = function useFullscreen() {
|
|
|
142
140
|
}(), []);
|
|
143
141
|
var exitFullscreen = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
144
142
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
145
|
-
while (1) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
_context2.next = 5;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
_context2.next = 4;
|
|
154
|
-
return document[getExitFunctionName()]();
|
|
155
|
-
case 4:
|
|
156
|
-
return _context2.abrupt("return", _context2.sent);
|
|
157
|
-
case 5:
|
|
158
|
-
_context2.next = 10;
|
|
143
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
144
|
+
case 0:
|
|
145
|
+
_context2.prev = 0;
|
|
146
|
+
if (!fullscreenElement) {
|
|
147
|
+
_context2.next = 5;
|
|
159
148
|
break;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
149
|
+
}
|
|
150
|
+
_context2.next = 4;
|
|
151
|
+
return document[getExitFunctionName()]();
|
|
152
|
+
case 4:
|
|
153
|
+
return _context2.abrupt("return", _context2.sent);
|
|
154
|
+
case 5:
|
|
155
|
+
_context2.next = 10;
|
|
156
|
+
break;
|
|
157
|
+
case 7:
|
|
158
|
+
_context2.prev = 7;
|
|
159
|
+
_context2.t0 = _context2["catch"](0);
|
|
160
|
+
console.warn(_context2.t0);
|
|
161
|
+
case 10:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context2.stop();
|
|
168
164
|
}
|
|
169
165
|
}, _callee2, null, [[0, 7]]);
|
|
170
166
|
})), [fullscreenElement]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useScripts } from './useScripts';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_BASE_URL = 'https://js.api.here.com/v3/3.1.20.0/';
|
|
4
|
+
|
|
5
|
+
const HERE_EXTERNALS = [
|
|
6
|
+
'mapsjs-core.js',
|
|
7
|
+
'mapsjs-core-legacy.js',
|
|
8
|
+
'mapsjs-service.js',
|
|
9
|
+
'mapsjs-service-legacy.js',
|
|
10
|
+
'mapsjs-mapevents.js',
|
|
11
|
+
'mapsjs-ui.js',
|
|
12
|
+
'mapsjs-clustering.js',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const getExternals = (scriptList: string[], baseUrl: string): string[] =>
|
|
16
|
+
scriptList.map((script) => `${baseUrl}${script}`);
|
|
17
|
+
|
|
18
|
+
const sanitizeBaseUrl = (url: string) => (url.endsWith('/') ? url : `${url}/`);
|
|
19
|
+
|
|
20
|
+
export const useHereMap = (baseUrl?: string) => {
|
|
21
|
+
const hereScripts = getExternals(HERE_EXTERNALS, sanitizeBaseUrl(baseUrl || DEFAULT_BASE_URL));
|
|
22
|
+
return useScripts(hereScripts, false);
|
|
23
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import { useRef, useLayoutEffect, useCallback } from 'react';
|
|
3
|
+
var isRef = function isRef(obj) {
|
|
4
|
+
return obj !== null && _typeof(obj) === 'object' && Object.prototype.hasOwnProperty.call(obj, 'current');
|
|
5
|
+
};
|
|
6
|
+
var unRef = function unRef(target) {
|
|
7
|
+
return isRef(target) ? target.current : target;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Options for the observer (which mutations to observe)
|
|
11
|
+
var DEFAULT_OPTIONS = {
|
|
12
|
+
attributes: true,
|
|
13
|
+
childList: false,
|
|
14
|
+
subtree: false
|
|
15
|
+
};
|
|
16
|
+
var useMutationObserver = function useMutationObserver(target) {
|
|
17
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
18
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_OPTIONS;
|
|
19
|
+
var observer = useRef(null);
|
|
20
|
+
var disconnect = useCallback(function () {
|
|
21
|
+
var _observer$current;
|
|
22
|
+
return (_observer$current = observer.current) === null || _observer$current === void 0 ? void 0 : _observer$current.disconnect();
|
|
23
|
+
}, []);
|
|
24
|
+
var observe = useCallback(function () {
|
|
25
|
+
var targetElement = unRef(target);
|
|
26
|
+
observer.current = new MutationObserver(callback);
|
|
27
|
+
if (targetElement) {
|
|
28
|
+
observer.current.observe(targetElement, options);
|
|
29
|
+
}
|
|
30
|
+
}, [target]);
|
|
31
|
+
useLayoutEffect(function () {
|
|
32
|
+
observe();
|
|
33
|
+
return function () {
|
|
34
|
+
return disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, [disconnect, observe]);
|
|
37
|
+
};
|
|
38
|
+
export default useMutationObserver;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const hasScriptsInHead = (src: string) => document.head.querySelectorAll(`script[src*="${src}"]`).length > 0;
|
|
4
|
+
|
|
5
|
+
export const useScripts = (scripts: string[], loadAsync: boolean = false) => {
|
|
6
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
7
|
+
const [hasLoaded, setHasLoaded] = useState<boolean>(false);
|
|
8
|
+
const [error, setError] = useState<Error | undefined>();
|
|
9
|
+
|
|
10
|
+
const promises = new Set();
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const [firstScript] = scripts;
|
|
14
|
+
|
|
15
|
+
if (hasScriptsInHead(firstScript)) {
|
|
16
|
+
setHasLoaded(true);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
setIsLoading(true);
|
|
21
|
+
|
|
22
|
+
scripts.map((external) => {
|
|
23
|
+
promises.add(
|
|
24
|
+
new Promise<void>((resolve, reject) => {
|
|
25
|
+
const script = document.createElement('script');
|
|
26
|
+
script.async = loadAsync;
|
|
27
|
+
script.src = external;
|
|
28
|
+
|
|
29
|
+
script.onload = () => {
|
|
30
|
+
console.debug(`loaded ${external}`);
|
|
31
|
+
resolve();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
script.onerror = () => {
|
|
35
|
+
console.debug(`failed to load ${external}`);
|
|
36
|
+
setError(new Error(`failed to load ${external}`));
|
|
37
|
+
reject();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
document.head.appendChild(script);
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
Promise.all([...promises]).then(() => {
|
|
46
|
+
setIsLoading(false);
|
|
47
|
+
setHasLoaded(true);
|
|
48
|
+
});
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
return { isLoading, error, hasLoaded };
|
|
52
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
var getModuleContent = function getModuleContent() {
|
|
4
|
+
return document.getElementsByClassName('module-content')[0];
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// "target" can be "window", "document.body", a "ref" or undefiend
|
|
8
|
+
// where in later case the module-content is taken as default
|
|
9
|
+
|
|
10
|
+
var useScrollPosition = function useScrollPosition(target) {
|
|
11
|
+
var _useState = useState(),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
targetElement = _useState2[0],
|
|
14
|
+
setTargetElement = _useState2[1];
|
|
15
|
+
var _useState3 = useState(0),
|
|
16
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
|
+
scrollPosition = _useState4[0],
|
|
18
|
+
setScrollPosition = _useState4[1];
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
var checkForModuleContent = null;
|
|
21
|
+
|
|
22
|
+
// In cae the target is undefined it might be that the module-content is not rendered yet,
|
|
23
|
+
// hence check periodically for the existence
|
|
24
|
+
if (!target) {
|
|
25
|
+
checkForModuleContent = setInterval(function () {
|
|
26
|
+
var element = getModuleContent();
|
|
27
|
+
if (element) {
|
|
28
|
+
setTargetElement(element);
|
|
29
|
+
}
|
|
30
|
+
}, 300);
|
|
31
|
+
} else if (target && checkForModuleContent) {
|
|
32
|
+
console.log('clearInterval');
|
|
33
|
+
clearInterval(checkForModuleContent);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// In case the target is a "ref" - set the targetElement when current is defined
|
|
37
|
+
else if (target !== null && target !== void 0 && target.current && !checkForModuleContent) {
|
|
38
|
+
setTargetElement(target.current);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// In case it's "wondow" or "document.body"
|
|
42
|
+
else {
|
|
43
|
+
setTargetElement(target);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
"if": function _if(checkForModuleContent) {
|
|
47
|
+
clearInterval(check);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}, [target]);
|
|
51
|
+
var handleScroll = function handleScroll() {
|
|
52
|
+
requestAnimationFrame(function () {
|
|
53
|
+
if (targetElement === window) {
|
|
54
|
+
setScrollPosition(targetElement.scrollY);
|
|
55
|
+
} else {
|
|
56
|
+
setScrollPosition(targetElement.scrollTop);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (targetElement) {
|
|
62
|
+
targetElement.addEventListener('scroll', handleScroll);
|
|
63
|
+
}
|
|
64
|
+
return function () {
|
|
65
|
+
if (targetElement) {
|
|
66
|
+
targetElement.removeEventListener('scroll', handleScroll);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [targetElement]);
|
|
70
|
+
return scrollPosition;
|
|
71
|
+
};
|
|
72
|
+
export default useScrollPosition;
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import versionJson from './version.json';
|
|
|
4
4
|
var VERSION = versionJson.version;
|
|
5
5
|
export { VERSION };
|
|
6
6
|
export * from 'framer-motion';
|
|
7
|
-
import _colors from './styles/
|
|
7
|
+
import _colors from './styles/variables/colors.json';
|
|
8
8
|
export { _colors as colors };
|
|
9
9
|
import { default as _Button } from './components/button/Button';
|
|
10
10
|
export { _Button as Button };
|
|
@@ -153,8 +153,13 @@ export { default as useInterval } from './hooks/useInterval';
|
|
|
153
153
|
export { default as useClickOutside } from './hooks/useClickOutside';
|
|
154
154
|
export { default as useClipboard } from './hooks/useClipboard';
|
|
155
155
|
export { default as useElementSize } from './hooks/useElementSize';
|
|
156
|
+
export { default as useScrollPosition } from './hooks/useScrollPosition';
|
|
157
|
+
export { default as useDarkMode } from './hooks/useDarkMode';
|
|
158
|
+
export { default as useMutationObserver } from './hooks/useMutationObserver';
|
|
156
159
|
import { hasTouch as _hasTouch, inIframe as _inIframe, isDesktop as _isDesktop } from './utils/deviceUtils';
|
|
157
160
|
export { _hasTouch as hasTouch, _inIframe as inIframe, _isDesktop as isDesktop };
|
|
161
|
+
import { getColorScheme as _getColorScheme, setColorScheme as _setColorScheme } from './utils/colorScheme';
|
|
162
|
+
export { _getColorScheme as getColorScheme, _setColorScheme as setColorScheme };
|
|
158
163
|
import { getNewGroupedSelected as _getNewGroupedSelected } from './utils/GroupSelectionUtil';
|
|
159
164
|
export { _getNewGroupedSelected as getNewGroupedSelected };
|
|
160
165
|
import { default as _ExpanderPanel } from './components/expander/ExpanderPanel';
|
package/lib/.DS_Store
ADDED
|
Binary file
|
package/lib/es/.DS_Store
ADDED
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getColorScheme", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _colorScheme.getColorScheme;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "setColorScheme", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _colorScheme.setColorScheme;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _colorScheme = require("./utils/colorScheme");
|
package/lib/es/Colors.js
CHANGED
package/lib/es/TruckLayer.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
Object.defineProperty(exports, "default", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function get() {
|
|
10
|
-
return
|
|
10
|
+
return _RoadRestrictionLayer["default"];
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var
|
|
13
|
+
var _RoadRestrictionLayer = _interopRequireDefault(require("./components/map/components/features/layers/RoadRestrictionLayer"));
|
|
Binary file
|