@yogiswara/honcho-editor-ui 3.1.3 → 3.1.4
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.
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect,
|
|
3
|
-
import { Stack,
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Stack, Typography } from "@mui/material";
|
|
4
4
|
import useHonchoTypography from "../../themes/honchoTheme";
|
|
5
5
|
import useColors from '../../themes/colors';
|
|
6
6
|
import useSliderEvents from "../editor/sliderComponents/useSliderEvents";
|
|
7
|
-
|
|
8
|
-
const wrapperRef = useRef(null);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const wrapper = wrapperRef.current;
|
|
11
|
-
if (!wrapper)
|
|
12
|
-
return;
|
|
13
|
-
const handleInteractionStart = (event) => {
|
|
14
|
-
// Check if the element that was clicked is the thumb or is inside the thumb.
|
|
15
|
-
const isThumb = event.target.closest('.MuiSlider-thumb');
|
|
16
|
-
// If the click was NOT on the thumb, isThumb will be null.
|
|
17
|
-
if (!isThumb) {
|
|
18
|
-
// Stop the event dead in its tracks.
|
|
19
|
-
event.preventDefault();
|
|
20
|
-
event.stopPropagation();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
// Manually attach the touchstart event with { passive: false }.
|
|
24
|
-
// This tells the browser it's "active", making preventDefault() valid.
|
|
25
|
-
wrapper.addEventListener('pointerdown', handleInteractionStart);
|
|
26
|
-
// Cleanup function
|
|
27
|
-
return () => {
|
|
28
|
-
// ✅ Simplified cleanup
|
|
29
|
-
wrapper.removeEventListener('pointerdown', handleInteractionStart);
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
return (
|
|
33
|
-
// This wrapper div catches the event before the Slider can.
|
|
34
|
-
_jsx("div", { ref: wrapperRef, children: _jsx(Slider, { sx: sx, slotProps: slotProps, size: size, value: value, step: step, min: min, max: max, onChange: onChange, onDoubleClick: onDoubleClick }) }));
|
|
35
|
-
}
|
|
7
|
+
import HThumbSlider from "../editor/sliderComponents/HThumbSlider";
|
|
36
8
|
const formatValue = (value) => {
|
|
37
9
|
if (value > 0)
|
|
38
10
|
return `+${value}`;
|
|
@@ -143,7 +115,7 @@ export default function HSliderColorMobile(props) {
|
|
|
143
115
|
color: colors.surface,
|
|
144
116
|
width: "40px", // Keep the fixed width for alignment
|
|
145
117
|
textAlign: "right", // Keep the text alignment
|
|
146
|
-
}, children: formatValue(props.tempScore) })] }), _jsx(
|
|
118
|
+
}, children: formatValue(props.tempScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
147
119
|
width: "100%", color: colors.surface,
|
|
148
120
|
'& .MuiSlider-rail': { background: tempGradient, opacity: 1 },
|
|
149
121
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -153,7 +125,7 @@ export default function HSliderColorMobile(props) {
|
|
|
153
125
|
color: colors.surface,
|
|
154
126
|
width: "40px", // Keep the fixed width for alignment
|
|
155
127
|
textAlign: "right", // Keep the text alignment
|
|
156
|
-
}, children: formatValue(props.tintScore) })] }), _jsx(
|
|
128
|
+
}, children: formatValue(props.tintScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
157
129
|
width: "100%", color: colors.surface,
|
|
158
130
|
'& .MuiSlider-rail': { background: tintGradient, opacity: 1 },
|
|
159
131
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -163,7 +135,7 @@ export default function HSliderColorMobile(props) {
|
|
|
163
135
|
color: colors.surface,
|
|
164
136
|
width: "40px", // Keep the fixed width for alignment
|
|
165
137
|
textAlign: "right", // Keep the text alignment
|
|
166
|
-
}, children: formatValue(props.vibranceScore) })] }), _jsx(
|
|
138
|
+
}, children: formatValue(props.vibranceScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
167
139
|
width: "100%", color: colors.surface,
|
|
168
140
|
'& .MuiSlider-rail': { background: fullTrackGradient, opacity: 1 },
|
|
169
141
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -173,7 +145,7 @@ export default function HSliderColorMobile(props) {
|
|
|
173
145
|
color: colors.surface,
|
|
174
146
|
width: "40px", // Keep the fixed width for alignment
|
|
175
147
|
textAlign: "right", // Keep the text alignment
|
|
176
|
-
}, children: formatValue(props.saturationScore) })] }), _jsx(
|
|
148
|
+
}, children: formatValue(props.saturationScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
177
149
|
width: "100%", color: colors.surface,
|
|
178
150
|
'& .MuiSlider-rail': { background: fullTrackGradient, opacity: 1 },
|
|
179
151
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slider, Box } from '@mui/material';
|
|
3
|
+
// I've renamed the component to HThumbSlider to match our earlier convention
|
|
4
4
|
export default function HThumbSlider(props) {
|
|
5
|
-
const wrapperRef = useRef(null);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const wrapper = wrapperRef.current;
|
|
8
|
-
if (!wrapper)
|
|
9
|
-
return;
|
|
10
|
-
const handleInteractionStart = (event) => {
|
|
11
|
-
// Check if the element that was clicked is the thumb
|
|
12
|
-
const isThumb = event.target.closest('.MuiSlider-thumb');
|
|
13
|
-
// If the click was NOT on the thumb, stop the event
|
|
14
|
-
if (!isThumb) {
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
event.stopPropagation();
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
// Manually attach an "active" touchstart listener to prevent console warnings
|
|
20
|
-
wrapper.addEventListener('pointerdown', handleInteractionStart);
|
|
21
|
-
// Cleanup function
|
|
22
|
-
return () => {
|
|
23
|
-
// ✅ Simplified cleanup
|
|
24
|
-
wrapper.removeEventListener('pointerdown', handleInteractionStart);
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
5
|
return (
|
|
28
|
-
//
|
|
29
|
-
|
|
6
|
+
// This wrapper creates the positioning context for the shield.
|
|
7
|
+
_jsxs(Box, { sx: { position: 'relative', width: '100%', py: 1.5 }, children: [_jsx(Box, { sx: {
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
top: 0,
|
|
10
|
+
left: 0,
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%',
|
|
13
|
+
zIndex: 1, // Sits above the track (z-index 0)
|
|
14
|
+
} }), _jsx(Slider, { ...props, sx: {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
...props.sx,
|
|
17
|
+
} })] }));
|
|
30
18
|
}
|