@yogiswara/honcho-editor-ui 2.10.19 → 2.11.0

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.
@@ -28,7 +28,7 @@ export function HAlertCopyBox() {
28
28
  }
29
29
  export function HAlertInternetConnectionBox(props) {
30
30
  const colors = useColors();
31
- return (_jsx(Alert, { icon: _jsx("img", { src: "v1/svg/check-ratio-editor.svg" }), sx: {
31
+ return (_jsx(Alert, { icon: _jsx("img", { src: "v1/svg/alert-circle-internet-problem.svg" }), sx: {
32
32
  position: 'absolute',
33
33
  top: '10%',
34
34
  left: '50%',
@@ -1,52 +1,14 @@
1
1
  import React from "react";
2
- import { AdjustmentState } from '../../hooks/editor/type';
3
- type Preset = {
4
- id: string;
5
- name: string;
6
- };
7
2
  interface Props {
8
- presets: Preset[];
9
- activePanel: string;
3
+ activePanelMobile: string;
10
4
  activeSubPanel: string;
11
- setActivePanel: (tab: string) => void;
12
- setActiveSubPanel: (subTab: string) => void;
13
- innerRef?: React.Ref<HTMLDivElement>;
5
+ setActivePanelMobile: (tab: string) => void;
6
+ subNavigation: React.ReactNode;
7
+ panelContent: React.ReactNode;
14
8
  panelRef: React.RefObject<HTMLDivElement>;
15
9
  contentRef: React.RefObject<HTMLDivElement | null>;
16
10
  panelHeight: number;
17
11
  handleDragStart: (e: React.MouseEvent | React.TouchEvent) => void;
18
- onContentHeightChange: (height: number) => void;
19
- tempScore: number;
20
- tintScore: number;
21
- vibranceScore: number;
22
- saturationScore: number;
23
- exposureScore: number;
24
- highlightsScore: number;
25
- shadowScore: number;
26
- whiteScore: number;
27
- blackScore: number;
28
- contrastScore: number;
29
- clarityScore: number;
30
- sharpnessScore: number;
31
- setTempScore: (field: keyof AdjustmentState, value: number) => void;
32
- setTintScore: (field: keyof AdjustmentState, value: number) => void;
33
- setVibranceScore: (field: keyof AdjustmentState, value: number) => void;
34
- setSaturationScore: (field: keyof AdjustmentState, value: number) => void;
35
- onExposureChange: (field: keyof AdjustmentState, value: number) => void;
36
- onHighlightsChange: (field: keyof AdjustmentState, value: number) => void;
37
- onShadowsChange: (field: keyof AdjustmentState, value: number) => void;
38
- onWhitesChange: (field: keyof AdjustmentState, value: number) => void;
39
- onBlacksChange: (field: keyof AdjustmentState, value: number) => void;
40
- onContrastChange: (field: keyof AdjustmentState, value: number) => void;
41
- onClarityChange: (field: keyof AdjustmentState, value: number) => void;
42
- onSharpnessChange: (field: keyof AdjustmentState, value: number) => void;
43
- isBatchMode: boolean;
44
- onDragStart: () => void;
45
- onDragEnd: () => void;
46
- selectedPreset: string | null;
47
- onSelectPreset: (id: string) => void;
48
- onOpenPresetModal: () => void;
49
- presetOptionModal: (event: React.MouseEvent<HTMLElement>, presetId: string) => void;
50
12
  }
51
13
  export default function HImageEditorMobile(props: Props): import("react/jsx-runtime").JSX.Element;
52
14
  export {};
@@ -1,42 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { BottomNavigation, BottomNavigationAction, Box, CardMedia, Paper, Stack } from "@mui/material";
3
- import useHonchoTypography from "../../themes/honchoTheme";
4
- import useColors from '../../themes/colors';
5
- import HTabColorAdjustmentMobile from "./HTabColorAdjustmentMobile";
6
- import HTabPresetMobile from "./HTabPresetMobile";
7
- // Data structure for the sub-navigation tabs
8
- const subTabs = {
9
- colorAdjustment: [
10
- { value: "color", label: "Color", inactiveIcon: "/v1/svg/new-mobile-coloAdjustment-notpress.svg", activeIcon: "/v1/svg/new-mobile-coloAdjustment-presssvg.svg" },
11
- { value: "light", label: "Light", inactiveIcon: "/v1/svg/light-inactive-mobile.svg", activeIcon: "/v1/svg/light-active-mobile.svg" },
12
- // { value: "details", label: "Details", inactiveIcon: "/v1/svg/details-inactive-mobile.svg", activeIcon: "/v1/svg/details-active-mobile.svg"},
13
- ],
14
- aspectRatio: [
15
- { value: "portrait", label: "Portrait" },
16
- { value: "square", label: "Square" },
17
- { value: "wide", label: "Wide" },
18
- ],
19
- preset: [
20
- { value: "Preset", label: "Preset", inactiveIcon: "/v1/svg/preset-inactive-mobile.svg", activeIcon: "/v1/svg/preset-active-mobile.svg" },
21
- ],
22
- };
2
+ import { Box, Paper, Stack } from "@mui/material";
3
+ // The hardcoded `subTabs` and `renderPanelContent` are now removed.
23
4
  export default function HImageEditorMobile(props) {
24
- const typography = useHonchoTypography();
25
- const colors = useColors();
5
+ // The handleChange function now only needs the renamed prop
26
6
  const handleChange = (event, newValue) => {
27
- props.setActivePanel(newValue);
28
- };
29
- const currentSubTabs = subTabs[props.activePanel];
30
- // Helper function to render the correct content inside the draggable panel
31
- const renderPanelContent = () => {
32
- switch (props.activePanel) {
33
- case 'colorAdjustment':
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, setTempScore: props.setTempScore, setTintScore: props.setTintScore, setVibranceScore: props.setVibranceScore, setSaturationScore: props.setSaturationScore, 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
- case 'preset':
36
- return _jsx(HTabPresetMobile, { ...props });
37
- default:
38
- return null;
39
- }
7
+ props.setActivePanelMobile(newValue);
40
8
  };
41
9
  return (_jsx(Paper, { elevation: 0, sx: {
42
10
  id: 'HImageEditorMobile',
@@ -70,23 +38,5 @@ export default function HImageEditorMobile(props) {
70
38
  overflowY: 'auto',
71
39
  scrollbarWidth: 'none',
72
40
  '&::-webkit-scrollbar': { display: 'none' },
73
- }, children: renderPanelContent() })] })), currentSubTabs && (_jsx(Paper, { sx: {
74
- backgroundColor: colors.onBackground,
75
- paddingTop: "10px",
76
- pb: "0px",
77
- mb: "0px",
78
- px: "44px",
79
- borderRadius: "0px",
80
- }, elevation: 3, children: _jsx(BottomNavigation, { showLabels: true, sx: { backgroundColor: colors.onBackground, gap: '10px' }, children: currentSubTabs.map((tab) => {
81
- const isActive = props.activeSubPanel === tab.value;
82
- const iconSrc = isActive ? tab.activeIcon : tab.inactiveIcon;
83
- return (_jsx(BottomNavigationAction, { label: tab.label, value: tab.value, onClick: () => props.setActiveSubPanel(isActive ? '' : tab.value), icon: iconSrc && _jsx(CardMedia, { component: "img", image: iconSrc, sx: { width: "20px", height: "20px", mb: "5px" } }), sx: {
84
- color: isActive ? colors.surface : colors.onSurfaceVariant1,
85
- minWidth: 'auto', p: 0,
86
- '& .MuiBottomNavigationAction-label': {
87
- ...typography.labelSmall,
88
- color: isActive ? colors.surface : colors.onSurfaceVariant1,
89
- }
90
- } }, tab.value));
91
- }) }) })), _jsx(Paper, { sx: { backgroundColor: colors.onBackground, borderRadius: "0px" }, elevation: 3, children: _jsx(Stack, { direction: "row", justifyContent: "center", alignItems: "center", sx: { pt: "0px", pb: "0px", mb: "0px", mr: "0px", ml: "0px" }, children: _jsxs(BottomNavigation, { value: props.activePanel, onChange: handleChange, sx: { backgroundColor: colors.onBackground }, children: [_jsx(BottomNavigationAction, { value: "colorAdjustment", sx: { px: '12px', py: '0px', minWidth: 'auto' }, icon: _jsx(CardMedia, { component: "img", image: props.activePanel === 'colorAdjustment' ? "/v1/svg/color-adjustment-active-mobile.svg" : "/v1/svg/color-adjustment-inactive-mobile.svg", sx: { width: "20px", height: "20px" } }) }), _jsx(BottomNavigationAction, { value: "preset", sx: { px: '12px', py: '0px', minWidth: 'auto' }, icon: _jsx(CardMedia, { component: "img", image: props.activePanel === 'preset' ? "/v1/svg/preset-and-watermark-active-mobile.svg" : "/v1/svg/preset-and-watermark-inactive-mobile.svg", sx: { width: "20px", height: "20px" } }) })] }) }) })] }) }));
41
+ }, children: props.panelContent })] })), props.subNavigation] }) }));
92
42
  }
