@opengeoweb/shared 2.1.0 → 2.1.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/lib/components/CustomSlider/CustomSlider.d.ts +4 -13
- package/package.json +3 -3
- package/shared.esm.js +21 -30
- package/shared.umd.js +18 -27
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SliderProps } from '@material-ui/core';
|
|
3
3
|
export declare const sliderStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"sliderHeader">;
|
|
4
|
-
interface CustomSliderProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
onKeyDown?: (event: any) => void;
|
|
8
|
-
dataTestId?: string;
|
|
9
|
-
orientation?: 'horizontal' | 'vertical';
|
|
10
|
-
max?: number;
|
|
11
|
-
min?: number;
|
|
12
|
-
step?: number;
|
|
13
|
-
marks?: Mark[];
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
ThumbComponent?: React.ElementType<React.HTMLAttributes<HTMLSpanElement>>;
|
|
4
|
+
interface CustomSliderProps extends Omit<SliderProps, 'onChange'> {
|
|
5
|
+
onChange: (event: React.ChangeEvent<HTMLSpanElement>, newValue: number) => void;
|
|
6
|
+
shouldAutoFocus?: boolean;
|
|
16
7
|
}
|
|
17
8
|
export declare const CustomSlider: React.FC<CustomSliderProps>;
|
|
18
9
|
export default CustomSlider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "16.14.0",
|
|
16
16
|
"@material-ui/lab": "^4.0.0-alpha.56",
|
|
17
|
-
"@opengeoweb/theme": "2.1.
|
|
17
|
+
"@opengeoweb/theme": "2.1.1",
|
|
18
18
|
"@material-ui/core": "^4.11.0",
|
|
19
19
|
"@material-ui/icons": "^4.9.1",
|
|
20
20
|
"react-draggable": "^4.4.3",
|
|
21
21
|
"re-resizable": "^6.9.0",
|
|
22
22
|
"lodash": "^4.17.20",
|
|
23
|
-
"@opengeoweb/form-fields": "2.1.
|
|
23
|
+
"@opengeoweb/form-fields": "2.1.1",
|
|
24
24
|
"react-hook-form": "^6.12.1",
|
|
25
25
|
"@material-ui/pickers": "^3.2.10",
|
|
26
26
|
"@date-io/moment": "^1.3.13",
|
package/shared.esm.js
CHANGED
|
@@ -2318,25 +2318,17 @@ var CustomSliderComponent = withStyles(function (theme) {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
};
|
|
2320
2320
|
})(Slider);
|
|
2321
|
-
var CustomSlider = function CustomSlider(
|
|
2322
|
-
var value =
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation,
|
|
2329
|
-
max = _ref.max,
|
|
2330
|
-
min = _ref.min,
|
|
2331
|
-
step = _ref.step,
|
|
2332
|
-
_ref$marks = _ref.marks,
|
|
2333
|
-
marks = _ref$marks === void 0 ? [] : _ref$marks,
|
|
2334
|
-
_ref$disabled = _ref.disabled,
|
|
2335
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
2336
|
-
ThumbComponent = _ref.ThumbComponent;
|
|
2337
|
-
// Add custom class (for bold text) to label adjacent to thumb component.
|
|
2321
|
+
var CustomSlider = function CustomSlider(_a) {
|
|
2322
|
+
var value = _a.value,
|
|
2323
|
+
_a$orientation = _a.orientation,
|
|
2324
|
+
orientation = _a$orientation === void 0 ? 'vertical' : _a$orientation,
|
|
2325
|
+
_a$shouldAutoFocus = _a.shouldAutoFocus,
|
|
2326
|
+
shouldAutoFocus = _a$shouldAutoFocus === void 0 ? false : _a$shouldAutoFocus,
|
|
2327
|
+
props = __rest(_a, ["value", "orientation", "shouldAutoFocus"]); // Add custom class (for bold text) to label adjacent to thumb component.
|
|
2338
2328
|
// Material UI doesn't support highlighing only adjacent label
|
|
2339
2329
|
// when track is highlighted everywhere below selected value.
|
|
2330
|
+
|
|
2331
|
+
|
|
2340
2332
|
var element = React.useRef(null);
|
|
2341
2333
|
var themeContext = useThemeContext();
|
|
2342
2334
|
React.useEffect(function () {
|
|
@@ -2351,21 +2343,20 @@ var CustomSlider = function CustomSlider(_ref) {
|
|
|
2351
2343
|
rest.forEach(function (element) {
|
|
2352
2344
|
return element.classList.remove('selectedLabel');
|
|
2353
2345
|
});
|
|
2354
|
-
}, [value, themeContext.isDark]);
|
|
2355
|
-
|
|
2346
|
+
}, [value, themeContext.isDark]); // autofocus
|
|
2347
|
+
|
|
2348
|
+
React.useEffect(function () {
|
|
2349
|
+
if (shouldAutoFocus && element.current) {
|
|
2350
|
+
var thumb = element.current.querySelector('.MuiSlider-thumb');
|
|
2351
|
+
thumb.focus();
|
|
2352
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2353
|
+
|
|
2354
|
+
}, []);
|
|
2355
|
+
return /*#__PURE__*/React.createElement(CustomSliderComponent, Object.assign({
|
|
2356
2356
|
ref: element,
|
|
2357
|
-
"data-testid": dataTestId,
|
|
2358
|
-
orientation: orientation,
|
|
2359
2357
|
value: value,
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
min: min,
|
|
2363
|
-
marks: marks,
|
|
2364
|
-
onChange: onChange,
|
|
2365
|
-
onKeyDown: onKeyDown,
|
|
2366
|
-
disabled: disabled,
|
|
2367
|
-
ThumbComponent: ThumbComponent
|
|
2368
|
-
});
|
|
2358
|
+
orientation: orientation
|
|
2359
|
+
}, props));
|
|
2369
2360
|
};
|
|
2370
2361
|
|
|
2371
2362
|
/* *
|
package/shared.umd.js
CHANGED
|
@@ -2207,23 +2207,15 @@
|
|
|
2207
2207
|
})(core.Slider);
|
|
2208
2208
|
var CustomSlider = function CustomSlider(_a) {
|
|
2209
2209
|
var value = _a.value,
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
orientation = _c === void 0 ? 'vertical' : _c,
|
|
2216
|
-
max = _a.max,
|
|
2217
|
-
min = _a.min,
|
|
2218
|
-
step = _a.step,
|
|
2219
|
-
_d = _a.marks,
|
|
2220
|
-
marks = _d === void 0 ? [] : _d,
|
|
2221
|
-
_e = _a.disabled,
|
|
2222
|
-
disabled = _e === void 0 ? false : _e,
|
|
2223
|
-
ThumbComponent = _a.ThumbComponent; // Add custom class (for bold text) to label adjacent to thumb component.
|
|
2210
|
+
_b = _a.orientation,
|
|
2211
|
+
orientation = _b === void 0 ? 'vertical' : _b,
|
|
2212
|
+
_c = _a.shouldAutoFocus,
|
|
2213
|
+
shouldAutoFocus = _c === void 0 ? false : _c,
|
|
2214
|
+
props = __rest(_a, ["value", "orientation", "shouldAutoFocus"]); // Add custom class (for bold text) to label adjacent to thumb component.
|
|
2224
2215
|
// Material UI doesn't support highlighing only adjacent label
|
|
2225
2216
|
// when track is highlighted everywhere below selected value.
|
|
2226
2217
|
|
|
2218
|
+
|
|
2227
2219
|
var element = React__namespace.useRef(null);
|
|
2228
2220
|
var themeContext = theme.useThemeContext();
|
|
2229
2221
|
React__namespace.useEffect(function () {
|
|
@@ -2237,21 +2229,20 @@
|
|
|
2237
2229
|
rest.forEach(function (element) {
|
|
2238
2230
|
return element.classList.remove('selectedLabel');
|
|
2239
2231
|
});
|
|
2240
|
-
}, [value, themeContext.isDark]);
|
|
2241
|
-
|
|
2232
|
+
}, [value, themeContext.isDark]); // autofocus
|
|
2233
|
+
|
|
2234
|
+
React__namespace.useEffect(function () {
|
|
2235
|
+
if (shouldAutoFocus && element.current) {
|
|
2236
|
+
var thumb = element.current.querySelector('.MuiSlider-thumb');
|
|
2237
|
+
thumb.focus();
|
|
2238
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2239
|
+
|
|
2240
|
+
}, []);
|
|
2241
|
+
return /*#__PURE__*/React__namespace.createElement(CustomSliderComponent, __assign({
|
|
2242
2242
|
ref: element,
|
|
2243
|
-
"data-testid": dataTestId,
|
|
2244
|
-
orientation: orientation,
|
|
2245
2243
|
value: value,
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
min: min,
|
|
2249
|
-
marks: marks,
|
|
2250
|
-
onChange: onChange,
|
|
2251
|
-
onKeyDown: onKeyDown,
|
|
2252
|
-
disabled: disabled,
|
|
2253
|
-
ThumbComponent: ThumbComponent
|
|
2254
|
-
});
|
|
2244
|
+
orientation: orientation
|
|
2245
|
+
}, props));
|
|
2255
2246
|
};
|
|
2256
2247
|
|
|
2257
2248
|
/* *
|