Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: combobox, select, menu, tabs #1431

Merged
merged 23 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .changeset/fluffy-cups-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
"@zag-js/combobox": minor
---

- Add `open` and `open.controlled` property to programmatically control the combobox's open state

- Add new `openOnChange` property to automatically open the combobox when the value changes. Value can be a boolean or a
function that returns a boolean.

```jsx
const [state, send] = useMachine(
combobox.machine({
// openOnChange: true,
openOnChange: ({ inputValue }) => inputValue.length > 2,
}),
)
```

- Add new `openOnKeypress` property to automatically open the combobox when the arrow keys (up and down) are pressed.

- Add `getSelectionValue` to the combobox's context to allow customizing the input value when an item is selected.

```jsx
const [state, send] = useMachine(
combobox.machine({
getSelectionValue({ inputValue, valueAsString }) {
return `${inputValue} ${valueAsString}`
},
}),
)
```

- Add new `dismissable` property to determine whether to add the combobox content to the dismissable stack.

- Add `popup` attribute to allow rendering the combobox has a select with input within the content.

- Add `persistFocus` to the item props to determine whether to clear the highlighted item on pointer leave.
6 changes: 6 additions & 0 deletions .changeset/four-snakes-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@zag-js/tags-input": minor
---

- Rename `allowTagEdit` to `editable`
- Add `onInputValueChange` to machine context
5 changes: 5 additions & 0 deletions .changeset/odd-rabbits-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/dialog": minor
---

Rename `closeOnEscapeKeyDown` to `closeOnEscape`
5 changes: 5 additions & 0 deletions .changeset/pretty-schools-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/menu": minor
---

Focus first tabbable element when menu opens. To allow composition with combobox
8 changes: 8 additions & 0 deletions .changeset/pretty-tips-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@zag-js/combobox": minor
"@zag-js/select": minor
"@zag-js/menu": minor
"@zag-js/tabs": minor
---

Rename `loop` to `loopFocus` to better reflect its purpose
5 changes: 5 additions & 0 deletions .changeset/sixty-ants-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/select": minor
---

Remove `selectOnBlur` to prevent accidental selection of options. Prefer explicit selection by user via click or enter key.
9 changes: 9 additions & 0 deletions .changeset/tough-owls-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@zag-js/combobox": minor
---

- Fix issue where combobox could be composed with tags-input due to the way `selectedItems` and `valueAsString` was
computed
- Remove `selectOnBlur` to prevent accidental selection of options. Prefer explicit selection by user via click or enter
key.
- Update the details provided by `onInputValueChange` to from `details.value` to `details.inputValue`
Loading
Loading