@rio-cloud/rio-uikit 0.15.0-beta-46 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -192
- 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 +3 -2
- 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/browserWarning/BrowserWarningMessageDE.js +1 -1
- package/lib/components/browserWarning/BrowserWarningMessageEN.js +1 -1
- 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 +2 -2
- package/lib/components/charts/PieChart.js +11 -6
- 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 +2 -1
- package/lib/components/dataTabs/DataTabs.js +78 -120
- package/lib/components/datepicker/DatePicker.js +41 -72
- package/lib/components/datepicker/DatePicker.less +35 -5
- 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 +165 -145
- package/lib/components/numberInput/NumberInput.js +152 -233
- 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/components/tooltip/Tooltip.less +0 -10
- 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/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/index.js +274 -266
- 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 +131 -0
- package/lib/style/css/_exports/vw-uikit.less +2 -1
- package/lib/style/css/bootstrap/badges.less +0 -12
- package/lib/style/css/bootstrap/dropdowns.less +13 -13
- package/lib/style/css/bootstrap/type.less +11 -4
- package/lib/style/css/rio-theme/badges.less +48 -1
- package/lib/style/css/rio-theme/button-groups.less +1 -1
- package/lib/style/css/rio-theme/buttons.less +58 -16
- 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 +46 -3
- 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 +139 -22
- package/lib/utils/SortUtils.js +54 -0
- package/lib/utils/buttonEffect.js +68 -0
- package/lib/utils/deviceUtils.js +1 -5
- 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 +73 -75
|
@@ -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,167 @@ 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
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
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({
|
|
148
|
-
value: newValue,
|
|
149
|
-
inputValue: newValue,
|
|
150
|
-
isValid: true
|
|
151
|
-
});
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
}, {
|
|
158
|
-
key: "decrementValue",
|
|
159
|
-
value: function decrementValue() {
|
|
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({
|
|
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
|
+
if (isFormatted(newValue)) {
|
|
115
|
+
if (newValue === '-' || newValue === '') {
|
|
116
|
+
setState({
|
|
165
117
|
value: newValue,
|
|
166
|
-
|
|
118
|
+
enteredValue: newValue,
|
|
167
119
|
isValid: true
|
|
168
120
|
});
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
}
|
|
121
|
+
} else {
|
|
122
|
+
var enteredValue = Number(newValue);
|
|
123
|
+
var isValid = enteredValue >= min && enteredValue <= max;
|
|
124
|
+
var newValidValue = clampNumber(enteredValue, min, max);
|
|
125
|
+
setState({
|
|
126
|
+
value: newValidValue,
|
|
127
|
+
enteredValue: enteredValue,
|
|
128
|
+
isValid: isValid
|
|
129
|
+
}); // Only call back the caller for valid values
|
|
130
|
+
|
|
131
|
+
isValid && onValueChanged(newValidValue);
|
|
199
132
|
}
|
|
200
133
|
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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;
|
|
262
|
-
}
|
|
263
|
-
}]);
|
|
264
|
-
return NumberInput;
|
|
265
|
-
}(_react.Component);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var handleOnChange = function handleOnChange(event) {
|
|
137
|
+
return applyValue(event.target.value);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
var handleBlur = function handleBlur(event) {
|
|
141
|
+
// console.log({enteredValue: state.enteredValue, event: Number(event.target.value)});
|
|
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 input and calmp it if the entered value exeeds the limitations
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
var convertedEnteredValue = convertNonIntegerToDefault(Number(lastEnteredValue), min);
|
|
153
|
+
var validNumber = clampNumber(convertedEnteredValue, min, max);
|
|
154
|
+
applyValue(validNumber);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var inputGroupClassNames = (0, _classnames.default)('input-group', bsSize === 'sm' && 'input-group-sm', bsSize === 'lg' && 'input-group-lg');
|
|
158
|
+
var inputClassNames = (0, _classnames.default)('form-control', 'no-controls', bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', className);
|
|
159
|
+
|
|
160
|
+
var input = /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, remainingProps, {
|
|
161
|
+
type: type,
|
|
162
|
+
step: step,
|
|
163
|
+
min: min,
|
|
164
|
+
max: max,
|
|
165
|
+
value: state.isValid ? state.value : state.enteredValue,
|
|
166
|
+
className: inputClassNames,
|
|
167
|
+
disabled: disabled,
|
|
168
|
+
onBlur: handleBlur,
|
|
169
|
+
onChange: handleOnChange,
|
|
170
|
+
ref: ref,
|
|
171
|
+
"aria-label": 'number-input'
|
|
172
|
+
}));
|
|
173
|
+
|
|
174
|
+
return unit || inputAddon ? /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
className: inputGroupClassNames
|
|
176
|
+
}, inputAddon && /*#__PURE__*/_react.default.createElement("span", {
|
|
177
|
+
className: 'input-group-addon'
|
|
178
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
179
|
+
className: inputAddon
|
|
180
|
+
})), input, unit && /*#__PURE__*/_react.default.createElement("span", {
|
|
181
|
+
className: 'input-group-addon'
|
|
182
|
+
}, unit)) : input;
|
|
183
|
+
});
|
|
266
184
|
|
|
267
|
-
exports.default = NumberInput;
|
|
268
185
|
NumberInput.propTypes = {
|
|
269
186
|
min: _propTypes.default.number,
|
|
270
187
|
max: _propTypes.default.number,
|
|
@@ -277,4 +194,6 @@ NumberInput.propTypes = {
|
|
|
277
194
|
className: _propTypes.default.string,
|
|
278
195
|
unit: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
279
196
|
inputAddon: _propTypes.default.string
|
|
280
|
-
};
|
|
197
|
+
};
|
|
198
|
+
var _default = NumberInput;
|
|
199
|
+
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
|
|