@ark-ui/react 1.0.0 → 1.0.1

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
@@ -6,6 +6,16 @@ description: All notable changes to this project will be documented in this file
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.1] - 2023-11-10
10
+
11
+ ### Fixed
12
+
13
+ - Resolved an issue where the `Dialog` component would not animate on exit.
14
+ - Resolved various issues for `Menu` when lazy mounted.
15
+ - Resolved an issue where `MenuTrigger` could still work even when disabled.
16
+ - Resolved an issue where components like `Dialog`, `Popover` etc would not invoke `onExitComplete`
17
+ - Fixed an issue where placement of the `Combobox` could be incorrect when lazy mounted.
18
+
9
19
  ## [1.0.0] - 2023-11-09
10
20
 
11
21
  We are happy to announce the release of `@ark-ui/react@1.0.0`. This release includes a number of breaking changes, new features, and bug fixes. Since our last release over two months ago, we will only highlight some key changes. Please refer to the documentation for each component to learn more.
@@ -20,69 +30,6 @@ We are happy to announce the release of `@ark-ui/react@1.0.0`. This release incl
20
30
 
21
31
  With the release of version 1.0.0, we are moving towards a more stable version of `@ark-ui/react`. Future updates will strive to avoid breaking changes, ensuring a smoother experience for our users. If you encounter any issues while upgrading, please do not hesitate to open an issue on our [GitHub repository](https://github.com/chakra-ui/ark/issues). Your feedback is invaluable in helping us improve.
22
32
 
23
- ## [1.0.0-beta.5] - 2023-11-09
24
-
25
- - Integrate latest `@zag-js` packages
26
-
27
- ## [1.0.0-beta.4] - 2023-10-31
28
-
29
- ### Fixed
30
-
31
- - Resolved an accessibility issue with `Select`
32
-
33
- ## [1.0.0-beta.3] - 2023-10-26
34
-
35
- ### Added
36
-
37
- - Added support to lazy mount the `DatePicker` and `ColorPicker` components using the `Presence` component
38
-
39
- ### Changed
40
-
41
- - Improved accessibility of all disclosure components when lazy mounting is enabled.
42
-
43
- ## [1.0.0-beta.2] - 2023-10-25
44
-
45
- ### Added
46
-
47
- - Added `ValueText` to the `ColorPicker` component
48
-
49
- ### Fixed
50
-
51
- - Added missing data attributes to `DatePickerView` component
52
-
53
- ## [1.0.0-beta.1] - 2023-10-20
54
-
55
- ### Added
56
-
57
- - Parsed `focusedValue` in `DatePicker`
58
-
59
- ### Fixed
60
-
61
- - Resolved an issue with `@ark-ui/anatomy`
62
-
63
- ## [1.0.0-beta.0] - 2023-10-20
64
-
65
- ### Changed
66
-
67
- - Add memoization to `Select` and `Combobox` item collection to improve performance.
68
- - Ensure all event callbacks have a stable reference
69
-
70
- ### Fixed
71
-
72
- - Resolved an issue when controlling the `Editable` component.
73
-
74
- ### Removed
75
-
76
- - Removed anatomy exports. These exports are now available in `@ark-ui/anatomy`.
77
-
78
- ```tsx
79
- // before
80
- import { accordionAnatomy } from '@ark-ui/react'
81
- // after
82
- import { accordionAnatomy } from '@ark-ui/anatomy' // or
83
- import { anatomy } from '@ark-ui/anatomy/accordion'
84
- ```
85
-
86
33
  ## [0.15.0] - 2023-09-14
87
34
 
88
35
  ### Added
@@ -9,16 +9,18 @@ const react = require('react');
9
9
  const factory = require('../factory.cjs');
10
10
  require('../presence/index.cjs');
11
11
  const dialogContext = require('./dialog-context.cjs');
12
- const presenceContext = require('../presence/presence-context.cjs');
12
+ const presencePropsContext = require('../presence/presence-props-context.cjs');
13
+ const usePresence = require('../presence/use-presence.cjs');
13
14
 
14
15
  const DialogBackdrop = react.forwardRef((props, ref) => {
15
16
  const api = dialogContext.useDialogContext();
16
- const presenceApi = presenceContext.usePresenceContext();
17
- const mergedProps = react$1.mergeProps(api.backdropProps, props);
17
+ const presenceProps = presencePropsContext.usePresencePropsContext();
18
+ const presenceApi = usePresence.usePresence({ ...presenceProps, present: api.isOpen });
19
+ const mergedProps = react$1.mergeProps(api.backdropProps, presenceApi.getPresenceProps(ref), props);
18
20
  if (presenceApi.isUnmounted) {
19
21
  return null;
20
22
  }
21
- return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ref, ...mergedProps });
23
+ return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps });
22
24
  });
