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AACpB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,UAAU,KAAe,EAAA;AACvB,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AAEX","file":"text.mjs","sourcesContent":["import { Action } from '../actions';\n\nimport { IInputElement, InputElement } from './base';\n\n/**\n * Style hint for text input.\n */\nexport type TextInputStyle = 'text' | 'tel' | 'url' | 'email' | 'password';\n\n/**\n * Lets a user enter text.\n */\nexport interface ITextInput extends IInputElement {\n  type: 'Input.Text';\n\n  /**\n   * If `true`, allow multiple lines of input.\n   */\n  isMultiline?: boolean;\n\n  /**\n   * Hint of maximum length characters to collect (may be ignored by some clients).\n   */\n  maxLength?: number;\n\n  /**\n   * Description of the input desired. Displayed when no text has been input.\n   */\n  placeholder?: string;\n\n  /**\n   * Regular expression indicating the required format of this text input.\n   */\n  regex?: string;\n\n  /**\n   * Style hint for text input.\n   */\n  style?: TextInputStyle;\n\n  /**\n   * The inline action for the input. Typically displayed to the right of the input. It is strongly recommended to provide an icon on the action (which will be displayed instead of the title of the action).\n   */\n  inlineAction?: Action;\n\n  /**\n   * The initial value for this field.\n   */\n  value?: string;\n}\n\nexport type TextInputOptions = Omit<ITextInput, 'type'>;\n\n/**\n * Lets a user enter text.\n */\nexport class TextInput extends InputElement implements ITextInput {\n  type: 'Input.Text';\n\n  /**\n   * If `true`, allow multiple lines of input.\n   */\n  isMultiline?: boolean;\n\n  /**\n   * Hint of maximum length characters to collect (may be ignored by some clients).\n   */\n  maxLength?: number;\n\n  /**\n   * Description of the input desired. Displayed when no text has been input.\n   */\n  placeholder?: string;\n\n  /**\n   * Regular expression indicating the required format of this text input.\n   */\n  regex?: string;\n\n  /**\n   * Style hint for text input.\n   */\n  style?: TextInputStyle;\n\n  /**\n   * The inline action for the input. Typically displayed to the right of the input. It is strongly recommended to provide an icon on the action (which will be displayed instead of the title of the action).\n   */\n  inlineAction?: Action;\n\n  /**\n   * The initial value for this field.\n   */\n  value?: string;\n\n  constructor(options: TextInputOptions = {}) {\n    super();\n    this.type = 'Input.Text';\n    this.withOptions(options);\n  }\n\n  withOptions(value: TextInputOptions) {\n    Object.assign(this, value);\n    return this;\n  }\n\n  withMultiLine(value = true) {\n    this.isMultiline = value;\n    return this;\n  }\n\n  withMaxLength(value: number) {\n    this.maxLength = value;\n    return this;\n  }\n\n  withPlaceholder(value: string) {\n    this.placeholder = value;\n    return this;\n  }\n\n  withRegex(value: string) {\n    this.regex = value;\n    return this;\n  }\n\n  withStyle(value: TextInputStyle) {\n    this.style = value;\n    return this;\n  }\n\n  withInlineAction(value: Action) {\n    this.inlineAction = value;\n    return this;\n  }\n\n  withValue(value: string) {\n    this.value = value;\n    return this;\n  }\n}\n"]}