Skip to content

Commit

Permalink
Ensure Input, Select and Textarea expose Ref related types (#…
Browse files Browse the repository at this point in the history
…2902)

* ensure `Input`, `Select` and `Textarea` expose `Ref` related types

* update changelog
  • Loading branch information
RobinMalfait authored Dec 27, 2023
1 parent 8c882e0 commit 3b961a6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/@headlessui-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Ensure `Input`, `Select` and `Textarea` expose `Ref` related types ([#2902](https://github.com/tailwindlabs/headlessui/pull/2902))

## [2.0.0-alpha.3] - 2023-12-20

Expand Down
12 changes: 10 additions & 2 deletions packages/@headlessui-react/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { useId } from '../../hooks/use-id'
import { useDisabled } from '../../internal/disabled'
import { useProvidedId } from '../../internal/id'
import type { Props } from '../../types'
import { forwardRefWithAs, mergeProps, render, type HasDisplayName } from '../../utils/render'
import {
forwardRefWithAs,
mergeProps,
render,
type HasDisplayName,
type RefProp,
} from '../../utils/render'
import { useDescribedBy } from '../description/description'
import { useLabelledBy } from '../label/label'

Expand Down Expand Up @@ -91,7 +97,9 @@ function InputFn<TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(
}

export interface _internal_ComponentInput extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(props: InputProps<TTag>): JSX.Element
<TTag extends ElementType = typeof DEFAULT_INPUT_TAG>(
props: InputProps<TTag> & RefProp<typeof InputFn>
): JSX.Element
}

export let Input = forwardRefWithAs(InputFn) as unknown as _internal_ComponentInput
12 changes: 10 additions & 2 deletions packages/@headlessui-react/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import { useId } from '../../hooks/use-id'
import { useDisabled } from '../../internal/disabled'
import { useProvidedId } from '../../internal/id'
import type { Props } from '../../types'
import { forwardRefWithAs, mergeProps, render, type HasDisplayName } from '../../utils/render'
import {
forwardRefWithAs,
mergeProps,
render,
type HasDisplayName,
type RefProp,
} from '../../utils/render'
import { useDescribedBy } from '../description/description'
import { useLabelledBy } from '../label/label'

Expand Down Expand Up @@ -93,7 +99,9 @@ function SelectFn<TTag extends ElementType = typeof DEFAULT_SELECT_TAG>(
}

export interface _internal_ComponentSelect extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_SELECT_TAG>(props: SelectProps<TTag>): JSX.Element
<TTag extends ElementType = typeof DEFAULT_SELECT_TAG>(
props: SelectProps<TTag> & RefProp<typeof SelectFn>
): JSX.Element
}

export let Select = forwardRefWithAs(SelectFn) as unknown as _internal_ComponentSelect
12 changes: 10 additions & 2 deletions packages/@headlessui-react/src/components/textarea/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { useId } from '../../hooks/use-id'
import { useDisabled } from '../../internal/disabled'
import { useProvidedId } from '../../internal/id'
import type { Props } from '../../types'
import { forwardRefWithAs, mergeProps, render, type HasDisplayName } from '../../utils/render'
import {
forwardRefWithAs,
mergeProps,
render,
type HasDisplayName,
type RefProp,
} from '../../utils/render'
import { useDescribedBy } from '../description/description'
import { useLabelledBy } from '../label/label'

Expand Down Expand Up @@ -88,7 +94,9 @@ function TextareaFn<TTag extends ElementType = typeof DEFAULT_TEXTAREA_TAG>(
}

export interface _internal_ComponentTextarea extends HasDisplayName {
<TTag extends ElementType = typeof DEFAULT_TEXTAREA_TAG>(props: TextareaProps<TTag>): JSX.Element
<TTag extends ElementType = typeof DEFAULT_TEXTAREA_TAG>(
props: TextareaProps<TTag> & RefProp<typeof TextareaFn>
): JSX.Element
}

export let Textarea = forwardRefWithAs(TextareaFn) as unknown as _internal_ComponentTextarea

2 comments on commit 3b961a6

@vercel
Copy link

@vercel vercel bot commented on 3b961a6 Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

headlessui-vue – ./packages/playground-vue

headlessui-vue-git-main-tailwindlabs.vercel.app
headlessui-vue.vercel.app
headlessui-vue-tailwindlabs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 3b961a6 Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

headlessui-react – ./packages/playground-react

headlessui-react-tailwindlabs.vercel.app
headlessui-react-git-main-tailwindlabs.vercel.app
headlessui-react.vercel.app

Please sign in to comment.