@@ -30,6 +30,7 @@ function useAdjustmentField(propValue, setValue, onDragStart, onDragEnd, isBatch
30
30
  // start batch on first valid change
31
31
  if (!started && !isBatchMode) {
32
32
  onDragStart();
33
+ console.log("[MOBILE UI] Starting batch: ", onDragStart);
33
34
  setStarted(true);
34
35
  }
35
36
  setValue(num);
@@ -41,6 +42,7 @@ function useAdjustmentField(propValue, setValue, onDragStart, onDragEnd, isBatch
41
42
  setLocal("0");
42
43
  setValue(0);
43
44
  if (!isBatchMode) {
45
+ console.log("[MOBILE UI] ending batch: ", onDragEnd);
44
46
  onDragEnd();
45
47
  }
46
48
  };
@@ -77,7 +79,16 @@ function useAdjustmentField(propValue, setValue, onDragStart, onDragEnd, isBatch
77
79
  export default function HSliderColorMobile(props) {
78
80
  const typography = useHonchoTypography();
79
81
  const colors = useColors();
80
- const tempSliderRef = useSliderEvents(props.onDragStart, props.onDragEnd, props.isBatchMode);
82
+ console.log(`[HSliderColorMobile TEMPERATURE] Received tempScore prop: ${props.tempScore}`);
83
+ const handleDragStartWithLog = () => {
84
+ console.log('[HSliderColorMobile TEMPERATURE] SLIDER onDragStart triggered.');
85
+ props.onDragStart();
86
+ };
87
+ const handleDragEndWithLog = () => {
88
+ console.log('[HSliderColorMobile TEMPERATURE] SLIDER onDragEnd triggered.');
89
+ props.onDragEnd();
90
+ };
91
+ const tempSliderRef = useSliderEvents(handleDragStartWithLog, handleDragEndWithLog, props.isBatchMode);
81
92
  const tintSliderRef = useSliderEvents(props.onDragStart, props.onDragEnd, props.isBatchMode);
82
93
  const vibranceSliderRef = useSliderEvents(props.onDragStart, props.onDragEnd, props.isBatchMode);
83
94
  const saturationSliderRef = useSliderEvents(props.onDragStart, props.onDragEnd, props.isBatchMode);
@@ -107,21 +118,6 @@ export default function HSliderColorMobile(props) {
107
118
  borderBottom: 'none',
108
119
  pl: '2px',
109
120
  };
110
- const formatValue = (value) => {
111
- if (value > 0)
112
- return `+${value}`;
113
- return value.toString();
114
- };
115
- const handleInputChange = (event, min, max, onChange) => {
116
- const value = event.target.value;
117
- if (value === '+' || value === '-')
118
- return;
119
- let numericValue = parseInt(value, 10);
120
- if (isNaN(numericValue))
121
- numericValue = 0;
122
- const clampedValue = Math.max(min, Math.min(max, numericValue));
123
- onChange(clampedValue);
124
- };
125
121
  return (_jsx(_Fragment, { children: _jsxs(Stack, { spacing: 0, direction: "column", sx: { width: '100%', paddingX: 1, m: "0px" }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px', '&:focus-within .MuiFilledInput-input': focusedInputStyle }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface }, onDoubleClick: tempInput.handleDoubleClick, children: "Temperature" }), _jsx(Typography, { sx: {
126
122
  ...typography.bodyMedium, // Use your standard typography
127
123
  color: colors.surface,
@@ -4,5 +4,6 @@ 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
+ console.log(`[HTabColorAdjustmentMobile TEMPERATURE] Passing down tempScore: ${props.tempScore}`);
7
8
  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, setTempScore: props.setTempScore, setTintScore: props.setTintScore, setVibranceScore: props.setVibranceScore, setSaturationScore: props.setSaturationScore, 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
9
  }
package/dist/index.d.ts CHANGED
@@ -33,6 +33,8 @@ export { ImageSize, HonchoEditor, AdjustmentValues, AdjustmentRange, AdjustmentR
33
33
  export { default as HPresetDeleteDialog } from './components/editor/HPresetDelete';
34
34
  export { default as HModalDialog } from './components/modal/HModalDialog';
35
35
  export { default as HModalRename } from './components/modal/HModalRename';
36
+ export { default as HTabColorAdjustmentMobile } from './components/editor/HTabColorAdjustmentMobile';
37
+ export { default as HTabPresetMobile } from './components/editor/HTabPresetMobile';
36
38
  export { useAdjustmentHistory, type UseAdjustmentHistoryReturn, type HistoryInfo, type HistoryActions, type HistoryConfig } from './hooks/useAdjustmentHistory';
37
39
  export { useAdjustmentHistoryBatch, type UseAdjustmentHistoryBatchReturn, type BatchAdjustmentState, type ImageAdjustmentConfig, type BatchHistoryInfo, type BatchHistoryActions, type BatchHistoryConfig } from './hooks/useAdjustmentHistoryBatch';
38
40
  export { usePreset, type UsePresetReturn, type PresetInfo, type PresetActions, type PresetOptions } from './hooks/usePreset';
package/dist/index.js CHANGED
@@ -32,6 +32,8 @@ export { HonchoEditor } from './lib/editor/honcho-editor';
32
32
  export { default as HPresetDeleteDialog } from './components/editor/HPresetDelete';
33
33
  export { default as HModalDialog } from './components/modal/HModalDialog';
34
34
  export { default as HModalRename } from './components/modal/HModalRename';
35
+ export { default as HTabColorAdjustmentMobile } from './components/editor/HTabColorAdjustmentMobile';
36
+ export { default as HTabPresetMobile } from './components/editor/HTabPresetMobile';
35
37
  // --- History Hooks ---
36
38
  export { useAdjustmentHistory } from './hooks/useAdjustmentHistory';
37
39
  export { useAdjustmentHistoryBatch } from './hooks/useAdjustmentHistoryBatch';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "2.10.19",
3
+ "version": "2.11.0",
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",