Skip to content

Commit

Permalink
Improve ListboxOption and ComboboxOption types (#2067)
Browse files Browse the repository at this point in the history
* improve `ListboxOption` and `ComboboxOption` types

* update changelog
  • Loading branch information
RobinMalfait committed Dec 5, 2022
1 parent 9ef269e commit ef3e154
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/@headlessui-vue/CHANGELOG.md
Expand Up @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve syncing of the `ComboboxInput` value ([#2042](https://github.com/tailwindlabs/headlessui/pull/2042))
- Fix crash when using `multiple` mode without `value` prop (uncontrolled) for `Listbox` and `Combobox` components ([#2058](https://github.com/tailwindlabs/headlessui/pull/2058))
- Allow passing in your own `id` prop ([#2060](https://github.com/tailwindlabs/headlessui/pull/2060))
- Add `null` as a valid type for Listbox and Combobox in Vue ([#2064](https://github.com/tailwindlabs/headlessui/pull/2064))
- Add `null` as a valid type for Listbox and Combobox in Vue ([#2064](https://github.com/tailwindlabs/headlessui/pull/2064), [#2067](https://github.com/tailwindlabs/headlessui/pull/2067))

## [1.7.4] - 2022-11-03

Expand Down
13 changes: 11 additions & 2 deletions packages/@headlessui-vue/src/components/combobox/combobox.ts
Expand Up @@ -124,7 +124,12 @@ export let Combobox = defineComponent({
>,
default: undefined,
},
defaultValue: { type: [Object, String, Number, Boolean], default: undefined },
defaultValue: {
type: [Object, String, Number, Boolean] as PropType<
object | string | number | boolean | null
>,
default: undefined,
},
name: { type: String },
nullable: { type: Boolean, default: false },
multiple: { type: [Boolean], default: false },
Expand Down Expand Up @@ -993,7 +998,11 @@ export let ComboboxOption = defineComponent({
name: 'ComboboxOption',
props: {
as: { type: [Object, String], default: 'li' },
value: { type: [Object, String, Number, Boolean] },
value: {
type: [Object, String, Number, Boolean] as PropType<
object | string | number | boolean | null
>,
},
disabled: { type: Boolean, default: false },
},
setup(props, { slots, attrs, expose }) {
Expand Down
13 changes: 11 additions & 2 deletions packages/@headlessui-vue/src/components/listbox/listbox.ts
Expand Up @@ -126,7 +126,12 @@ export let Listbox = defineComponent({
>,
default: undefined,
},
defaultValue: { type: [Object, String, Number, Boolean], default: undefined },
defaultValue: {
type: [Object, String, Number, Boolean] as PropType<
object | string | number | boolean | null
>,
default: undefined,
},
name: { type: String, optional: true },
multiple: { type: [Boolean], default: false },
},
Expand Down Expand Up @@ -679,7 +684,11 @@ export let ListboxOption = defineComponent({
name: 'ListboxOption',
props: {
as: { type: [Object, String], default: 'li' },
value: { type: [Object, String, Number, Boolean] },
value: {
type: [Object, String, Number, Boolean] as PropType<
object | string | number | boolean | null
>,
},
disabled: { type: Boolean, default: false },
id: { type: String, default: () => `headlessui-listbox.option-${useId()}` },
},
Expand Down

0 comments on commit ef3e154

Please sign in to comment.