@synerise/ds-filter 1.2.56 → 1.2.58
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/dist/Filter.js +40 -33
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.2.58](https://github.com/Synerise/synerise-design/compare/@synerise/ds-filter@1.2.57...@synerise/ds-filter@1.2.58) (2026-07-08)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- guard ds-filter move animation against null refs ([e4eb699](https://github.com/Synerise/synerise-design/commit/e4eb699641cb62f585d0b8f27f0feac563fb2786))
|
|
11
|
+
|
|
12
|
+
## [1.2.57](https://github.com/Synerise/synerise-design/compare/@synerise/ds-filter@1.2.56...@synerise/ds-filter@1.2.57) (2026-06-17)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @synerise/ds-filter
|
|
15
|
+
|
|
6
16
|
## [1.2.56](https://github.com/Synerise/synerise-design/compare/@synerise/ds-filter@1.2.55...@synerise/ds-filter@1.2.56) (2026-06-11)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @synerise/ds-filter
|
package/dist/Filter.js
CHANGED
|
@@ -45,40 +45,47 @@ const Filter = ({
|
|
|
45
45
|
const expressionRefs = useRef({});
|
|
46
46
|
const movedExpressionId = useRef(null);
|
|
47
47
|
useEffect(() => {
|
|
48
|
-
if (movedExpressionId.current
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const high = Math.max(oldIndex, newIndex);
|
|
59
|
-
const movedExpressionHeight = sign * expressionRefs.current[movedExpressionId.current].getBoundingClientRect().height;
|
|
60
|
-
let expressionOffset = 0;
|
|
61
|
-
const movedCardTransformDuration = Math.min((high - low) * TRANSITION_DURATION, TRANSITION_DURATION_MAX);
|
|
62
|
-
expressions.forEach((expression, index) => {
|
|
63
|
-
if (expression.id !== movedExpressionId.current && index >= low && index <= high) {
|
|
64
|
-
expressionOffset += expressionRefs.current[expression.id].getBoundingClientRect().height;
|
|
65
|
-
expressionRefs.current[expression.id].style.transition = "";
|
|
66
|
-
expressionRefs.current[expression.id].style.zIndex = BOTTOM_TRANSITION_ZINDEX;
|
|
67
|
-
expressionRefs.current[expression.id].style.transform = `translateY(${movedExpressionHeight}px)`;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
expressionRefs.current[movedExpressionId.current].style.transition = "";
|
|
71
|
-
expressionRefs.current[movedExpressionId.current].style.zIndex = TOP_TRANSITION_ZINDEX;
|
|
72
|
-
expressionRefs.current[movedExpressionId.current].style.transform = `translateY(${-sign * expressionOffset}px)`;
|
|
73
|
-
requestAnimationFrame(() => {
|
|
74
|
-
expressions.forEach((expression) => {
|
|
75
|
-
expressionRefs.current[expression.id].style.transition = `transform ${expression.id === movedExpressionId.current ? movedCardTransformDuration : TRANSITION_DURATION}s`;
|
|
76
|
-
expressionRefs.current[expression.id].style.transform = "";
|
|
77
|
-
});
|
|
78
|
-
movedExpressionId.current = null;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
48
|
+
if (!movedExpressionId.current || !previousExpressions?.length) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const movedId = movedExpressionId.current;
|
|
52
|
+
const oldIndex = previousExpressions.findIndex((expression) => expression.id === movedId);
|
|
53
|
+
const newIndex = expressions.findIndex((expression) => expression.id === movedId);
|
|
54
|
+
const movedElement = expressionRefs.current[movedId];
|
|
55
|
+
if (oldIndex === -1 || newIndex === -1 || oldIndex === newIndex || !movedElement) {
|
|
56
|
+
movedExpressionId.current = null;
|
|
57
|
+
return;
|
|
81
58
|
}
|
|
59
|
+
const sign = oldIndex < newIndex ? 1 : -1;
|
|
60
|
+
const low = Math.min(oldIndex, newIndex);
|
|
61
|
+
const high = Math.max(oldIndex, newIndex);
|
|
62
|
+
const movedExpressionHeight = sign * movedElement.getBoundingClientRect().height;
|
|
63
|
+
let expressionOffset = 0;
|
|
64
|
+
const movedCardTransformDuration = Math.min((high - low) * TRANSITION_DURATION, TRANSITION_DURATION_MAX);
|
|
65
|
+
expressions.forEach((expression, index) => {
|
|
66
|
+
const element = expressionRefs.current[expression.id];
|
|
67
|
+
if (!element || expression.id === movedId || index < low || index > high) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
expressionOffset += element.getBoundingClientRect().height;
|
|
71
|
+
element.style.transition = "";
|
|
72
|
+
element.style.zIndex = BOTTOM_TRANSITION_ZINDEX;
|
|
73
|
+
element.style.transform = `translateY(${movedExpressionHeight}px)`;
|
|
74
|
+
});
|
|
75
|
+
movedElement.style.transition = "";
|
|
76
|
+
movedElement.style.zIndex = TOP_TRANSITION_ZINDEX;
|
|
77
|
+
movedElement.style.transform = `translateY(${-sign * expressionOffset}px)`;
|
|
78
|
+
requestAnimationFrame(() => {
|
|
79
|
+
expressions.forEach((expression) => {
|
|
80
|
+
const element = expressionRefs.current[expression.id];
|
|
81
|
+
if (!element) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
element.style.transition = `transform ${expression.id === movedId ? movedCardTransformDuration : TRANSITION_DURATION}s`;
|
|
85
|
+
element.style.transform = "";
|
|
86
|
+
});
|
|
87
|
+
movedExpressionId.current = null;
|
|
88
|
+
});
|
|
82
89
|
});
|
|
83
90
|
useEffect(() => {
|
|
84
91
|
if (previousExpressions && expressions.length > previousExpressions.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-filter",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.58",
|
|
4
4
|
"description": "Filter UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
],
|
|
42
42
|
"types": "dist/index.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-button": "^1.5.
|
|
45
|
-
"@synerise/ds-logic": "^1.1.
|
|
46
|
-
"@synerise/ds-sortable": "^1.3.
|
|
47
|
-
"@synerise/ds-step-card": "^1.2.
|
|
48
|
-
"@synerise/ds-utils": "^1.10.
|
|
44
|
+
"@synerise/ds-button": "^1.5.33",
|
|
45
|
+
"@synerise/ds-logic": "^1.1.45",
|
|
46
|
+
"@synerise/ds-sortable": "^1.3.20",
|
|
47
|
+
"@synerise/ds-step-card": "^1.2.55",
|
|
48
|
+
"@synerise/ds-utils": "^1.10.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@synerise/ds-core": "*",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"styled-components": "^5.3.3",
|
|
55
55
|
"vitest": "4"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5452c886c6a70cc2847fdb50ccf376dfb93916e5"
|
|
58
58
|
}
|