import type { Component, Snippet } from 'svelte'; import type { ValidationContext, ValidationResult } from '../../utils/validation'; export type NodeSelectorValidator = (context: ValidationContext) => ValidationResult; export type BaseProps = { /** Generated internally for the label association and Sitevision setup. */ id?: never; /** Field label, a string or Svelte snippet. */ label: string | Snippet; /** Description shown below the field, a string or Svelte snippet. */ description?: string | Snippet; /** Configuration key and HTML name attribute. */ name?: string; /** Set the field as required. */ required?: boolean; /** Disables the field. */ disabled?: boolean; /** Whether the value can be cleared. */ removable?: boolean; /** Selected node ID. An initial Sitevision node object from the configuration is normalized to its ID. */ value?: string; /** Display name of the selected node, initialized from the configuration node’s display name or path when available. */ displayName?: string; /** Shows or hides the selector without destroying it. */ show?: boolean; /** CSS class added to the form-group wrapper. */ class?: string; /** Content rendered after the selector and validation message. */ children?: Snippet; /** Called on a selection change. */ onChange?: (value: string, event: Event) => void | Promise; /** Custom validator. */ validate?: NodeSelectorValidator; }; /** Public props for the Sitevision NodeSelector component. */ export type Props = BaseProps & { /** Sitevision component. */ component: 'page' | 'file' | 'image' | 'user' | 'content-node' | 'link' | (string & {}); /** Restricts selectable node types. */ types?: string | string[]; }; /** * Generic wrapper for Sitevision [input components](https://developer.sitevision.se/docs/webapps/configuration/sitevision-components) used for selecting nodes. * See [Readme](https://docs.soleil.se/packages/config-svelte/components/base/nodeselector/). */ declare const NodeSelector: Component; export default NodeSelector;