@rio-cloud/rio-uikit 0.16.2-beta.9 → 0.16.3-beta.1
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/AspectRatioPlaceholder.d.ts +5 -0
- package/AspectRatioPlaceholder.js +2 -0
- package/AspectRatioPlaceholder.ts +5 -0
- package/ConfirmationDialog.d.ts +2 -0
- package/Dialog.d.ts +2 -0
- package/Map.d.ts +2 -1
- package/README.md +11 -1
- package/ResponsiveColumnStripe.d.ts +5 -0
- package/ResponsiveColumnStripe.js +2 -0
- package/RuleConnector.d.ts +2 -1
- package/RuleContainer.d.ts +3 -2
- package/RulesWrapper.d.ts +2 -1
- package/SaveDialog.d.ts +2 -0
- package/SimpleDialog.d.ts +2 -0
- package/SplitDialog.d.ts +2 -0
- package/components/activity/Activity.js +6 -4
- package/components/animatedNumber/AnimatedNumber.js +6 -4
- package/components/applicationHeader/AppMenu.js +6 -3
- package/components/applicationHeader/AppMenuDropdown.js +6 -2
- package/components/applicationHeader/ApplicationHeader.js +16 -8
- package/components/applicationHeader/MobileAppMenu.js +8 -4
- package/components/applicationLayout/ApplicationLayout.js +8 -8
- package/components/applicationLayout/ApplicationLayoutBody.js +6 -3
- package/components/applicationLayout/ApplicationLayoutBodyBanner.js +4 -3
- package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +6 -4
- package/components/applicationLayout/ApplicationLayoutBodyNavigation.js +6 -4
- package/components/applicationLayout/ApplicationLayoutHeader.js +9 -7
- package/components/aspectRatioPlaceholder/AspectRatioPlaceholder.js +25 -0
- package/components/assetTree/AssetTree.js +6 -3
- package/components/assetTree/TypeCounter.js +6 -4
- package/components/dialog/Dialog.js +3 -1
- package/components/dialog/MediaDialog.js +5 -1
- package/components/dialog/SaveDialog.js +5 -2
- package/components/fade/Fade.js +5 -0
- package/components/filepicker/FilePicker.js +1 -1
- package/components/map/assets/icon_map_settings_bounding_box_active.svg +1 -1
- package/components/map/assets/icon_map_settings_bounding_box_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_construction_active.svg +1 -1
- package/components/map/assets/icon_map_settings_construction_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_layer_active.svg +1 -1
- package/components/map/assets/icon_map_settings_layer_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_flat_active.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_flat_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_flat_truck_active.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_flat_truck_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_night_active.svg +1 -12
- package/components/map/assets/icon_map_settings_maptype_night_inactive.svg +1 -12
- package/components/map/assets/icon_map_settings_maptype_satelite_active.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_satelite_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_terrain_active.svg +1 -1
- package/components/map/assets/icon_map_settings_maptype_terrain_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_road_restrictions_active.svg +1 -1
- package/components/map/assets/icon_map_settings_road_restrictions_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_system_pois_active.svg +1 -1
- package/components/map/assets/icon_map_settings_system_pois_inactive.svg +1 -1
- package/components/map/assets/icon_map_settings_workshop_pois_active.svg +1 -1
- package/components/map/assets/icon_map_settings_workshop_pois_inactive.svg +1 -1
- package/components/map/components/Map.js +47 -36
- package/components/map/components/features/ContextMenu.js +1 -1
- package/components/map/components/features/Route.js +1 -9
- package/components/map/components/features/basics/Circle.js +11 -6
- package/components/map/components/features/basics/MapLayerGroup.js +8 -5
- package/components/map/components/features/basics/Polygon.js +6 -5
- package/components/map/components/features/basics/Polyline.js +39 -42
- package/components/map/components/features/basics/marker/DomMarker.js +9 -3
- package/components/map/components/features/basics/marker/Marker.js +101 -121
- package/components/map/components/features/basics/marker/TextMarker.js +15 -43
- package/components/map/components/features/layers/Layer.js +1 -1
- package/components/map/components/features/layers/MarkerLayer.js +7 -4
- package/components/map/components/features/layers/RoadRestrictionLayer.js +1 -2
- package/components/map/components/features/layers/TrafficLayer.js +2 -2
- package/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +2 -1
- package/components/map/components/features/layers/baselayers/useBaseLayer.js +4 -1
- package/components/map/components/features/layers/clustering/ClusterLayer.js +25 -9
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +18 -3
- package/components/map/icons/MapIcon.js +46 -66
- package/components/map/utils/hooks.js +3 -3
- package/components/mapMarker/ClusterMapMarker.js +16 -20
- package/components/mapMarker/SingleMapMarker.js +16 -30
- package/components/numberControl/NumberControl.js +13 -7
- package/components/numberInput/NumberInput.js +30 -12
- package/components/responsiveColumnStripe/ResponsiveColumnStripe.js +255 -0
- package/components/rules/RuleContainer.js +4 -0
- package/components/rules/RulesWrapper.js +3 -3
- package/hooks/useDarkMode.js +3 -2
- package/hooks/useMutationObserver.js +13 -4
- package/hooks/useScrollPosition.js +6 -7
- package/index.d.ts +31 -29
- package/index.js +4 -0
- package/lib/es/AspectRatioPlaceholder.d.ts +5 -0
- package/lib/es/AspectRatioPlaceholder.js +13 -0
- package/lib/es/AspectRatioPlaceholder.ts +5 -0
- package/lib/es/ConfirmationDialog.d.ts +2 -0
- package/lib/es/Dialog.d.ts +2 -0
- package/lib/es/Map.d.ts +2 -1
- package/lib/es/ResponsiveColumnStripe.d.ts +5 -0
- package/lib/es/ResponsiveColumnStripe.js +13 -0
- package/lib/es/RuleConnector.d.ts +2 -1
- package/lib/es/RuleContainer.d.ts +3 -2
- package/lib/es/RulesWrapper.d.ts +2 -1
- package/lib/es/SaveDialog.d.ts +2 -0
- package/lib/es/SimpleDialog.d.ts +2 -0
- package/lib/es/SplitDialog.d.ts +2 -0
- package/lib/es/components/activity/Activity.js +9 -4
- package/lib/es/components/animatedNumber/AnimatedNumber.js +5 -3
- 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 +15 -7
- package/lib/es/components/applicationHeader/MobileAppMenu.js +8 -4
- package/lib/es/components/applicationLayout/ApplicationLayout.js +11 -8
- package/lib/es/components/applicationLayout/ApplicationLayoutBody.js +5 -2
- package/lib/es/components/applicationLayout/ApplicationLayoutBodyBanner.js +7 -3
- package/lib/es/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +9 -4
- package/lib/es/components/applicationLayout/ApplicationLayoutBodyNavigation.js +9 -4
- package/lib/es/components/applicationLayout/ApplicationLayoutHeader.js +12 -7
- package/lib/es/components/aspectRatioPlaceholder/AspectRatioPlaceholder.js +33 -0
- package/lib/es/components/assetTree/AssetTree.js +5 -2
- package/lib/es/components/assetTree/TypeCounter.js +9 -4
- package/lib/es/components/dialog/Dialog.js +3 -1
- package/lib/es/components/dialog/MediaDialog.js +5 -1
- package/lib/es/components/dialog/SaveDialog.js +5 -2
- package/lib/es/components/fade/Fade.js +5 -0
- package/lib/es/components/filepicker/FilePicker.js +1 -1
- package/lib/es/components/map/assets/icon_map_settings_bounding_box_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_bounding_box_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_construction_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_construction_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_layer_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_layer_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_flat_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_flat_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_flat_truck_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_flat_truck_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_night_active.svg +1 -12
- package/lib/es/components/map/assets/icon_map_settings_maptype_night_inactive.svg +1 -12
- package/lib/es/components/map/assets/icon_map_settings_maptype_satelite_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_satelite_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_terrain_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_maptype_terrain_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_road_restrictions_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_road_restrictions_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_system_pois_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_system_pois_inactive.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_workshop_pois_active.svg +1 -1
- package/lib/es/components/map/assets/icon_map_settings_workshop_pois_inactive.svg +1 -1
- package/lib/es/components/map/components/Map.js +47 -36
- package/lib/es/components/map/components/features/ContextMenu.js +1 -1
- package/lib/es/components/map/components/features/Route.js +1 -9
- package/lib/es/components/map/components/features/basics/Circle.js +10 -5
- package/lib/es/components/map/components/features/basics/MapLayerGroup.js +8 -5
- package/lib/es/components/map/components/features/basics/Polygon.js +6 -5
- package/lib/es/components/map/components/features/basics/Polyline.js +39 -42
- package/lib/es/components/map/components/features/basics/marker/DomMarker.js +8 -3
- package/lib/es/components/map/components/features/basics/marker/Marker.js +105 -120
- package/lib/es/components/map/components/features/basics/marker/TextMarker.js +15 -42
- package/lib/es/components/map/components/features/layers/Layer.js +1 -1
- package/lib/es/components/map/components/features/layers/MarkerLayer.js +7 -4
- package/lib/es/components/map/components/features/layers/RoadRestrictionLayer.js +1 -2
- package/lib/es/components/map/components/features/layers/TrafficLayer.js +2 -2
- package/lib/es/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +2 -1
- package/lib/es/components/map/components/features/layers/baselayers/useBaseLayer.js +4 -1
- package/lib/es/components/map/components/features/layers/clustering/ClusterLayer.js +25 -9
- package/lib/es/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +18 -3
- package/lib/es/components/map/icons/MapIcon.js +46 -66
- package/lib/es/components/map/utils/hooks.js +3 -3
- package/lib/es/components/mapMarker/ClusterMapMarker.js +16 -20
- package/lib/es/components/mapMarker/SingleMapMarker.js +16 -30
- package/lib/es/components/numberControl/NumberControl.js +13 -7
- package/lib/es/components/numberInput/NumberInput.js +31 -12
- package/lib/es/components/responsiveColumnStripe/ResponsiveColumnStripe.js +266 -0
- package/lib/es/components/rules/RuleContainer.js +4 -0
- package/lib/es/components/rules/RulesWrapper.js +3 -3
- package/lib/es/hooks/useDarkMode.js +4 -3
- package/lib/es/hooks/useMutationObserver.js +15 -4
- package/lib/es/hooks/useScrollPosition.js +6 -7
- package/lib/es/index.d.ts +31 -29
- package/lib/es/index.js +24 -0
- package/lib/es/styles/components/ApplicationHeader.less +2 -0
- package/lib/es/styles/components/Dialog.less +41 -23
- package/lib/es/styles/components/MapMarker.less +224 -14
- package/lib/es/styles/components/MapSettings.less +45 -29
- package/lib/es/styles/components/Notification.less +1 -1
- package/lib/es/styles/design/alerts.less +7 -9
- package/lib/es/styles/design/aspect-ratio.less +1 -0
- package/lib/es/styles/design/blur.less +7 -0
- package/lib/es/styles/design/border.less +51 -14
- package/lib/es/styles/design/callouts.less +12 -11
- package/lib/es/styles/design/colors.less +15 -6
- package/lib/es/styles/design/cols.less +19 -18
- package/lib/es/styles/design/divide.less +165 -0
- package/lib/es/styles/design/divider.less +90 -0
- package/lib/es/styles/design/responsive/_imports.less +1 -0
- package/lib/es/styles/design/responsive/gap.less +0 -8
- package/lib/es/styles/design/responsive/spacing.less +25 -0
- package/lib/es/styles/design/text.less +16 -2
- package/lib/es/styles/mapping/color-map.less +10 -0
- package/lib/es/styles/mapping/spacings-map.less +5 -0
- package/lib/es/styles/rio-uikit-core.less +2 -0
- package/lib/es/styles/variables/colors.json +6 -0
- package/lib/es/styles/variables/concated_css_variables.less +6 -0
- package/lib/es/styles/variables/dark_colors.less +7 -0
- package/lib/es/styles/variables/dark_css_variables_map.less +7 -0
- package/lib/es/styles/variables/light_colors.less +7 -0
- package/lib/es/styles/variables/light_css_variables_map.less +7 -0
- package/lib/es/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +14 -5
- package/lib/es/types.ts +71 -25
- 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/version.json +1 -1
- package/package.json +1 -1
- package/styles/components/ApplicationHeader.less +2 -0
- package/styles/components/Dialog.less +41 -23
- package/styles/components/MapMarker.less +224 -14
- package/styles/components/MapSettings.less +45 -29
- package/styles/components/Notification.less +1 -1
- package/styles/design/alerts.less +7 -9
- package/styles/design/aspect-ratio.less +1 -0
- package/styles/design/blur.less +7 -0
- package/styles/design/border.less +51 -14
- package/styles/design/callouts.less +12 -11
- package/styles/design/colors.less +15 -6
- package/styles/design/cols.less +19 -18
- package/styles/design/divide.less +165 -0
- package/styles/design/divider.less +90 -0
- package/styles/design/responsive/_imports.less +1 -0
- package/styles/design/responsive/gap.less +0 -8
- package/styles/design/responsive/spacing.less +25 -0
- package/styles/design/text.less +16 -2
- package/styles/mapping/color-map.less +10 -0
- package/styles/mapping/spacings-map.less +5 -0
- package/styles/rio-uikit-core.less +2 -0
- package/styles/variables/colors.json +6 -0
- package/styles/variables/concated_css_variables.less +6 -0
- package/styles/variables/dark_colors.less +7 -0
- package/styles/variables/dark_css_variables_map.less +7 -0
- package/styles/variables/light_colors.less +7 -0
- package/styles/variables/light_css_variables_map.less +7 -0
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +15 -6
- package/types.ts +71 -25
- package/useDarkMode.d.ts +4 -0
- package/useDarkMode.js +2 -0
- package/useMutationObserver.d.ts +4 -0
- package/useMutationObserver.js +2 -0
- package/version.json +1 -1
- package/components/.DS_Store +0 -0
- package/components/map/.DS_Store +0 -0
- package/components/map/components/.DS_Store +0 -0
- package/components/map/components/features/layers/TruckLayer.js +0 -20
- package/components/map/components/features/layers/baselayers/BaseLayer.js +0 -33
- package/components/map/components/features/layers/baselayers/DefaultLayer.js +0 -23
- package/hooks/useHereMap.ts +0 -23
- package/hooks/useScripts.ts +0 -52
- package/lib/.DS_Store +0 -0
- package/lib/es/.DS_Store +0 -0
- package/lib/es/components/.DS_Store +0 -0
- package/lib/es/components/map/components/features/layers/TruckLayer.js +0 -28
- package/lib/es/components/map/components/features/layers/baselayers/BaseLayer.js +0 -41
- package/lib/es/components/map/components/features/layers/baselayers/DefaultLayer.js +0 -30
- package/lib/es/hooks/useHereMap.ts +0 -23
- package/lib/es/hooks/useScripts.ts +0 -52
- package/lib/es/styles/.DS_Store +0 -0
- package/lib/es/styles/mixins/_mixins.less +0 -13
- package/lib/es/styles/mixins/alerts.less +0 -13
- package/lib/es/styles/shared/colors.json +0 -56
- package/lib/es/styles/shared/colors.less +0 -73
- package/lib/es/styles/shared/screens.less +0 -7
- package/lib/es/styles/shared/text.less +0 -23
- package/lib/es/styles/variables.less +0 -186
- package/lib/es/themes/.DS_Store +0 -0
- package/styles/.DS_Store +0 -0
- package/styles/mixins/_mixins.less +0 -13
- package/styles/mixins/alerts.less +0 -13
- package/styles/shared/colors.json +0 -56
- package/styles/shared/colors.less +0 -73
- package/styles/shared/screens.less +0 -7
- package/styles/shared/text.less +0 -23
- package/styles/variables.less +0 -186
- package/themes/.DS_Store +0 -0
- package/themes/Volkswagen/.DS_Store +0 -0
- package/themes/Website/.DS_Store +0 -0
|
@@ -13,9 +13,13 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _useAfterMount = _interopRequireDefault(require("../../hooks/useAfterMount"));
|
|
16
|
-
var _excluded = ["unit", "inputAddon", "className", "bsSize", "disabled", "onValueChanged", "min", "max", "value", "step", "placeholder"];
|
|
16
|
+
var _excluded = ["unit", "inputAddon", "className", "bsSize", "disabled", "onChange", "onValueChanged", "min", "max", "value", "step", "digitPrecision", "placeholder"];
|
|
17
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
var DEFAULT_DIGIT_PRECISION = 3;
|
|
20
|
+
var DEFAULT_VALUE = 0;
|
|
21
|
+
var DEFAULT_STEP = 1;
|
|
22
|
+
|
|
19
23
|
// Note: even if limits are set and input type is number, many browsers allow to enter invalid data
|
|
20
24
|
// like entering characters or values outside the boundaries, hence we have to check the input here
|
|
21
25
|
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
|
|
@@ -23,10 +27,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
27
|
var defaultProps = {
|
|
24
28
|
min: 0,
|
|
25
29
|
max: Number.MAX_VALUE,
|
|
26
|
-
step:
|
|
30
|
+
step: DEFAULT_STEP
|
|
27
31
|
};
|
|
28
32
|
exports.defaultProps = defaultProps;
|
|
29
|
-
var DEFAULT_VALUE = 0;
|
|
30
33
|
var getValueFromProps = function getValueFromProps(val, min, max, placeholder) {
|
|
31
34
|
// Show placeholders if given instead of 0
|
|
32
35
|
if (val === undefined && placeholder) {
|
|
@@ -56,15 +59,21 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
56
59
|
className = props.className,
|
|
57
60
|
bsSize = props.bsSize,
|
|
58
61
|
disabled = props.disabled,
|
|
62
|
+
onChange = props.onChange,
|
|
59
63
|
_props$onValueChanged = props.onValueChanged,
|
|
60
64
|
onValueChanged = _props$onValueChanged === void 0 ? function () {} : _props$onValueChanged,
|
|
61
65
|
propMin = props.min,
|
|
62
66
|
propMax = props.max,
|
|
63
67
|
propValue = props.value,
|
|
64
68
|
_props$step = props.step,
|
|
65
|
-
step = _props$step === void 0 ?
|
|
69
|
+
step = _props$step === void 0 ? DEFAULT_STEP : _props$step,
|
|
70
|
+
_props$digitPrecision = props.digitPrecision,
|
|
71
|
+
digitPrecision = _props$digitPrecision === void 0 ? DEFAULT_DIGIT_PRECISION : _props$digitPrecision,
|
|
66
72
|
placeholder = props.placeholder,
|
|
67
73
|
remainingProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
74
|
+
|
|
75
|
+
// Note, "onChange" should replace "onValueChanged" in the future but it's widely used
|
|
76
|
+
var callback = onChange || onValueChanged;
|
|
68
77
|
var min = Number.isFinite(propMin) ? propMin : defaultProps.min;
|
|
69
78
|
var max = Number.isFinite(propMax) ? propMax : defaultProps.max;
|
|
70
79
|
var value = getValueFromProps(propValue, min, max, placeholder);
|
|
@@ -106,25 +115,32 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
106
115
|
});
|
|
107
116
|
|
|
108
117
|
// Only call back the caller for valid values
|
|
109
|
-
isValid &&
|
|
118
|
+
isValid && callback(newValidValue);
|
|
110
119
|
};
|
|
111
120
|
var handleOnChange = function handleOnChange(event) {
|
|
112
|
-
|
|
121
|
+
applyValue(event.target.value);
|
|
113
122
|
};
|
|
114
|
-
var handleBlur = function handleBlur(event) {
|
|
115
|
-
// console.log({enteredValue: state.enteredValue, event: Number(event.target.value)});
|
|
116
123
|
|
|
117
|
-
|
|
124
|
+
// Prevent entering exponent to avoide side effects
|
|
125
|
+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1398528
|
|
126
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
127
|
+
if (event.key === 'e' || event.key === 'E') {
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var handleBlur = function handleBlur(event) {
|
|
132
|
+
// When the value is removed, keep the input empty but trigger the outside callback
|
|
118
133
|
// since the user has finished his input
|
|
119
134
|
var lastEnteredValue = state.enteredValue;
|
|
120
135
|
if (lastEnteredValue === '') {
|
|
121
|
-
|
|
136
|
+
callback(lastEnteredValue);
|
|
122
137
|
return;
|
|
123
138
|
}
|
|
124
139
|
|
|
125
|
-
// Otherwise, validate the input
|
|
140
|
+
// Otherwise, validate the input, round it according to digitPrecision,
|
|
141
|
+
// and clamp the value if the entered value exeeds the limitations
|
|
126
142
|
var convertedEnteredValue = convertNonIntegerToDefault(Number(lastEnteredValue));
|
|
127
|
-
var validNumber = clampNumber(convertedEnteredValue, min, max);
|
|
143
|
+
var validNumber = clampNumber(Number(convertedEnteredValue).toFixed(digitPrecision), min, max);
|
|
128
144
|
applyValue(validNumber);
|
|
129
145
|
};
|
|
130
146
|
var inputGroupClassNames = (0, _classnames["default"])('input-group', bsSize === 'sm' && 'input-group-sm', bsSize === 'lg' && 'input-group-lg');
|
|
@@ -139,6 +155,7 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
139
155
|
disabled: disabled,
|
|
140
156
|
onBlur: handleBlur,
|
|
141
157
|
onChange: handleOnChange,
|
|
158
|
+
onKeyDown: handleKeyDown,
|
|
142
159
|
ref: ref,
|
|
143
160
|
"aria-label": "number-input",
|
|
144
161
|
placeholder: placeholder,
|
|
@@ -162,11 +179,13 @@ NumberInput.propTypes = {
|
|
|
162
179
|
value: _propTypes["default"].number,
|
|
163
180
|
step: _propTypes["default"].number,
|
|
164
181
|
disabled: _propTypes["default"].bool,
|
|
182
|
+
onChange: _propTypes["default"].func,
|
|
165
183
|
onValueChanged: _propTypes["default"].func,
|
|
166
184
|
bsSize: _propTypes["default"].oneOf(['sm', 'lg', 'small', 'large']),
|
|
167
185
|
className: _propTypes["default"].string,
|
|
168
186
|
unit: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
169
187
|
inputAddon: _propTypes["default"].string,
|
|
188
|
+
digitPrecision: _propTypes["default"].number,
|
|
170
189
|
placeholder: _propTypes["default"].string
|
|
171
190
|
};
|
|
172
191
|
var _default = NumberInput;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
|
+
var _findIndex = _interopRequireDefault(require("lodash/fp/findIndex"));
|
|
17
|
+
var _chunk = _interopRequireDefault(require("lodash/fp/chunk"));
|
|
18
|
+
var _framerMotion = require("framer-motion");
|
|
19
|
+
var _useAfterMount = _interopRequireDefault(require("../../hooks/useAfterMount"));
|
|
20
|
+
var _useElementSize3 = _interopRequireDefault(require("../../hooks/useElementSize"));
|
|
21
|
+
var _excluded = ["minColumnWith", "minColumns", "maxColumns", "className", "buttonClassName", "columnsWrapperClassName", "onNextClick", "onPreviousClick", "stretchLastItems", "asType", "activePage", "disableAnimation", "children"];
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
var DEFAULT_MIN_COLUMN_WITH = 300;
|
|
25
|
+
var DEFAULT_MIN_COLUMNS = 1;
|
|
26
|
+
var DEFAULT_MAX_COLUMNS = 5;
|
|
27
|
+
var DEFAULT_COLUMN_WRAPPER_TYPE = 'div';
|
|
28
|
+
var DEFAULT_ACTIVE_PAGE = 0;
|
|
29
|
+
var MIN_WITH_THRESHOLD = 10;
|
|
30
|
+
var ANIMATION_DURATION = 0.2;
|
|
31
|
+
var ANIMATION_NEXT = 'page';
|
|
32
|
+
var ANIMATION_BACK = 'pageBack';
|
|
33
|
+
var COLUMN_ITEM_CLASSNAME = 'ColumnItem';
|
|
34
|
+
var pageTransitionVariants = function pageTransitionVariants(pageDirection) {
|
|
35
|
+
return {
|
|
36
|
+
pageEnter: function pageEnter() {
|
|
37
|
+
return {
|
|
38
|
+
x: pageDirection === ANIMATION_NEXT ? '60%' : '-60%',
|
|
39
|
+
opacity: 0
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
pageCenter: function pageCenter() {
|
|
43
|
+
return {
|
|
44
|
+
x: 0,
|
|
45
|
+
opacity: 1
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var getFirstColumnItem = function getFirstColumnItem(node) {
|
|
51
|
+
if ((0, _toConsumableArray2["default"])(node.classList).includes(COLUMN_ITEM_CLASSNAME)) {
|
|
52
|
+
return node;
|
|
53
|
+
}
|
|
54
|
+
return getFirstColumnItem(node.children[0]);
|
|
55
|
+
};
|
|
56
|
+
var ResponsiveColumnStripe = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
57
|
+
var _props$minColumnWith = props.minColumnWith,
|
|
58
|
+
minColumnWith = _props$minColumnWith === void 0 ? DEFAULT_MIN_COLUMN_WITH : _props$minColumnWith,
|
|
59
|
+
_props$minColumns = props.minColumns,
|
|
60
|
+
minColumns = _props$minColumns === void 0 ? DEFAULT_MIN_COLUMNS : _props$minColumns,
|
|
61
|
+
_props$maxColumns = props.maxColumns,
|
|
62
|
+
maxColumns = _props$maxColumns === void 0 ? DEFAULT_MAX_COLUMNS : _props$maxColumns,
|
|
63
|
+
_props$className = props.className,
|
|
64
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
65
|
+
_props$buttonClassNam = props.buttonClassName,
|
|
66
|
+
buttonClassName = _props$buttonClassNam === void 0 ? '' : _props$buttonClassNam,
|
|
67
|
+
_props$columnsWrapper = props.columnsWrapperClassName,
|
|
68
|
+
columnsWrapperClassName = _props$columnsWrapper === void 0 ? '' : _props$columnsWrapper,
|
|
69
|
+
_props$onNextClick = props.onNextClick,
|
|
70
|
+
onNextClick = _props$onNextClick === void 0 ? function () {} : _props$onNextClick,
|
|
71
|
+
_props$onPreviousClic = props.onPreviousClick,
|
|
72
|
+
onPreviousClick = _props$onPreviousClic === void 0 ? function () {} : _props$onPreviousClic,
|
|
73
|
+
_props$stretchLastIte = props.stretchLastItems,
|
|
74
|
+
stretchLastItems = _props$stretchLastIte === void 0 ? true : _props$stretchLastIte,
|
|
75
|
+
_props$asType = props.asType,
|
|
76
|
+
asType = _props$asType === void 0 ? DEFAULT_COLUMN_WRAPPER_TYPE : _props$asType,
|
|
77
|
+
_props$activePage = props.activePage,
|
|
78
|
+
activePage = _props$activePage === void 0 ? DEFAULT_ACTIVE_PAGE : _props$activePage,
|
|
79
|
+
_props$disableAnimati = props.disableAnimation,
|
|
80
|
+
disableAnimation = _props$disableAnimati === void 0 ? false : _props$disableAnimati,
|
|
81
|
+
children = props.children,
|
|
82
|
+
remainingProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
83
|
+
var ComponentType = asType;
|
|
84
|
+
var _useState = (0, _react.useState)(activePage),
|
|
85
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
86
|
+
currentPage = _useState2[0],
|
|
87
|
+
setCurrentPage = _useState2[1];
|
|
88
|
+
var _useState3 = (0, _react.useState)(maxColumns),
|
|
89
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
90
|
+
columnsPerPage = _useState4[0],
|
|
91
|
+
setColumnsPerPage = _useState4[1];
|
|
92
|
+
var _useState5 = (0, _react.useState)(false),
|
|
93
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
94
|
+
enableInitialAnimation = _useState6[0],
|
|
95
|
+
setEnableInitialAnimation = _useState6[1];
|
|
96
|
+
var _useState7 = (0, _react.useState)(false),
|
|
97
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
98
|
+
isResizePage = _useState8[0],
|
|
99
|
+
setIsResizePage = _useState8[1];
|
|
100
|
+
var _useState9 = (0, _react.useState)(ANIMATION_NEXT),
|
|
101
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
102
|
+
animationDirection = _useState10[0],
|
|
103
|
+
setAnimationDirection = _useState10[1];
|
|
104
|
+
|
|
105
|
+
// The base for reacting on changing width of the wrapping element.
|
|
106
|
+
// It uses a ResizeObserver under the hood.
|
|
107
|
+
var columnWrapperRef = (0, _react.useRef)();
|
|
108
|
+
var _useElementSize = (0, _useElementSize3["default"])(columnWrapperRef),
|
|
109
|
+
_useElementSize2 = (0, _slicedToArray2["default"])(_useElementSize, 1),
|
|
110
|
+
columnWrapperWidth = _useElementSize2[0];
|
|
111
|
+
(0, _useAfterMount["default"])(function () {
|
|
112
|
+
setEnableInitialAnimation(true);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Update active page from outside to be used as controlled component
|
|
116
|
+
(0, _react.useEffect)(function () {
|
|
117
|
+
if (Number.isFinite(activePage)) {
|
|
118
|
+
setCurrentPage(activePage);
|
|
119
|
+
}
|
|
120
|
+
}, [activePage]);
|
|
121
|
+
var updatePageOnColumnsSizeChange = function updatePageOnColumnsSizeChange(firstItem, columnsPerPage, children) {
|
|
122
|
+
// Split children in page chunks
|
|
123
|
+
var itemChunks = (0, _chunk["default"])(columnsPerPage)(children);
|
|
124
|
+
|
|
125
|
+
// find the currently rendered first item inside the chunks.
|
|
126
|
+
// The found chunk index is the new page to render.
|
|
127
|
+
// example of chunks => [['a', 'b', 'c'], ['d']]
|
|
128
|
+
var targetPage = (0, _findIndex["default"])(function (chunk) {
|
|
129
|
+
return chunk.some(function (chunkItem) {
|
|
130
|
+
var _firstItem$attributes;
|
|
131
|
+
return chunkItem.key === ((_firstItem$attributes = firstItem.attributes['data-key']) === null || _firstItem$attributes === void 0 ? void 0 : _firstItem$attributes.value);
|
|
132
|
+
});
|
|
133
|
+
})(itemChunks);
|
|
134
|
+
if (targetPage !== currentPage) {
|
|
135
|
+
setCurrentPage(targetPage);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// When the container size changes, adapt the amount of columns to be rendered according
|
|
140
|
+
// to the given min width of a single item. The new amount of columns also has to respect
|
|
141
|
+
// the lower and upper limit. When updating the amount, the current page hse to be updated as well.
|
|
142
|
+
(0, _react.useEffect)(function () {
|
|
143
|
+
if (!columnWrapperRef.current) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
var firstItem = getFirstColumnItem(columnWrapperRef.current.children[0]);
|
|
147
|
+
if (!firstItem) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Get the width of the first column to calculate how many columns fit in one page
|
|
152
|
+
// according to the given minWidth per column
|
|
153
|
+
var columnWidth = firstItem.getBoundingClientRect().width;
|
|
154
|
+
|
|
155
|
+
// Limit columns per page for given min and max values
|
|
156
|
+
var allowForLessColumns = columnsPerPage - 1 >= minColumns;
|
|
157
|
+
var allowForMoreColumns = columnsPerPage + 1 <= maxColumns;
|
|
158
|
+
|
|
159
|
+
// The threshold is required to avoid jumping between bigger and smaller after the columns per page
|
|
160
|
+
// has changed and it continues to resize
|
|
161
|
+
var goSmaller = allowForLessColumns && columnWidth + MIN_WITH_THRESHOLD <= minColumnWith;
|
|
162
|
+
var goBigger = allowForMoreColumns && (columnsPerPage + 1) * minColumnWith <= columnWrapperWidth;
|
|
163
|
+
|
|
164
|
+
// During resizing, we don't want any animation
|
|
165
|
+
setIsResizePage(true);
|
|
166
|
+
if (goBigger) {
|
|
167
|
+
var newValue = columnsPerPage + 1;
|
|
168
|
+
setColumnsPerPage(newValue);
|
|
169
|
+
updatePageOnColumnsSizeChange(firstItem, newValue, children);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (goSmaller) {
|
|
173
|
+
var _newValue = columnsPerPage - 1;
|
|
174
|
+
setColumnsPerPage(_newValue);
|
|
175
|
+
updatePageOnColumnsSizeChange(firstItem, _newValue, children);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}, [columnWrapperWidth, columnWrapperRef.current, children]);
|
|
179
|
+
var handlePrevClick = function handlePrevClick() {
|
|
180
|
+
setIsResizePage(false);
|
|
181
|
+
setAnimationDirection(ANIMATION_BACK);
|
|
182
|
+
var pageNumber = currentPage - 1;
|
|
183
|
+
setCurrentPage(pageNumber);
|
|
184
|
+
onPreviousClick(pageNumber, columnsPerPage);
|
|
185
|
+
};
|
|
186
|
+
var handleNextClick = function handleNextClick() {
|
|
187
|
+
setIsResizePage(false);
|
|
188
|
+
setAnimationDirection(ANIMATION_NEXT);
|
|
189
|
+
var pageNumber = currentPage + 1;
|
|
190
|
+
setCurrentPage(pageNumber);
|
|
191
|
+
onNextClick(pageNumber, columnsPerPage);
|
|
192
|
+
};
|
|
193
|
+
if (!children) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Split the children/columns in chunks according to the current columns per page size
|
|
198
|
+
// and get the current page chunk for rendering
|
|
199
|
+
var columnsToDisplay = (0, _chunk["default"])(columnsPerPage)(children)[currentPage];
|
|
200
|
+
var showPageButtons = minColumns < children.length;
|
|
201
|
+
var disablePreviousPage = currentPage === 0;
|
|
202
|
+
var disableNextPage = currentPage === Math.ceil(children.length / columnsPerPage) - 1;
|
|
203
|
+
var wrapperClassName = (0, _classnames["default"])('ResponsiveColumnStripe', 'display-flex align-items-center', 'overflow-hidden', className);
|
|
204
|
+
var baseButtonClassName = (0, _classnames["default"])('align-items-center', 'align-self-stretch', 'display-flex', 'hover-scale-105', 'hover-text-color-darkest', 'padding-10', 'cursor-pointer', 'text-color-darker', 'text-size-12');
|
|
205
|
+
var disabledButtonClassName = 'pointer-events-none opacity-30';
|
|
206
|
+
var previousButtonClassName = (0, _classnames["default"])('PreviousButton', baseButtonClassName, disablePreviousPage && disabledButtonClassName);
|
|
207
|
+
var nextButtonClassName = (0, _classnames["default"])('NextButton', baseButtonClassName, disableNextPage && disabledButtonClassName);
|
|
208
|
+
var mergedColumnsWrapperClassName = (0, _classnames["default"])('ColumnWrapper', 'flex-1-1', 'display-flex', columnsWrapperClassName);
|
|
209
|
+
var columnClassName = disableNextPage && !stretchLastItems ? 'flex-0-1' : 'flex-1-1';
|
|
210
|
+
|
|
211
|
+
// Use the given custom component type "div" or any other. Clone the children to inject certain
|
|
212
|
+
// properties that are required to stretch the items and deal with their size.
|
|
213
|
+
var columns = /*#__PURE__*/_react["default"].createElement(ComponentType, {
|
|
214
|
+
className: mergedColumnsWrapperClassName
|
|
215
|
+
}, _react["default"].Children.map(columnsToDisplay, function (column) {
|
|
216
|
+
var _column$props;
|
|
217
|
+
return /*#__PURE__*/_react["default"].cloneElement(column, {
|
|
218
|
+
className: "".concat(COLUMN_ITEM_CLASSNAME, " ").concat(columnClassName, " ").concat(((_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.className) || ''),
|
|
219
|
+
// style: { ...column.props?.style, minWidth: `${minColumnWith}px` },
|
|
220
|
+
'data-key': column.key
|
|
221
|
+
});
|
|
222
|
+
}));
|
|
223
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, remainingProps, {
|
|
224
|
+
ref: ref,
|
|
225
|
+
className: wrapperClassName
|
|
226
|
+
}), showPageButtons && /*#__PURE__*/_react["default"].createElement("div", {
|
|
227
|
+
className: previousButtonClassName,
|
|
228
|
+
onClick: handlePrevClick
|
|
229
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
230
|
+
className: "rioglyph rioglyph-chevron-left"
|
|
231
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
232
|
+
className: "ColumnsArea flex-1-1 overflow-hidden",
|
|
233
|
+
ref: columnWrapperRef
|
|
234
|
+
}, disableAnimation || isResizePage ? columns : null, !disableAnimation && !isResizePage && /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, {
|
|
235
|
+
exitBeforeEnter: true
|
|
236
|
+
}, /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, {
|
|
237
|
+
key: currentPage,
|
|
238
|
+
variants: pageTransitionVariants(animationDirection),
|
|
239
|
+
initial: enableInitialAnimation ? 'pageEnter' : false,
|
|
240
|
+
animate: "pageCenter",
|
|
241
|
+
transition: {
|
|
242
|
+
duration: ANIMATION_DURATION
|
|
243
|
+
}
|
|
244
|
+
}, columns))), showPageButtons && /*#__PURE__*/_react["default"].createElement("div", {
|
|
245
|
+
className: nextButtonClassName,
|
|
246
|
+
onClick: handleNextClick
|
|
247
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
248
|
+
className: "rioglyph rioglyph-chevron-right"
|
|
249
|
+
})));
|
|
250
|
+
});
|
|
251
|
+
var _default = ResponsiveColumnStripe;
|
|
252
|
+
exports["default"] = _default;
|
|
253
|
+
ResponsiveColumnStripe.propTypes = {
|
|
254
|
+
minColumnWith: _propTypes["default"].number,
|
|
255
|
+
minColumns: _propTypes["default"].number,
|
|
256
|
+
maxColumns: _propTypes["default"].number,
|
|
257
|
+
className: _propTypes["default"].string,
|
|
258
|
+
buttonClassName: _propTypes["default"].string,
|
|
259
|
+
columnsWrapperClassName: _propTypes["default"].string,
|
|
260
|
+
onNextClick: _propTypes["default"].func,
|
|
261
|
+
onPreviousClick: _propTypes["default"].func,
|
|
262
|
+
stretchLastItems: _propTypes["default"].bool,
|
|
263
|
+
asType: _propTypes["default"].string,
|
|
264
|
+
activePage: _propTypes["default"].number,
|
|
265
|
+
disableAnimation: _propTypes["default"].bool
|
|
266
|
+
};
|
|
@@ -36,6 +36,10 @@ var RuleContainer = function RuleContainer(props) {
|
|
|
36
36
|
exitBeforeEnter: true
|
|
37
37
|
}, _react["default"].Children.map(children, function (child) {
|
|
38
38
|
var _child$type;
|
|
39
|
+
if (!child) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
// In case there are multiple children of RuleContainer, use the
|
|
40
44
|
// type name or the type itself as a key to animate between the two children
|
|
41
45
|
return /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, {
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _framerMotion = require("framer-motion");
|
|
12
12
|
var _excluded = ["children"];
|
|
13
|
-
var
|
|
13
|
+
var RulesWrapper = function RulesWrapper(_ref) {
|
|
14
14
|
var children = _ref.children,
|
|
15
15
|
remainigProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
16
16
|
return /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, (0, _extends2["default"])({
|
|
@@ -20,6 +20,6 @@ var RuleWrapper = function RuleWrapper(_ref) {
|
|
|
20
20
|
layout: "position"
|
|
21
21
|
}, children)));
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
var _default =
|
|
23
|
+
RulesWrapper.defaultProps = {};
|
|
24
|
+
var _default = RulesWrapper;
|
|
25
25
|
exports["default"] = _default;
|
|
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _colorScheme = require("./../utils/colorScheme");
|
|
11
11
|
var _useMutationObserver = _interopRequireDefault(require("./useMutationObserver"));
|
|
12
|
-
var useDarkMode = function useDarkMode(
|
|
12
|
+
var useDarkMode = function useDarkMode() {
|
|
13
13
|
var _useState = (0, _react.useState)(false),
|
|
14
14
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
15
15
|
isDarkMode = _useState2[0],
|
|
@@ -34,4 +34,5 @@ var useDarkMode = function useDarkMode(widgetName) {
|
|
|
34
34
|
});
|
|
35
35
|
return isDarkMode;
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
var _default = useDarkMode;
|
|
38
|
+
exports["default"] = _default;
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
7
9
|
var _react = require("react");
|
|
10
|
+
var isRef = function isRef(obj) {
|
|
11
|
+
return obj !== null && (0, _typeof2["default"])(obj) === 'object' && Object.prototype.hasOwnProperty.call(obj, 'current');
|
|
12
|
+
};
|
|
13
|
+
var unRef = function unRef(target) {
|
|
14
|
+
return isRef(target) ? target.current : target;
|
|
15
|
+
};
|
|
16
|
+
|
|
8
17
|
// Options for the observer (which mutations to observe)
|
|
9
18
|
var DEFAULT_OPTIONS = {
|
|
10
19
|
attributes: true,
|
|
11
|
-
childList:
|
|
12
|
-
subtree:
|
|
20
|
+
childList: false,
|
|
21
|
+
subtree: false
|
|
13
22
|
};
|
|
14
|
-
var useMutationObserver = function useMutationObserver(
|
|
23
|
+
var useMutationObserver = function useMutationObserver(target) {
|
|
24
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
15
25
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_OPTIONS;
|
|
16
26
|
var observer = (0, _react.useRef)(null);
|
|
17
27
|
var disconnect = (0, _react.useCallback)(function () {
|
|
@@ -19,11 +29,12 @@ var useMutationObserver = function useMutationObserver(targetElement, callback)
|
|
|
19
29
|
return (_observer$current = observer.current) === null || _observer$current === void 0 ? void 0 : _observer$current.disconnect();
|
|
20
30
|
}, []);
|
|
21
31
|
var observe = (0, _react.useCallback)(function () {
|
|
32
|
+
var targetElement = unRef(target);
|
|
22
33
|
observer.current = new MutationObserver(callback);
|
|
23
34
|
if (targetElement) {
|
|
24
35
|
observer.current.observe(targetElement, options);
|
|
25
36
|
}
|
|
26
|
-
}, [
|
|
37
|
+
}, [target]);
|
|
27
38
|
(0, _react.useLayoutEffect)(function () {
|
|
28
39
|
observe();
|
|
29
40
|
return function () {
|
|
@@ -26,8 +26,8 @@ var useScrollPosition = function useScrollPosition(target) {
|
|
|
26
26
|
(0, _react.useEffect)(function () {
|
|
27
27
|
var checkForModuleContent = null;
|
|
28
28
|
|
|
29
|
-
// In cae the target is undefined it might be that the module-content is
|
|
30
|
-
// hence check periodically for the existence
|
|
29
|
+
// In cae the target is undefined it might be that the module-content is
|
|
30
|
+
// not rendered yet, hence check periodically for the existence in the DOM
|
|
31
31
|
if (!target) {
|
|
32
32
|
checkForModuleContent = setInterval(function () {
|
|
33
33
|
var element = getModuleContent();
|
|
@@ -36,7 +36,6 @@ var useScrollPosition = function useScrollPosition(target) {
|
|
|
36
36
|
}
|
|
37
37
|
}, 300);
|
|
38
38
|
} else if (target && checkForModuleContent) {
|
|
39
|
-
console.log('clearInterval');
|
|
40
39
|
clearInterval(checkForModuleContent);
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -45,13 +44,13 @@ var useScrollPosition = function useScrollPosition(target) {
|
|
|
45
44
|
setTargetElement(target.current);
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
// In case it's "
|
|
47
|
+
// In case it's "window" or "document.body"
|
|
49
48
|
else {
|
|
50
49
|
setTargetElement(target);
|
|
51
50
|
}
|
|
52
|
-
return {
|
|
53
|
-
|
|
54
|
-
clearInterval(
|
|
51
|
+
return function () {
|
|
52
|
+
if (checkForModuleContent) {
|
|
53
|
+
clearInterval(checkForModuleContent);
|
|
55
54
|
}
|
|
56
55
|
};
|
|
57
56
|
}, [target]);
|
package/lib/es/index.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
declare module '@rio-cloud/lib/es/rio-uikit' {
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {
|
|
4
|
-
ActionBarItemProps,
|
|
5
4
|
ActionBarItemIconProps,
|
|
6
5
|
ActionBarItemPopoverProps,
|
|
7
6
|
ActionBarItemPopoverWidth,
|
|
7
|
+
ActionBarItemProps,
|
|
8
8
|
ActivityProps,
|
|
9
9
|
ApplicationHeaderProps,
|
|
10
|
-
ApplicationLayoutProps,
|
|
11
|
-
ApplicationLayoutHeaderProps,
|
|
12
|
-
ApplicationLayoutBodyProps,
|
|
13
|
-
ApplicationLayoutSidebarProps,
|
|
14
10
|
ApplicationLayoutBodyBannerProps,
|
|
15
11
|
ApplicationLayoutBodyBottomBarProps,
|
|
16
12
|
ApplicationLayoutBodyNavigationProps,
|
|
13
|
+
ApplicationLayoutBodyProps,
|
|
14
|
+
ApplicationLayoutHeaderProps,
|
|
15
|
+
ApplicationLayoutProps,
|
|
16
|
+
ApplicationLayoutSidebarProps,
|
|
17
17
|
Area as AreaProps,
|
|
18
18
|
AreaChartProps,
|
|
19
19
|
AreaGradient as AreaGradientProps,
|
|
20
20
|
AssetTreeProps,
|
|
21
|
-
AutoSuggestProps,
|
|
22
21
|
AutoSuggestInputProps,
|
|
22
|
+
AutoSuggestProps,
|
|
23
23
|
AutoSuggestSuggestion,
|
|
24
24
|
Bar as BarProps,
|
|
25
25
|
BarChartProps,
|
|
26
|
-
|
|
26
|
+
BaseStateProps,
|
|
27
27
|
BrowserWarningProps,
|
|
28
|
+
ButtonDropdownProps,
|
|
28
29
|
CheckboxProps,
|
|
29
30
|
ClearableInputProps,
|
|
30
|
-
ConfirmationDialogProps,
|
|
31
31
|
CollapseProps,
|
|
32
|
+
ConfirmationDialogProps,
|
|
32
33
|
ContentLoaderProps,
|
|
33
|
-
BaseStateProps,
|
|
34
34
|
DataTabProps,
|
|
35
35
|
DataTabsProps,
|
|
36
36
|
DatePickerProps,
|
|
@@ -53,30 +53,30 @@ declare module '@rio-cloud/lib/es/rio-uikit' {
|
|
|
53
53
|
MenuItemProps,
|
|
54
54
|
MultiselectProps,
|
|
55
55
|
NoDataProps,
|
|
56
|
+
NotBookedStateProps,
|
|
56
57
|
NotificationsContainerProps,
|
|
57
58
|
notificationTriggerFunction,
|
|
58
|
-
NotBookedStateProps,
|
|
59
59
|
NumberControlProps,
|
|
60
60
|
NumberInputProps,
|
|
61
|
+
OnboardingTipAlignment,
|
|
61
62
|
OnboardingTipProps,
|
|
62
|
-
OverlayTriggerProps,
|
|
63
|
-
OverlayTriggerPlacement,
|
|
64
63
|
OverlayTriggerEvent,
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
OverlayTriggerPlacement,
|
|
65
|
+
OverlayTriggerProps,
|
|
67
66
|
PagerProps,
|
|
67
|
+
PieChartProps,
|
|
68
68
|
PopoverProps,
|
|
69
|
-
ResizerDirection,
|
|
70
|
-
ResizerPosition,
|
|
71
69
|
RadioButtonProps,
|
|
72
70
|
RangeSliderProps,
|
|
73
|
-
ReleaseNotesProps,
|
|
74
71
|
ReleaseNotesDialogProps,
|
|
72
|
+
ReleaseNotesProps,
|
|
73
|
+
ResizerDirection,
|
|
74
|
+
ResizerPosition,
|
|
75
75
|
ResizerProps,
|
|
76
76
|
ResponsiveVideoProps,
|
|
77
|
-
RulesWrapperProps,
|
|
78
|
-
RuleContainerProps,
|
|
79
77
|
RuleConnectorProps,
|
|
78
|
+
RuleContainerProps,
|
|
79
|
+
RulesWrapperProps,
|
|
80
80
|
SaveDialogProps,
|
|
81
81
|
SelectProps,
|
|
82
82
|
SidebarProps,
|
|
@@ -89,15 +89,15 @@ declare module '@rio-cloud/lib/es/rio-uikit' {
|
|
|
89
89
|
SortArrowsProps,
|
|
90
90
|
SortDirection,
|
|
91
91
|
SpinnerProps,
|
|
92
|
-
SplitDialogProps,
|
|
93
92
|
SplitButtonDropdownProps,
|
|
94
|
-
|
|
95
|
-
StatsWidgetHeaderProps,
|
|
93
|
+
SplitDialogProps,
|
|
96
94
|
StatsWidgetBodyProps,
|
|
97
95
|
StatsWidgetFooterProps,
|
|
98
|
-
|
|
99
|
-
StatsWidgetSpacerProps,
|
|
96
|
+
StatsWidgetHeaderProps,
|
|
100
97
|
StatsWidgetNumberProps,
|
|
98
|
+
StatsWidgetProps,
|
|
99
|
+
StatsWidgetSpacerProps,
|
|
100
|
+
StatsWidgetsProps,
|
|
101
101
|
StatusBarProps,
|
|
102
102
|
SteppedProgressBarProps,
|
|
103
103
|
SwitchProps,
|
|
@@ -106,11 +106,11 @@ declare module '@rio-cloud/lib/es/rio-uikit' {
|
|
|
106
106
|
TableSettingsDialogProps,
|
|
107
107
|
TableViewTogglesProps,
|
|
108
108
|
TableViewTogglesValues,
|
|
109
|
-
TagProps,
|
|
110
109
|
TagListProps,
|
|
111
110
|
TagManagerProps,
|
|
112
|
-
|
|
111
|
+
TagProps,
|
|
113
112
|
TeaserContainerProps,
|
|
113
|
+
TeaserProps,
|
|
114
114
|
TimePickerProps,
|
|
115
115
|
ToggleButtonProps,
|
|
116
116
|
ToolTipProps,
|
|
@@ -158,6 +158,8 @@ declare module '@rio-cloud/lib/es/rio-uikit' {
|
|
|
158
158
|
export class Dialog extends React.Component<DialogProps> {
|
|
159
159
|
public static SIZE_FULL_SCREEN: 'fullscreen';
|
|
160
160
|
public static SIZE_FULL: 'full';
|
|
161
|
+
public static SIZE_FULL_WIDTH = 'fullwidth';
|
|
162
|
+
public static SIZE_FULL_HEIGHT = 'fullheight';
|
|
161
163
|
public static SIZE_XL: 'xl';
|
|
162
164
|
public static SIZE_LG: 'lg';
|
|
163
165
|
public static SIZE_MD: 'md';
|
|
@@ -204,9 +206,9 @@ declare module '@rio-cloud/lib/es/rio-uikit' {
|
|
|
204
206
|
export class ReleaseNotesDialog extends React.Component<ReleaseNotesDialogProps> {}
|
|
205
207
|
export class Resizer extends React.Component<ResizerProps> {}
|
|
206
208
|
export class ResponsiveVideo extends React.Component<ResponsiveVideoProps> {}
|
|
207
|
-
export class RulesWrapper extends React.Component<RulesWrapperProps
|
|
208
|
-
export class RuleContainer extends React.Component<RuleContainerProps
|
|
209
|
-
export class RuleConnector extends React.Component<RuleConnectorProps
|
|
209
|
+
export class RulesWrapper extends React.Component<React.PropsWithChildren<RulesWrapperProps>> {}
|
|
210
|
+
export class RuleContainer extends React.Component<React.PropsWithChildren<RuleContainerProps>> {}
|
|
211
|
+
export class RuleConnector extends React.Component<React.PropsWithChildren<RuleConnectorProps>> {}
|
|
210
212
|
export class SaveDialog extends React.Component<SaveDialogProps> {}
|
|
211
213
|
export class Select extends React.Component<SelectProps> {}
|
|
212
214
|
export class Sidebar extends React.Component<SidebarProps> {}
|