@hyphen/hyphen-components 9.1.0 → 9.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/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/hyphen-components.cjs.development.js +12 -4
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +2 -2
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +12 -4
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Sidebar/Sidebar.resize.test.tsx +29 -6
- package/src/components/Sidebar/useSidebarResize.ts +12 -4
|
@@ -4504,6 +4504,12 @@ function useSidebarResize({
|
|
|
4504
4504
|
} catch {
|
|
4505
4505
|
}
|
|
4506
4506
|
};
|
|
4507
|
+
const finish = () => {
|
|
4508
|
+
if (!gesture.current) return;
|
|
4509
|
+
if (gesture.current.moved) persist();
|
|
4510
|
+
gesture.current = null;
|
|
4511
|
+
setDragging(false);
|
|
4512
|
+
};
|
|
4507
4513
|
const cancel = () => {
|
|
4508
4514
|
if (!gesture.current) return;
|
|
4509
4515
|
setPreferredWidth(gesture.current.preferred);
|
|
@@ -4540,14 +4546,16 @@ function useSidebarResize({
|
|
|
4540
4546
|
update(
|
|
4541
4547
|
start.width + (side === "left" ? 1 : -1) * (event.clientX - start.x)
|
|
4542
4548
|
);
|
|
4543
|
-
persist();
|
|
4544
4549
|
}
|
|
4545
|
-
|
|
4546
|
-
setDragging(false);
|
|
4550
|
+
finish();
|
|
4547
4551
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4548
4552
|
},
|
|
4549
4553
|
onPointerCancel: cancel,
|
|
4550
|
-
|
|
4554
|
+
// Capture can end before pointerup reaches the rail. Keep the last move
|
|
4555
|
+
// instead of treating release as a cancelled drag and restoring its start.
|
|
4556
|
+
onLostPointerCapture: (event) => {
|
|
4557
|
+
if (gesture.current?.id === event.pointerId) finish();
|
|
4558
|
+
},
|
|
4551
4559
|
onClickCapture: (event) => {
|
|
4552
4560
|
if (suppressClick.current && event.detail !== 0) {
|
|
4553
4561
|
event.preventDefault();
|