Skip to content
Snippets Groups Projects
Select Git revision
  • f76be7cff71bfe6d8142b79ff8b7241b5fb31128
  • main default protected
  • hookup-to-django
  • small-test-to-test-pipeline
  • connect-to-adex_cache_fastapi-database
  • improve_alta_algorithm
6 results

main.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    TextInput.tsx 1.46 KiB
    import { Dispatch, ReactNode, SetStateAction } from "react";
    import { BaseInput } from "./utils/baseComponents.tsx";
    
    type TextInputProps = {
      isRequired?: boolean;
      label?: string;
      endContent?: ReactNode; // such as units (as text element e.g. <span>)
      isClearable?: boolean;
      value: string;
      onValueChange?: Dispatch<SetStateAction<string>>;
      isInvalid?: boolean;
      errorMessage?: string;
      isDisabled?: boolean;
      isReadOnly?: boolean;
      maxLength?: number;
      type?:
        | "text"
        | "search"
        | "url"
        | "tel"
        | "email"
        | "password"
        | (string & NonNullable<unknown>);
      inputMode?:
        | "none"
        | "text"
        | "tel"
        | "url"
        | "email"
        | "numeric"
        | "decimal"
        | "search";
    };
    
    const TextInput = ({
      isRequired = false,
      label = "",
      endContent,
      isClearable = false,
      value,
      onValueChange,
      isInvalid = false,
      errorMessage = "",
      isDisabled = false,
      isReadOnly = false,
      maxLength,
      type = "text",
      inputMode = "text",
    }: TextInputProps) => {
      return (
        <BaseInput
          isRequired={isRequired}
          label={label}
          endContent={endContent}
          placeholder=" "
          isClearable={isClearable}
          value={value}
          onValueChange={onValueChange}
          isInvalid={isInvalid}
          errorMessage={errorMessage}
          isDisabled={isDisabled}
          isReadOnly={isReadOnly}
          maxLength={maxLength}
          type={type}
          inputMode={inputMode}
        />
      );
    };
    
    export default TextInput;
    export type { TextInputProps };