Skip to content

Commit ea26870

Browse files
Add Combobox component (#1047)
* start of combobox * start with a copy of the Listbox * WIP * Add Vue Combobox * Update Vue version of combobox * Update tests * Fix typescript errors in combobox test * Fix input label The spec says that the combobox itself is labelled directly by the associated label. The button can however be labelled by the label or itself. * Add active descendant to combobox/input * Add listbox role to comobox options Right now the option list *is* just a listbox. If we were to allow other types in the future this will need to be changable * Update tests * move React playground to dedicated package * add react playground script to root * ensure we only open/close the combobox when necessary * ensure export order is correct * remove leftover pages directory from React package * Only add aria controls when combobox is open * add missing next commands * make typescript happy * build @headlessui/react before building playground-react * add empty public folder This makes vercel happy * wip * Add todo * Update tests Still more updates to do but some are blocked on implementation * change default combobox example slightly * ensure that we sync the input with new state When the <Combobox value={...} /> changes, then the input should change as well. * only sync the value with the input in a single spot * WIP: object value to string * WIP * WIP * WIP groups * Add static search filtering to combobox * Move mouse leave event to combobox * Fix use in fragments * Update * WIP * make all tests pass for the combobox in React * remove unnecessary playground item * remove listbox wip * only fire change event on inputs Potentially we also have to do this for all kinds of form inputs. But this will do for now. * disable combobox vue tests * Fix vue typescript errors * Vue tests WIP * improve combobox playgrounds a tiny bit * ensure to lookup the correct value * make sure that we are using a div instead of a Fragment * expose `activeItem` This will be similar to `yourData[activeIndex]`, but in this case the active option's data. Can probably rename this if necessary! * Update comments * Port react tests to Vue * Vue tests WIP * WIP * Rename activeItem to activeOption * Move display value to input * Update playgrounds * Remove static filtering * Add tests for display value * WIP Vue Tests * WIP * unfocus suite * Cleanup react accessibility assertions code * Vue WIP * Cleanup errors in react interactions test utils * Update vue implementation closer :D * Fix searching * Update * Add display value stubs * Update tests * move `<Combobox onSearch={} />` to `<Combobox.Input onChange={} />` * use `useLatestValue` hook * make `onChange` explicitly required * remove unused variables * move `<Combobox @search="" />` to `<ComboboxInput @change="" />` * use correct event * use `let` for consistency * remove unnecessary hidden check * implement displayValue for Vue * update playground to reflect changes * make sure that the activeOptionIndex stays correct * update changelog Co-authored-by: Jordan Pittman <[email protected]>
1 parent cae976a commit ea26870

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+16186
-104
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Improve controlled Tabs behaviour ([#1050](https://github.com/tailwindlabs/headlessui/pull/1050))
1414
- Improve typeahead search logic ([#1051](https://github.com/tailwindlabs/headlessui/pull/1051))
1515

16+
### Added
17+
18+
- Add `Combobox` component ([#1047](https://github.com/tailwindlabs/headlessui/pull/1047))
19+
1620
## [Unreleased - @headlessui/vue]
1721

1822
### Fixed
1923

2024
- Ensure correct order when conditionally rendering `MenuItem`, `ListboxOption` and `RadioGroupOption` ([#1045](https://github.com/tailwindlabs/headlessui/pull/1045))
2125
- Improve typeahead search logic ([#1051](https://github.com/tailwindlabs/headlessui/pull/1051))
2226

27+
### Added
28+
29+
- Add `Combobox` component ([#1047](https://github.com/tailwindlabs/headlessui/pull/1047))
30+
2331
## [@headlessui/react@v1.4.3] - 2022-01-14
2432

2533
### Fixes
@@ -88,7 +96,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8896
- Add `aria-orientation` to `Listbox`, which swaps Up/Down with Left/Right keys ([#683](https://github.com/tailwindlabs/headlessui/pull/683))
8997
- Expose `close` function from the render prop for `Disclosure`, `Disclosure.Panel`, `Popover` and `Popover.Panel` ([#697](https://github.com/tailwindlabs/headlessui/pull/697))
9098

91-
9299
## [@headlessui/vue@v1.4.0] - 2021-07-29
93100

94101
### Added

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
],
1212
"scripts": {
1313
"react": "yarn workspace @headlessui/react",
14+
"react-playground": "yarn workspace playground-react dev",
15+
"playground-react": "yarn workspace playground-react dev",
1416
"vue": "yarn workspace @headlessui/vue",
1517
"shared": "yarn workspace @headlessui/shared",
1618
"build": "yarn workspaces run build",

packages/@headlessui-react/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"prepublishOnly": "npm run build",
2727
"test": "../../scripts/test.sh",
2828
"build": "../../scripts/build.sh",
29+
"watch": "../../scripts/watch.sh",
2930
"lint": "../../scripts/lint.sh"
3031
},
3132
"peerDependencies": {

0 commit comments

Comments
 (0)