@yogiswara/honcho-editor-ui 3.1.2 → 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,25 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import { Stack,
|
|
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 handleInteractionStart = (event) => {
|
|
9
|
-
// Check if the element that was clicked is the thumb or is inside the thumb.
|
|
10
|
-
const isThumb = event.target.closest('.MuiSlider-thumb');
|
|
11
|
-
// If the click was NOT on the thumb, isThumb will be null.
|
|
12
|
-
if (!isThumb) {
|
|
13
|
-
// These two lines stop the event dead in its tracks.
|
|
14
|
-
// The Slider's internal logic will never know this click happened.
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
event.stopPropagation();
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
return (
|
|
20
|
-
// This wrapper div catches the event before the Slider can.
|
|
21
|
-
_jsx("div", { onMouseDown: handleInteractionStart, onTouchStart: handleInteractionStart, children: _jsx(Slider, { sx: sx, slotProps: slotProps, size: size, value: value, step: step, min: min, max: max, onChange: onChange, onDoubleClick: onDoubleClick }) }));
|
|
22
|
-
}
|
|
7
|
+
import HThumbSlider from "../editor/sliderComponents/HThumbSlider";
|
|
23
8
|
const formatValue = (value) => {
|
|
24
9
|
if (value > 0)
|
|
25
10
|
return `+${value}`;
|
|
@@ -130,7 +115,7 @@ export default function HSliderColorMobile(props) {
|
|
|
130
115
|
color: colors.surface,
|
|
131
116
|
width: "40px", // Keep the fixed width for alignment
|
|
132
117
|
textAlign: "right", // Keep the text alignment
|
|
133
|
-
}, children: formatValue(props.tempScore) })] }), _jsx(
|
|
118
|
+
}, children: formatValue(props.tempScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
134
119
|
width: "100%", color: colors.surface,
|
|
135
120
|
'& .MuiSlider-rail': { background: tempGradient, opacity: 1 },
|
|
136
121
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -140,7 +125,7 @@ export default function HSliderColorMobile(props) {
|
|
|
140
125
|
color: colors.surface,
|
|
141
126
|
width: "40px", // Keep the fixed width for alignment
|
|
142
127
|
textAlign: "right", // Keep the text alignment
|
|
143
|
-
}, children: formatValue(props.tintScore) })] }), _jsx(
|
|
128
|
+
}, children: formatValue(props.tintScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
144
129
|
width: "100%", color: colors.surface,
|
|
145
130
|
'& .MuiSlider-rail': { background: tintGradient, opacity: 1 },
|
|
146
131
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -150,7 +135,7 @@ export default function HSliderColorMobile(props) {
|
|
|
150
135
|
color: colors.surface,
|
|
151
136
|
width: "40px", // Keep the fixed width for alignment
|
|
152
137
|
textAlign: "right", // Keep the text alignment
|
|
153
|
-
}, children: formatValue(props.vibranceScore) })] }), _jsx(
|
|
138
|
+
}, children: formatValue(props.vibranceScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
154
139
|
width: "100%", color: colors.surface,
|
|
155
140
|
'& .MuiSlider-rail': { background: fullTrackGradient, opacity: 1 },
|
|
156
141
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -160,7 +145,7 @@ export default function HSliderColorMobile(props) {
|
|
|
160
145
|
color: colors.surface,
|
|
161
146
|
width: "40px", // Keep the fixed width for alignment
|
|
162
147
|
textAlign: "right", // Keep the text alignment
|
|
163
|
-
}, children: formatValue(props.saturationScore) })] }), _jsx(
|
|
148
|
+
}, children: formatValue(props.saturationScore) })] }), _jsx(HThumbSlider, { sx: {
|
|
164
149
|
width: "100%", color: colors.surface,
|
|
165
150
|
'& .MuiSlider-rail': { background: fullTrackGradient, opacity: 1 },
|
|
166
151
|
'& .MuiSlider-track': { background: 'transparent', border: 'none' },
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export default function HThumbSlider(props) {
|
|
5
|
+
return (
|
|
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
|
+
} })] }));
|
|
18
|
+
}
|