23
25
  DialogBackdrop.displayName = "DialogBackdrop";
24
26
 
@@ -5,16 +5,18 @@ import { forwardRef } from 'react';
5
5
  import { ark } from '../factory.mjs';
6
6
  import '../presence/index.mjs';
7
7
  import { useDialogContext } from './dialog-context.mjs';
8
- import { usePresenceContext } from '../presence/presence-context.mjs';
8
+ import { usePresencePropsContext } from '../presence/presence-props-context.mjs';
9
+ import { usePresence } from '../presence/use-presence.mjs';
9
10
 
10
11
  const DialogBackdrop = forwardRef((props, ref) => {
11
12
  const api = useDialogContext();
12
- const presenceApi = usePresenceContext();
13
- const mergedProps = mergeProps(api.backdropProps, props);
13
+ const presenceProps = usePresencePropsContext();
14
+ const presenceApi = usePresence({ ...presenceProps, present: api.isOpen });
15
+ const mergedProps = mergeProps(api.backdropProps, presenceApi.getPresenceProps(ref), props);
14
16
  if (presenceApi.isUnmounted) {
15
17
  return null;
16
18
  }
17
- return /* @__PURE__ */ jsx(ark.div, { ref, ...mergedProps });
19
+ return /* @__PURE__ */ jsx(ark.div, { ...mergedProps });
18
20
  });
19
21
  DialogBackdrop.displayName = "DialogBackdrop";
20
22
 
package/dialog/dialog.cjs CHANGED
@@ -11,6 +11,7 @@ const runIfFn = require('../run-if-fn.cjs');
11
11
  const dialogContext = require('./dialog-context.cjs');
12
12
  const useDialog = require('./use-dialog.cjs');
13
13
  const usePresence = require('../presence/use-presence.cjs');
14
+ const presencePropsContext = require('../presence/presence-props-context.cjs');
14
15
  const presenceContext = require('../presence/presence-context.cjs');
15
16
 
16
17
  const Dialog = (props) => {
@@ -18,7 +19,7 @@ const Dialog = (props) => {
18
19
  const api = useDialog.useDialog(localProps);
19
20
  const presenceApi = usePresence.usePresence({ ...presenceProps, present: api.isOpen });
20
21
  const view = runIfFn.runIfFn(children, api);
21
- return /* @__PURE__ */ jsxRuntime.jsx(dialogContext.DialogProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(presenceContext.PresenceProvider, { value: presenceApi, children: view }) });
22
+ return /* @__PURE__ */ jsxRuntime.jsx(dialogContext.DialogProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(presencePropsContext.PresencePropsProvider, { value: presenceProps, children: /* @__PURE__ */ jsxRuntime.jsx(presenceContext.PresenceProvider, { value: presenceApi, children: view }) }) });
22
23
  };
23
24
 
24
25
  exports.Dialog = Dialog;
package/dialog/dialog.mjs CHANGED
@@ -7,6 +7,7 @@ import { runIfFn } from '../run-if-fn.mjs';
7
7
  import { DialogProvider } from './dialog-context.mjs';
8
8
  import { useDialog } from './use-dialog.mjs';
9
9
  import { usePresence } from '../presence/use-presence.mjs';
10
+ import { PresencePropsProvider } from '../presence/presence-props-context.mjs';
10
11
  import { PresenceProvider } from '../presence/presence-context.mjs';
11
12
 
