Skip to main content
Glama
deleonio
by deleonio
FieldControlStateWrapper.tsx1.71 kB
import { h, type FunctionalComponent as FC } from '@stencil/core'; import KolFieldControlFc, { type FieldControlProps } from '../../functional-components/FieldControl'; import { type InputCheckboxStates, type InputColorStates, type InputEmailStates, type InputFileStates, type InputNumberStates, type InputPasswordStates, type InputRadioStates, type InputRangeStates, type InputTextStates, type MsgPropType, type SelectStates, } from '../../schema'; type InputState = | InputTextStates | InputEmailStates | InputPasswordStates | InputNumberStates | InputColorStates | InputFileStates | InputRangeStates | InputCheckboxStates | InputRadioStates | SelectStates; export type FieldControlStateWrapperProps = Partial<FieldControlProps> & { state: InputState; }; function getFieldControlProps(state: InputState): FieldControlProps { const props: FieldControlProps = { id: state._id, disabled: state._disabled, msg: state._msg as MsgPropType, hint: state._hint, label: state._label, hideLabel: state._hideLabel, touched: state._touched, }; if ('_required' in state) { props.required = state._required; } if ('_readOnly' in state) { props.readonly = state._readOnly; } if ('_labelAlign' in state) { props.labelAlign = state._labelAlign; } if ('_accessKey' in state) { props.accessKey = state._accessKey; } if ('_shortKey' in state) { props.shortKey = state._shortKey; } return props; } const FieldControlStateWrapper: FC<FieldControlStateWrapperProps> = ({ state, ...other }, children) => { return ( <KolFieldControlFc {...getFieldControlProps(state)} {...other}> {children} </KolFieldControlFc> ); }; export default FieldControlStateWrapper;

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