@ariakit/react@0.3.0
Minor Changes
-
#2714
Added support for a dynamicstore
prop on component stores.This is similar to the
store
prop on components, keeping both stores in sync. Now, component store hooks can support modifying the value of thestore
prop after the initial render. For instance:// props.store can change between renders now const checkbox = useCheckboxStore({ store: props.store });
When the
store
prop changes, the object returned from the store hook will update as well. Consequently, effects and hooks that rely on the store will re-run.While it's unlikely, this could represent a breaking change if you're depending on the
store
prop in component stores to only acknowledge the first value passed to it. -
#2783
BREAKING (This should affect very few people): Thecombobox
state onuseSelectStore
has been replaced by thecombobox
property on the store object.Before:
const combobox = useComboboxStore(); const select = useSelectStore({ combobox }); const hasCombobox = select.useState("combobox");
After:
const combobox = useComboboxStore(); const select = useSelectStore({ combobox }); const hasCombobox = Boolean(select.combobox);
In the example above,
select.combobox
is literally the same as thecombobox
store. It will be defined if thecombobox
store is passed touseSelectStore
. -
#2783
BREAKING (This should affect very few people): Theselect
andmenu
props onuseComboboxStore
have been removed. If you need to composeCombobox
withSelect
orMenu
, use thecombobox
prop onuseSelectStore
oruseMenuStore
instead. -
#2717
Thechildren
prop as a function has been deprecated on all components. Use therender
prop instead. -
#2717
Theas
prop has been deprecated on all components. Use therender
prop instead. -
#2717
ThebackdropProps
prop has been deprecated onDialog
and derived components. Use thebackdrop
prop instead. -
#2745
Component stores will now throw an error if they receive another store prop in conjunction with default prop values.
Patch Changes
-
#2737
Fixed controlled component stores rendering with a stale state. -
#2783
Component store objects now contain properties for the composed stores passed to them as props. For instance,useSelectStore({ combobox })
will return acombobox
property if thecombobox
prop is specified. -
#2785
Addedparent
andmenubar
properties to the menu store. These properties are automatically set when rendering nested menus or menus within a menubar.Now, it also supports rendering nested menus that aren't nested in the React tree. In this case, you would have to supply the parent menu store manually to the child menu store.
These properties are also included in the returned menu store object, allowing you to verify whether the menu is nested. For instance:
const menu = useMenuStore(props); const isNested = Boolean(menu.parent);
-
#2795
Updated theMenu
component so thecomposite
andtypeahead
props are automatically set tofalse
when combining it with aCombobox
component.This means you'll not need to explicitly pass
composite={false}
when building a Menu with Combobox component. -
#2796
Composed store props such asuseSelectStore({ combobox })
now acceptnull
as a value. -
Updated dependencies:
@ariakit/react-core@0.3.0
.