@automattic/jetpack-components 1.12.17 → 2.0.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/CHANGELOG.md +10 -0
- package/build/index.d.ts +0 -1
- package/build/index.js +0 -1
- package/index.ts +0 -1
- package/package.json +2 -4
- package/build/components/number-slider/index.d.ts +0 -12
- package/build/components/number-slider/index.js +0 -43
- package/build/components/number-slider/style.scss +0 -68
- package/build/components/number-slider/types.d.ts +0 -50
- package/build/components/number-slider/types.js +0 -1
- package/components/number-slider/index.tsx +0 -86
- package/components/number-slider/style.scss +0 -68
- package/components/number-slider/types.ts +0 -58
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Components package releases.
|
|
4
4
|
|
|
5
|
+
## [2.0.1] - 2026-07-27
|
|
6
|
+
### Changed
|
|
7
|
+
- Update package dependencies.
|
|
8
|
+
|
|
9
|
+
## [2.0.0] - 2026-07-22
|
|
10
|
+
### Removed
|
|
11
|
+
- Number Slider: remove the NumberSlider component. It wrapped the unmaintained react-slider dependency (which blocked React 19) and had a single consumer; use the WordPress RangeControl component from @wordpress/components directly instead. [#50289]
|
|
12
|
+
|
|
5
13
|
## [1.12.17] - 2026-07-20
|
|
6
14
|
### Changed
|
|
7
15
|
- PricingTable: Add optional `breakpoint` prop to control the viewport width at which offers switch from columns to stacked blocks (defaults to 'large'). [#50567]
|
|
@@ -1885,6 +1893,8 @@
|
|
|
1885
1893
|
### Changed
|
|
1886
1894
|
- Update node version requirement to 14.16.1
|
|
1887
1895
|
|
|
1896
|
+
[2.0.1]: https://github.com/Automattic/jetpack-components/compare/2.0.0...2.0.1
|
|
1897
|
+
[2.0.0]: https://github.com/Automattic/jetpack-components/compare/1.12.17...2.0.0
|
|
1888
1898
|
[1.12.17]: https://github.com/Automattic/jetpack-components/compare/1.12.16...1.12.17
|
|
1889
1899
|
[1.12.16]: https://github.com/Automattic/jetpack-components/compare/1.12.15...1.12.16
|
|
1890
1900
|
[1.12.15]: https://github.com/Automattic/jetpack-components/compare/1.12.14...1.12.15
|
package/build/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export type { GravatarProps } from './components/gravatar/index.tsx';
|
|
|
15
15
|
export { default as IconTooltip } from './components/icon-tooltip/index.tsx';
|
|
16
16
|
export { default as ActionButton } from './components/action-button/index.tsx';
|
|
17
17
|
export { default as PricingCard } from './components/pricing-card/index.tsx';
|
|
18
|
-
export { default as NumberSlider } from './components/number-slider/index.tsx';
|
|
19
18
|
export { default as AdminSection } from './components/admin-section/basic/index.tsx';
|
|
20
19
|
export { default as AdminSectionHero } from './components/admin-section/hero/index.tsx';
|
|
21
20
|
export { default as AdminPage } from './components/admin-page/index.tsx';
|
package/build/index.js
CHANGED
|
@@ -28,7 +28,6 @@ export { default as Gravatar } from './components/gravatar/index.js';
|
|
|
28
28
|
export { default as IconTooltip } from './components/icon-tooltip/index.js';
|
|
29
29
|
export { default as ActionButton } from './components/action-button/index.js';
|
|
30
30
|
export { default as PricingCard } from './components/pricing-card/index.js';
|
|
31
|
-
export { default as NumberSlider } from './components/number-slider/index.js';
|
|
32
31
|
export { default as AdminSection } from './components/admin-section/basic/index.js';
|
|
33
32
|
export { default as AdminSectionHero } from './components/admin-section/hero/index.js';
|
|
34
33
|
export { default as AdminPage } from './components/admin-page/index.js';
|
package/index.ts
CHANGED
|
@@ -30,7 +30,6 @@ export type { GravatarProps } from './components/gravatar/index.tsx';
|
|
|
30
30
|
export { default as IconTooltip } from './components/icon-tooltip/index.tsx';
|
|
31
31
|
export { default as ActionButton } from './components/action-button/index.tsx';
|
|
32
32
|
export { default as PricingCard } from './components/pricing-card/index.tsx';
|
|
33
|
-
export { default as NumberSlider } from './components/number-slider/index.tsx';
|
|
34
33
|
export { default as AdminSection } from './components/admin-section/basic/index.tsx';
|
|
35
34
|
export { default as AdminSectionHero } from './components/admin-section/hero/index.tsx';
|
|
36
35
|
export { default as AdminPage } from './components/admin-page/index.tsx';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Jetpack Components Package",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/components/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -95,7 +95,6 @@
|
|
|
95
95
|
"js-sha256": "0.11.1",
|
|
96
96
|
"prop-types": "^15.7.2",
|
|
97
97
|
"qrcode.react": "4.2.0",
|
|
98
|
-
"react-slider": "2.0.5",
|
|
99
98
|
"social-logos": "^3.3.18",
|
|
100
99
|
"uplot": "1.6.31",
|
|
101
100
|
"uplot-react": "1.1.4"
|
|
@@ -112,7 +111,6 @@
|
|
|
112
111
|
"@types/jest": "30.0.0",
|
|
113
112
|
"@types/react": "18.3.28",
|
|
114
113
|
"@types/react-dom": "18.3.7",
|
|
115
|
-
"@types/react-slider": "1.3.6",
|
|
116
114
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
117
115
|
"jest": "30.4.2",
|
|
118
116
|
"react": "18.3.1",
|
|
@@ -122,7 +120,7 @@
|
|
|
122
120
|
"ts-dedent": "2.2.0",
|
|
123
121
|
"typescript": "6.0.3",
|
|
124
122
|
"webpack": "5.107.2",
|
|
125
|
-
"webpack-cli": "
|
|
123
|
+
"webpack-cli": "7.2.1"
|
|
126
124
|
},
|
|
127
125
|
"peerDependencies": {
|
|
128
126
|
"react": "^18.0.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NumberSliderProps } from './types.ts';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import './style.scss';
|
|
4
|
-
/**
|
|
5
|
-
* Generate Number Slider
|
|
6
|
-
* More support from the original ReactSlider component: https://zillow.github.io/react-slider/
|
|
7
|
-
*
|
|
8
|
-
* @param {NumberSliderProps} props - Props
|
|
9
|
-
* @return {ReactElement} - JSX element
|
|
10
|
-
*/
|
|
11
|
-
declare const NumberSlider: FC<NumberSliderProps>;
|
|
12
|
-
export default NumberSlider;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import ReactSlider from 'react-slider';
|
|
5
|
-
import './style.scss';
|
|
6
|
-
/**
|
|
7
|
-
* Generate Number Slider
|
|
8
|
-
* More support from the original ReactSlider component: https://zillow.github.io/react-slider/
|
|
9
|
-
*
|
|
10
|
-
* @param {NumberSliderProps} props - Props
|
|
11
|
-
* @return {ReactElement} - JSX element
|
|
12
|
-
*/
|
|
13
|
-
const NumberSlider = ({ className, maxValue = 100, minValue = 0, step = 1, value, onChange, onBeforeChange, onAfterChange, renderThumb, }) => {
|
|
14
|
-
const [isThumbHolding, setIsThumbHolding] = useState(false);
|
|
15
|
-
const componentClassName = clsx('jp-components-number-slider', className, {
|
|
16
|
-
'jp-components-number-slider--is-holding': isThumbHolding,
|
|
17
|
-
});
|
|
18
|
-
const onBeforeChangeCallback = beforeValue => {
|
|
19
|
-
setIsThumbHolding(true);
|
|
20
|
-
if (typeof onBeforeChange === 'function') {
|
|
21
|
-
onBeforeChange(beforeValue);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const onAfterChangeCallback = afterValue => {
|
|
25
|
-
setIsThumbHolding(false);
|
|
26
|
-
if (typeof onAfterChange === 'function') {
|
|
27
|
-
onAfterChange(afterValue);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const renderThumbCallback = renderThumb
|
|
31
|
-
? renderThumb
|
|
32
|
-
: (props, state) => {
|
|
33
|
-
const { key, ...otherProps } = props;
|
|
34
|
-
return (_jsx("div", { ...otherProps, children: state.valueNow }, key));
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Type casting to prevent TypeScript error:
|
|
38
|
-
* TS2604: JSX element type 'ReactSlider' does not have any construct or call signatures.
|
|
39
|
-
*/
|
|
40
|
-
const TypedReactSlider = ReactSlider;
|
|
41
|
-
return (_jsx("div", { className: componentClassName, "data-testid": "number-slider", children: _jsx(TypedReactSlider, { className: "jp-components-number-slider__control", thumbClassName: "jp-components-number-slider__thumb", thumbActiveClassName: "jp-components-number-slider__thumb--is-active", trackClassName: "jp-components-number-slider__track", value: value, max: maxValue, min: minValue, step: step, renderThumb: renderThumbCallback, onChange: onChange, onBeforeChange: onBeforeChangeCallback, onAfterChange: onAfterChangeCallback }) }));
|
|
42
|
-
};
|
|
43
|
-
export default NumberSlider;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
@use "@automattic/jetpack-base-styles/style";
|
|
2
|
-
|
|
3
|
-
$thumb-height: 40px;
|
|
4
|
-
$track-height: 8px;
|
|
5
|
-
|
|
6
|
-
@mixin adjust-track-rail-styles {
|
|
7
|
-
height: $track-height;
|
|
8
|
-
border-radius: 8px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// On holding thumb styling
|
|
12
|
-
.jp-components-number-slider--is-holding {
|
|
13
|
-
|
|
14
|
-
.jp-components-number-slider__thumb {
|
|
15
|
-
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(6, 158, 8, 0.25);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Base styles
|
|
20
|
-
.jp-components-number-slider__control {
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: $thumb-height;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.jp-components-number-slider__track {
|
|
26
|
-
|
|
27
|
-
@include adjust-track-rail-styles;
|
|
28
|
-
top: calc(($thumb-height / 2) - ($track-height / 2));
|
|
29
|
-
background: var(--jp-gray);
|
|
30
|
-
|
|
31
|
-
&.jp-components-number-slider__track-0 {
|
|
32
|
-
background: var(--jp-green-40);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.jp-components-number-slider__track-1 {
|
|
36
|
-
background: var(--jp-gray);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.jp-components-number-slider__thumb {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
padding: 8px 16px;
|
|
45
|
-
height: $thumb-height;
|
|
46
|
-
background-color: var(--jp-white);
|
|
47
|
-
border: 1.5px solid var(--jp-green-50);
|
|
48
|
-
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
color: var(--jp-black);
|
|
51
|
-
font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
52
|
-
font-style: normal;
|
|
53
|
-
font-weight: 600;
|
|
54
|
-
font-size: var(--font-body);
|
|
55
|
-
line-height: 24px;
|
|
56
|
-
letter-spacing: -0.02em;
|
|
57
|
-
white-space: nowrap;
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
|
|
60
|
-
// On focus thumb styling
|
|
61
|
-
&.jp-components-number-slider__thumb--is-active {
|
|
62
|
-
outline: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&[aria-valuenow="0"] {
|
|
66
|
-
border-color: var(--jp-gray);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { HTMLProps, RefCallback, JSX } from 'react';
|
|
2
|
-
interface HTMLPropsWithRefCallback<T> extends HTMLProps<T> {
|
|
3
|
-
ref: RefCallback<T>;
|
|
4
|
-
}
|
|
5
|
-
export type NumberSliderProps = {
|
|
6
|
-
/**
|
|
7
|
-
* The wrapper class name of this NumberSlider component.
|
|
8
|
-
*/
|
|
9
|
-
className?: string;
|
|
10
|
-
/**
|
|
11
|
-
* The maximum value of the slider.
|
|
12
|
-
*/
|
|
13
|
-
maxValue?: number;
|
|
14
|
-
/**
|
|
15
|
-
* The minimum value of the slider.
|
|
16
|
-
*/
|
|
17
|
-
minValue?: number;
|
|
18
|
-
/**
|
|
19
|
-
* The initial value of the slider.
|
|
20
|
-
*/
|
|
21
|
-
value?: number;
|
|
22
|
-
/**
|
|
23
|
-
* The step value of the slider.
|
|
24
|
-
*/
|
|
25
|
-
step?: number;
|
|
26
|
-
/**
|
|
27
|
-
* Callback called on every value change.
|
|
28
|
-
* The function will be called with two arguments, the first being the new value(s) the second being thumb index.
|
|
29
|
-
*/
|
|
30
|
-
onChange?: (value: number) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Callback called before starting to move a thumb. The callback will only be called if the action will result in a change.
|
|
33
|
-
* The function will be called with two arguments, the first being the initial value(s) the second being thumb index.
|
|
34
|
-
*/
|
|
35
|
-
onBeforeChange?: (value: number) => void;
|
|
36
|
-
/**
|
|
37
|
-
* Callback called only after moving a thumb has ended. The callback will only be called if the action resulted in a change.
|
|
38
|
-
* The function will be called with two arguments, the first being the result value(s) the second being thumb index.
|
|
39
|
-
*/
|
|
40
|
-
onAfterChange?: (value: number) => void;
|
|
41
|
-
/**
|
|
42
|
-
* Node to render on the slider.
|
|
43
|
-
*/
|
|
44
|
-
renderThumb?: (props: HTMLPropsWithRefCallback<HTMLDivElement>, state: {
|
|
45
|
-
index: number;
|
|
46
|
-
value: number | ReadonlyArray<number>;
|
|
47
|
-
valueNow: number;
|
|
48
|
-
}) => JSX.Element | null;
|
|
49
|
-
};
|
|
50
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import ReactSlider, { ReactSliderProps } from 'react-slider';
|
|
4
|
-
import { NumberSliderProps } from './types.ts';
|
|
5
|
-
import type { ComponentType, FC, ReactElement } from 'react';
|
|
6
|
-
import './style.scss';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Generate Number Slider
|
|
10
|
-
* More support from the original ReactSlider component: https://zillow.github.io/react-slider/
|
|
11
|
-
*
|
|
12
|
-
* @param {NumberSliderProps} props - Props
|
|
13
|
-
* @return {ReactElement} - JSX element
|
|
14
|
-
*/
|
|
15
|
-
const NumberSlider: FC< NumberSliderProps > = ( {
|
|
16
|
-
className,
|
|
17
|
-
maxValue = 100,
|
|
18
|
-
minValue = 0,
|
|
19
|
-
step = 1,
|
|
20
|
-
value,
|
|
21
|
-
onChange,
|
|
22
|
-
onBeforeChange,
|
|
23
|
-
onAfterChange,
|
|
24
|
-
renderThumb,
|
|
25
|
-
} ) => {
|
|
26
|
-
const [ isThumbHolding, setIsThumbHolding ] = useState( false );
|
|
27
|
-
|
|
28
|
-
const componentClassName = clsx( 'jp-components-number-slider', className, {
|
|
29
|
-
'jp-components-number-slider--is-holding': isThumbHolding,
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
const onBeforeChangeCallback = beforeValue => {
|
|
33
|
-
setIsThumbHolding( true );
|
|
34
|
-
|
|
35
|
-
if ( typeof onBeforeChange === 'function' ) {
|
|
36
|
-
onBeforeChange( beforeValue );
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const onAfterChangeCallback = afterValue => {
|
|
41
|
-
setIsThumbHolding( false );
|
|
42
|
-
|
|
43
|
-
if ( typeof onAfterChange === 'function' ) {
|
|
44
|
-
onAfterChange( afterValue );
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const renderThumbCallback = renderThumb
|
|
49
|
-
? renderThumb
|
|
50
|
-
: ( props, state ) => {
|
|
51
|
-
const { key, ...otherProps } = props;
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<div key={ key } { ...otherProps }>
|
|
55
|
-
{ state.valueNow }
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Type casting to prevent TypeScript error:
|
|
62
|
-
* TS2604: JSX element type 'ReactSlider' does not have any construct or call signatures.
|
|
63
|
-
*/
|
|
64
|
-
const TypedReactSlider = ReactSlider as unknown as ComponentType< ReactSliderProps >;
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div className={ componentClassName } data-testid="number-slider">
|
|
68
|
-
<TypedReactSlider
|
|
69
|
-
className="jp-components-number-slider__control"
|
|
70
|
-
thumbClassName="jp-components-number-slider__thumb"
|
|
71
|
-
thumbActiveClassName="jp-components-number-slider__thumb--is-active"
|
|
72
|
-
trackClassName="jp-components-number-slider__track"
|
|
73
|
-
value={ value }
|
|
74
|
-
max={ maxValue }
|
|
75
|
-
min={ minValue }
|
|
76
|
-
step={ step }
|
|
77
|
-
renderThumb={ renderThumbCallback } // eslint-disable-line react/jsx-no-bind
|
|
78
|
-
onChange={ onChange }
|
|
79
|
-
onBeforeChange={ onBeforeChangeCallback } // eslint-disable-line react/jsx-no-bind
|
|
80
|
-
onAfterChange={ onAfterChangeCallback } // eslint-disable-line react/jsx-no-bind
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default NumberSlider;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
@use "@automattic/jetpack-base-styles/style";
|
|
2
|
-
|
|
3
|
-
$thumb-height: 40px;
|
|
4
|
-
$track-height: 8px;
|
|
5
|
-
|
|
6
|
-
@mixin adjust-track-rail-styles {
|
|
7
|
-
height: $track-height;
|
|
8
|
-
border-radius: 8px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// On holding thumb styling
|
|
12
|
-
.jp-components-number-slider--is-holding {
|
|
13
|
-
|
|
14
|
-
.jp-components-number-slider__thumb {
|
|
15
|
-
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 3px rgba(6, 158, 8, 0.25);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Base styles
|
|
20
|
-
.jp-components-number-slider__control {
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: $thumb-height;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.jp-components-number-slider__track {
|
|
26
|
-
|
|
27
|
-
@include adjust-track-rail-styles;
|
|
28
|
-
top: calc(($thumb-height / 2) - ($track-height / 2));
|
|
29
|
-
background: var(--jp-gray);
|
|
30
|
-
|
|
31
|
-
&.jp-components-number-slider__track-0 {
|
|
32
|
-
background: var(--jp-green-40);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.jp-components-number-slider__track-1 {
|
|
36
|
-
background: var(--jp-gray);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.jp-components-number-slider__thumb {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
padding: 8px 16px;
|
|
45
|
-
height: $thumb-height;
|
|
46
|
-
background-color: var(--jp-white);
|
|
47
|
-
border: 1.5px solid var(--jp-green-50);
|
|
48
|
-
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
color: var(--jp-black);
|
|
51
|
-
font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
52
|
-
font-style: normal;
|
|
53
|
-
font-weight: 600;
|
|
54
|
-
font-size: var(--font-body);
|
|
55
|
-
line-height: 24px;
|
|
56
|
-
letter-spacing: -0.02em;
|
|
57
|
-
white-space: nowrap;
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
|
|
60
|
-
// On focus thumb styling
|
|
61
|
-
&.jp-components-number-slider__thumb--is-active {
|
|
62
|
-
outline: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&[aria-valuenow="0"] {
|
|
66
|
-
border-color: var(--jp-gray);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { HTMLProps, RefCallback, JSX } from 'react';
|
|
2
|
-
|
|
3
|
-
interface HTMLPropsWithRefCallback< T > extends HTMLProps< T > {
|
|
4
|
-
ref: RefCallback< T >;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type NumberSliderProps = {
|
|
8
|
-
/**
|
|
9
|
-
* The wrapper class name of this NumberSlider component.
|
|
10
|
-
*/
|
|
11
|
-
className?: string;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The maximum value of the slider.
|
|
15
|
-
*/
|
|
16
|
-
maxValue?: number;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The minimum value of the slider.
|
|
20
|
-
*/
|
|
21
|
-
minValue?: number;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The initial value of the slider.
|
|
25
|
-
*/
|
|
26
|
-
value?: number;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The step value of the slider.
|
|
30
|
-
*/
|
|
31
|
-
step?: number;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Callback called on every value change.
|
|
35
|
-
* The function will be called with two arguments, the first being the new value(s) the second being thumb index.
|
|
36
|
-
*/
|
|
37
|
-
onChange?: ( value: number ) => void;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Callback called before starting to move a thumb. The callback will only be called if the action will result in a change.
|
|
41
|
-
* The function will be called with two arguments, the first being the initial value(s) the second being thumb index.
|
|
42
|
-
*/
|
|
43
|
-
onBeforeChange?: ( value: number ) => void;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Callback called only after moving a thumb has ended. The callback will only be called if the action resulted in a change.
|
|
47
|
-
* The function will be called with two arguments, the first being the result value(s) the second being thumb index.
|
|
48
|
-
*/
|
|
49
|
-
onAfterChange?: ( value: number ) => void;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Node to render on the slider.
|
|
53
|
-
*/
|
|
54
|
-
renderThumb?: (
|
|
55
|
-
props: HTMLPropsWithRefCallback< HTMLDivElement >,
|
|
56
|
-
state: { index: number; value: number | ReadonlyArray< number >; valueNow: number }
|
|
57
|
-
) => JSX.Element | null;
|
|
58
|
-
};
|