@rio-cloud/rio-uikit 0.15.0-beta-45 → 0.15.0-beta-49
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/README.md +12 -8
- package/lib/components/actionBarItem/ActionBarItem.js +9 -0
- package/lib/components/actionBarItem/ActionBarItemList.js +38 -0
- package/lib/components/actionBarItem/ActionBarItemListItem.js +51 -0
- package/lib/components/actionBarItem/ActionBarItemListSeparator.js +37 -0
- package/lib/components/actionBarItem/ActionBarOverlay.js +2 -2
- package/lib/components/animatedNumber/AnimatedNumber.js +81 -0
- package/lib/components/applicationHeader/ApplicationHeader.js +4 -1
- package/lib/components/applicationLayout/ApplicationLayoutBody.js +3 -1
- package/lib/components/assetTree/AssetTree.less +1 -0
- package/lib/components/assetTree/Tree.js +3 -3
- package/lib/components/autosuggest/AutoSuggest.js +5 -3
- package/lib/components/bottomSheet/BottomSheet.js +157 -0
- package/lib/components/button/Button.js +127 -7
- package/lib/components/button/ToggleButton.js +11 -108
- package/lib/components/charts/BarChart.js +4 -3
- package/lib/components/charts/ChartNeedle.js +57 -0
- package/lib/components/charts/PieChart.js +19 -15
- package/lib/components/charts/RadialBarChart.js +4 -1
- package/lib/components/charts/chartHelper.js +3 -3
- package/lib/components/checkbox/Checkbox.js +127 -171
- package/lib/components/checkbox/Checkbox.less +4 -2
- package/lib/components/clearableInput/ClearableInput.js +2 -2
- package/lib/components/clearableInput/ClearableInput.less +1 -0
- package/lib/components/dataTabs/DataTabs.js +78 -120
- package/lib/components/datepicker/DatePicker.less +4 -0
- package/lib/components/datepicker/DateRangePicker.js +3 -3
- package/lib/components/dialog/Dialog.js +2 -2
- package/lib/components/dialog/InfoDialog.js +2 -2
- package/lib/components/dialog/MediaDialog.js +2 -2
- package/lib/components/dialog/SaveDialog.js +2 -2
- package/lib/components/dialog/SimpleDialog.js +2 -2
- package/lib/components/dialog/SplitDialog.js +2 -2
- package/lib/components/driverName/DriverName.js +1 -1
- package/lib/components/dropdown/ButtonDropdown.js +2 -2
- package/lib/components/dropdown/DropdownSubmenu.less +2 -2
- package/lib/components/fade/Fade.js +2 -2
- package/lib/components/filepicker/FilePicker.js +2 -2
- package/lib/components/listMenu/ListMenu.js +2 -2
- package/lib/components/loadMore/LoadMoreButton.js +1 -1
- package/lib/components/map/components/Map.js +2 -2
- package/lib/components/map/components/constants.js +1 -1
- package/lib/components/map/components/features/Route.js +2 -2
- package/lib/components/map/components/features/basics/MapLayerGroup.js +2 -2
- package/lib/components/map/components/features/basics/marker/Marker.js +2 -1
- package/lib/components/map/components/features/basics/marker/TextMarker.js +1 -1
- package/lib/components/map/components/features/layers/MarkerLayer.js +2 -2
- package/lib/components/map/components/features/layers/clustering/SimpleClusterLayer.js +2 -2
- package/lib/components/map/utils/eventHandling.js +5 -4
- package/lib/components/map/utils/hooks.js +1 -1
- package/lib/components/map/utils/validation.js +1 -1
- package/lib/components/numberControl/NumberControl.js +161 -145
- package/lib/components/numberInput/NumberInput.js +147 -229
- package/lib/components/onboarding/OnboardingTip.js +1 -1
- package/lib/components/overlay/OverlayTrigger.js +2 -1
- package/lib/components/radiobutton/RadioButton.js +116 -148
- package/lib/components/radiobutton/RadioButton.less +10 -6
- package/lib/components/resizer/Resizer.less +2 -2
- package/lib/components/selects/BaseDropdownMenu.js +2 -2
- package/lib/components/selects/DropdownHeader.js +2 -6
- package/lib/components/spinner/Spinner.js +1 -1
- package/lib/components/spinner/Spinner.less +2 -2
- package/lib/components/states/MaintenanceState.js +25 -0
- package/lib/components/states/baseStatePropTypes.js +1 -1
- package/lib/components/supportMarker/toggleSupportMarker.js +1 -1
- package/lib/components/table/SortArrows.js +1 -1
- package/lib/components/table/TableCardsSorting.js +7 -7
- package/lib/components/table/TableSettingsDialog.js +2 -2
- package/lib/components/table/TableSettingsListItem.js +1 -1
- package/lib/components/teaser/Teaser.js +1 -1
- package/lib/components/timepicker/TimePicker.js +10 -2
- package/lib/components/tooltip/Tooltip.js +4 -4
- package/lib/es/ActionBarItem.d.ts +6 -0
- package/lib/es/ActionBarItemList.d.ts +5 -0
- package/lib/es/ActionBarItemList.js +15 -0
- package/lib/es/ActionBarItemListItem.d.ts +5 -0
- package/lib/es/ActionBarItemListItem.js +15 -0
- package/lib/es/ActionBarItemListSeparator.d.ts +5 -0
- package/lib/es/ActionBarItemListSeparator.js +15 -0
- package/lib/es/AnimatedNumber.d.ts +5 -0
- package/lib/es/AnimatedNumber.js +15 -0
- package/lib/es/BottomSheet.d.ts +5 -0
- package/lib/es/BottomSheet.js +15 -0
- package/lib/es/ChartNeedle.d.ts +5 -0
- package/lib/es/ChartNeedle.js +15 -0
- package/lib/es/DeviceUtils.d.ts +5 -0
- package/lib/es/MaintenanceState.d.ts +5 -0
- package/lib/es/MaintenanceState.js +15 -0
- package/lib/es/SortDirection.d.ts +6 -0
- package/lib/es/SortDirection.js +13 -0
- package/lib/es/SortUtils.d.ts +6 -0
- package/lib/es/SortUtils.js +19 -0
- package/lib/es/SupportMarker.js +15 -0
- package/lib/es/deviceUtils.js +14 -2
- package/lib/es/routeUtils.js +6 -6
- package/lib/es/useAfterMount.d.ts +4 -0
- package/lib/es/useAfterMount.js +15 -0
- package/lib/es/useClickOutside.d.ts +4 -0
- package/lib/es/useClickOutside.js +15 -0
- package/lib/es/useClipboard.d.ts +4 -0
- package/lib/es/useClipboard.js +15 -0
- package/lib/es/useDebugInfo.d.ts +4 -0
- package/lib/es/useDebugInfo.js +15 -0
- package/lib/es/useEffectOnce.d.ts +4 -0
- package/lib/es/useEffectOnce.js +15 -0
- package/lib/es/useElementSize.d.ts +4 -0
- package/lib/es/useElementSize.js +15 -0
- package/lib/es/useEsc.d.ts +4 -0
- package/lib/es/useEsc.js +15 -0
- package/lib/es/useEvent.d.ts +4 -0
- package/lib/es/useEvent.js +15 -0
- package/lib/es/useInterval.d.ts +4 -0
- package/lib/es/useInterval.js +15 -0
- package/lib/es/useKey.d.ts +4 -0
- package/lib/es/useKey.js +15 -0
- package/lib/es/useLocalStorage.d.ts +4 -0
- package/lib/es/useLocalStorage.js +13 -0
- package/lib/es/useOnMount.js +15 -0
- package/lib/es/useOnScreen.d.ts +4 -0
- package/lib/es/useOnScreen.js +15 -0
- package/lib/es/useOnlineStatus.d.ts +4 -0
- package/lib/es/useOnlineStatus.js +15 -0
- package/lib/es/useRenderCount.d.ts +4 -0
- package/lib/es/useRenderCount.js +15 -0
- package/lib/es/useSessionStorage.d.ts +4 -0
- package/lib/es/useSessionStorage.js +13 -0
- package/lib/es/useStateWithValidation.d.ts +4 -0
- package/lib/es/useStateWithValidation.js +15 -0
- package/lib/es/useTimeout.d.ts +4 -0
- package/lib/es/useTimeout.js +15 -0
- package/lib/es/useWindowResize.d.ts +4 -0
- package/lib/es/useWindowResize.js +15 -0
- package/lib/hooks/useDebugInfo.js +55 -0
- package/lib/hooks/useInterval.js +30 -0
- package/lib/hooks/useOnScreen.js +46 -0
- package/lib/hooks/useOnlineStatus.js +30 -0
- package/lib/hooks/useRenderCount.js +17 -0
- package/lib/hooks/useStateWithValidation.js +33 -0
- package/lib/hooks/useStorage.js +53 -0
- package/lib/hooks/useTimeout.js +9 -6
- package/lib/hooks/useWindowResize.js +9 -3
- package/lib/index.js +280 -264
- package/lib/mapIndex.js +72 -72
- package/lib/style/css/_exports/man-uikit.less +1 -0
- package/lib/style/css/_exports/rio-buyButton.less +5 -0
- package/lib/style/css/_exports/rio-uikit-core.less +2 -2
- package/lib/style/css/_exports/rio-uikit-print-utilities.less +21 -0
- package/lib/style/css/_exports/rio-uikit-responsive-utilities.less +2 -1
- package/lib/style/css/_exports/rio-uikit.less +1 -0
- package/lib/style/css/_exports/rio-website.less +70 -0
- package/lib/style/css/_exports/vw-uikit.less +2 -1
- package/lib/style/css/bootstrap/dropdowns.less +13 -13
- package/lib/style/css/rio-theme/button-groups.less +1 -1
- package/lib/style/css/rio-theme/buttons.less +57 -1
- package/lib/style/css/rio-theme/carousel.less +1 -1
- package/lib/style/css/rio-theme/dropdowns.less +6 -26
- package/lib/style/css/rio-theme/navbar.less +45 -2
- package/lib/style/css/rio-theme/navs.less +19 -0
- package/lib/style/css/rio-theme/pagination.less +1 -1
- package/lib/style/css/utils/_imports.less +82 -0
- package/lib/style/css/utils/animations/translate.less +4 -1
- package/lib/style/css/utils/responsive/border.less +27 -19
- package/lib/style/css/utils/responsive/display.less +2 -0
- package/lib/style/css/utils/responsive/grid.less +6 -0
- package/lib/style/css/utils/responsive/sizing.less +1 -1
- package/lib/style/css/utils/text.less +3 -0
- package/lib/style/fonts/rioglyph/rioglyph.less +74 -14
- package/lib/style/fonts/rioglyph/rioglyph.svg +106 -34
- package/lib/style/fonts/rioglyph/rioglyph.ttf +0 -0
- package/lib/style/fonts/rioglyph/rioglyph.woff +0 -0
- package/lib/types.ts +150 -11
- package/lib/utils/SortUtils.js +54 -0
- package/lib/utils/buttonEffect.js +68 -0
- package/lib/utils/deviceUtils.js +1 -1
- package/lib/utils/logDeprecatedWarnings.js +1 -1
- package/lib/utils/logPropError.js +1 -1
- package/lib/utils/routeUtils.js +7 -6
- package/lib/utils/scrollItemIntoView.js +1 -1
- package/lib/version.json +1 -1
- package/package.json +65 -69
|
@@ -7,17 +7,13 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default = void 0;
|
|
10
|
+
exports.defaultProps = exports.default = exports.convertNonIntegerToDefault = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
21
17
|
|
|
22
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
19
|
|
|
@@ -25,246 +21,166 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
25
21
|
|
|
26
22
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
23
|
|
|
24
|
+
var _useAfterMount = _interopRequireDefault(require("../../hooks/useAfterMount"));
|
|
25
|
+
|
|
26
|
+
var _excluded = ["unit", "inputAddon", "className", "bsSize", "disabled", "onValueChanged", "min", "max", "value", "step", "type"];
|
|
27
|
+
|
|
28
28
|
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); }
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
var defaultProps = {
|
|
33
|
+
min: 0,
|
|
34
|
+
max: Number.MAX_VALUE,
|
|
35
|
+
value: 0,
|
|
36
|
+
step: 1
|
|
37
|
+
};
|
|
38
|
+
exports.defaultProps = defaultProps;
|
|
39
|
+
|
|
40
|
+
var getStepFromProps = function getStepFromProps(propStep, defaultStep, max, min) {
|
|
41
|
+
return Number.isInteger(propStep) && propStep < Math.abs(max - min) ? propStep : defaultStep;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var getValueFromProps = function getValueFromProps(val, min, max, fallback) {
|
|
45
|
+
return clampNumber(Number(val), min, max) || fallback;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var clampNumber = function clampNumber(number, min, max) {
|
|
49
|
+
if (number < min) {
|
|
50
|
+
return min;
|
|
51
|
+
} else if (number > max) {
|
|
52
|
+
return max;
|
|
53
|
+
}
|
|
35
54
|
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
return number;
|
|
56
|
+
};
|
|
38
57
|
|
|
39
|
-
|
|
58
|
+
var isFormatted = function isFormatted(number) {
|
|
59
|
+
return /^(-)?([1-9]\d*)?$/.test(number) || number === '0';
|
|
60
|
+
};
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
var convertNonIntegerToDefault = function convertNonIntegerToDefault(value, min) {
|
|
63
|
+
var currentValue = value;
|
|
43
64
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
_this.state = _this.propsToState(props);
|
|
47
|
-
return _this;
|
|
65
|
+
if (!Number.isInteger(currentValue)) {
|
|
66
|
+
currentValue = min;
|
|
48
67
|
}
|
|
49
68
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
value:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
101
|
-
var isEqual = this.isEqual(nextProps, this.props);
|
|
102
|
-
|
|
103
|
-
if (!isEqual) {
|
|
104
|
-
this.setState(this.propsToState(nextProps));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
key: "componentWillUpdate",
|
|
109
|
-
value: function componentWillUpdate(nextProps, nextState) {
|
|
110
|
-
var isEqual = this.isEqual(nextState, this.state);
|
|
111
|
-
|
|
112
|
-
if (!isEqual && nextState.isValid && typeof nextState.value === 'number' && typeof nextProps.onValueChanged === 'function') {
|
|
113
|
-
nextProps.onValueChanged(nextState.value);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "isEqual",
|
|
118
|
-
value: function isEqual(nextValue, value) {
|
|
119
|
-
var isValuesEqual = nextValue.value === value.value && nextValue.inputValue === value.inputValue;
|
|
120
|
-
var isIntervalAndStepEqual = nextValue.min === value.min && nextValue.max === value.max && nextValue.step === value.step;
|
|
121
|
-
var isTypeAndDisabledEqual = nextValue.type === value.type && nextValue.disabled === value.disabled;
|
|
122
|
-
return isValuesEqual && isIntervalAndStepEqual && isTypeAndDisabledEqual;
|
|
123
|
-
}
|
|
124
|
-
}, {
|
|
125
|
-
key: "toValidNumber",
|
|
126
|
-
value: function toValidNumber(number) {
|
|
127
|
-
if (number < this.state.min) {
|
|
128
|
-
return this.state.min;
|
|
129
|
-
} else if (number > this.state.max) {
|
|
130
|
-
return this.state.max;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return number;
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
key: "isFormatted",
|
|
137
|
-
value: function isFormatted(number) {
|
|
138
|
-
return /^(-)?([1-9]\d*)?$/.test(number) || number === '0';
|
|
139
|
-
}
|
|
140
|
-
}, {
|
|
141
|
-
key: "incrementValue",
|
|
142
|
-
value: function incrementValue() {
|
|
143
|
-
var currentValue = this.convertNonIntegerToDefault(this.state.value);
|
|
144
|
-
var newValue = currentValue + this.state.step;
|
|
145
|
-
|
|
146
|
-
if (newValue <= this.state.max) {
|
|
147
|
-
this.setState({
|
|
69
|
+
return currentValue;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
exports.convertNonIntegerToDefault = convertNonIntegerToDefault;
|
|
73
|
+
|
|
74
|
+
var NumberInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
75
|
+
var unit = props.unit,
|
|
76
|
+
inputAddon = props.inputAddon,
|
|
77
|
+
className = props.className,
|
|
78
|
+
bsSize = props.bsSize,
|
|
79
|
+
disabled = props.disabled,
|
|
80
|
+
_props$onValueChanged = props.onValueChanged,
|
|
81
|
+
onValueChanged = _props$onValueChanged === void 0 ? function () {} : _props$onValueChanged,
|
|
82
|
+
propMin = props.min,
|
|
83
|
+
propMax = props.max,
|
|
84
|
+
propValue = props.value,
|
|
85
|
+
propStep = props.step,
|
|
86
|
+
propType = props.type,
|
|
87
|
+
remainingProps = (0, _objectWithoutProperties2.default)(props, _excluded); // Breaking change - default is now "number"
|
|
88
|
+
|
|
89
|
+
var type = propType === 'text' ? 'text' : 'number';
|
|
90
|
+
var min = Number.isInteger(propMin) ? propMin : defaultProps.min;
|
|
91
|
+
var max = Number.isInteger(propMax) ? propMax : defaultProps.max;
|
|
92
|
+
var value = getValueFromProps(propValue, min, max, defaultProps.value);
|
|
93
|
+
var step = getStepFromProps(propStep, defaultProps.step, max, min); // Define local state and define initial values
|
|
94
|
+
|
|
95
|
+
var _useState = (0, _react.useState)({
|
|
96
|
+
value: value,
|
|
97
|
+
enteredValue: value,
|
|
98
|
+
isValid: true
|
|
99
|
+
}),
|
|
100
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
101
|
+
state = _useState2[0],
|
|
102
|
+
setState = _useState2[1]; // Update internal value whenever the value prop from outside changes
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
(0, _useAfterMount.default)(function () {
|
|
106
|
+
setState({
|
|
107
|
+
value: getValueFromProps(propValue, min, max, defaultProps.value),
|
|
108
|
+
enteredValue: value,
|
|
109
|
+
isValid: true
|
|
110
|
+
});
|
|
111
|
+
}, [propValue, clampNumber]);
|
|
112
|
+
|
|
113
|
+
var applyValue = function applyValue(newValue) {
|
|
114
|
+
console.log(newValue);
|
|
115
|
+
|
|
116
|
+
if (isFormatted(newValue)) {
|
|
117
|
+
if (newValue === '-' || newValue === '') {
|
|
118
|
+
setState({
|
|
148
119
|
value: newValue,
|
|
149
|
-
|
|
120
|
+
enteredValue: newValue,
|
|
150
121
|
isValid: true
|
|
151
122
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var currentValue = this.convertNonIntegerToDefault(this.state.value);
|
|
161
|
-
var newValue = currentValue - this.state.step;
|
|
162
|
-
|
|
163
|
-
if (newValue >= this.state.min) {
|
|
164
|
-
this.setState({
|
|
165
|
-
value: newValue,
|
|
166
|
-
inputValue: newValue,
|
|
167
|
-
isValid: true
|
|
123
|
+
} else {
|
|
124
|
+
var enteredValue = Number(newValue);
|
|
125
|
+
var isValid = enteredValue >= min && enteredValue <= max;
|
|
126
|
+
var newValidValue = clampNumber(enteredValue);
|
|
127
|
+
setState({
|
|
128
|
+
value: newValidValue,
|
|
129
|
+
enteredValue: enteredValue,
|
|
130
|
+
isValid: isValid
|
|
168
131
|
});
|
|
169
|
-
|
|
132
|
+
onValueChanged(newValidValue);
|
|
170
133
|
}
|
|
171
|
-
|
|
172
|
-
return false;
|
|
173
134
|
}
|
|
174
|
-
}
|
|
175
|
-
key: "handleOnChange",
|
|
176
|
-
value: function handleOnChange(event) {
|
|
177
|
-
var newValue = event.target.value;
|
|
178
|
-
this.applyValue(newValue);
|
|
179
|
-
}
|
|
180
|
-
}, {
|
|
181
|
-
key: "applyValue",
|
|
182
|
-
value: function applyValue(newValue) {
|
|
183
|
-
if (this.isFormatted(newValue)) {
|
|
184
|
-
if (newValue === '-' || newValue === '') {
|
|
185
|
-
this.setState({
|
|
186
|
-
value: newValue,
|
|
187
|
-
inputValue: newValue,
|
|
188
|
-
isValid: true
|
|
189
|
-
});
|
|
190
|
-
} else {
|
|
191
|
-
var inputValue = Number(newValue);
|
|
192
|
-
var isValid = inputValue >= this.state.min && inputValue <= this.state.max;
|
|
193
|
-
this.setState({
|
|
194
|
-
value: this.toValidNumber(inputValue),
|
|
195
|
-
inputValue: inputValue,
|
|
196
|
-
isValid: isValid
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "convertNonIntegerToDefault",
|
|
203
|
-
value: function convertNonIntegerToDefault(value) {
|
|
204
|
-
var currentValue = value;
|
|
135
|
+
};
|
|
205
136
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
137
|
+
var handleOnChange = function handleOnChange(event) {
|
|
138
|
+
return applyValue(event.target.value);
|
|
139
|
+
};
|
|
209
140
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
unit = _this$props.unit,
|
|
226
|
-
inputAddon = _this$props.inputAddon,
|
|
227
|
-
className = _this$props.className;
|
|
228
|
-
var _this$state = this.state,
|
|
229
|
-
type = _this$state.type,
|
|
230
|
-
step = _this$state.step,
|
|
231
|
-
isValid = _this$state.isValid,
|
|
232
|
-
value = _this$state.value,
|
|
233
|
-
inputValue = _this$state.inputValue,
|
|
234
|
-
disabled = _this$state.disabled,
|
|
235
|
-
bsSize = _this$state.bsSize;
|
|
236
|
-
var inputGroupClassNames = (0, _classnames.default)('input-group', bsSize === 'sm' && 'input-group-sm', bsSize === 'lg' && 'input-group-lg');
|
|
237
|
-
var inputClassNames = (0, _classnames.default)('form-control', 'no-controls', bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', className);
|
|
238
|
-
|
|
239
|
-
var input = /*#__PURE__*/_react.default.createElement("input", {
|
|
240
|
-
type: type,
|
|
241
|
-
step: step,
|
|
242
|
-
value: isValid ? value : inputValue,
|
|
243
|
-
className: inputClassNames,
|
|
244
|
-
disabled: disabled,
|
|
245
|
-
onBlur: function onBlur() {
|
|
246
|
-
return _this2.handleBlur();
|
|
247
|
-
},
|
|
248
|
-
onChange: function onChange(event) {
|
|
249
|
-
return _this2.handleOnChange(event);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
return unit || inputAddon ? /*#__PURE__*/_react.default.createElement("div", {
|
|
254
|
-
className: inputGroupClassNames
|
|
255
|
-
}, inputAddon && /*#__PURE__*/_react.default.createElement("span", {
|
|
256
|
-
className: 'input-group-addon'
|
|
257
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
258
|
-
className: inputAddon
|
|
259
|
-
})), input, unit && /*#__PURE__*/_react.default.createElement("span", {
|
|
260
|
-
className: 'input-group-addon'
|
|
261
|
-
}, unit)) : input;
|
|
141
|
+
var handleBlur = function handleBlur(event) {
|
|
142
|
+
// When the vales is removed, keep the input empty but trigger the onValueChanged callback
|
|
143
|
+
// since the user has finished his input
|
|
144
|
+
var lastEnteredValue = state.enteredValue;
|
|
145
|
+
|
|
146
|
+
if (lastEnteredValue === '') {
|
|
147
|
+
onValueChanged(lastEnteredValue);
|
|
148
|
+
return;
|
|
149
|
+
} // Otherwise, validate the last input and calmp it if the entered value exeeds the limitations
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
if (Number(lastEnteredValue) !== Number(event.target.value)) {
|
|
153
|
+
var convertedEnteredValue = convertNonIntegerToDefault(Number(lastEnteredValue), min);
|
|
154
|
+
var validNumber = clampNumber(convertedEnteredValue);
|
|
155
|
+
applyValue(validNumber);
|
|
262
156
|
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var inputGroupClassNames = (0, _classnames.default)('input-group', bsSize === 'sm' && 'input-group-sm', bsSize === 'lg' && 'input-group-lg');
|
|
160
|
+
var inputClassNames = (0, _classnames.default)('form-control', 'no-controls', bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', className);
|
|
161
|
+
|
|
162
|
+
var input = /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
|
|
163
|
+
type: type,
|
|
164
|
+
step: step,
|
|
165
|
+
value: state.isValid ? state.value : state.enteredValue,
|
|
166
|
+
className: inputClassNames,
|
|
167
|
+
disabled: disabled,
|
|
168
|
+
onBlur: handleBlur,
|
|
169
|
+
onChange: handleOnChange,
|
|
170
|
+
ref: ref
|
|
171
|
+
}, remainingProps));
|
|
172
|
+
|
|
173
|
+
return unit || inputAddon ? /*#__PURE__*/_react.default.createElement("div", {
|
|
174
|
+
className: inputGroupClassNames
|
|
175
|
+
}, inputAddon && /*#__PURE__*/_react.default.createElement("span", {
|
|
176
|
+
className: 'input-group-addon'
|
|
177
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
178
|
+
className: inputAddon
|
|
179
|
+
})), input, unit && /*#__PURE__*/_react.default.createElement("span", {
|
|
180
|
+
className: 'input-group-addon'
|
|
181
|
+
}, unit)) : input;
|
|
182
|
+
});
|
|
266
183
|
|
|
267
|
-
exports.default = NumberInput;
|
|
268
184
|
NumberInput.propTypes = {
|
|
269
185
|
min: _propTypes.default.number,
|
|
270
186
|
max: _propTypes.default.number,
|
|
@@ -277,4 +193,6 @@ NumberInput.propTypes = {
|
|
|
277
193
|
className: _propTypes.default.string,
|
|
278
194
|
unit: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
279
195
|
inputAddon: _propTypes.default.string
|
|
280
|
-
};
|
|
196
|
+
};
|
|
197
|
+
var _default = NumberInput;
|
|
198
|
+
exports.default = _default;
|
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = OnboardingTip;
|
|
9
8
|
exports.OnboardingTipPlacementType = void 0;
|
|
9
|
+
exports.default = OnboardingTip;
|
|
10
10
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
|
|
@@ -5,8 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.OverlayTriggerPlacementType = void 0;
|
|
8
9
|
exports.default = OverlayTrigger;
|
|
9
|
-
exports.
|
|
10
|
+
exports.triggerType = void 0;
|
|
10
11
|
|
|
11
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
13
|
|