mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-20 05:51:21 +02:00
Enforcing inclusion of our OSS license at the top of .ts and .tsx files. Also updates any relevant files in the repo that were previously missing the license comment. An additional `@license` comment is added to client/web/src/index.tsx to preserve the license in generated Javascript. Updates #10261 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
45 lines
1011 B
TypeScript
45 lines
1011 B
TypeScript
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
import cx from "classnames"
|
|
import React, { InputHTMLAttributes } from "react"
|
|
|
|
type Props = {
|
|
className?: string
|
|
inputClassName?: string
|
|
error?: boolean
|
|
suffix?: JSX.Element
|
|
} & InputHTMLAttributes<HTMLInputElement>
|
|
|
|
// Input is styled in a way that only works for text inputs.
|
|
const Input = React.forwardRef<HTMLInputElement, Props>((props, ref) => {
|
|
const {
|
|
className,
|
|
inputClassName,
|
|
error,
|
|
prefix,
|
|
suffix,
|
|
disabled,
|
|
...rest
|
|
} = props
|
|
return (
|
|
<div className={cx("relative", className)}>
|
|
<input
|
|
ref={ref}
|
|
className={cx("input z-10", inputClassName, {
|
|
"input-error": error,
|
|
})}
|
|
disabled={disabled}
|
|
{...rest}
|
|
/>
|
|
{suffix ? (
|
|
<div className="bg-white top-1 bottom-1 right-1 rounded-r-md absolute flex items-center">
|
|
{suffix}
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
)
|
|
})
|
|
|
|
export default Input
|