|
@@ -12,13 +12,21 @@ export interface SelectOption {
|
|
|
interface SelectInputProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
options: SelectOption[]
|
|
|
value: string
|
|
|
- tooltip?: React.ReactNode,
|
|
|
- popoverSide?: Side,
|
|
|
- chevron?: boolean,
|
|
|
+ tooltip?: React.ReactNode
|
|
|
+ popoverSide?: Side
|
|
|
+ chevron?: boolean
|
|
|
onValueChange: (value: string) => void
|
|
|
}
|
|
|
|
|
|
-export function SelectInput({ options, tooltip, popoverSide, chevron = true, value, onValueChange, ...rest }: SelectInputProps) {
|
|
|
+export function SelectInput({
|
|
|
+ options,
|
|
|
+ tooltip,
|
|
|
+ popoverSide,
|
|
|
+ chevron = true,
|
|
|
+ value,
|
|
|
+ onValueChange,
|
|
|
+ ...rest
|
|
|
+}: SelectInputProps) {
|
|
|
const [isOpen, setIsOpen] = React.useState(false)
|
|
|
return (
|
|
|
<div {...rest} className="tl-select-input">
|
|
@@ -33,16 +41,22 @@ export function SelectInput({ options, tooltip, popoverSide, chevron = true, val
|
|
|
<div className="tl-select-input-trigger-value">
|
|
|
<Select.Value />
|
|
|
</div>
|
|
|
- {chevron &&
|
|
|
+ {chevron && (
|
|
|
<Select.Icon style={{ lineHeight: 1 }} className="ml-1 md:ml-3">
|
|
|
<TablerIcon name={isOpen ? 'chevron-up' : 'chevron-down'} />
|
|
|
</Select.Icon>
|
|
|
- }
|
|
|
+ )}
|
|
|
</Select.Trigger>
|
|
|
</Tooltip>
|
|
|
|
|
|
<Select.Portal className="tl-select-input-portal">
|
|
|
- <Select.Content className="tl-select-input-content" align="center">
|
|
|
+ <Select.Content
|
|
|
+ className="tl-select-input-content"
|
|
|
+ side={popoverSide}
|
|
|
+ position="popper"
|
|
|
+ sideOffset={14}
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
<Select.ScrollUpButton />
|
|
|
<Select.Viewport className="tl-select-input-viewport">
|
|
|
{options.map(option => {
|