import type { Component, Snippet } from 'svelte'; import type { ValidationContext, ValidationResult } from '../../utils/validation'; export type SelectValidator = (context: ValidationContext) => ValidationResult; export type Option = string | ({ label: string; value: string } & Record); export type Props = { /** 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; /** Shows or hides the select without destroying it. */ show?: boolean; /** Select options, supplied as strings or objects with `label` and `value`. */ options?: Option[]; /** Selected option value. */ value?: string; /** CSS class added to the form-group wrapper. */ class?: string; /** Content rendered after the select and validation message. */ children?: Snippet; /** Callback for the native input event with the updated value. */ onInput?: (value: string, event: Event) => void | Promise; /** Callback for the native change event with the updated value. */ onChange?: (value: string, event: Event) => void | Promise; /** Custom validator. */ validate?: SelectValidator; }; /** * A select component. * See [Readme](https://docs.soleil.se/packages/config-svelte/components/select/). */ declare const Select: Component; export default Select;