/** @module @airtable/blocks: settingsButton */ /** */ import Watchable from './watchable'; import { ObjectValues } from './private_utils'; declare const WatchableSettingsButtonKeys: Readonly<{ isVisible: "isVisible"; click: "click"; }>; /** * A watchable key in {@link SettingsButton}. * - `isVisible` * - `click` */ type WatchableSettingsButtonKey = ObjectValues; /** * Interface to the settings button that lives outside the extension's viewport. * * The {@link useSettingsButton} hook is the recommended way to use the settings button, but you can * also use it with {@link useWatchable} if you want more granular control (for example, to only * show the button conditionally). * * @alias settingsButton * @example * ```js * import {settingsButton} from '@airtable/blocks'; * import {useWatchable} from '@airtable/blocks/ui'; * * function AppWithSettings({shouldShowSettingsButton}) { * useEffect(() => { * // A count of calls to `show()` and `hide()` is maintained internally. The button will * // stay visible if there are more calls to `show()` than `hide()` - so here, we check * // `isVisible` so we only we only call them when necessary. * // The button is not visible by default. * if (shouldShowSettingsButton && !settingsButton.isVisible) { * settingsButton.show(); * } else if (!shouldShowSettingsButton && settingsButton.isVisible) { * settingsButton.hide(); * } * }); * * useWatchable(settingsButton, 'click', function() { * alert('Clicked!'); * }); * } * ``` * @docsPath models/SettingsButton */ declare class SettingsButton extends Watchable { /** * Whether the settings button is being shown. * Can be watched. */ get isVisible(): boolean; /** * Show the settings button. */ show(): void; /** * Hide the settings button. * * Note: A count of calls to `show()` and `hide()` is maintained internally. The button will * stay visible if there are more calls to `show()` than `hide()`. */ hide(): void; } export default SettingsButton; //# sourceMappingURL=settings_button.d.ts.map