import { Edit } from 'lucide-react'
import React, { useState } from 'react'
import { Button, cn } from 'ui'
import { Input } from 'ui-patterns/DataInputs/Input'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
export type ExplorerToolbarProps = React.ComponentProps<'div'>
/**
* Shared toolbar row for Explorer resources such as notebooks and queries.
* Defaults to 40px and follows `--header-height` from the `md` breakpoint up, so
* a consumer that defines its own header height gets toolbars matching it. The
* fallback keeps the row at its default height in apps that leave the variable
* unset, rather than dropping the rule.
*/
const ExplorerToolbar = ({ className, role = 'toolbar', ...props }: ExplorerToolbarProps) => (
)
ExplorerToolbar.displayName = 'ExplorerToolbar'
export type ExplorerToolbarIconProps = React.ComponentProps<'span'>
/** Decorative resource icon shown before the toolbar title. */
const ExplorerToolbarIcon = ({
'aria-hidden': ariaHidden = true,
className,
...props
}: ExplorerToolbarIconProps) => (
)
ExplorerToolbarIcon.displayName = 'ExplorerToolbarIcon'
export type ExplorerToolbarTitleProps = Omit, 'children'> & {
children: string
onSaveTitle?: (value: string) => void
}
/** Flexible title region for static text or an editable resource name. */
const ExplorerToolbarTitle = ({
children: title,
className,
onSaveTitle,
...props
}: ExplorerToolbarTitleProps) => {
const [isEditingTitle, setIsEditingTitle] = useState(false)
const [value, setValue] = useState(title)
const handleStartEditing = () => {
setValue(title)
setIsEditingTitle(true)
}
return (