12
13
  const Dialog = (props) => {
@@ -14,7 +15,7 @@ const Dialog = (props) => {
14
15
  const api = useDialog(localProps);
15
16
  const presenceApi = usePresence({ ...presenceProps, present: api.isOpen });
16
17
  const view = runIfFn(children, api);
17
- return /* @__PURE__ */ jsx(DialogProvider, { value: api, children: /* @__PURE__ */ jsx(PresenceProvider, { value: presenceApi, children: view }) });
18
+ return /* @__PURE__ */ jsx(DialogProvider, { value: api, children: /* @__PURE__ */ jsx(PresencePropsProvider, { value: presenceProps, children: /* @__PURE__ */ jsx(PresenceProvider, { value: presenceApi, children: view }) }) });
18
19
  };
19
20
 
20
21
  export { Dialog };
@@ -7,11 +7,17 @@ const jsxRuntime = require('react/jsx-runtime');
7
7
  const react$1 = require('@zag-js/react');
8
8
  const react = require('react');
9
9
  const factory = require('../factory.cjs');
10
+ require('../presence/index.cjs');
10
11
  const menuContext = require('./menu-context.cjs');
12
+ const presenceContext = require('../presence/presence-context.cjs');
11
13
 
12
14
  const MenuPositioner = react.forwardRef((props, ref) => {
13
15
  const api = menuContext.useMenuContext();
14
16
  const mergedProps = react$1.mergeProps(api?.positionerProps ?? {}, props);
17
+ const presenceApi = presenceContext.usePresenceContext();
18
+ if (presenceApi.isUnmounted) {
19
+ return null;
20
+ }
15
21
  return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
16
22
  });
17
23
  MenuPositioner.displayName = "MenuPositioner";
@@ -3,11 +3,17 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { mergeProps } from '@zag-js/react';
4
4
  import { forwardRef } from 'react';
5
5
  import { ark } from '../factory.mjs';
6
+ import '../presence/index.mjs';
6
7
  import { useMenuContext } from './menu-context.mjs';
8
+ import { usePresenceContext } from '../presence/presence-context.mjs';
7
9
 
8
10
  const MenuPositioner = forwardRef((props, ref) => {
9
11
  const api = useMenuContext();
10
12
  const mergedProps = mergeProps(api?.positionerProps ?? {}, props);
13
+ const presenceApi = usePresenceContext();
14
+ if (presenceApi.isUnmounted) {
15
+ return null;
16
+ }
11
17
  return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
12
18
  });
13
19
  MenuPositioner.displayName = "MenuPositioner";
@@ -7,11 +7,20 @@ const jsxRuntime = require('react/jsx-runtime');
7
7
  const react$1 = require('@zag-js/react');
8
8
  const react = require('react');
9
9
  const factory = require('../factory.cjs');
10
+ require('../presence/index.cjs');
10
11
  const menuContext = require('./menu-context.cjs');
12
+ const presenceContext = require('../presence/presence-context.cjs');
11
13
 
12
14
  const MenuTrigger = react.forwardRef((props, ref) => {
13
15
  const api = menuContext.useMenuContext();
14
- const mergedProps = react$1.mergeProps(api?.triggerProps ?? {}, props);
16
+ const presenceApi = presenceContext.usePresenceContext();
17
+ const mergedProps = react$1.mergeProps(
18
+ {
19
+ ...api.triggerProps,
20
+ "aria-controls": presenceApi.isUnmounted ? void 0 : api.triggerProps["aria-controls"]
21
+ },
22
+ props
23
+ );
15
24
  return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
16
25
  });
17
26
  MenuTrigger.displayName = "MenuTrigger";
@@ -3,11 +3,20 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { mergeProps } from '@zag-js/react';
4
4
  import { forwardRef } from 'react';
5
5
  import { ark } from '../factory.mjs';
6
+ import '../presence/index.mjs';
6
7
  import { useMenuContext } from './menu-context.mjs';
8
+ import { usePresenceContext } from '../presence/presence-context.mjs';
7
9
 
8
10
  const MenuTrigger = forwardRef((props, ref) => {
9
11
  const api = useMenuContext();
10
- const mergedProps = mergeProps(api?.triggerProps ?? {}, props);
12
+ const presenceApi = usePresenceContext();
13
+ const mergedProps = mergeProps(
14
+ {
15
+ ...api.triggerProps,
16
+ "aria-controls": presenceApi.isUnmounted ? void 0 : api.triggerProps["aria-controls"]
17
+ },
18
+ props
19
+ );
11
20
  return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
12
21
  });
13
22
  MenuTrigger.displayName = "MenuTrigger";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ark-ui/react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
5
5
  "keywords": [
6
6
  "accordion",
@@ -60,38 +60,38 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@ark-ui/anatomy": "1.0.0",
63
- "@zag-js/accordion": "0.28.0",
64
- "@zag-js/avatar": "0.28.0",
65
- "@zag-js/carousel": "0.28.0",
66
- "@zag-js/checkbox": "0.28.0",
67
- "@zag-js/color-picker": "0.28.0",
68
- "@zag-js/color-utils": "0.28.0",
69
- "@zag-js/combobox": "0.28.0",
70
- "@zag-js/core": "0.28.0",
71
- "@zag-js/date-picker": "0.28.0",
72
- "@zag-js/date-utils": "0.28.0",
73
- "@zag-js/dialog": "0.28.0",
74
- "@zag-js/editable": "0.28.0",
75
- "@zag-js/hover-card": "0.28.0",
76
- "@zag-js/menu": "0.28.0",
77
- "@zag-js/number-input": "0.28.0",
78
- "@zag-js/pagination": "0.28.0",
79
- "@zag-js/pin-input": "0.28.0",
80
- "@zag-js/popover": "0.28.0",
81
- "@zag-js/presence": "0.28.0",
82
- "@zag-js/radio-group": "0.28.0",
83
- "@zag-js/rating-group": "0.28.0",
84
- "@zag-js/react": "0.28.0",
85
- "@zag-js/select": "0.28.0",
86
- "@zag-js/slider": "0.28.0",
87
- "@zag-js/splitter": "0.28.0",
88
- "@zag-js/switch": "0.28.0",
89
- "@zag-js/tabs": "0.28.0",
90
- "@zag-js/tags-input": "0.28.0",
91
- "@zag-js/toast": "0.28.0",
92
- "@zag-js/toggle-group": "0.28.0",
93
- "@zag-js/tooltip": "0.28.0",
94
- "@zag-js/types": "0.28.0"
63
+ "@zag-js/accordion": "0.29.0",
64
+ "@zag-js/avatar": "0.29.0",
65
+ "@zag-js/carousel": "0.29.0",
66
+ "@zag-js/checkbox": "0.29.0",
67
+ "@zag-js/color-picker": "0.29.0",
68
+ "@zag-js/color-utils": "0.29.0",
69
+ "@zag-js/combobox": "0.29.0",
70
+ "@zag-js/core": "0.29.0",
71
+ "@zag-js/date-picker": "0.29.0",
72
+ "@zag-js/date-utils": "0.29.0",
73
+ "@zag-js/dialog": "0.29.0",
74
+ "@zag-js/editable": "0.29.0",
75
+ "@zag-js/hover-card": "0.29.0",
76
+ "@zag-js/menu": "0.29.0",
77
+ "@zag-js/number-input": "0.29.0",
78
+ "@zag-js/pagination": "0.29.0",
79
+ "@zag-js/pin-input": "0.29.0",
80
+ "@zag-js/popover": "0.29.0",
81
+ "@zag-js/presence": "0.29.0",
82
+ "@zag-js/radio-group": "0.29.0",
83
+ "@zag-js/rating-group": "0.29.0",
84
+ "@zag-js/react": "0.29.0",
85
+ "@zag-js/select": "0.29.0",
86
+ "@zag-js/slider": "0.29.0",
87
+ "@zag-js/splitter": "0.29.0",
88
+ "@zag-js/switch": "0.29.0",
89
+ "@zag-js/tabs": "0.29.0",
90
+ "@zag-js/tags-input": "0.29.0",
91
+ "@zag-js/toast": "0.29.0",
92
+ "@zag-js/toggle-group": "0.29.0",
93
+ "@zag-js/tooltip": "0.29.0",
94
+ "@zag-js/types": "0.29.0"
95
95
  },
96
96
  "devDependencies": {
97
97
  "@release-it/keep-a-changelog": "4.0.0",