@ariakit/core 0.4.13 → 0.4.14

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ariakit/core
2
2
 
3
+ ## 0.4.14
4
+
5
+ - Fixed a regression on [Hovercard](https://ariakit.org/components/hovercard) that sometimes prevented it from closing when other popups were opened.
6
+ - Fixed typings for [`onSubmit`](https://ariakit.org/reference/use-form-store#onsubmit) and [`onValidate`](https://ariakit.org/reference/use-form-store#onvalidate).
7
+ - Improved JSDocs.
8
+
3
9
  ## 0.4.13
4
10
 
5
11
  - Fixed the [`item`](https://ariakit.org/reference/use-collection-store#item) method to prevent it from returning items that have been removed from the collection store.
@@ -186,7 +186,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
186
186
  * }
187
187
  * });
188
188
  */
189
- onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => void;
189
+ onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
190
190
  /**
191
191
  * Function that accepts a callback that will be used to submit the form when
192
192
  * [`submit`](https://ariakit.org/reference/use-form-store#submit) is called.
@@ -201,7 +201,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
201
201
  * }
202
202
  * });
203
203
  */
204
- onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => void;
204
+ onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
205
205
  /**
206
206
  * Validates the form.
207
207
  * @example
@@ -186,7 +186,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
186
186
  * }
187
187
  * });
188
188
  */
189
- onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => void;
189
+ onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
190
190
  /**
191
191
  * Function that accepts a callback that will be used to submit the form when
192
192
  * [`submit`](https://ariakit.org/reference/use-form-store#submit) is called.
@@ -201,7 +201,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
201
201
  * }
202
202
  * });
203
203
  */
204
- onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => void;
204
+ onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
205
205
  /**
206
206
  * Validates the form.
207
207
  * @example
@@ -101,7 +101,7 @@ function queueBeforeEvent(element, type, callback, timeout) {
101
101
  function addGlobalEventListener(type, listener, options, scope = window) {
102
102
  const children = [];
103
103
  try {
104
- scope.addEventListener(type, listener, options);
104
+ scope.document.addEventListener(type, listener, options);
105
105
  for (const frame of Array.from(scope.frames)) {
106
106
  children.push(addGlobalEventListener(type, listener, options, frame));
107
107
  }
@@ -109,7 +109,7 @@ function addGlobalEventListener(type, listener, options, scope = window) {
109
109
  }
110
110
  const removeEventListener = () => {
111
111
  try {
112
- scope.removeEventListener(type, listener, options);
112
+ scope.document.removeEventListener(type, listener, options);
113
113
  } catch (e) {
114
114
  }
115
115
  for (const remove of children) {
@@ -186,7 +186,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
186
186
  * }
187
187
  * });
188
188
  */
189
- onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => void;
189
+ onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
190
190
  /**
191
191
  * Function that accepts a callback that will be used to submit the form when
192
192
  * [`submit`](https://ariakit.org/reference/use-form-store#submit) is called.
@@ -201,7 +201,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
201
201
  * }
202
202
  * });
203
203
  */
204
- onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => void;
204
+ onSubmit: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
205
205
  /**
206
206
  * Validates the form.
207
207
  * @example
@@ -102,7 +102,7 @@ function queueBeforeEvent(element, type, callback, timeout) {
102
102
  function addGlobalEventListener(type, listener, options, scope = window) {
103
103
  const children = [];
104
104
  try {
105
- scope.addEventListener(type, listener, options);
105
+ scope.document.addEventListener(type, listener, options);
106
106
  for (const frame of Array.from(scope.frames)) {
107
107
  children.push(addGlobalEventListener(type, listener, options, frame));
108
108
  }
@@ -110,7 +110,7 @@ function addGlobalEventListener(type, listener, options, scope = window) {
110
110
  }
111
111
  const removeEventListener = () => {
112
112
  try {
113
- scope.removeEventListener(type, listener, options);
113
+ scope.document.removeEventListener(type, listener, options);
114
114
  } catch (e) {
115
115
  }
116
116
  for (const remove of children) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariakit/core",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "Ariakit core",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",