@yogiswara/honcho-editor-ui 2.10.5 → 2.10.7

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.
@@ -31,7 +31,7 @@ export default function HImageEditorMobile(props) {
31
31
  const renderPanelContent = () => {
32
32
  switch (props.activePanel) {
33
33
  case 'colorAdjustment':
34
- return _jsx(HTabColorAdjustmentMobile, { ...props });
34
+ return _jsx(HTabColorAdjustmentMobile, { activeSubPanel: props.activeSubPanel, innerRef: props.innerRef, onDragStart: props.onDragStart, onDragEnd: props.onDragEnd, onExposureChange: props.onExposureChange, onContrastChange: props.onContrastChange, onHighlightsChange: props.onHighlightsChange, onShadowsChange: props.onShadowsChange, onWhitesChange: props.onWhitesChange, onBlacksChange: props.onBlacksChange, onTempChange: props.onTempChange, onTintChange: props.onTintChange, onVibranceChange: props.onVibranceChange, onSaturationChange: props.onSaturationChange, exposureScore: props.exposureScore, contrastScore: props.contrastScore, highlightsScore: props.highlightsScore, shadowScore: props.shadowScore, whiteScore: props.whiteScore, blackScore: props.blackScore, tempScore: props.tempScore, tintScore: props.tintScore, vibranceScore: props.vibranceScore, saturationScore: props.saturationScore, isBatchMode: props.isBatchMode, sharpnessScore: props.sharpnessScore, onSharpnessChange: props.onSharpnessChange, clarityScore: props.clarityScore, onClarityChange: props.onClarityChange });
35
35
  case 'preset':
36
36
  return _jsx(HTabPresetMobile, { ...props });
37
37
  default:
@@ -4,5 +4,5 @@ import HSliderLightMobile from "./HSliderLightMobile";
4
4
  import HSliderDetailsMobile from "./HSliderDetailsMobile";
5
5
  import { Box } from "@mui/material";
6
6
  export default function HTabColorAdjustmentMobile(props) {
7
- return (_jsxs(Box, { ref: props.innerRef, children: [props.activeSubPanel === "light" && _jsx(HSliderLightMobile, { ...props }), props.activeSubPanel === "color" && _jsx(HSliderColorMobile, { ...props }), props.activeSubPanel === "details" && _jsx(HSliderDetailsMobile, { ...props })] }));
7
+ return (_jsxs(Box, { ref: props.innerRef, children: [props.activeSubPanel === "light" && _jsx(HSliderLightMobile, { exposureScore: props.exposureScore, contrastScore: props.contrastScore, highlightsScore: props.highlightsScore, shadowScore: props.shadowScore, whiteScore: props.whiteScore, blackScore: props.blackScore, isBatchMode: props.isBatchMode, onExposureChange: props.onExposureChange, onContrastChange: props.onContrastChange, onHighlightsChange: props.onHighlightsChange, onShadowsChange: props.onShadowsChange, onWhitesChange: props.onWhitesChange, onBlacksChange: props.onBlacksChange, onDragStart: props.onDragStart, onDragEnd: props.onDragEnd }), props.activeSubPanel === "color" && _jsx(HSliderColorMobile, { tempScore: props.tempScore, tintScore: props.tintScore, vibranceScore: props.vibranceScore, saturationScore: props.saturationScore, isBatchMode: props.isBatchMode, onTempChange: props.onTempChange, onTintChange: props.onTintChange, onVibranceChange: props.onVibranceChange, onSaturationChange: props.onSaturationChange, onDragStart: props.onDragStart, onDragEnd: props.onDragEnd }), props.activeSubPanel === "details" && _jsx(HSliderDetailsMobile, { clarityScore: props.clarityScore, sharpnessScore: props.sharpnessScore, isBatchMode: props.isBatchMode, onClarityChange: props.onClarityChange, onSharpnessChange: props.onSharpnessChange, onDragStart: props.onDragStart, onDragEnd: props.onDragEnd })] }));
8
8
  }
@@ -1,2 +1,2 @@
1
1
  import React from "react";
2
- export default function useSliderEvents(onDragStart: () => void, onDragEnd: () => void, isBatchMode: boolean): React.RefObject<HTMLDivElement>;
2
+ export default function useSliderEvents(onDragStart: () => void, onDragEnd: () => void, isBatchMode: boolean): React.RefObject<HTMLSpanElement>;
@@ -2,46 +2,32 @@ import { useEffect, useRef } from "react";
2
2
  export default function useSliderEvents(onDragStart, onDragEnd, isBatchMode) {
3
3
  const sliderRef = useRef(null);
4
4
  useEffect(() => {
5
- const sliderElement = sliderRef.current;
6
- if (!sliderElement)
5
+ const slider = sliderRef.current;
6
+ if (!slider)
7
7
  return;
8
- const handleMouseDown = () => {
8
+ // A single handler for starting the drag
9
+ const handleStart = () => {
9
10
  if (!isBatchMode) {
10
11
  onDragStart();
11
12
  }
12
- // Add document listeners when dragging starts
13
- document.addEventListener("mouseup", handleMouseUp);
14
- document.addEventListener("touchend", handleTouchEnd);
15
13
  };
16
- const handleTouchStart = () => {
17
- if (!isBatchMode) {
18
- onDragStart();
19
- }
20
- // Add document listeners when dragging starts
21
- document.addEventListener("mouseup", handleMouseUp);
22
- document.addEventListener("touchend", handleTouchEnd);
23
- };
24
- const handleMouseUp = () => {
25
- onDragEnd();
26
- // Remove document listeners when dragging ends
27
- document.removeEventListener("mouseup", handleMouseUp);
28
- document.removeEventListener("touchend", handleTouchEnd);
29
- };
30
- const handleTouchEnd = () => {
14
+ // A single handler for ending the drag
15
+ const handleEnd = () => {
31
16
  onDragEnd();
32
- // Remove document listeners when dragging ends
33
- document.removeEventListener("mouseup", handleMouseUp);
34
- document.removeEventListener("touchend", handleTouchEnd);
35
17
  };
36
- sliderElement.addEventListener("mousedown", handleMouseDown);
37
- sliderElement.addEventListener("touchstart", handleTouchStart);
18
+ // Listen for BOTH mouse and touch start events
19
+ slider.addEventListener('mousedown', handleStart);
20
+ slider.addEventListener('touchstart', handleStart, { passive: true });
21
+ // Listen for BOTH mouse and touch end events
22
+ slider.addEventListener('mouseup', handleEnd);
23
+ slider.addEventListener('touchend', handleEnd, { passive: true });
24
+ // Cleanup function to remove all listeners
38
25
  return () => {
39
- sliderElement.removeEventListener("mousedown", handleMouseDown);
40
- sliderElement.removeEventListener("touchstart", handleTouchStart);
41
- // Clean up any remaining document listeners
42
- document.removeEventListener("mouseup", handleMouseUp);
43
- document.removeEventListener("touchend", handleTouchEnd);
26
+ slider.removeEventListener('mousedown', handleStart);
27
+ slider.removeEventListener('touchstart', handleStart);
28
+ slider.removeEventListener('mouseup', handleEnd);
29
+ slider.removeEventListener('touchend', handleEnd);
44
30
  };
45
31
  }, [onDragStart, onDragEnd, isBatchMode]);
46
- return sliderRef; // Return the ref to be attached to the slider
32
+ return sliderRef;
47
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.10.5",
3
+ "version": "2.10.7",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",