@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
|
@@ -4372,6 +4372,12 @@ function useSidebarResize({
|
|
|
4372
4372
|
} catch {
|
|
4373
4373
|
}
|
|
4374
4374
|
};
|
|
4375
|
+
const finish = () => {
|
|
4376
|
+
if (!gesture.current) return;
|
|
4377
|
+
if (gesture.current.moved) persist();
|
|
4378
|
+
gesture.current = null;
|
|
4379
|
+
setDragging(false);
|
|
4380
|
+
};
|
|
4375
4381
|
const cancel = () => {
|
|
4376
4382
|
if (!gesture.current) return;
|
|
4377
4383
|
setPreferredWidth(gesture.current.preferred);
|
|
@@ -4408,14 +4414,16 @@ function useSidebarResize({
|
|
|
4408
4414
|
update(
|
|
4409
4415
|
start.width + (side === "left" ? 1 : -1) * (event.clientX - start.x)
|
|
4410
4416
|
);
|
|
4411
|
-
persist();
|
|
4412
4417
|
}
|
|
4413
|
-
|
|
4414
|
-
setDragging(false);
|
|
4418
|
+
finish();
|
|
4415
4419
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4416
4420
|
},
|
|
4417
4421
|
onPointerCancel: cancel,
|
|
4418
|
-
|
|
4422
|
+
// Capture can end before pointerup reaches the rail. Keep the last move
|
|
4423
|
+
// instead of treating release as a cancelled drag and restoring its start.
|
|
4424
|
+
onLostPointerCapture: (event) => {
|
|
4425
|
+
if (gesture.current?.id === event.pointerId) finish();
|
|
4426
|
+
},
|
|
4419
4427
|
onClickCapture: (event) => {
|
|
4420
4428
|
if (suppressClick.current && event.detail !== 0) {
|
|
4421
4429
|
event.preventDefault();
|