import React from "react"; import { __ } from "@wordpress/i18n"; import { ToggleControl, RangeControl } from "@wordpress/components"; import { validateNumericRange } from "../../../utils/security"; import { SliderAttributes } from "../../../types/slider"; import { ToolsPanelItemWrapper } from "../../shared"; interface AutoplaySettingsProps { attributes: SliderAttributes; setAttributes: (attrs: Partial) => void; } export const AutoplaySettings: React.FC = ({ attributes, setAttributes, }) => { return ( <> attributes.autoplay} onDeselect={() => setAttributes({ autoplay: false })} isShownByDefault > setAttributes({ autoplay: value })} /> {attributes.autoplay && ( <> attributes.autoplaySpeed !== 5000} onDeselect={() => setAttributes({ autoplaySpeed: 5000 })} > setAttributes({ autoplaySpeed: validateNumericRange( value ?? 5000, 1000, 10000, 5000 ), }) } min={1000} max={10000} step={500} /> !attributes.pauseOnHover} onDeselect={() => setAttributes({ pauseOnHover: true })} > setAttributes({ pauseOnHover: value })} /> )} ); };