/** @module @airtable/blocks: settingsButton */ /** */ import Watchable from './watchable'; import { ObjectValues } from './private_utils'; import { AirtableInterface } from './types/airtable_interface'; declare const WatchableSettingsButtonKeys: Readonly<{ isVisible: "isVisible"; click: "click"; }>; /** * A watchable key in {@link SettingsButton}. * - `isVisible` * - `click` */ declare type WatchableSettingsButtonKey = ObjectValues; /** * Interface to the settings button that lives outside the app'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 { /** @internal */ static _className: string; /** @internal */ static _isWatchableKey(key: string): boolean; /** @internal */ _refCount: number; /** @internal */ _airtableInterface: AirtableInterface; /** @internal */ constructor(airtableInterface: AirtableInterface); /** * 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; /** @internal */ __onClick(): void; } export default SettingsButton;