@synerise/ds-slider 1.0.8 → 1.0.10
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 +19 -0
- package/dist/Slider.js +23 -13
- package/dist/Slider.styles.d.ts +2 -3
- package/dist/Slider.styles.js +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@1.0.9...@synerise/ds-slider@1.0.10) (2025-06-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **slider:** render marks if tooltip is hidden ([fa528d4](https://github.com/Synerise/synerise-design/commit/fa528d42e1c94cd55b01184c05adf3b3a97de6ae))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.0.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@1.0.8...@synerise/ds-slider@1.0.9) (2025-05-26)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @synerise/ds-slider
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.0.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-slider@1.0.7...@synerise/ds-slider@1.0.8) (2025-05-19)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-slider
|
package/dist/Slider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var _excluded = ["useColorPalette", "label", "inverted", "getTooltipPopupContainer", "tracksColorMap", "type", "thickness", "description", "tipFormatter", "allocationConfig", "hideMinAndMaxMarks", "disabled", "max", "min", "value", "range"];
|
|
1
|
+
var _excluded = ["useColorPalette", "label", "inverted", "getTooltipPopupContainer", "tracksColorMap", "type", "thickness", "description", "tipFormatter", "allocationConfig", "hideMinAndMaxMarks", "disabled", "max", "min", "value", "range", "tooltipVisible", "tooltipPlacement"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { Label } from '@synerise/ds-typography';
|
|
6
6
|
import '@synerise/ds-core/dist/js/style';
|
|
7
7
|
import { defaultColorsOrder } from '@synerise/ds-core';
|
|
@@ -45,17 +45,23 @@ var Slider = function Slider(props) {
|
|
|
45
45
|
min = props.min,
|
|
46
46
|
value = props.value,
|
|
47
47
|
range = props.range,
|
|
48
|
+
tooltipVisible = props.tooltipVisible,
|
|
49
|
+
_props$tooltipPlaceme = props.tooltipPlacement,
|
|
50
|
+
tooltipPlacement = _props$tooltipPlaceme === void 0 ? 'bottom' : _props$tooltipPlaceme,
|
|
48
51
|
antdProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
49
|
-
var
|
|
50
|
-
reachedEnd =
|
|
51
|
-
setReachedEnd =
|
|
52
|
-
var
|
|
53
|
-
reachedStart =
|
|
54
|
-
setReachedStart =
|
|
55
|
-
var
|
|
52
|
+
var _useState = useState(false),
|
|
53
|
+
reachedEnd = _useState[0],
|
|
54
|
+
setReachedEnd = _useState[1];
|
|
55
|
+
var _useState2 = useState(false),
|
|
56
|
+
reachedStart = _useState2[0],
|
|
57
|
+
setReachedStart = _useState2[1];
|
|
58
|
+
var showValueTooltip = useMemo(function () {
|
|
59
|
+
return tooltipVisible !== false && (!antdProps.tooltip || antdProps.tooltip.open !== false);
|
|
60
|
+
}, [tooltipVisible, antdProps.tooltip]);
|
|
61
|
+
var calcHandlePosition = useCallback(function () {
|
|
56
62
|
var handler = document.querySelectorAll('.ant-slider-handle');
|
|
57
63
|
var markTexts = document.querySelectorAll('.ant-slider-mark-text');
|
|
58
|
-
if (handler && markTexts != null && markTexts.length) {
|
|
64
|
+
if (handler && markTexts != null && markTexts.length && showValueTooltip) {
|
|
59
65
|
var firstMark = markTexts[0].getBoundingClientRect();
|
|
60
66
|
var lastMark = markTexts[markTexts.length - 1].getBoundingClientRect();
|
|
61
67
|
var firstHandler = handler[0].getBoundingClientRect();
|
|
@@ -75,13 +81,13 @@ var Slider = function Slider(props) {
|
|
|
75
81
|
reachedEnd: reachedEnd,
|
|
76
82
|
reachedStart: reachedStart
|
|
77
83
|
};
|
|
78
|
-
}, [reachedEnd, reachedStart]);
|
|
79
|
-
|
|
84
|
+
}, [reachedEnd, reachedStart, showValueTooltip]);
|
|
85
|
+
useEffect(function () {
|
|
80
86
|
setTimeout(function () {
|
|
81
87
|
calcHandlePosition();
|
|
82
88
|
}, 0);
|
|
83
89
|
}, [calcHandlePosition, value]);
|
|
84
|
-
var labelElement =
|
|
90
|
+
var labelElement = useMemo(function () {
|
|
85
91
|
return label ? /*#__PURE__*/React.createElement(S.LabelWrapper, null, /*#__PURE__*/React.createElement(Label, null, label)) : null;
|
|
86
92
|
}, [label]);
|
|
87
93
|
if (type === SliderTypes.ALLOCATION && !!allocationConfig) {
|
|
@@ -92,6 +98,10 @@ var Slider = function Slider(props) {
|
|
|
92
98
|
max: max,
|
|
93
99
|
value: value,
|
|
94
100
|
reachedEnd: reachedEnd,
|
|
101
|
+
tooltip: _extends({}, antdProps.tooltip, {
|
|
102
|
+
placement: tooltipPlacement,
|
|
103
|
+
open: tooltipVisible
|
|
104
|
+
}),
|
|
95
105
|
range: range,
|
|
96
106
|
reachedStart: reachedStart,
|
|
97
107
|
className: value && couldBeInverted(value, !!inverted) ? 'ant-slider-inverted' : undefined,
|
package/dist/Slider.styles.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FlattenSimpleInterpolation } from 'styled-components';
|
|
2
1
|
import { SliderSingleProps, SliderRangeProps } from 'antd/lib/slider';
|
|
3
2
|
import { ThemeProps } from '@synerise/ds-core';
|
|
4
3
|
import { ComponentType } from 'react';
|
|
@@ -9,8 +8,8 @@ export declare const Description: import("styled-components").StyledComponent<"d
|
|
|
9
8
|
}, never>;
|
|
10
9
|
export declare const LabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
10
|
export declare const DescriptionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
-
export declare const applyTooltipStyles: (props: ThemeProps & DsSliderProps & SliderStyles) => FlattenSimpleInterpolation;
|
|
13
|
-
export declare const createTracksStyles: (props: ThemeProps, colorsMap: ColorMapProps) => FlattenSimpleInterpolation;
|
|
11
|
+
export declare const applyTooltipStyles: (props: ThemeProps & DsSliderProps & SliderStyles) => import("styled-components").FlattenSimpleInterpolation;
|
|
12
|
+
export declare const createTracksStyles: (props: ThemeProps, colorsMap: ColorMapProps) => import("styled-components").FlattenSimpleInterpolation;
|
|
14
13
|
type SliderStyles = {
|
|
15
14
|
reachedEnd?: boolean;
|
|
16
15
|
reachedStart?: boolean;
|
package/dist/Slider.styles.js
CHANGED
|
@@ -15,7 +15,7 @@ var INDEX_MAP = {
|
|
|
15
15
|
export var Description = styled.div.withConfig({
|
|
16
16
|
displayName: "Sliderstyles__Description",
|
|
17
17
|
componentId: "sc-1gtvqj9-0"
|
|
18
|
-
})(["
|
|
18
|
+
})(["bottom:70px;color:", ";font-weight:400;position:absolute;opacity:", ";"], function (props) {
|
|
19
19
|
return props.theme.palette['grey-500'];
|
|
20
20
|
}, function (props) {
|
|
21
21
|
return props.range ? '0' : '1';
|
|
@@ -27,7 +27,7 @@ export var LabelWrapper = styled.div.withConfig({
|
|
|
27
27
|
export var DescriptionWrapper = styled.div.withConfig({
|
|
28
28
|
displayName: "Sliderstyles__DescriptionWrapper",
|
|
29
29
|
componentId: "sc-1gtvqj9-2"
|
|
30
|
-
})(["display:flex;direction:column;align-items:center;justify-content:center;position:relative;user-select:none;bottom:0;right:0;"]);
|
|
30
|
+
})(["display:flex;direction:column;align-items:center;justify-content:center;position:relative;user-select:none;pointer-events:none;bottom:0;right:0;"]);
|
|
31
31
|
export var applyTooltipStyles = function applyTooltipStyles(props) {
|
|
32
32
|
return css([".ant-tooltip-inner{font-size:13px;padding:3px 7px;user-select:none;white-space:nowrap;}", " ", " &&&.ant-slider-disabled{.ant-slider-dot-active{background-color:", ";}.ant-slider-rail{background-color:", ";}}.ant-slider-handle:hover,.ant-slider-handle:focus{", "}.ant-slider-handle:focus{", " .ant-slider-handle:hover:not(:focus){background-color:", ";}.ant-slider-handle:not(:focus){.ant-tooltip-content:hover{background-color:transparent !important;border-radius:3px;}.ant-tooltip-inner:hover{color:", " !important;}}.ant-slider-dot[style*='left: 100%;'],.ant-slider-dot:first-of-type{visibility:", ";}.ant-slider-mark-text:last-of-type{padding-right:30px;}.ant-slider-mark-text:last-of-type{", "}.ant-slider-mark-text:first-of-type{", "}.ant-slider-handle-dragging{border-color:", " !important;box-shadow:0 0 0 3px rgba(35,138,254,0.25) !important;}"], props.disabled && ".ant-tooltip-inner {\n color: " + props.theme.palette['grey-400'] + ";\n }\n ", props.disabled && ".ant-slider-dot {\n background-color: " + props.theme.palette.white + ";\n }\n ", props.theme.palette.white, props.theme.palette['grey-200'], !props.disabled && "\n .ant-tooltip-content {\n background-color: " + props.theme.palette['grey-900'] + ";\n border-radius: 3px;\n }\n " + Description + " {\n color: " + (!props.disabled && props.theme.palette['grey-600']) + ";\n }\n .ant-tooltip-inner {\n color: " + props.theme.palette['grey-050'] + ";\n }\n ", !props.disabled && "\n " + Description + " {\n " + (props.range && "opacity: 1") + ";\n }\n }\n ", !props.disabled && props.theme.palette['grey-500'], !props.disabled && props.theme.palette['grey-600'], props.hideMinAndMaxMarks ? 'hidden' : 'visible', props.reachedEnd && "opacity: 0", props.reachedStart && "opacity: 0", props.theme.palette['grey-050']);
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-slider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Slider UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-tooltip": "^1.1.
|
|
38
|
-
"@synerise/ds-typography": "^1.0.
|
|
39
|
-
"@synerise/ds-utils": "^1.1.
|
|
37
|
+
"@synerise/ds-tooltip": "^1.1.8",
|
|
38
|
+
"@synerise/ds-typography": "^1.0.9",
|
|
39
|
+
"@synerise/ds-utils": "^1.1.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@synerise/ds-core": "*",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
46
46
|
"styled-components": "^5.3.3"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "022e7ef05dd9d54cdb148bdd03dcf592fbaf3a52"
|
|
49
49
|
}
|