import {JSX, mergeProps, splitProps} from "solid-js"; import classNames from "./classnames"; import {createWithBsPrefix} from "./createWithBsPrefix"; import {useBootstrapPrefix} from "./ThemeProvider"; import FormCheckInput, {FormCheckInputProps} from "./FormCheckInput"; import InputGroupContext from "./InputGroupContext"; import {BsPrefixProps, BsPrefixRefForwardingComponent} from "./helpers"; import {Dynamic} from "solid-js/web"; const InputGroupText = createWithBsPrefix("input-group-text", { Component: "span", }); const InputGroupCheckbox = (props: FormCheckInputProps) => ( ); const InputGroupRadio = (props: FormCheckInputProps) => ( ); export interface InputGroupProps extends BsPrefixProps, JSX.HTMLAttributes { size?: "sm" | "lg"; hasValidation?: boolean; } const defaultProps = { as: "div", }; /** * * @property {InputGroupText} Text * @property {InputGroupRadio} Radio * @property {InputGroupCheckbox} Checkbox */ const InputGroup: BsPrefixRefForwardingComponent<"div", InputGroupProps> = (p: InputGroupProps) => { const [local, props] = splitProps(mergeProps(defaultProps, p), [ "as", "bsPrefix", "size", "hasValidation", "class", ]); const bsPrefix = useBootstrapPrefix(local.bsPrefix, "input-group"); // Intentionally an empty object. Used in detecting if a dropdown // exists under an input group. const contextValue = {}; return ( ); }; export default Object.assign(InputGroup, { Text: InputGroupText, Radio: InputGroupRadio, Checkbox: InputGroupCheckbox, });