@neo4j-ndl/react 2.5.0 → 2.6.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/CHANGELOG.md +11 -0
- package/lib/LICENSES.txt +1 -1
- package/lib/NOTICE.txt +3 -1
- package/lib/cjs/slider/Slider.js +134 -0
- package/lib/cjs/slider/Slider.js.map +1 -0
- package/lib/cjs/slider/index.js +38 -0
- package/lib/cjs/slider/index.js.map +1 -0
- package/lib/esm/slider/Slider.js +128 -0
- package/lib/esm/slider/Slider.js.map +1 -0
- package/lib/esm/slider/index.js +22 -0
- package/lib/esm/slider/index.js.map +1 -0
- package/lib/types/slider/Slider.d.ts +77 -0
- package/lib/types/slider/index.d.ts +21 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#733](https://github.com/neo4j/needle/pull/733) [`6f374de548bbdb0f4fd32a76e49ec85c8118b351`](https://github.com/neo4j/needle/commit/6f374de548bbdb0f4fd32a76e49ec85c8118b351) Thanks [@konsalex](https://github.com/konsalex)! - add new slider component
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`6f374de548bbdb0f4fd32a76e49ec85c8118b351`](https://github.com/neo4j/needle/commit/6f374de548bbdb0f4fd32a76e49ec85c8118b351)]:
|
|
12
|
+
- @neo4j-ndl/base@2.6.0
|
|
13
|
+
|
|
3
14
|
## 2.5.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/lib/LICENSES.txt
CHANGED
|
@@ -17001,7 +17001,7 @@ SOFTWARE.
|
|
|
17001
17001
|
|
|
17002
17002
|
-----
|
|
17003
17003
|
|
|
17004
|
-
The following software may be included in this product: react-aria. A copy of the source code may be downloaded from https://github.com/adobe/react-spectrum. This software contains the following license and notice below:
|
|
17004
|
+
The following software may be included in this product: react-aria, react-stately. A copy of the source code may be downloaded from https://github.com/adobe/react-spectrum (react-aria), https://github.com/adobe/react-spectrum (react-stately). This software contains the following license and notice below:
|
|
17005
17005
|
|
|
17006
17006
|
Apache License
|
|
17007
17007
|
Version 2.0, January 2004
|
package/lib/NOTICE.txt
CHANGED
|
@@ -333,7 +333,9 @@ Third-party licenses
|
|
|
333
333
|
│ │ ├─ URL: https://github.com/krisk/Fuse.git
|
|
334
334
|
│ │ ├─ VendorName: Kiro Risk
|
|
335
335
|
│ │ └─ VendorUrl: http://fusejs.io
|
|
336
|
-
│ ├─ [38;5;173mreact-aria[39m[38;5;111m@[39m[38;5;111mnpm:3.31.
|
|
336
|
+
│ ├─ [38;5;173mreact-aria[39m[38;5;111m@[39m[38;5;111mnpm:3.31.0 [a2e03][39m (via [38;5;37mnpm:3.31.0 [a2e03][39m)
|
|
337
|
+
│ │ └─ URL: https://github.com/adobe/react-spectrum
|
|
338
|
+
│ ├─ [38;5;173mreact-stately[39m[38;5;111m@[39m[38;5;111mnpm:3.29.1 [a2e03][39m (via [38;5;37mnpm:3.29.1 [a2e03][39m)
|
|
337
339
|
│ │ └─ URL: https://github.com/adobe/react-spectrum
|
|
338
340
|
│ ├─ [38;5;173mstyle-dictionary[39m[38;5;111m@[39m[38;5;111mnpm:3.9.2[39m (via [38;5;37mnpm:^3.0.3[39m)
|
|
339
341
|
│ │ ├─ URL: git://github.com/amzn/style-dictionary.git
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Slider = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) "Neo4j"
|
|
22
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
23
|
+
*
|
|
24
|
+
* This file is part of Neo4j.
|
|
25
|
+
*
|
|
26
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
27
|
+
* it under the terms of the GNU General Public License as published by
|
|
28
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
29
|
+
* (at your option) any later version.
|
|
30
|
+
*
|
|
31
|
+
* This program is distributed in the hope that it will be useful,
|
|
32
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
33
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
34
|
+
* GNU General Public License for more details.
|
|
35
|
+
*
|
|
36
|
+
* You should have received a copy of the GNU General Public License
|
|
37
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
38
|
+
*/
|
|
39
|
+
const defaultImports_1 = require("../_common/defaultImports");
|
|
40
|
+
const react_1 = __importDefault(require("react"));
|
|
41
|
+
const helpers_1 = require("../helpers");
|
|
42
|
+
const tip_1 = require("../tip");
|
|
43
|
+
const react_stately_1 = require("react-stately");
|
|
44
|
+
const react_aria_1 = require("react-aria");
|
|
45
|
+
exports.Slider = (0, helpers_1.forwardRef)(function SliderComponent(_a, ref) {
|
|
46
|
+
var { rootProps = {}, inputProps = {}, minValue = 0, maxValue = 100, isDisabled = false, showSteps = false, showValues = false, step = 1, type = 'single', onChange } = _a, restProps = __rest(_a, ["rootProps", "inputProps", "minValue", "maxValue", "isDisabled", "showSteps", "showValues", "step", "type", "onChange"]);
|
|
47
|
+
const trackRef = react_1.default.useRef(null);
|
|
48
|
+
const castedValue = type === 'range'
|
|
49
|
+
? restProps.values
|
|
50
|
+
: restProps.value;
|
|
51
|
+
const castedOnChange = type === 'range'
|
|
52
|
+
? onChange
|
|
53
|
+
: onChange;
|
|
54
|
+
const state = (0, react_stately_1.useSliderState)({
|
|
55
|
+
isDisabled,
|
|
56
|
+
minValue,
|
|
57
|
+
maxValue,
|
|
58
|
+
step,
|
|
59
|
+
defaultValue: castedValue,
|
|
60
|
+
numberFormatter: new Intl.NumberFormat('en-US'),
|
|
61
|
+
onChange: castedOnChange, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
62
|
+
});
|
|
63
|
+
const { groupProps, trackProps } = (0, react_aria_1.useSlider)({ 'aria-label': 'slider' }, state, trackRef);
|
|
64
|
+
const mergedProps = (0, react_aria_1.mergeProps)(groupProps, rootProps);
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, mergedProps, { className: (0, defaultImports_1.classNames)('ndl-slider', rootProps.className), role: "presentation", ref: ref, children: (0, jsx_runtime_1.jsxs)("div", Object.assign({}, trackProps, { ref: trackRef, className: (0, defaultImports_1.classNames)('ndl-track', {
|
|
66
|
+
'ndl-is-disabled': state.isDisabled,
|
|
67
|
+
}), children: [showSteps && ((0, jsx_runtime_1.jsx)(TrackMarks, { state: state, min: minValue, max: maxValue })), (0, jsx_runtime_1.jsx)(FilledTrack, { state: state }), (0, jsx_runtime_1.jsx)(Thumb, { index: 0, state: state, trackRef: trackRef, showValues: showValues, inputForwardedProps: inputProps }), type === 'range' && ((0, jsx_runtime_1.jsx)(Thumb, { index: 1, state: state, trackRef: trackRef, showValues: showValues, inputForwardedProps: inputProps }))] })) })));
|
|
68
|
+
});
|
|
69
|
+
function FilledTrack({ state }) {
|
|
70
|
+
let width;
|
|
71
|
+
let left;
|
|
72
|
+
if (state.values.length === 1) {
|
|
73
|
+
width = state.getValuePercent(state.values[0]) * 100;
|
|
74
|
+
left = 0;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
width =
|
|
78
|
+
state.getValuePercent(state.values[1]) * 100 -
|
|
79
|
+
state.getValuePercent(state.values[0]) * 100;
|
|
80
|
+
left = state.getValuePercent(state.values[0]) * 100;
|
|
81
|
+
}
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "ndl-filled-track", style: {
|
|
83
|
+
left: `${left}%`,
|
|
84
|
+
width: `${width}%`,
|
|
85
|
+
} }));
|
|
86
|
+
}
|
|
87
|
+
function TrackMarks({ state, max, min, }) {
|
|
88
|
+
const markNo = Math.round((max - min) / state.step);
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)("div", { role: "presentation", className: "ndl-track-marks", children: Array.from({ length: markNo }).map((_, index) => {
|
|
90
|
+
const percent = (index / markNo) * 100;
|
|
91
|
+
let isFilled;
|
|
92
|
+
if (state.values.length === 1) {
|
|
93
|
+
isFilled = state.getValuePercent(state.values[0]) * 100 > percent;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
isFilled =
|
|
97
|
+
state.getValuePercent(state.values[0]) * 100 < percent &&
|
|
98
|
+
state.getValuePercent(state.values[1]) * 100 > percent;
|
|
99
|
+
}
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, defaultImports_1.classNames)('ndl-track-mark', {
|
|
101
|
+
'ndl-on-active-track': isFilled,
|
|
102
|
+
}), style: {
|
|
103
|
+
left: `${(index / markNo) * 100}%`,
|
|
104
|
+
} }, `track-mark-${index}`));
|
|
105
|
+
}) }));
|
|
106
|
+
}
|
|
107
|
+
function Thumb(props) {
|
|
108
|
+
const { state, trackRef, index, inputForwardedProps } = props;
|
|
109
|
+
const inputRef = react_1.default.useRef(null);
|
|
110
|
+
const { thumbProps, inputProps, isDragging } = (0, react_aria_1.useSliderThumb)({
|
|
111
|
+
index,
|
|
112
|
+
trackRef,
|
|
113
|
+
inputRef,
|
|
114
|
+
name: 'slider-thumb',
|
|
115
|
+
}, state);
|
|
116
|
+
const { focusProps, isFocusVisible } = (0, react_aria_1.useFocusRing)();
|
|
117
|
+
/**
|
|
118
|
+
* Solve issue with:
|
|
119
|
+
* Warning: Received NaN for the `value` attribute. If this is expected, cast the value to a string.
|
|
120
|
+
* Receiving NaN for other attributes also, like `max`. Waiting for a fix in react-aria.
|
|
121
|
+
* @see https://github.com/adobe/react-spectrum/issues/5859
|
|
122
|
+
* @see https://github.com/adobe/react-spectrum/pull/5861
|
|
123
|
+
*/
|
|
124
|
+
const mergedProps = (0, react_aria_1.mergeProps)(inputProps, focusProps,
|
|
125
|
+
// Omitting aria-valuetext double announcements, unless explicitly provided
|
|
126
|
+
{ 'aria-valuetext': '' }, inputForwardedProps);
|
|
127
|
+
const value = mergedProps.value || mergedProps.value === 0 ? mergedProps.value : '';
|
|
128
|
+
return ((0, jsx_runtime_1.jsxs)(tip_1.Tip, { isDisabled: props.showValues !== true, isOpen: isDragging || undefined, allowedPlacements: ['top'], children: [(0, jsx_runtime_1.jsx)(tip_1.Tip.Trigger, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({}, thumbProps, { className: (0, defaultImports_1.classNames)('ndl-thumb', {
|
|
129
|
+
'ndl-is-dragging': isDragging,
|
|
130
|
+
'ndl-focus': isFocusVisible,
|
|
131
|
+
}), children: (0, jsx_runtime_1.jsx)(react_aria_1.VisuallyHidden, { children: (0, jsx_runtime_1.jsx)("input", Object.assign({ ref: inputRef }, mergedProps)) }) })) }), (0, jsx_runtime_1.jsx)(tip_1.Tip.Content, { children: (0, jsx_runtime_1.jsx)(tip_1.Tip.Body, { children: value }) })] }));
|
|
132
|
+
}
|
|
133
|
+
exports.default = exports.Slider;
|
|
134
|
+
//# sourceMappingURL=Slider.js.map
|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AU,IAAI,SAAS,EAC/B,iBAAiB,EAAE,CAAC,KAAK,CAAC,aAE1B,uBAAC,SAAG,CAAC,OAAO,cACV,gDACM,UAAU,IACd,SAAS,EAAE,IAAA,2BAAU,EAAC,WAAW,EAAE;wBACjC,iBAAiB,EAAE,UAAU;wBAC7B,WAAW,EAAE,cAAc;qBAC5B,CAAC,YAEF,uBAAC,2BAAc,cACb,gDAAO,GAAG,EAAE,QAAQ,IAAM,WAAW,EAAI,GAC1B,IACb,GACM,EACd,uBAAC,SAAG,CAAC,OAAO,cACV,uBAAC,SAAG,CAAC,IAAI,cAAE,KAAK,GAAY,GAChB,IACV,CACP,CAAC;AACJ,CAAC;AAED,kBAAe,cAAM,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
34
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
__exportStar(require("./Slider"), exports);
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/slider/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,2CAAyB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) "Neo4j"
|
|
16
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
17
|
+
*
|
|
18
|
+
* This file is part of Neo4j.
|
|
19
|
+
*
|
|
20
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
21
|
+
* it under the terms of the GNU General Public License as published by
|
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
+
* (at your option) any later version.
|
|
24
|
+
*
|
|
25
|
+
* This program is distributed in the hope that it will be useful,
|
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
+
* GNU General Public License for more details.
|
|
29
|
+
*
|
|
30
|
+
* You should have received a copy of the GNU General Public License
|
|
31
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
+
*/
|
|
33
|
+
import { classNames } from '../_common/defaultImports';
|
|
34
|
+
import React from 'react';
|
|
35
|
+
import { forwardRef } from '../helpers';
|
|
36
|
+
import { Tip } from '../tip';
|
|
37
|
+
import { useSliderState } from 'react-stately';
|
|
38
|
+
import { mergeProps, useFocusRing, useSlider, useSliderThumb, VisuallyHidden, } from 'react-aria';
|
|
39
|
+
export const Slider = forwardRef(function SliderComponent(_a, ref) {
|
|
40
|
+
var { rootProps = {}, inputProps = {}, minValue = 0, maxValue = 100, isDisabled = false, showSteps = false, showValues = false, step = 1, type = 'single', onChange } = _a, restProps = __rest(_a, ["rootProps", "inputProps", "minValue", "maxValue", "isDisabled", "showSteps", "showValues", "step", "type", "onChange"]);
|
|
41
|
+
const trackRef = React.useRef(null);
|
|
42
|
+
const castedValue = type === 'range'
|
|
43
|
+
? restProps.values
|
|
44
|
+
: restProps.value;
|
|
45
|
+
const castedOnChange = type === 'range'
|
|
46
|
+
? onChange
|
|
47
|
+
: onChange;
|
|
48
|
+
const state = useSliderState({
|
|
49
|
+
isDisabled,
|
|
50
|
+
minValue,
|
|
51
|
+
maxValue,
|
|
52
|
+
step,
|
|
53
|
+
defaultValue: castedValue,
|
|
54
|
+
numberFormatter: new Intl.NumberFormat('en-US'),
|
|
55
|
+
onChange: castedOnChange, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
56
|
+
});
|
|
57
|
+
const { groupProps, trackProps } = useSlider({ 'aria-label': 'slider' }, state, trackRef);
|
|
58
|
+
const mergedProps = mergeProps(groupProps, rootProps);
|
|
59
|
+
return (_jsx("div", Object.assign({}, mergedProps, { className: classNames('ndl-slider', rootProps.className), role: "presentation", ref: ref, children: _jsxs("div", Object.assign({}, trackProps, { ref: trackRef, className: classNames('ndl-track', {
|
|
60
|
+
'ndl-is-disabled': state.isDisabled,
|
|
61
|
+
}), children: [showSteps && (_jsx(TrackMarks, { state: state, min: minValue, max: maxValue })), _jsx(FilledTrack, { state: state }), _jsx(Thumb, { index: 0, state: state, trackRef: trackRef, showValues: showValues, inputForwardedProps: inputProps }), type === 'range' && (_jsx(Thumb, { index: 1, state: state, trackRef: trackRef, showValues: showValues, inputForwardedProps: inputProps }))] })) })));
|
|
62
|
+
});
|
|
63
|
+
function FilledTrack({ state }) {
|
|
64
|
+
let width;
|
|
65
|
+
let left;
|
|
66
|
+
if (state.values.length === 1) {
|
|
67
|
+
width = state.getValuePercent(state.values[0]) * 100;
|
|
68
|
+
left = 0;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
width =
|
|
72
|
+
state.getValuePercent(state.values[1]) * 100 -
|
|
73
|
+
state.getValuePercent(state.values[0]) * 100;
|
|
74
|
+
left = state.getValuePercent(state.values[0]) * 100;
|
|
75
|
+
}
|
|
76
|
+
return (_jsx("div", { className: "ndl-filled-track", style: {
|
|
77
|
+
left: `${left}%`,
|
|
78
|
+
width: `${width}%`,
|
|
79
|
+
} }));
|
|
80
|
+
}
|
|
81
|
+
function TrackMarks({ state, max, min, }) {
|
|
82
|
+
const markNo = Math.round((max - min) / state.step);
|
|
83
|
+
return (_jsx("div", { role: "presentation", className: "ndl-track-marks", children: Array.from({ length: markNo }).map((_, index) => {
|
|
84
|
+
const percent = (index / markNo) * 100;
|
|
85
|
+
let isFilled;
|
|
86
|
+
if (state.values.length === 1) {
|
|
87
|
+
isFilled = state.getValuePercent(state.values[0]) * 100 > percent;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
isFilled =
|
|
91
|
+
state.getValuePercent(state.values[0]) * 100 < percent &&
|
|
92
|
+
state.getValuePercent(state.values[1]) * 100 > percent;
|
|
93
|
+
}
|
|
94
|
+
return (_jsx("div", { className: classNames('ndl-track-mark', {
|
|
95
|
+
'ndl-on-active-track': isFilled,
|
|
96
|
+
}), style: {
|
|
97
|
+
left: `${(index / markNo) * 100}%`,
|
|
98
|
+
} }, `track-mark-${index}`));
|
|
99
|
+
}) }));
|
|
100
|
+
}
|
|
101
|
+
function Thumb(props) {
|
|
102
|
+
const { state, trackRef, index, inputForwardedProps } = props;
|
|
103
|
+
const inputRef = React.useRef(null);
|
|
104
|
+
const { thumbProps, inputProps, isDragging } = useSliderThumb({
|
|
105
|
+
index,
|
|
106
|
+
trackRef,
|
|
107
|
+
inputRef,
|
|
108
|
+
name: 'slider-thumb',
|
|
109
|
+
}, state);
|
|
110
|
+
const { focusProps, isFocusVisible } = useFocusRing();
|
|
111
|
+
/**
|
|
112
|
+
* Solve issue with:
|
|
113
|
+
* Warning: Received NaN for the `value` attribute. If this is expected, cast the value to a string.
|
|
114
|
+
* Receiving NaN for other attributes also, like `max`. Waiting for a fix in react-aria.
|
|
115
|
+
* @see https://github.com/adobe/react-spectrum/issues/5859
|
|
116
|
+
* @see https://github.com/adobe/react-spectrum/pull/5861
|
|
117
|
+
*/
|
|
118
|
+
const mergedProps = mergeProps(inputProps, focusProps,
|
|
119
|
+
// Omitting aria-valuetext double announcements, unless explicitly provided
|
|
120
|
+
{ 'aria-valuetext': '' }, inputForwardedProps);
|
|
121
|
+
const value = mergedProps.value || mergedProps.value === 0 ? mergedProps.value : '';
|
|
122
|
+
return (_jsxs(Tip, { isDisabled: props.showValues !== true, isOpen: isDragging || undefined, allowedPlacements: ['top'], children: [_jsx(Tip.Trigger, { children: _jsx("div", Object.assign({}, thumbProps, { className: classNames('ndl-thumb', {
|
|
123
|
+
'ndl-is-dragging': isDragging,
|
|
124
|
+
'ndl-focus': isFocusVisible,
|
|
125
|
+
}), children: _jsx(VisuallyHidden, { children: _jsx("input", Object.assign({ ref: inputRef }, mergedProps)) }) })) }), _jsx(Tip.Content, { children: _jsx(Tip.Body, { children: value }) })] }));
|
|
126
|
+
}
|
|
127
|
+
export default Slider;
|
|
128
|
+
//# sourceMappingURL=Slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../../src/slider/Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAsC,UAAU,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAoB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EACL,UAAU,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC;AA0DpB,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,eAAe,CACvD,EAYc,EACd,GAAuC;QAbvC,EACE,SAAS,GAAG,EAAE,EACd,UAAU,GAAG,EAAE,EACf,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,GAAG,EACd,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,QAAQ,EACf,QAAQ,OAEI,EADT,SAAS,cAXd,wHAYC,CADa;IAId,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAA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IAAI,EAAE,cAAc;KACrB,EACD,KAAK,CACN,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAAC;IAEtD;;;;;;OAMG;IACH,MAAM,WAAW,GAAG,UAAU,CAC5B,UAAU,EACV,UAAU;IACV,2EAA2E;IAC3E,EAAE,gBAAgB,EAAE,EAAE,EAAE,EACxB,mBAAmB,CACpB,CAAC;IACF,MAAM,KAAK,GACT,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAExE,OAAO,CACL,MAAC,GAAG,IACF,UAAU,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,EACrC,MAAM,EAAE,UAAU,IAAI,SAAS,EAC/B,iBAAiB,EAAE,CAAC,KAAK,CAAC,aAE1B,KAAC,GAAG,CAAC,OAAO,cACV,8BACM,UAAU,IACd,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE;wBACjC,iBAAiB,EAAE,UAAU;wBAC7B,WAAW,EAAE,cAAc;qBAC5B,CAAC,YAEF,KAAC,cAAc,cACb,8BAAO,GAAG,EAAE,QAAQ,IAAM,WAAW,EAAI,GAC1B,IACb,GACM,EACd,KAAC,GAAG,CAAC,OAAO,cACV,KAAC,GAAG,CAAC,IAAI,cAAE,KAAK,GAAY,GAChB,IACV,CACP,CAAC;AACJ,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
export * from './Slider';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/slider/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import React from 'react';
|
|
23
|
+
import { type ComponentPropsWithoutRefAsObj } from '../helpers';
|
|
24
|
+
export interface SliderPropsBase {
|
|
25
|
+
as?: string | React.ComponentType<any>;
|
|
26
|
+
/** Forwards the props to the slider container's wrapper */
|
|
27
|
+
rootProps?: ComponentPropsWithoutRefAsObj<'div'>;
|
|
28
|
+
/** Forwards the input element(s) of the slider */
|
|
29
|
+
inputProps?: ComponentPropsWithoutRefAsObj<'input'>;
|
|
30
|
+
/**
|
|
31
|
+
* Which value interval will be added or removed from
|
|
32
|
+
* the current value when moving the slider button.
|
|
33
|
+
*
|
|
34
|
+
* @default 1
|
|
35
|
+
*/
|
|
36
|
+
step?: number;
|
|
37
|
+
isDisabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The minimum value possible to choose.
|
|
40
|
+
* @default 0
|
|
41
|
+
*/
|
|
42
|
+
minValue?: number;
|
|
43
|
+
/**
|
|
44
|
+
* The maximum value possible to choose.
|
|
45
|
+
* @default 100
|
|
46
|
+
*/
|
|
47
|
+
maxValue?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Displays a tooltip with the current
|
|
50
|
+
* value for a brief second.
|
|
51
|
+
*/
|
|
52
|
+
showValues?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Displays visual indicators for each
|
|
55
|
+
* of the steps in the slider.
|
|
56
|
+
*/
|
|
57
|
+
showSteps?: boolean;
|
|
58
|
+
}
|
|
59
|
+
type SingleSlider = SliderPropsBase & {
|
|
60
|
+
type?: 'single' | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Current value of the single slider.
|
|
63
|
+
*/
|
|
64
|
+
value: number;
|
|
65
|
+
onChange: (value: number) => void;
|
|
66
|
+
};
|
|
67
|
+
type RangeSlider = SliderPropsBase & {
|
|
68
|
+
type: 'range';
|
|
69
|
+
/**
|
|
70
|
+
* Current values of the range slider.
|
|
71
|
+
*/
|
|
72
|
+
values: [number, number];
|
|
73
|
+
onChange: (value: [number, number]) => void;
|
|
74
|
+
};
|
|
75
|
+
export type SliderProps = SingleSlider | RangeSlider;
|
|
76
|
+
export declare const Slider: (props: SliderProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
77
|
+
export default Slider;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
export * from './Slider';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@floating-ui/react": "0.25.1",
|
|
94
94
|
"@heroicons/react": "2.0.13",
|
|
95
95
|
"@neo4j-cypher/react-codemirror": "^1.0.1",
|
|
96
|
-
"@neo4j-ndl/base": "^2.
|
|
96
|
+
"@neo4j-ndl/base": "^2.6.0",
|
|
97
97
|
"@table-nav/core": "0.0.7",
|
|
98
98
|
"@table-nav/react": "0.0.7",
|
|
99
99
|
"@tanstack/react-table": "^8.9.3",
|
|
@@ -101,11 +101,12 @@
|
|
|
101
101
|
"date-fns": "^2.30.0",
|
|
102
102
|
"detect-browser": "^5.3.0",
|
|
103
103
|
"re-resizable": "^6.9.11",
|
|
104
|
-
"react-aria": "
|
|
104
|
+
"react-aria": "3.31.0",
|
|
105
105
|
"react-datepicker": "^4.14.1",
|
|
106
106
|
"react-dropzone": "^14.0.0",
|
|
107
107
|
"react-focus-lock": "^2.9.4",
|
|
108
108
|
"react-select": "5.7.0",
|
|
109
|
+
"react-stately": "3.29.1",
|
|
109
110
|
"react-syntax-highlighter": "^15.5.0",
|
|
110
111
|
"react-table": "^7.7.0",
|
|
111
112
|
"react-use": "^17.4.0",
|