@ariakit/react 0.3.13 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,138 @@
1
1
  # @ariakit/react
2
2
 
3
+ ## 0.4.0
4
+
5
+ This version introduces enhanced support for CSS animations and transitions, along with a few breaking changes for quite specific cases. The majority of users won't be impacted by these.
6
+
7
+ Please review the brief notes following the **BREAKING** labels on each update to determine if any changes are needed in your code.
8
+
9
+ ### Improved animation support
10
+
11
+ This version enhances support for CSS animations and transitions on Ariakit components that use [Disclosure](https://ariakit.org/component/disclosure). This includes [Dialog](https://ariakit.org/components/dialog), [Popover](https://ariakit.org/components/popover), [Combobox](https://ariakit.org/components/combobox), [Select](https://ariakit.org/components/select), [Hovercard](https://ariakit.org/components/hovercard), [Menu](https://ariakit.org/components/menu), and [Tooltip](https://ariakit.org/components/tooltip).
12
+
13
+ These components now support _enter_ and _leave_ transitions and animations right out of the box, eliminating the need to provide an explicit `animated` prop. If an enter animation is detected, the component will automatically wait for a leave animation to complete before unmounting or hiding itself.
14
+
15
+ Use the [`[data-enter]`](https://ariakit.org/guide/styling#data-enter) selector for CSS transitions. For CSS animations, use the newly introduced [`[data-open]`](https://ariakit.org/guide/styling#data-open) selector. The [`[data-leave]`](https://ariakit.org/guide/styling#data-leave) selector can be used for both transitions and animations.
16
+
17
+ ### `ComboboxList` is no longer focusable
18
+
19
+ **BREAKING** if you're using the [`ComboboxList`](https://ariakit.org/reference/combobox-list) component directly with [`Focusable`](https://ariakit.org/reference/focusable) props.
20
+
21
+ The [`ComboboxList`](https://ariakit.org/reference/combobox-list) component is no longer focusable and doesn't accept [`Focusable`](https://ariakit.org/reference/focusable) props such as [`autoFocus`](https://ariakit.org/reference/focusable#autofocus), [`disabled`](https://ariakit.org/reference/focusable#disabled), and [`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible) anymore. If you need [Focusable](https://ariakit.org/components/focusable) features specifically on the [`ComboboxList`](https://ariakit.org/reference/combobox-list) component, you can use [composition](https://ariakit.org/guide/composition) to render it as a [`Focusable`](https://ariakit.org/reference/focusable) component.
22
+
23
+ Before:
24
+
25
+ ```jsx
26
+ <ComboboxList disabled />
27
+ ```
28
+
29
+ After:
30
+
31
+ ```jsx
32
+ <ComboboxList render={<Focusable disabled />} />
33
+ ```
34
+
35
+ ### Composite widgets with `grid` role
36
+
37
+ **BREAKING** if you're manually setting the `role="grid"` prop on a composite widget.
38
+
39
+ Ariakit automatically assigns the `role` prop to all composite items to align with the container `role`. For example, if [`SelectPopover`](https://ariakit.org/reference/select-popover) has its role set to `listbox` (which is the default value), its owned [`SelectItem`](https://ariakit.org/reference/select-item) elements will automatically get their role set to `option`.
40
+
41
+ In previous versions, this was also valid for composite widgets with a `grid` role, where the composite item element would automatically be given `role="gridcell"`. This is no longer the case, and you're now required to manually pass `role="gridcell"` to the composite item element if you're rendering a container with `role="grid"`.
42
+
43
+ Before:
44
+
45
+ ```jsx
46
+ <SelectPopover role="grid">
47
+ <SelectRow> {/* Automatically gets role="row" */}
48
+ <SelectItem> {/* Automatically gets role="gridcell" */}
49
+ ```
50
+
51
+ After:
52
+
53
+ ```jsx
54
+ <SelectPopover role="grid">
55
+ <SelectRow> {/* Still gets role="row" */}
56
+ <SelectItem role="gridcell">
57
+ ```
58
+
59
+ This change is due to the possibility of rendering a composite item element with a different role as a child of a static `div` with `role="gridcell"`, which is a valid and frequently used practice when using the `grid` role. As a result, you no longer have to manually adjust the `role` prop on the composite item:
60
+
61
+ ```jsx
62
+ <SelectPopover role="grid">
63
+ <SelectRow>
64
+ <div role="gridcell">
65
+ <SelectItem render={<button />}>
66
+ ```
67
+
68
+ Previously, you had to explicitly pass `role="button"` to the [`SelectItem`](https://ariakit.org/reference/select-item) component above, otherwise it would automatically receive `role="gridcell"`, leading to an invalid accessibility tree.
69
+
70
+ ### Radio types have improved
71
+
72
+ **BREAKING** if you're using TypeScript and the [`onChange`](https://ariakit.org/reference/radio#onchange) prop on [`Radio`](https://ariakit.org/reference/radio), [`FormRadio`](https://ariakit.org/reference/form-radio), or [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio).
73
+
74
+ The [`onChange`](https://ariakit.org/reference/radio#onchange) callback argument type has changed from `React.SyntheticEvent` to `React.ChangeEvent`.
75
+
76
+ Before:
77
+
78
+ ```tsx
79
+ <Radio onChange={(event: React.SyntheticEvent) => {}} />
80
+ ```
81
+
82
+ After:
83
+
84
+ ```tsx
85
+ <Radio onChange={(event: React.ChangeEvent) => {}} />
86
+ ```
87
+
88
+ ### Public data attributes have now boolean values
89
+
90
+ **BREAKING** if you're depending on [data attributes](https://ariakit.org/guide/styling#data-active) to carry an empty string (`""`) value.
91
+
92
+ In previous versions, data attributes such as [`data-active`](https://ariakit.org/guide/styling#data-active), [`data-active-item`](https://ariakit.org/guide/styling#data-active-item), [`data-enter`](https://ariakit.org/guide/styling#data-enter), [`data-leave`](https://ariakit.org/guide/styling#data-leave), and [`data-focus-visible`](https://ariakit.org/guide/styling#data-focus-visible) would carry an empty string (`""`) value when active, and `undefined` when inactive. Now, they have a `true` value when active, but remain `undefined` when inactive.
93
+
94
+ Their use as CSS selectors remains unchanged. You should continue to select them with the attribute selector with no value (e.g., `[data-enter]`). However, if you're employing them in different ways or have snapshot tests that depend on their value, you might need to update your code.
95
+
96
+ ### Removed deprecated features
97
+
98
+ **BREAKING** if you haven't addressed the deprecation warnings from previous releases.
99
+
100
+ This version eliminates features that were deprecated in previous releases: the `backdropProps` and `as` props, as well as the ability to use a render function for the `children` prop across all components.
101
+
102
+ Before:
103
+
104
+ ```jsx
105
+ <Dialog backdropProps={{ className: "backdrop" }} />
106
+ <Combobox as="textarea" />
107
+ <Combobox>
108
+ {(props) => <textarea {...props} />}
109
+ </Combobox>
110
+ ```
111
+
112
+ After:
113
+
114
+ ```jsx
115
+ <Dialog backdrop={<div className="backdrop" />} />
116
+ <Combobox render={<textarea />} />
117
+ <Combobox render={(props) => <textarea {...props} />} />
118
+ ```
119
+
120
+ You can learn more about these new features in the [Composition guide](https://ariakit.org/guide/composition).
121
+
122
+ ### Other updates
123
+
124
+ - Deprecated `MenuBar` in favor of [Menubar](https://ariakit.org/components/menubar) components.
125
+ - The `type` prop for the [Tooltip](https://ariakit.org/components/tooltip) has been deprecated. See [Tooltip anchors must have accessible names](https://ariakit.org/components/tooltip#tooltip-anchors-must-have-accessible-names).
126
+ - Removed the ancestors of open, nested modals from the accessibility tree.
127
+ - Tooltips no longer use `aria-describedby` to associate the tooltip content with the anchor.
128
+ - Added new [`disclosure`](https://ariakit.org/reference/use-disclosure-store#disclosure-1) property to disclosure stores.
129
+ - Updated dependencies: `@ariakit/react-core@0.4.0`
130
+
131
+ ## 0.3.14
132
+
133
+ - Fixed a regression introduced in `v0.3.13` where dialogs wouldn't close when clicking outside on iOS.
134
+ - Updated dependencies: `@ariakit/react-core@0.3.14`
135
+
3
136
  ## 0.3.13
4
137
 
5
138
  ### Improved performance of large collections
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariakit/react",
3
- "version": "0.3.13",
3
+ "version": "0.4.0",
4
4
  "description": "Toolkit for building accessible web apps with React",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "components"
38
38
  ],
39
39
  "dependencies": {
40
- "@ariakit/react-core": "0.3.13"
40
+ "@ariakit/react-core": "0.4.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "^17.0.0 || ^18.0.0",