-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: redesign select and combobox (#826)
- Loading branch information
1 parent
8676fec
commit 224cbbb
Showing
75 changed files
with
3,124 additions
and
1,926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
--- | ||
"@zag-js/combobox": patch | ||
"@zag-js/dom-event": patch | ||
"@zag-js/shared": patch | ||
"website": patch | ||
--- | ||
|
||
Add support for `closeOnSelect` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
"@zag-js/select": minor | ||
"@zag-js/combobox": minor | ||
"@zag-js/utils": minor | ||
--- | ||
|
||
> Breaking Changes 💥 | ||
Redesign select and combobox API to allow passing value as `string` and `collection` | ||
|
||
Prior to this change, Zag computes the label and value from the DOM element. While this worked, it makes it challenging | ||
to manage complex objects that don't match the `label` and `value` convention. | ||
|
||
```jsx | ||
// Create the collection | ||
const collection = select.collection({ | ||
items: [], | ||
itemToString(item) { | ||
return item.label | ||
}, | ||
itemToValue(item) { | ||
return item.value | ||
}, | ||
}) | ||
|
||
// Pass the collection to the select machine | ||
const [state, send] = useMachine( | ||
select.machine({ | ||
collection, | ||
id: useId(), | ||
}), | ||
) | ||
``` |
Oops, something went wrong.
224cbbb
There was a problem hiding this comment.
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:
zag-website – ./website
zag-website-git-main-chakra-ui.vercel.app
zag-website-chakra-ui.vercel.app
zag-website.vercel.app
zagjs.com
www.zagjs.com
224cbbb
There was a problem hiding this comment.
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:
zag-solid – ./examples/solid-ts
zag-solid-chakra-ui.vercel.app
zag-solid-git-main-chakra-ui.vercel.app
zag-solid.vercel.app
224cbbb
There was a problem hiding this comment.
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:
zag-vue – ./examples/vue-ts
zag-vue-git-main-chakra-ui.vercel.app
zag-vue.vercel.app
zag-vue-chakra-ui.vercel.app
224cbbb
There was a problem hiding this comment.
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:
zag-nextjs – ./examples/next-ts
zag-nextjs-git-main-chakra-ui.vercel.app
zag-two.vercel.app
zag-nextjs-chakra-ui.vercel.app