Skip to content

Conversation

diegohaz
Copy link
Member

@diegohaz diegohaz commented Oct 13, 2023

Closes #2913
Closes #2914
Closes #2915
Closes #2916

This PR introduces a new example, menu-values-test, illustrating various applications of the MenuItemCheckbox and MenuItemRadio components:

  • Controlled with checked and onChange props.
  • Uncontrolled with the defaultChecked prop.
  • Controlled with a parent onClick handler.
  • Disabled.

This PR addresses some bugs and missing features found in those scenarios. For more details, please refer to the linked issues and changeset files.

@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2023

🦋 Changeset detected

Latest commit: 3f7bb8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@ariakit/core Patch
@ariakit/react-core Patch
@ariakit/react Patch
@ariakit/test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ariakit ✅ Ready (Inspect) Visit Preview Oct 13, 2023 5:27am
1 Ignored Deployment
Name Status Preview Updated (UTC)
reakit ⬜️ Ignored (Inspect) Visit Preview Oct 13, 2023 5:27am

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 13, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3f7bb8b:

Sandbox Source
Ariakit Configuration

@vercel vercel bot temporarily deployed to Preview – ariakit October 13, 2023 04:08 Inactive
@vercel vercel bot temporarily deployed to Preview – ariakit October 13, 2023 04:40 Inactive
@vercel vercel bot temporarily deployed to Preview – ariakit October 13, 2023 04:48 Inactive
@vercel vercel bot temporarily deployed to Preview – ariakit October 13, 2023 05:27 Inactive
@diegohaz diegohaz marked this pull request as ready for review October 13, 2023 05:38
@diegohaz diegohaz merged commit ba8481f into main Oct 13, 2023
@diegohaz diegohaz deleted the menu-item-radio-checkbox-controlled branch October 13, 2023 22:01
@github-actions github-actions bot mentioned this pull request Oct 13, 2023
diegohaz pushed a commit that referenced this pull request Oct 14, 2023
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @ariakit/core@0.3.4

### Patch Changes

- [`#2935`](#2935) Fixed
TypeScript declaration files in CommonJS projects using `NodeNext` for
`moduleResolution`.

- [`#2945`](#2945) Added new
`disabledFromProps` function to `@ariakit/core/utils/misc`.

- [`#2948`](#2948) Added `"use
client"` directive to all modules.

-   Improved JSDocs.

## @ariakit/react@0.3.5

### Patch Changes

- [`#2935`](#2935) Fixed
TypeScript declaration files in CommonJS projects using `NodeNext` for
`moduleResolution`.

- [`#2945`](#2945) Added `name`
and `value` properties to non-native input elements rendered by
[`Checkbox`](https://ariakit.org/reference/checkbox),
[`Radio`](https://ariakit.org),
[`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox),
and [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).

It's now possible to access the `name` and `value` properties from the
`event.target` element in the
[`onChange`](https://ariakit.org/reference/checkbox#onchange) event
handler.

- [`#2945`](#2945) Fixed
[`CompositeItem`](https://ariakit.org/reference/composite-item) and
associated components not receiving the
[`disabled`](https://ariakit.org/reference/composite-item#disabled) prop
when it's being used by a higher-level component such as
[`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox)
or [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).

- [`#2945`](#2945) It's now
possible to control the menu
[`values`](https://ariakit.org/reference/menu-provider#values) state by
passing the
[`checked`](https://ariakit.org/reference/menu-item-checkbox#checked),
[`defaultChecked`](https://ariakit.org/reference/menu-item-checkbox#defaultchecked)
and
[`onChange`](https://ariakit.org/reference/menu-item-checkbox#onchange)
props to
[`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox)
and [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).

- [`#2948`](#2948) Added `"use
client"` directive to all modules.

- [`#2949`](#2949) The
[Select](https://ariakit.org/components/select) component will now
display the selected option(s) on the underlying native select element
even when the corresponding
[`SelectItem`](https://ariakit.org/reference/select-item) components
aren't rendered.

This comes in handy when the
[`SelectPopover`](https://ariakit.org/reference/select-popover)
component is rendered dynamically (for instance, using the
[`unmountOnHide`](https://ariakit.org/reference/select-popover#unmountonhide)
prop) or a
[`defaultValue`](https://ariakit.org/reference/select-provider#defaultvalue)
is given without a matching
[`SelectItem`](https://ariakit.org/reference/select-item) component.

-   Improved JSDocs.

-   Updated dependencies: `@ariakit/react-core@0.3.5`.

## @ariakit/react-core@0.3.5

### Patch Changes

- [`#2935`](#2935) Fixed
TypeScript declaration files in CommonJS projects using `NodeNext` for
`moduleResolution`.

- [`#2945`](#2945) Added `name`
and `value` properties to non-native input elements rendered by
[`Checkbox`](https://ariakit.org/reference/checkbox),
[`Radio`](https://ariakit.org),
[`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox),
and [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).

It's now possible to access the `name` and `value` properties from the
`event.target` element in the
[`onChange`](https://ariakit.org/reference/checkbox#onchange) event
handler.

- [`#2945`](#2945) Fixed
[`CompositeItem`](https://ariakit.org/reference/composite-item) and
associated components not receiving the
[`disabled`](https://ariakit.org/reference/composite-item#disabled) prop
when it's being used by a higher-level component such as
[`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox)
or [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).

- [`#2945`](#2945) It's now
possible to control the menu
[`values`](https://ariakit.org/reference/menu-provider#values) state by
passing the
[`checked`](https://ariakit.org/reference/menu-item-checkbox#checked),
[`defaultChecked`](https://ariakit.org/reference/menu-item-checkbox#defaultchecked)
and
[`onChange`](https://ariakit.org/reference/menu-item-checkbox#onchange)
props to
[`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox)
and [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).

- [`#2948`](#2948) Added `"use
client"` directive to all modules.

- [`#2949`](#2949) The
[Select](https://ariakit.org/components/select) component will now
display the selected option(s) on the underlying native select element
even when the corresponding
[`SelectItem`](https://ariakit.org/reference/select-item) components
aren't rendered.

This comes in handy when the
[`SelectPopover`](https://ariakit.org/reference/select-popover)
component is rendered dynamically (for instance, using the
[`unmountOnHide`](https://ariakit.org/reference/select-popover#unmountonhide)
prop) or a
[`defaultValue`](https://ariakit.org/reference/select-provider#defaultvalue)
is given without a matching
[`SelectItem`](https://ariakit.org/reference/select-item) component.

-   Improved JSDocs.

-   Updated dependencies: `@ariakit/core@0.3.4`.

## @ariakit/test@0.3.1

### Patch Changes

- [`#2935`](#2935) Fixed
TypeScript declaration files in CommonJS projects using `NodeNext` for
`moduleResolution`.

- [`#2948`](#2948) Added `"use
client"` directive to all modules.

-   Updated dependencies: `@ariakit/core@0.3.4`.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant