diff --git a/.changeset/0-2714-clean-coins-play-1.md b/.changeset/0-2714-clean-coins-play-1.md deleted file mode 100644 index da69aa36b6..0000000000 --- a/.changeset/0-2714-clean-coins-play-1.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -"@ariakit/react-core": minor -"@ariakit/react": minor ---- - -[`#2714`](https://github.com/ariakit/ariakit/pull/2714) Added support for a dynamic `store` 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 the `store` prop after the initial render. For instance: - -```js -// 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. diff --git a/.changeset/0-2714-clean-coins-play-2.md b/.changeset/0-2714-clean-coins-play-2.md deleted file mode 100644 index 05a955baa1..0000000000 --- a/.changeset/0-2714-clean-coins-play-2.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": minor ---- - -[`#2714`](https://github.com/ariakit/ariakit/pull/2714) **BREAKING**: The `useStore` function exported by `@ariakit/react-core/utils/store` has been updated. diff --git a/.changeset/0-2760-real-toes-prove.md b/.changeset/0-2760-real-toes-prove.md deleted file mode 100644 index c1c1e6769e..0000000000 --- a/.changeset/0-2760-real-toes-prove.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": minor ---- - -[`#2760`](https://github.com/ariakit/ariakit/pull/2760) **BREAKING**: The `useStoreState` function exported by `@ariakit/react-core/utils/store` has been updated so it'll always run the selector callback even when the passed store is `null` or `undefined`. diff --git a/.changeset/0-2783-has-combobox.md b/.changeset/0-2783-has-combobox.md deleted file mode 100644 index d8c91e0949..0000000000 --- a/.changeset/0-2783-has-combobox.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -"@ariakit/react-core": minor -"@ariakit/react": minor ---- - -[`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** *(This should affect very few people)*: The `combobox` state on `useSelectStore` has been replaced by the `combobox` property on the store object. - -**Before:** - -```js -const combobox = useComboboxStore(); -const select = useSelectStore({ combobox }); -const hasCombobox = select.useState("combobox"); -``` - -**After:** - -```js -const combobox = useComboboxStore(); -const select = useSelectStore({ combobox }); -const hasCombobox = Boolean(select.combobox); -``` - -In the example above, `select.combobox` is literally the same as the `combobox` store. It will be defined if the `combobox` store is passed to `useSelectStore`. diff --git a/.changeset/0-2783-menu-select-on-combobox-store.md b/.changeset/0-2783-menu-select-on-combobox-store.md deleted file mode 100644 index 1016165b14..0000000000 --- a/.changeset/0-2783-menu-select-on-combobox-store.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@ariakit/core": minor -"@ariakit/react-core": minor -"@ariakit/react": minor ---- - -[`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** *(This should affect very few people)*: The `select` and `menu` props on `useComboboxStore` have been removed. If you need to compose `Combobox` with `Select` or `Menu`, use the `combobox` prop on `useSelectStore` or `useMenuStore` instead. diff --git a/.changeset/2717-large-shrimps-cross-1.md b/.changeset/2717-large-shrimps-cross-1.md deleted file mode 100644 index c9a3ac0e4b..0000000000 --- a/.changeset/2717-large-shrimps-cross-1.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@ariakit/react-core": minor -"@ariakit/react": minor ---- - -[`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `children` prop as a function has been deprecated on all components. Use the [`render`](https://ariakit.org/guide/composition#explicit-render-function) prop instead. diff --git a/.changeset/2717-large-shrimps-cross-2.md b/.changeset/2717-large-shrimps-cross-2.md deleted file mode 100644 index b600aee2dc..0000000000 --- a/.changeset/2717-large-shrimps-cross-2.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@ariakit/react-core": minor -"@ariakit/react": minor ---- - -[`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `as` prop has been deprecated on all components. Use the [`render`](https://ariakit.org/guide/composition) prop instead. diff --git a/.changeset/2717-large-shrimps-cross-3.md b/.changeset/2717-large-shrimps-cross-3.md deleted file mode 100644 index 8be810c67a..0000000000 --- a/.changeset/2717-large-shrimps-cross-3.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@ariakit/react-core": minor -"@ariakit/react": minor ---- - -[`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `backdropProps` prop has been deprecated on `Dialog` and derived components. Use the [`backdrop`](https://ariakit.org/reference/dialog#backdrop) prop instead. diff --git a/.changeset/2737-chilly-rivers-argue.md b/.changeset/2737-chilly-rivers-argue.md deleted file mode 100644 index 3739d46784..0000000000 --- a/.changeset/2737-chilly-rivers-argue.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@ariakit/react-core": patch -"@ariakit/react": patch ---- - -[`#2737`](https://github.com/ariakit/ariakit/pull/2737) Fixed controlled component stores rendering with a stale state. diff --git a/.changeset/2745-thin-pugs-thank.md b/.changeset/2745-thin-pugs-thank.md deleted file mode 100644 index dd4caab26e..0000000000 --- a/.changeset/2745-thin-pugs-thank.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@ariakit/react-core": minor -"@ariakit/core": minor -"@ariakit/react": minor ---- - -[`#2745`](https://github.com/ariakit/ariakit/pull/2745) Component stores will now throw an error if they receive another store prop in conjunction with default prop values. diff --git a/.changeset/2758-rich-peas-fix-1.md b/.changeset/2758-rich-peas-fix-1.md deleted file mode 100644 index 09564ef9bc..0000000000 --- a/.changeset/2758-rich-peas-fix-1.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2758`](https://github.com/ariakit/ariakit/pull/2758) Added `CheckboxProvider` component and `useCheckboxContext` hook. diff --git a/.changeset/2759-big-waves-build-1.md b/.changeset/2759-big-waves-build-1.md deleted file mode 100644 index 8b9800d8c3..0000000000 --- a/.changeset/2759-big-waves-build-1.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2759`](https://github.com/ariakit/ariakit/pull/2759) Added `CollectionProvider` component and `useCollectionContext` hook. diff --git a/.changeset/2769-big-waves-build-1.md b/.changeset/2769-big-waves-build-1.md deleted file mode 100644 index 5388d75fb0..0000000000 --- a/.changeset/2769-big-waves-build-1.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2769`](https://github.com/ariakit/ariakit/pull/2769) Added `DisclosureProvider` component and `useDisclosureContext` hook. diff --git a/.changeset/2770-big-waves-build-1.md b/.changeset/2770-big-waves-build-1.md deleted file mode 100644 index 9cb557f013..0000000000 --- a/.changeset/2770-big-waves-build-1.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2770`](https://github.com/ariakit/ariakit/pull/2770) Added `CompositeProvider` component and `useCompositeContext` hook. diff --git a/.changeset/2771-big-waves-dialog-1.md b/.changeset/2771-big-waves-dialog-1.md deleted file mode 100644 index 4a67dd47da..0000000000 --- a/.changeset/2771-big-waves-dialog-1.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2771`](https://github.com/ariakit/ariakit/pull/2771) Added `DialogProvider` component and `useDialogContext` hook. diff --git a/.changeset/2774-big-waves-dialog-1.md b/.changeset/2774-big-waves-dialog-1.md deleted file mode 100644 index b62760f66b..0000000000 --- a/.changeset/2774-big-waves-dialog-1.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2774`](https://github.com/ariakit/ariakit/pull/2774) Added `PopoverProvider` component and `usePopoverContext` hook. diff --git a/.changeset/2775-big-waves-dialog-2.md b/.changeset/2775-big-waves-dialog-2.md deleted file mode 100644 index 5564c65697..0000000000 --- a/.changeset/2775-big-waves-dialog-2.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2775`](https://github.com/ariakit/ariakit/pull/2775) Added `ComboboxProvider` component and `useComboboxContext` hook. diff --git a/.changeset/2776-big-waves-dialog-3.md b/.changeset/2776-big-waves-dialog-3.md deleted file mode 100644 index 67d53f0ad6..0000000000 --- a/.changeset/2776-big-waves-dialog-3.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2776`](https://github.com/ariakit/ariakit/pull/2776) Added `SelectProvider` component and `useSelectContext` hook. diff --git a/.changeset/2777-big-waves-dialog-4.md b/.changeset/2777-big-waves-dialog-4.md deleted file mode 100644 index 1a3f0ab667..0000000000 --- a/.changeset/2777-big-waves-dialog-4.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2777`](https://github.com/ariakit/ariakit/pull/2777) Added `RadioProvider` component and `useRadioContext` hook. diff --git a/.changeset/2778-big-waves-dialog-6.md b/.changeset/2778-big-waves-dialog-6.md deleted file mode 100644 index d63572b33c..0000000000 --- a/.changeset/2778-big-waves-dialog-6.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2778`](https://github.com/ariakit/ariakit/pull/2778) Added `HovercardProvider` component and `useHovercardContext` hook. diff --git a/.changeset/2779-big-waves-dialog-5.md b/.changeset/2779-big-waves-dialog-5.md deleted file mode 100644 index e89b53e7cc..0000000000 --- a/.changeset/2779-big-waves-dialog-5.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2779`](https://github.com/ariakit/ariakit/pull/2779) Added `TabProvider` component and `useTabContext` hook. diff --git a/.changeset/2780-big-waves-build-5.md b/.changeset/2780-big-waves-build-5.md deleted file mode 100644 index 385e48e9cf..0000000000 --- a/.changeset/2780-big-waves-build-5.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2780`](https://github.com/ariakit/ariakit/pull/2780) Added `ToolbarProvider` component and `useToolbarContext` hook. diff --git a/.changeset/2781-big-waves-build.md b/.changeset/2781-big-waves-build.md deleted file mode 100644 index 224d50cab4..0000000000 --- a/.changeset/2781-big-waves-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2781`](https://github.com/ariakit/ariakit/pull/2781) Added `TooltipProvider` component and `useTooltipContext` hook. diff --git a/.changeset/2782-big-waves-build-2.md b/.changeset/2782-big-waves-build-2.md deleted file mode 100644 index 7dcce43db4..0000000000 --- a/.changeset/2782-big-waves-build-2.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/core": patch ---- - -[`#2782`](https://github.com/ariakit/ariakit/pull/2782) Fixed form store not synchrozining validate and submit callbacks with another form store through the `store` property. diff --git a/.changeset/2782-big-waves-build.md b/.changeset/2782-big-waves-build.md deleted file mode 100644 index fdbb29d425..0000000000 --- a/.changeset/2782-big-waves-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2782`](https://github.com/ariakit/ariakit/pull/2782) Added `FormProvider` component and `useFormContext` hook. diff --git a/.changeset/2783-sync-stores.md b/.changeset/2783-sync-stores.md deleted file mode 100644 index 7158400842..0000000000 --- a/.changeset/2783-sync-stores.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@ariakit/core": patch -"@ariakit/react-core": patch -"@ariakit/react": patch ---- - -[`#2783`](https://github.com/ariakit/ariakit/pull/2783) Component store objects now contain properties for the composed stores passed to them as props. For instance, `useSelectStore({ combobox })` will return a `combobox` property if the `combobox` prop is specified. diff --git a/.changeset/2785-menu-provider-2.md b/.changeset/2785-menu-provider-2.md deleted file mode 100644 index bdc6108d92..0000000000 --- a/.changeset/2785-menu-provider-2.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `MenuProvider` component and `useMenuContext` hook. diff --git a/.changeset/2785-menu-provider-3.md b/.changeset/2785-menu-provider-3.md deleted file mode 100644 index 3dbe0fb30a..0000000000 --- a/.changeset/2785-menu-provider-3.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@ariakit/react-core": patch ---- - -[`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `MenuBarProvider` component and `useMenuBarContext` hook. diff --git a/.changeset/2785-menu-provider-4.md b/.changeset/2785-menu-provider-4.md deleted file mode 100644 index 7d56acff1d..0000000000 --- a/.changeset/2785-menu-provider-4.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -"@ariakit/core": patch -"@ariakit/react-core": patch -"@ariakit/react": patch ---- - -[`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `parent` and `menubar` 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: - -```jsx -const menu = useMenuStore(props); -const isNested = Boolean(menu.parent); -``` diff --git a/package-lock.json b/package-lock.json index 8f5811dbbd..ddb7bfe851 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22410,15 +22410,15 @@ }, "packages/ariakit-core": { "name": "@ariakit/core", - "version": "0.2.9", + "version": "0.3.0", "license": "MIT" }, "packages/ariakit-react": { "name": "@ariakit/react", - "version": "0.2.17", + "version": "0.3.0", "license": "MIT", "dependencies": { - "@ariakit/react-core": "0.2.17" + "@ariakit/react-core": "0.3.0" }, "funding": { "type": "opencollective", @@ -22431,10 +22431,10 @@ }, "packages/ariakit-react-core": { "name": "@ariakit/react-core", - "version": "0.2.17", + "version": "0.3.0", "license": "MIT", "dependencies": { - "@ariakit/core": "0.2.9", + "@ariakit/core": "0.3.0", "@floating-ui/dom": "^1.0.0", "use-sync-external-store": "^1.2.0" }, @@ -22445,10 +22445,10 @@ }, "packages/ariakit-test": { "name": "@ariakit/test", - "version": "0.2.2", + "version": "0.2.3", "license": "MIT", "dependencies": { - "@ariakit/core": "0.2.9" + "@ariakit/core": "0.3.0" }, "peerDependencies": { "@testing-library/dom": "^8.0.0 || ^9.0.0", diff --git a/packages/ariakit-core/CHANGELOG.md b/packages/ariakit-core/CHANGELOG.md index 3daf003085..9e941f04b4 100644 --- a/packages/ariakit-core/CHANGELOG.md +++ b/packages/ariakit-core/CHANGELOG.md @@ -1,5 +1,30 @@ # @ariakit/core +## 0.3.0 + +### Minor Changes + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `select` and `menu` props on `useComboboxStore` have been removed. If you need to compose `Combobox` with `Select` or `Menu`, use the `combobox` prop on `useSelectStore` or `useMenuStore` instead. + +- [`#2745`](https://github.com/ariakit/ariakit/pull/2745) Component stores will now throw an error if they receive another store prop in conjunction with default prop values. + +### Patch Changes + +- [`#2782`](https://github.com/ariakit/ariakit/pull/2782) Fixed form store not synchrozining validate and submit callbacks with another form store through the `store` property. + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) Component store objects now contain properties for the composed stores passed to them as props. For instance, `useSelectStore({ combobox })` will return a `combobox` property if the `combobox` prop is specified. + +- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `parent` and `menubar` 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: + + ```jsx + const menu = useMenuStore(props); + const isNested = Boolean(menu.parent); + ``` + ## 0.2.9 ### Patch Changes diff --git a/packages/ariakit-core/package.json b/packages/ariakit-core/package.json index 6ea6f0d4ab..15286de393 100644 --- a/packages/ariakit-core/package.json +++ b/packages/ariakit-core/package.json @@ -1,6 +1,6 @@ { "name": "@ariakit/core", - "version": "0.2.9", + "version": "0.3.0", "description": "Ariakit core", "sideEffects": false, "license": "MIT", diff --git a/packages/ariakit-react-core/CHANGELOG.md b/packages/ariakit-react-core/CHANGELOG.md index 507c862f1a..90fdb17443 100644 --- a/packages/ariakit-react-core/CHANGELOG.md +++ b/packages/ariakit-react-core/CHANGELOG.md @@ -1,5 +1,107 @@ # @ariakit/react-core +## 0.3.0 + +### Minor Changes + +- [`#2714`](https://github.com/ariakit/ariakit/pull/2714) Added support for a dynamic `store` 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 the `store` prop after the initial render. For instance: + + ```js + // 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. + +- [`#2714`](https://github.com/ariakit/ariakit/pull/2714) **BREAKING**: The `useStore` function exported by `@ariakit/react-core/utils/store` has been updated. + +- [`#2760`](https://github.com/ariakit/ariakit/pull/2760) **BREAKING**: The `useStoreState` function exported by `@ariakit/react-core/utils/store` has been updated so it'll always run the selector callback even when the passed store is `null` or `undefined`. + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `combobox` state on `useSelectStore` has been replaced by the `combobox` property on the store object. + + **Before:** + + ```js + const combobox = useComboboxStore(); + const select = useSelectStore({ combobox }); + const hasCombobox = select.useState("combobox"); + ``` + + **After:** + + ```js + const combobox = useComboboxStore(); + const select = useSelectStore({ combobox }); + const hasCombobox = Boolean(select.combobox); + ``` + + In the example above, `select.combobox` is literally the same as the `combobox` store. It will be defined if the `combobox` store is passed to `useSelectStore`. + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `select` and `menu` props on `useComboboxStore` have been removed. If you need to compose `Combobox` with `Select` or `Menu`, use the `combobox` prop on `useSelectStore` or `useMenuStore` instead. + +- [`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `children` prop as a function has been deprecated on all components. Use the [`render`](https://ariakit.org/guide/composition#explicit-render-function) prop instead. + +- [`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `as` prop has been deprecated on all components. Use the [`render`](https://ariakit.org/guide/composition) prop instead. + +- [`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `backdropProps` prop has been deprecated on `Dialog` and derived components. Use the [`backdrop`](https://ariakit.org/reference/dialog#backdrop) prop instead. + +- [`#2745`](https://github.com/ariakit/ariakit/pull/2745) Component stores will now throw an error if they receive another store prop in conjunction with default prop values. + +### Patch Changes + +- [`#2737`](https://github.com/ariakit/ariakit/pull/2737) Fixed controlled component stores rendering with a stale state. + +- [`#2758`](https://github.com/ariakit/ariakit/pull/2758) Added `CheckboxProvider` component and `useCheckboxContext` hook. + +- [`#2759`](https://github.com/ariakit/ariakit/pull/2759) Added `CollectionProvider` component and `useCollectionContext` hook. + +- [`#2769`](https://github.com/ariakit/ariakit/pull/2769) Added `DisclosureProvider` component and `useDisclosureContext` hook. + +- [`#2770`](https://github.com/ariakit/ariakit/pull/2770) Added `CompositeProvider` component and `useCompositeContext` hook. + +- [`#2771`](https://github.com/ariakit/ariakit/pull/2771) Added `DialogProvider` component and `useDialogContext` hook. + +- [`#2774`](https://github.com/ariakit/ariakit/pull/2774) Added `PopoverProvider` component and `usePopoverContext` hook. + +- [`#2775`](https://github.com/ariakit/ariakit/pull/2775) Added `ComboboxProvider` component and `useComboboxContext` hook. + +- [`#2776`](https://github.com/ariakit/ariakit/pull/2776) Added `SelectProvider` component and `useSelectContext` hook. + +- [`#2777`](https://github.com/ariakit/ariakit/pull/2777) Added `RadioProvider` component and `useRadioContext` hook. + +- [`#2778`](https://github.com/ariakit/ariakit/pull/2778) Added `HovercardProvider` component and `useHovercardContext` hook. + +- [`#2779`](https://github.com/ariakit/ariakit/pull/2779) Added `TabProvider` component and `useTabContext` hook. + +- [`#2780`](https://github.com/ariakit/ariakit/pull/2780) Added `ToolbarProvider` component and `useToolbarContext` hook. + +- [`#2781`](https://github.com/ariakit/ariakit/pull/2781) Added `TooltipProvider` component and `useTooltipContext` hook. + +- [`#2782`](https://github.com/ariakit/ariakit/pull/2782) Added `FormProvider` component and `useFormContext` hook. + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) Component store objects now contain properties for the composed stores passed to them as props. For instance, `useSelectStore({ combobox })` will return a `combobox` property if the `combobox` prop is specified. + +- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `MenuProvider` component and `useMenuContext` hook. + +- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `MenuBarProvider` component and `useMenuBarContext` hook. + +- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `parent` and `menubar` 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: + + ```jsx + const menu = useMenuStore(props); + const isNested = Boolean(menu.parent); + ``` + +- Updated dependencies: `@ariakit/core@0.3.0`. + ## 0.2.17 ### Patch Changes diff --git a/packages/ariakit-react-core/package.json b/packages/ariakit-react-core/package.json index ca020b88e8..71aa011d46 100644 --- a/packages/ariakit-react-core/package.json +++ b/packages/ariakit-react-core/package.json @@ -1,6 +1,6 @@ { "name": "@ariakit/react-core", - "version": "0.2.17", + "version": "0.3.0", "description": "Ariakit React core", "sideEffects": false, "license": "MIT", @@ -30,7 +30,7 @@ "core" ], "dependencies": { - "@ariakit/core": "0.2.9", + "@ariakit/core": "0.3.0", "@floating-ui/dom": "^1.0.0", "use-sync-external-store": "^1.2.0" }, diff --git a/packages/ariakit-react/CHANGELOG.md b/packages/ariakit-react/CHANGELOG.md index 1e92f78182..02b1757b80 100644 --- a/packages/ariakit-react/CHANGELOG.md +++ b/packages/ariakit-react/CHANGELOG.md @@ -1,5 +1,71 @@ # @ariakit/react +## 0.3.0 + +### Minor Changes + +- [`#2714`](https://github.com/ariakit/ariakit/pull/2714) Added support for a dynamic `store` 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 the `store` prop after the initial render. For instance: + + ```js + // 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`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `combobox` state on `useSelectStore` has been replaced by the `combobox` property on the store object. + + **Before:** + + ```js + const combobox = useComboboxStore(); + const select = useSelectStore({ combobox }); + const hasCombobox = select.useState("combobox"); + ``` + + **After:** + + ```js + const combobox = useComboboxStore(); + const select = useSelectStore({ combobox }); + const hasCombobox = Boolean(select.combobox); + ``` + + In the example above, `select.combobox` is literally the same as the `combobox` store. It will be defined if the `combobox` store is passed to `useSelectStore`. + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `select` and `menu` props on `useComboboxStore` have been removed. If you need to compose `Combobox` with `Select` or `Menu`, use the `combobox` prop on `useSelectStore` or `useMenuStore` instead. + +- [`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `children` prop as a function has been deprecated on all components. Use the [`render`](https://ariakit.org/guide/composition#explicit-render-function) prop instead. + +- [`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `as` prop has been deprecated on all components. Use the [`render`](https://ariakit.org/guide/composition) prop instead. + +- [`#2717`](https://github.com/ariakit/ariakit/pull/2717) The `backdropProps` prop has been deprecated on `Dialog` and derived components. Use the [`backdrop`](https://ariakit.org/reference/dialog#backdrop) prop instead. + +- [`#2745`](https://github.com/ariakit/ariakit/pull/2745) Component stores will now throw an error if they receive another store prop in conjunction with default prop values. + +### Patch Changes + +- [`#2737`](https://github.com/ariakit/ariakit/pull/2737) Fixed controlled component stores rendering with a stale state. + +- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) Component store objects now contain properties for the composed stores passed to them as props. For instance, `useSelectStore({ combobox })` will return a `combobox` property if the `combobox` prop is specified. + +- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `parent` and `menubar` 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: + + ```jsx + const menu = useMenuStore(props); + const isNested = Boolean(menu.parent); + ``` + +- Updated dependencies: `@ariakit/react-core@0.3.0`. + ## 0.2.17 ### Patch Changes diff --git a/packages/ariakit-react/package.json b/packages/ariakit-react/package.json index cdf41454ed..be32069ec2 100644 --- a/packages/ariakit-react/package.json +++ b/packages/ariakit-react/package.json @@ -1,6 +1,6 @@ { "name": "@ariakit/react", - "version": "0.2.17", + "version": "0.3.0", "description": "Toolkit for building accessible web apps with React", "sideEffects": false, "license": "MIT", @@ -37,7 +37,7 @@ "components" ], "dependencies": { - "@ariakit/react-core": "0.2.17" + "@ariakit/react-core": "0.3.0" }, "peerDependencies": { "react": "^17.0.0 || ^18.0.0", diff --git a/packages/ariakit-test/CHANGELOG.md b/packages/ariakit-test/CHANGELOG.md index a6744ac374..ea5fe9db1c 100644 --- a/packages/ariakit-test/CHANGELOG.md +++ b/packages/ariakit-test/CHANGELOG.md @@ -1,5 +1,11 @@ # @ariakit/test +## 0.2.3 + +### Patch Changes + +- Updated dependencies: `@ariakit/core@0.3.0`. + ## 0.2.2 ### Patch Changes diff --git a/packages/ariakit-test/package.json b/packages/ariakit-test/package.json index 5f91290f43..30fbdc6818 100644 --- a/packages/ariakit-test/package.json +++ b/packages/ariakit-test/package.json @@ -1,6 +1,6 @@ { "name": "@ariakit/test", - "version": "0.2.2", + "version": "0.2.3", "description": "Ariakit test utils", "license": "MIT", "homepage": "https://ariakit.org", @@ -28,7 +28,7 @@ "react" ], "dependencies": { - "@ariakit/core": "0.2.9" + "@ariakit/core": "0.3.0" }, "peerDependencies": { "@testing-library/dom": "^8.0.0 || ^9.0.0",