import type { Component, Snippet } from 'svelte'; import type { ValidationContext, ValidationResult } from '../../utils/validation'; export type CustomSelectorValidator = (context: ValidationContext) => ValidationResult; export type Option = ({ label: string; value: string } & Record) | string; export type Props = { /** 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; /** Placeholder shown when no option is selected. */ placeholder?: string; /** Options available for selection. */ options: Option[]; /** Enables searching the options. */ searchable?: boolean; /** Whether the value can be cleared. */ removable?: boolean; /** Set the field as required. */ required?: boolean; /** Disables the field. */ disabled?: boolean; /** Allows multiple options to be selected. */ multiple?: boolean; /** Shows or hides the selector without destroying it. */ show?: boolean; /** Selected option value or values. */ value?: string | string[]; /** CSS class added to the form-group wrapper. */ class?: string; /** Renders a custom option using the option as its snippet argument. */ option?: Snippet<[option: Option]>; /** Content rendered after the selector and validation message. */ children?: Snippet; /** Callback for the select2 change event with the updated value. */ onChange?: ( value: string | string[], event: JQuery.TriggeredEvent, ) => void | Promise; /** Custom validator. */ validate?: CustomSelectorValidator; }; /** * Wrapper component for Sitevision [Custom selector](https://developer.sitevision.se/docs/webapps/configuration/sitevision-components). * See [Readme](https://docs.soleil.se/packages/config-svelte/components/customselector/). */ declare const CustomSelector: Component; export default CustomSelector;