@rio-cloud/rio-uikit 0.16.2-beta.3 → 0.16.2-beta.4
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/components/.DS_Store +0 -0
- package/components/filepicker/FilePicker.js +5 -4
- package/components/map/.DS_Store +0 -0
- package/components/map/assets/icon_map_settings_maptype_night_active.svg +12 -0
- package/components/map/assets/icon_map_settings_maptype_night_inactive.svg +12 -0
- package/components/map/components/.DS_Store +0 -0
- package/components/map/components/Map.js +54 -44
- package/components/map/components/constants.js +2 -4
- package/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +4 -5
- package/components/map/components/features/layers/baselayers/DefaultVectorLayer.js +4 -3
- package/components/map/components/features/layers/baselayers/FleetStyleLayer.js +2 -2
- package/components/map/components/features/layers/baselayers/NightLayer.js +17 -0
- package/components/map/components/features/layers/baselayers/SatelliteLayer.js +2 -2
- package/components/map/components/features/layers/baselayers/TerrainLayer.js +2 -2
- package/components/map/components/features/layers/baselayers/useBaseLayer.js +27 -15
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +9 -3
- package/components/map/components/mapUtils.js +37 -7
- package/components/map/icons/MapIcon.js +64 -0
- package/components/mapMarker/SingleMapMarker.js +6 -0
- package/components/numberControl/NumberControl.js +34 -11
- package/components/numberInput/NumberInput.js +52 -50
- package/hooks/useDarkMode.js +29 -0
- package/hooks/useMutationObserver.js +29 -0
- 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/filepicker/FilePicker.js +5 -4
- package/lib/es/components/map/assets/icon_map_settings_maptype_night_active.svg +12 -0
- package/lib/es/components/map/assets/icon_map_settings_maptype_night_inactive.svg +12 -0
- package/lib/es/components/map/components/Map.js +53 -43
- package/lib/es/components/map/components/constants.js +3 -4
- package/lib/es/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +4 -5
- package/lib/es/components/map/components/features/layers/baselayers/DefaultVectorLayer.js +4 -3
- package/lib/es/components/map/components/features/layers/baselayers/FleetStyleLayer.js +2 -2
- package/lib/es/components/map/components/features/layers/baselayers/NightLayer.js +23 -0
- package/lib/es/components/map/components/features/layers/baselayers/SatelliteLayer.js +2 -2
- package/lib/es/components/map/components/features/layers/baselayers/TerrainLayer.js +2 -2
- package/lib/es/components/map/components/features/layers/baselayers/useBaseLayer.js +28 -16
- package/lib/es/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +7 -1
- package/lib/es/components/map/components/mapUtils.js +37 -7
- package/lib/es/components/map/icons/MapIcon.js +67 -1
- package/lib/es/components/mapMarker/SingleMapMarker.js +6 -0
- package/lib/es/components/numberControl/NumberControl.js +33 -10
- package/lib/es/components/numberInput/NumberInput.js +51 -50
- package/lib/es/hooks/useDarkMode.js +37 -0
- package/lib/es/hooks/useMutationObserver.js +35 -0
- package/lib/es/styles/.DS_Store +0 -0
- package/lib/es/styles/components/Dialog.less +1 -1
- package/lib/es/styles/mapping/color-map.less +11 -11
- package/lib/es/themes/.DS_Store +0 -0
- package/lib/es/themes/Website/styles/rio-website.less +10 -5
- package/lib/es/types.ts +8 -2
- package/lib/es/utils/colorScheme.js +12 -3
- package/lib/es/version.json +1 -1
- package/package.json +2 -2
- package/styles/.DS_Store +0 -0
- package/styles/components/Dialog.less +1 -1
- package/styles/mapping/color-map.less +11 -11
- package/themes/.DS_Store +0 -0
- package/themes/Volkswagen/.DS_Store +0 -0
- package/themes/Website/.DS_Store +0 -0
- package/themes/Website/styles/rio-website.less +10 -5
- package/types.ts +8 -2
- package/utils/colorScheme.js +7 -3
- package/version.json +1 -1
|
@@ -13,12 +13,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
var _NumberInput = _interopRequireWildcard(require("../numberInput/NumberInput"));
|
|
16
|
-
var _excluded = ["min", "max", "step", "value", "onValueChanged", "disabled", "bsSize", "className", "unit", "inputAddon"];
|
|
16
|
+
var _excluded = ["min", "max", "step", "value", "onValueChanged", "disabled", "bsSize", "className", "unit", "inputAddon", "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
19
|
var INITIAL_TICK = 700;
|
|
20
20
|
var TICK_TIME = 50;
|
|
21
|
-
var NumberControl = function
|
|
21
|
+
var NumberControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
22
22
|
var _props$min = props.min,
|
|
23
23
|
min = _props$min === void 0 ? _NumberInput.defaultProps.min : _props$min,
|
|
24
24
|
_props$max = props.max,
|
|
@@ -34,6 +34,9 @@ var NumberControl = function NumberControl(props) {
|
|
|
34
34
|
className = props.className,
|
|
35
35
|
unit = props.unit,
|
|
36
36
|
inputAddon = props.inputAddon,
|
|
37
|
+
_props$digitPrecision = props.digitPrecision,
|
|
38
|
+
digitPrecision = _props$digitPrecision === void 0 ? 3 : _props$digitPrecision,
|
|
39
|
+
placeholder = props.placeholder,
|
|
37
40
|
remainingProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
38
41
|
var timeout = (0, _react.useRef)();
|
|
39
42
|
var _useState = (0, _react.useState)(false),
|
|
@@ -59,6 +62,20 @@ var NumberControl = function NumberControl(props) {
|
|
|
59
62
|
callback();
|
|
60
63
|
}, TICK_TIME);
|
|
61
64
|
};
|
|
65
|
+
|
|
66
|
+
// Update internal state if external value has changed
|
|
67
|
+
(0, _react.useEffect)(function () {
|
|
68
|
+
if (internalValue !== value) {
|
|
69
|
+
setInternalValue(value);
|
|
70
|
+
}
|
|
71
|
+
}, [value]);
|
|
72
|
+
|
|
73
|
+
// Notify external component if internal value has changed
|
|
74
|
+
(0, _react.useEffect)(function () {
|
|
75
|
+
if (internalValue !== value) {
|
|
76
|
+
onValueChanged(internalValue);
|
|
77
|
+
}
|
|
78
|
+
}, [internalValue]);
|
|
62
79
|
(0, _react.useEffect)(function () {
|
|
63
80
|
// Call increment function for a loop when button is holding down
|
|
64
81
|
if (isHoldingDownInc && !disabled) {
|
|
@@ -73,15 +90,17 @@ var NumberControl = function NumberControl(props) {
|
|
|
73
90
|
var incrementInternalValue = function incrementInternalValue() {
|
|
74
91
|
setInternalValue(function (val) {
|
|
75
92
|
var currentValue = (0, _NumberInput.convertNonIntegerToDefault)(val);
|
|
76
|
-
var newValue = currentValue + step;
|
|
77
|
-
|
|
93
|
+
var newValue = Number((currentValue + step).toFixed(digitPrecision));
|
|
94
|
+
var newValueLimited = newValue <= max ? newValue : val;
|
|
95
|
+
return newValueLimited;
|
|
78
96
|
});
|
|
79
97
|
};
|
|
80
98
|
var decrementInternalValue = function decrementInternalValue() {
|
|
81
99
|
setInternalValue(function (val) {
|
|
82
100
|
var currentValue = (0, _NumberInput.convertNonIntegerToDefault)(val);
|
|
83
|
-
var newValue = currentValue - step;
|
|
84
|
-
|
|
101
|
+
var newValue = Number((currentValue - step).toFixed(digitPrecision));
|
|
102
|
+
var newValueLimited = newValue >= min ? newValue : val;
|
|
103
|
+
return newValueLimited;
|
|
85
104
|
});
|
|
86
105
|
};
|
|
87
106
|
var incrementRecusively = function incrementRecusively() {
|
|
@@ -120,7 +139,7 @@ var NumberControl = function NumberControl(props) {
|
|
|
120
139
|
// for instance the user has typed in a number manually and to
|
|
121
140
|
// use this number as base to increase or decrease from.
|
|
122
141
|
// Ignore empty value in case the user has removed it
|
|
123
|
-
if (value && (
|
|
142
|
+
if (value !== undefined && !(isHoldingDownDec && isHoldingDownInc)) {
|
|
124
143
|
setInternalValue(Number(value));
|
|
125
144
|
}
|
|
126
145
|
onValueChanged(value);
|
|
@@ -136,12 +155,14 @@ var NumberControl = function NumberControl(props) {
|
|
|
136
155
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
137
156
|
className: inputAddon
|
|
138
157
|
})), /*#__PURE__*/_react["default"].createElement(_NumberInput["default"], {
|
|
158
|
+
ref: ref,
|
|
139
159
|
min: min,
|
|
140
160
|
max: max,
|
|
141
161
|
value: internalValue,
|
|
142
162
|
step: step,
|
|
143
163
|
disabled: disabled,
|
|
144
|
-
onValueChanged: handleUpdatedNumberInputValue
|
|
164
|
+
onValueChanged: handleUpdatedNumberInputValue,
|
|
165
|
+
placeholder: placeholder
|
|
145
166
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
146
167
|
className: 'input-group-addon'
|
|
147
168
|
}, unit && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -163,7 +184,7 @@ var NumberControl = function NumberControl(props) {
|
|
|
163
184
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
164
185
|
className: 'rioglyph rioglyph-plus scale-90'
|
|
165
186
|
})))));
|
|
166
|
-
};
|
|
187
|
+
});
|
|
167
188
|
NumberControl.propTypes = {
|
|
168
189
|
min: _propTypes["default"].number,
|
|
169
190
|
max: _propTypes["default"].number,
|
|
@@ -174,7 +195,9 @@ NumberControl.propTypes = {
|
|
|
174
195
|
bsSize: _propTypes["default"].string,
|
|
175
196
|
className: _propTypes["default"].string,
|
|
176
197
|
unit: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
177
|
-
inputAddon: _propTypes["default"].string
|
|
198
|
+
inputAddon: _propTypes["default"].string,
|
|
199
|
+
digitPrecision: _propTypes["default"].number,
|
|
200
|
+
placeholder: _propTypes["default"].string
|
|
178
201
|
};
|
|
179
202
|
var _default = NumberControl;
|
|
180
203
|
exports["default"] = _default;
|
|
@@ -13,21 +13,26 @@ 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", "
|
|
16
|
+
var _excluded = ["unit", "inputAddon", "className", "bsSize", "disabled", "onValueChanged", "min", "max", "value", "step", "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
|
+
// Note: even if limits are set and input type is number, many browsers allow to enter invalid data
|
|
20
|
+
// like entering characters or values outside the boundaries, hence we have to check the input here
|
|
21
|
+
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
|
|
22
|
+
|
|
19
23
|
var defaultProps = {
|
|
20
24
|
min: 0,
|
|
21
25
|
max: Number.MAX_VALUE,
|
|
22
|
-
value: 0,
|
|
23
26
|
step: 1
|
|
24
27
|
};
|
|
25
28
|
exports.defaultProps = defaultProps;
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
var DEFAULT_VALUE = 0;
|
|
30
|
+
var getValueFromProps = function getValueFromProps(val, min, max, placeholder) {
|
|
31
|
+
// Show placeholders if given instead of 0
|
|
32
|
+
if (val === undefined && placeholder) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
return clampNumber(Number(val), min, max) || DEFAULT_VALUE;
|
|
31
36
|
};
|
|
32
37
|
var clampNumber = function clampNumber(value, min, max) {
|
|
33
38
|
if (value < min) {
|
|
@@ -37,13 +42,10 @@ var clampNumber = function clampNumber(value, min, max) {
|
|
|
37
42
|
}
|
|
38
43
|
return value;
|
|
39
44
|
};
|
|
40
|
-
var
|
|
41
|
-
return /^(-)?([1-9]\d*)?$/.test(value) || value === '0';
|
|
42
|
-
};
|
|
43
|
-
var convertNonIntegerToDefault = function convertNonIntegerToDefault(value, min) {
|
|
45
|
+
var convertNonIntegerToDefault = function convertNonIntegerToDefault(value) {
|
|
44
46
|
var currentValue = value;
|
|
45
|
-
if (!Number.
|
|
46
|
-
currentValue =
|
|
47
|
+
if (!Number.isFinite(currentValue)) {
|
|
48
|
+
currentValue = DEFAULT_VALUE;
|
|
47
49
|
}
|
|
48
50
|
return currentValue;
|
|
49
51
|
};
|
|
@@ -59,16 +61,13 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
59
61
|
propMin = props.min,
|
|
60
62
|
propMax = props.max,
|
|
61
63
|
propValue = props.value,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
_props$step = props.step,
|
|
65
|
+
step = _props$step === void 0 ? 1 : _props$step,
|
|
66
|
+
placeholder = props.placeholder,
|
|
64
67
|
remainingProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
var min = Number.isInteger(propMin) ? propMin : defaultProps.min;
|
|
69
|
-
var max = Number.isInteger(propMax) ? propMax : defaultProps.max;
|
|
70
|
-
var value = getValueFromProps(propValue, min, max, defaultProps.value);
|
|
71
|
-
var step = getStepFromProps(propStep, defaultProps.step, max, min);
|
|
68
|
+
var min = Number.isFinite(propMin) ? propMin : defaultProps.min;
|
|
69
|
+
var max = Number.isFinite(propMax) ? propMax : defaultProps.max;
|
|
70
|
+
var value = getValueFromProps(propValue, min, max, placeholder);
|
|
72
71
|
|
|
73
72
|
// Define local state and define initial values
|
|
74
73
|
var _useState = (0, _react.useState)({
|
|
@@ -83,33 +82,31 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
83
82
|
// Update internal value whenever the value prop from outside changes
|
|
84
83
|
(0, _useAfterMount["default"])(function () {
|
|
85
84
|
setState({
|
|
86
|
-
value: getValueFromProps(propValue, min, max,
|
|
85
|
+
value: getValueFromProps(propValue, min, max, placeholder),
|
|
87
86
|
enteredValue: value,
|
|
88
87
|
isValid: true
|
|
89
88
|
});
|
|
90
89
|
}, [propValue, clampNumber]);
|
|
91
90
|
var applyValue = function applyValue(newValue) {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
} else {
|
|
100
|
-
var enteredValue = Number(newValue);
|
|
101
|
-
var isValid = enteredValue >= min && enteredValue <= max;
|
|
102
|
-
var newValidValue = clampNumber(enteredValue, min, max);
|
|
103
|
-
setState({
|
|
104
|
-
value: newValidValue,
|
|
105
|
-
enteredValue: enteredValue,
|
|
106
|
-
isValid: isValid
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// Only call back the caller for valid values
|
|
110
|
-
isValid && onValueChanged(newValidValue);
|
|
111
|
-
}
|
|
91
|
+
if (newValue === '-' || newValue === '') {
|
|
92
|
+
setState({
|
|
93
|
+
value: newValue,
|
|
94
|
+
enteredValue: newValue,
|
|
95
|
+
isValid: true
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
112
98
|
}
|
|
99
|
+
var enteredValue = Number(newValue);
|
|
100
|
+
var isValid = !isNaN(enteredValue) && enteredValue >= min && enteredValue <= max;
|
|
101
|
+
var newValidValue = clampNumber(enteredValue, min, max);
|
|
102
|
+
setState({
|
|
103
|
+
value: newValidValue,
|
|
104
|
+
enteredValue: enteredValue,
|
|
105
|
+
isValid: isValid
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Only call back the caller for valid values
|
|
109
|
+
isValid && onValueChanged(newValidValue);
|
|
113
110
|
};
|
|
114
111
|
var handleOnChange = function handleOnChange(event) {
|
|
115
112
|
return applyValue(event.target.value);
|
|
@@ -117,7 +114,7 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
117
114
|
var handleBlur = function handleBlur(event) {
|
|
118
115
|
// console.log({enteredValue: state.enteredValue, event: Number(event.target.value)});
|
|
119
116
|
|
|
120
|
-
// When the
|
|
117
|
+
// When the value is removed, keep the input empty but trigger the onValueChanged callback
|
|
121
118
|
// since the user has finished his input
|
|
122
119
|
var lastEnteredValue = state.enteredValue;
|
|
123
120
|
if (lastEnteredValue === '') {
|
|
@@ -125,15 +122,15 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
125
122
|
return;
|
|
126
123
|
}
|
|
127
124
|
|
|
128
|
-
// Otherwise, validate the input and
|
|
129
|
-
var convertedEnteredValue = convertNonIntegerToDefault(Number(lastEnteredValue)
|
|
125
|
+
// Otherwise, validate the input and clamp it if the entered value exeeds the limitations
|
|
126
|
+
var convertedEnteredValue = convertNonIntegerToDefault(Number(lastEnteredValue));
|
|
130
127
|
var validNumber = clampNumber(convertedEnteredValue, min, max);
|
|
131
128
|
applyValue(validNumber);
|
|
132
129
|
};
|
|
133
130
|
var inputGroupClassNames = (0, _classnames["default"])('input-group', bsSize === 'sm' && 'input-group-sm', bsSize === 'lg' && 'input-group-lg');
|
|
134
131
|
var inputClassNames = (0, _classnames["default"])('form-control', 'no-controls', bsSize === 'sm' && 'input-sm', bsSize === 'lg' && 'input-lg', className);
|
|
135
132
|
var input = /*#__PURE__*/_react["default"].createElement("input", (0, _extends2["default"])({}, remainingProps, {
|
|
136
|
-
type:
|
|
133
|
+
type: "number",
|
|
137
134
|
step: step,
|
|
138
135
|
min: min,
|
|
139
136
|
max: max,
|
|
@@ -143,7 +140,11 @@ var NumberInput = /*#__PURE__*/_react["default"].forwardRef(function (props, ref
|
|
|
143
140
|
onBlur: handleBlur,
|
|
144
141
|
onChange: handleOnChange,
|
|
145
142
|
ref: ref,
|
|
146
|
-
"aria-label":
|
|
143
|
+
"aria-label": "number-input",
|
|
144
|
+
placeholder: placeholder,
|
|
145
|
+
onWheel: function onWheel(event) {
|
|
146
|
+
return event.target.blur();
|
|
147
|
+
}
|
|
147
148
|
}));
|
|
148
149
|
return unit || inputAddon ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
149
150
|
className: inputGroupClassNames
|
|
@@ -160,13 +161,13 @@ NumberInput.propTypes = {
|
|
|
160
161
|
max: _propTypes["default"].number,
|
|
161
162
|
value: _propTypes["default"].number,
|
|
162
163
|
step: _propTypes["default"].number,
|
|
163
|
-
type: _propTypes["default"].string,
|
|
164
164
|
disabled: _propTypes["default"].bool,
|
|
165
165
|
onValueChanged: _propTypes["default"].func,
|
|
166
166
|
bsSize: _propTypes["default"].oneOf(['sm', 'lg', 'small', 'large']),
|
|
167
167
|
className: _propTypes["default"].string,
|
|
168
168
|
unit: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
169
|
-
inputAddon: _propTypes["default"].string
|
|
169
|
+
inputAddon: _propTypes["default"].string,
|
|
170
|
+
placeholder: _propTypes["default"].string
|
|
170
171
|
};
|
|
171
172
|
var _default = NumberInput;
|
|
172
173
|
exports["default"] = _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useDarkMode = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _colorScheme = require("./../utils/colorScheme");
|
|
11
|
+
var _useMutationObserver = _interopRequireDefault(require("./useMutationObserver"));
|
|
12
|
+
var useDarkMode = function useDarkMode(widgetName) {
|
|
13
|
+
var _useState = (0, _react.useState)(false),
|
|
14
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
15
|
+
isDarkMode = _useState2[0],
|
|
16
|
+
setIsDarkMode = _useState2[1];
|
|
17
|
+
var handleMutation = (0, _react.useCallback)(function (mutationList) {
|
|
18
|
+
mutationList.map(function (mutation) {
|
|
19
|
+
if (mutation.type === 'attributes' && mutation.attributeName === _colorScheme.THEME_DATA_ATTRIBUTE) {
|
|
20
|
+
var _mutation$target$attr;
|
|
21
|
+
var scheme = (_mutation$target$attr = mutation.target.attributes[_colorScheme.THEME_DATA_ATTRIBUTE]) === null || _mutation$target$attr === void 0 ? void 0 : _mutation$target$attr.value;
|
|
22
|
+
setIsDarkMode(scheme === _colorScheme.THEME_DARK);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// if (mutation.type === 'classList') {
|
|
26
|
+
// console.log({ classList: mutation });
|
|
27
|
+
// }
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
(0, _useMutationObserver["default"])(document.documentElement, handleMutation, {
|
|
31
|
+
attributes: true,
|
|
32
|
+
childList: false,
|
|
33
|
+
subtree: false
|
|
34
|
+
});
|
|
35
|
+
return isDarkMode;
|
|
36
|
+
};
|
|
37
|
+
exports.useDarkMode = useDarkMode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
// Options for the observer (which mutations to observe)
|
|
9
|
+
var DEFAULT_OPTIONS = {
|
|
10
|
+
attributes: true,
|
|
11
|
+
childList: true,
|
|
12
|
+
subtree: true
|
|
13
|
+
};
|
|
14
|
+
var useMutationObserver = function useMutationObserver(targetElement, callback) {
|
|
15
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_OPTIONS;
|
|
16
|
+
var observer = (0, _react.useRef)(null);
|
|
17
|
+
var disconnect = (0, _react.useCallback)(function () {
|
|
18
|
+
var _observer$current;
|
|
19
|
+
return (_observer$current = observer.current) === null || _observer$current === void 0 ? void 0 : _observer$current.disconnect();
|
|
20
|
+
}, []);
|
|
21
|
+
var observe = (0, _react.useCallback)(function () {
|
|
22
|
+
observer.current = new MutationObserver(callback);
|
|
23
|
+
if (targetElement) {
|
|
24
|
+
observer.current.observe(targetElement, options);
|
|
25
|
+
}
|
|
26
|
+
}, [targetElement]);
|
|
27
|
+
(0, _react.useLayoutEffect)(function () {
|
|
28
|
+
observe();
|
|
29
|
+
return function () {
|
|
30
|
+
return disconnect();
|
|
31
|
+
};
|
|
32
|
+
}, [disconnect, observe]);
|
|
33
|
+
};
|
|
34
|
+
var _default = useMutationObserver;
|
|
35
|
+
exports["default"] = _default;
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@modal-title-padding: 15px;
|
|
4
4
|
@modal-content-bg: var(--color-white);
|
|
5
5
|
@modal-content-border-color: var(--gray-light);
|
|
6
|
-
@modal-backdrop-bg: var(always-color-black);
|
|
6
|
+
@modal-backdrop-bg: var(--always-color-black);
|
|
7
7
|
@modal-header-border-color: var(--gray-lighter);
|
|
8
8
|
@modal-footer-border-color: var(--gray-lighter);
|
|
9
9
|
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
// warning
|
|
48
48
|
// danger
|
|
49
49
|
@colors-status-map: {
|
|
50
|
-
info:
|
|
51
|
-
success:
|
|
52
|
-
warning:
|
|
53
|
-
danger:
|
|
50
|
+
info: var(--brand-info);
|
|
51
|
+
success: var(--brand-success);
|
|
52
|
+
warning: var(--brand-warning);
|
|
53
|
+
danger: var(--brand-danger);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// Color Map - Status Decent
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
@colors-brand-and-status-map: {
|
|
73
73
|
primary: var(--brand-primary);
|
|
74
74
|
secondary: var(--brand-secondary);
|
|
75
|
-
info:
|
|
76
|
-
success:
|
|
77
|
-
warning:
|
|
78
|
-
danger:
|
|
75
|
+
info: var(--brand-info);
|
|
76
|
+
success: var(--brand-success);
|
|
77
|
+
warning: var(--brand-warning);
|
|
78
|
+
danger: var(--brand-danger);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Color Map - Brand & Status Decent
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
// Color Map - Forms
|
|
93
93
|
// Danger = Error // BS Fuckup
|
|
94
94
|
@colors-forms-map: {
|
|
95
|
-
success:
|
|
96
|
-
warning:
|
|
97
|
-
error:
|
|
95
|
+
success: var(--brand-success);
|
|
96
|
+
warning: var(--brand-warning);
|
|
97
|
+
error: var(--brand-danger);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// Color Map - Driving Status
|
|
Binary file
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@import (less) '../../../styles/rio-uikit-core.less';
|
|
3
3
|
|
|
4
4
|
// Theme
|
|
5
|
-
|
|
5
|
+
@hasDarkmode: false;
|
|
6
6
|
|
|
7
7
|
// Utility Classes
|
|
8
8
|
@import (less) '../../../styles/design/responsive/_imports.less';
|
|
@@ -194,7 +194,6 @@ body .module-content {
|
|
|
194
194
|
|
|
195
195
|
.ApplicationHeader {
|
|
196
196
|
.navbar-brand {
|
|
197
|
-
//background-image: url('https://@{cdnBase}/svg/common/ico_rio.svg') !important;
|
|
198
197
|
background-size: cover;
|
|
199
198
|
}
|
|
200
199
|
|
|
@@ -1939,6 +1938,11 @@ blockquote {
|
|
|
1939
1938
|
}
|
|
1940
1939
|
}
|
|
1941
1940
|
|
|
1941
|
+
// Rounded Images
|
|
1942
|
+
.rounded-image .img-responsive {
|
|
1943
|
+
border-radius: 10px
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1942
1946
|
.anchor {
|
|
1943
1947
|
display: block;
|
|
1944
1948
|
position: absolute;
|
|
@@ -1962,7 +1966,6 @@ blockquote {
|
|
|
1962
1966
|
}
|
|
1963
1967
|
|
|
1964
1968
|
.ApplicationLayoutBody {
|
|
1965
|
-
|
|
1966
1969
|
@media (min-width: @screen-ls) {
|
|
1967
1970
|
.module-content {
|
|
1968
1971
|
display: flex;
|
|
@@ -2096,12 +2099,13 @@ blockquote {
|
|
|
2096
2099
|
}
|
|
2097
2100
|
}
|
|
2098
2101
|
|
|
2102
|
+
// Button Hover
|
|
2099
2103
|
[class*="btn-"]:hover {
|
|
2100
2104
|
transform: none !important;
|
|
2101
2105
|
box-shadow: none !important;
|
|
2102
2106
|
}
|
|
2103
2107
|
|
|
2104
|
-
//
|
|
2108
|
+
// Cookie Disclaimer
|
|
2105
2109
|
#cookieDisclaimer > .position-absolute {
|
|
2106
2110
|
position: fixed !important;
|
|
2107
2111
|
|
|
@@ -2172,6 +2176,7 @@ form[id*="contactForm"] {
|
|
|
2172
2176
|
}
|
|
2173
2177
|
}
|
|
2174
2178
|
|
|
2179
|
+
// Tables
|
|
2175
2180
|
body:not(.legal-documents) {
|
|
2176
2181
|
.table-responsive {
|
|
2177
2182
|
@media (min-width: @screen-ls) {
|
|
@@ -2222,7 +2227,7 @@ body:not(.legal-documents) {
|
|
|
2222
2227
|
}
|
|
2223
2228
|
}
|
|
2224
2229
|
|
|
2225
|
-
//
|
|
2230
|
+
// Section Clippig
|
|
2226
2231
|
.section-wrapper {
|
|
2227
2232
|
&[class*="clip-"]:after {
|
|
2228
2233
|
content: "";
|
package/lib/es/types.ts
CHANGED
|
@@ -674,7 +674,9 @@ export interface FilePickerProps {
|
|
|
674
674
|
maxSize?: number; // max file size
|
|
675
675
|
onPick: (files: FileList | null) => void;
|
|
676
676
|
className?: string;
|
|
677
|
-
accept?:
|
|
677
|
+
accept?: {
|
|
678
|
+
[mimeType: string]: string[];
|
|
679
|
+
};
|
|
678
680
|
children?: ({ isDragActive }: FilePickerRenderProps) => any;
|
|
679
681
|
}
|
|
680
682
|
|
|
@@ -1087,6 +1089,9 @@ export interface NumberControlProps {
|
|
|
1087
1089
|
className?: string;
|
|
1088
1090
|
unit?: string | React.ReactNode;
|
|
1089
1091
|
inputAddon?: string;
|
|
1092
|
+
digitPrecision?: number;
|
|
1093
|
+
placeholder?: string;
|
|
1094
|
+
ref?: React.MutableRefObject<object>;
|
|
1090
1095
|
}
|
|
1091
1096
|
|
|
1092
1097
|
export interface NumberInputProps {
|
|
@@ -1094,13 +1099,14 @@ export interface NumberInputProps {
|
|
|
1094
1099
|
max?: number;
|
|
1095
1100
|
value?: number;
|
|
1096
1101
|
step?: number;
|
|
1097
|
-
type?: string;
|
|
1098
1102
|
disabled?: boolean;
|
|
1099
1103
|
onValueChanged?: (value: number) => void;
|
|
1100
1104
|
bsSize?: 'sm' | 'lg';
|
|
1101
1105
|
className?: string;
|
|
1102
1106
|
unit?: string | React.ReactNode;
|
|
1103
1107
|
inputAddon?: string;
|
|
1108
|
+
placeholder?: string;
|
|
1109
|
+
ref?: React.MutableRefObject<object>;
|
|
1104
1110
|
}
|
|
1105
1111
|
|
|
1106
1112
|
// O --------------------------------------------------------------------------------------------------
|
|
@@ -4,13 +4,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.setColorScheme = exports.getColorScheme = void 0;
|
|
7
|
+
exports.setColorScheme = exports.getColorScheme = exports.THEME_SYSTEM = exports.THEME_LIGHT = exports.THEME_DEFAULT = exports.THEME_DATA_ATTRIBUTE = exports.THEME_DARK = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var COOKIE_NAME = 'uikit-color-scheme';
|
|
10
10
|
var THEME_DATA_ATTRIBUTE = 'data-theme';
|
|
11
|
+
exports.THEME_DATA_ATTRIBUTE = THEME_DATA_ATTRIBUTE;
|
|
11
12
|
var PATH = '/';
|
|
12
13
|
var DOMAIN = '.rio.cloud';
|
|
13
14
|
var EXPIRATION_DATE = 'Thu, 18 Dec 2030 12:00:00 UTC';
|
|
15
|
+
var THEME_DEFAULT = 'default';
|
|
16
|
+
exports.THEME_DEFAULT = THEME_DEFAULT;
|
|
17
|
+
var THEME_SYSTEM = 'system';
|
|
18
|
+
exports.THEME_SYSTEM = THEME_SYSTEM;
|
|
19
|
+
var THEME_LIGHT = 'light';
|
|
20
|
+
exports.THEME_LIGHT = THEME_LIGHT;
|
|
21
|
+
var THEME_DARK = 'dark';
|
|
22
|
+
exports.THEME_DARK = THEME_DARK;
|
|
14
23
|
var getColorScheme = function getColorScheme() {
|
|
15
24
|
return readColorSchemeFromCookie();
|
|
16
25
|
};
|
|
@@ -38,11 +47,11 @@ var readColorSchemeFromCookie = function readColorSchemeFromCookie() {
|
|
|
38
47
|
return;
|
|
39
48
|
}
|
|
40
49
|
var html = document.documentElement;
|
|
41
|
-
if (colorScheme ===
|
|
50
|
+
if (colorScheme === THEME_DEFAULT || colorScheme === THEME_SYSTEM) {
|
|
42
51
|
html.removeAttribute(THEME_DATA_ATTRIBUTE);
|
|
43
52
|
return colorScheme;
|
|
44
53
|
}
|
|
45
|
-
if (colorScheme ===
|
|
54
|
+
if (colorScheme === THEME_LIGHT || colorScheme === THEME_DARK) {
|
|
46
55
|
html.setAttribute(THEME_DATA_ATTRIBUTE, colorScheme);
|
|
47
56
|
return colorScheme;
|
|
48
57
|
}
|
package/lib/es/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rio-cloud/rio-uikit",
|
|
3
|
-
"version": "0.16.2-beta.
|
|
3
|
+
"version": "0.16.2-beta.4",
|
|
4
4
|
"description": "The RIO UIKIT component library",
|
|
5
5
|
"repository": "https://collaboration.msi.audi.com/stash/projects/RIOFRONT/repos/uikit-web/browse",
|
|
6
6
|
"scripts": {
|
|
@@ -128,6 +128,6 @@
|
|
|
128
128
|
"react-popper": "2.3.0",
|
|
129
129
|
"react-responsive": "9.0.0",
|
|
130
130
|
"react-transition-group": "4.4.5",
|
|
131
|
-
"recharts": "
|
|
131
|
+
"recharts": "2.1.12"
|
|
132
132
|
}
|
|
133
133
|
}
|
package/styles/.DS_Store
ADDED
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@modal-title-padding: 15px;
|
|
4
4
|
@modal-content-bg: var(--color-white);
|
|
5
5
|
@modal-content-border-color: var(--gray-light);
|
|
6
|
-
@modal-backdrop-bg: var(always-color-black);
|
|
6
|
+
@modal-backdrop-bg: var(--always-color-black);
|
|
7
7
|
@modal-header-border-color: var(--gray-lighter);
|
|
8
8
|
@modal-footer-border-color: var(--gray-lighter);
|
|
9
9
|
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
// warning
|
|
48
48
|
// danger
|
|
49
49
|
@colors-status-map: {
|
|
50
|
-
info:
|
|
51
|
-
success:
|
|
52
|
-
warning:
|
|
53
|
-
danger:
|
|
50
|
+
info: var(--brand-info);
|
|
51
|
+
success: var(--brand-success);
|
|
52
|
+
warning: var(--brand-warning);
|
|
53
|
+
danger: var(--brand-danger);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// Color Map - Status Decent
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
@colors-brand-and-status-map: {
|
|
73
73
|
primary: var(--brand-primary);
|
|
74
74
|
secondary: var(--brand-secondary);
|
|
75
|
-
info:
|
|
76
|
-
success:
|
|
77
|
-
warning:
|
|
78
|
-
danger:
|
|
75
|
+
info: var(--brand-info);
|
|
76
|
+
success: var(--brand-success);
|
|
77
|
+
warning: var(--brand-warning);
|
|
78
|
+
danger: var(--brand-danger);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Color Map - Brand & Status Decent
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
// Color Map - Forms
|
|
93
93
|
// Danger = Error // BS Fuckup
|
|
94
94
|
@colors-forms-map: {
|
|
95
|
-
success:
|
|
96
|
-
warning:
|
|
97
|
-
error:
|
|
95
|
+
success: var(--brand-success);
|
|
96
|
+
warning: var(--brand-warning);
|
|
97
|
+
error: var(--brand-danger);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// Color Map - Driving Status
|
package/themes/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|