Skip to main content
Glama
deleonio
by deleonio
Input.tsx1.72 kB
/* eslint-disable no-console */ import { Fragment, h, type FunctionalComponent as FC } from '@stencil/core'; import type { JSXBase, VNode } from '@stencil/core/internal'; import clsx from 'clsx'; import { checkHasMsg, type MsgPropType, type Stringified } from '../../../schema'; import { getDefaultProps } from '../_helpers/getDefaultProps'; import type { DefaultInputProps } from '../_types'; export type InputProps = DefaultInputProps<JSXBase.InputHTMLAttributes<HTMLInputElement>> & { msg?: Stringified<MsgPropType>; touched?: boolean; spellcheck?: boolean; suggestions?: VNode; value?: string | number | string[]; } & { [key: `aria-${string}`]: unknown; [key: `data-${string}`]: unknown; }; const InputFc: FC<InputProps> = (props) => { const { class: classNames, msg, required, disabled, touched, readonly, ariaDescribedBy, hideLabel, label, suggestions, value, ...other } = props; const showMsg = checkHasMsg(msg, touched); const msgType = typeof msg === 'string' ? 'error' : msg?._type; const stateCssClasses = { ['kol-input--disabled']: Boolean(disabled), ['kol-input--required']: Boolean(required), ['kol-input--touched']: Boolean(touched), ['kol-input--readonly']: Boolean(readonly), [`kol-input--${msgType || 'error'}`]: showMsg, }; const inputProps: JSXBase.InputHTMLAttributes<HTMLInputElement> = { class: clsx('kol-input', stateCssClasses, classNames), required: required, disabled: disabled, readonly: readonly, type: 'text', list: suggestions ? `${other.id}-list` : undefined, ...getDefaultProps({ ariaDescribedBy, hideLabel, label }), ...other, }; return ( <> <input {...inputProps} value={value} /> {suggestions} </> ); }; export default InputFc;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server