/* * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License. */ import { CoordinateSystem, CoordinateValue } from "../../components/coordinate-field/types.js"; import { UseTimeoutCleanupResult } from "./use-timeout-cleanup.js"; //#region src/hooks/coordinate-field/use-coordinate-copy.d.ts /** Options for the useCoordinateCopy hook */ interface UseCoordinateCopyOptions { /** Current coordinate value to copy (null if empty) */ currentValue: CoordinateValue | null; /** Array of validation error messages */ validationErrors: string[]; /** Whether copying is disabled */ isDisabled: boolean; /** Function to register timeouts for cleanup */ registerTimeout: UseTimeoutCleanupResult['registerTimeout']; } /** Return value from the useCoordinateCopy hook */ interface UseCoordinateCopyResult { /** Currently copied format (for visual feedback) or null */ copiedFormat: CoordinateSystem | null; /** Copy coordinate in specified format to clipboard */ handleCopyFormat: (formatToCopy: CoordinateSystem) => Promise; /** Whether copy format buttons should be enabled */ isFormatButtonEnabled: boolean; } /** * Handles copying coordinates to clipboard with format conversion and visual feedback * * @example * ```tsx * function CoordinateField() { * const { registerTimeout } = useTimeoutCleanup(); * const [value, setValue] = useState(null); * const [errors, setErrors] = useState([]); * * const { copiedFormat, handleCopyFormat, isFormatButtonEnabled } = useCoordinateCopy({ * currentValue: value, * validationErrors: errors, * isDisabled: false, * registerTimeout, * }); * * return ( * * ); * } * ``` * * @param options - {@link UseCoordinateCopyOptions} * @param options.currentValue - Current coordinate value to copy (null if empty). * @param options.validationErrors - Array of validation error messages. * @param options.isDisabled - Whether copying is disabled. * @param options.registerTimeout - Function to register timeouts for cleanup. * @returns {@link UseCoordinateCopyResult} Copy utilities and feedback state. */ declare function useCoordinateCopy({ currentValue, validationErrors, isDisabled, registerTimeout }: UseCoordinateCopyOptions): UseCoordinateCopyResult; //#endregion export { UseCoordinateCopyOptions, UseCoordinateCopyResult, useCoordinateCopy }; //# sourceMappingURL=use-coordinate-copy.d.ts.map