@ark-ui/react 1.0.0-beta.5 → 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,68 +6,29 @@ description: All notable changes to this project will be documented in this file
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [1.0.0-beta.5] - 2023-11-09
10
-
11
- - Integrate latest `@zag-js` packages
12
-
13
- ## [1.0.0-beta.4] - 2023-10-31
9
+ ## [1.0.1] - 2023-11-10
14
10
 
15
11
  ### Fixed
16
12
 
17
- - Resolved an accessibility issue with `Select`
18
-
19
- ## [1.0.0-beta.3] - 2023-10-26
20
-
21
- ### Added
22
-
23
- - Added support to lazy mount the `DatePicker` and `ColorPicker` components using the `Presence` component
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.
24
18
 
25
- ### Changed
19
+ ## [1.0.0] - 2023-11-09
26
20
 
27
- - Improved accessibility of all disclosure components when lazy mounting is enabled.
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.
28
22
 
29
- ## [1.0.0-beta.2] - 2023-10-25
23
+ ### Highlights
30
24
 
31
- ### Added
32
-
33
- - Added `ValueText` to the `ColorPicker` component
34
-
35
- ### Fixed
36
-
37
- - Added missing data attributes to `DatePickerView` component
38
-
39
- ## [1.0.0-beta.1] - 2023-10-20
40
-
41
- ### Added
25
+ - Revised the `Presence` component: `lazyMount` and `unmountOnExit` have been added at the root level. For some disclosure components like `Tabs` and `Accordion`, this constitutes a breaking change.
26
+ - Breaking changes have been implemented in `Accordion`, `ColorPicker`, `DatePicker`, `Dialog`, `RadioGroup`, `SegmentGroup`, `TagsInput`, `Toast`, and `ToggleGroup` to achieve a consistent and more intuitive API.
27
+ - Resolved various bugs and addressed accessibility issues across all components.
42
28
 
43
- - Parsed `focusedValue` in `DatePicker`
29
+ ### Stability and Support
44
30
 
45
- ### Fixed
46
-
47
- - Resolved an issue with `@ark-ui/anatomy`
48
-
49
- ## [1.0.0-beta.0] - 2023-10-20
50
-
51
- ### Changed
52
-
53
- - Add memoization to `Select` and `Combobox` item collection to improve performance.
54
- - Ensure all event callbacks have a stable reference
55
-
56
- ### Fixed
57
-
58
- - Resolved an issue when controlling the `Editable` component.
59
-
60
- ### Removed
61
-
62
- - Removed anatomy exports. These exports are now available in `@ark-ui/anatomy`.
63
-
64
- ```tsx
65
- // before
66
- import { accordionAnatomy } from '@ark-ui/react'
67
- // after
68
- import { accordionAnatomy } from '@ark-ui/anatomy' // or
69
- import { anatomy } from '@ark-ui/anatomy/accordion'
70
- ```
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.
71
32
 
72
33
  ## [0.15.0] - 2023-09-14
73
34
 
@@ -4,12 +4,26 @@
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5
5
 
6
6
  const jsxRuntime = require('react/jsx-runtime');
7
- require('react');
7
+ const anatomy = require('@ark-ui/anatomy');
8
+ const react = require('react');
9
+ const factory = require('../factory.cjs');
8
10
  const colorPickerContext = require('./color-picker-context.cjs');
9
11
 
10
- const ColorPickerView = (props) => {
12
+ const ColorPickerView = react.forwardRef((props, ref) => {
11
13
  const api = colorPickerContext.useColorPickerContext();
12
- return api.format === props.format ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children }) : null;
13
- };
14
+ if (api.format !== props.format) {
15
+ return null;
16
+ }
17
+ return /* @__PURE__ */ jsxRuntime.jsx(
18
+ factory.ark.div,
19
+ {
20
+ ref,
21
+ "data-format": props.format,
22
+ ...anatomy.colorPickerAnatomy.build().view.attrs,
23
+ ...props
24
+ }
25
+ );
26
+ });
27
+ ColorPickerView.displayName = "ColorPickerView";
14
28
 
15
29
  exports.ColorPickerView = ColorPickerView;
@@ -1,7 +1,8 @@
1
- import { JSX } from 'react/jsx-runtime';
1
+ import { ForwardRefExoticComponent, RefAttributes } from 'react';
2
+ /// <reference types="react" />
2
3
  import type { ColorFormat } from '@zag-js/color-picker';
3
- import { type PropsWithChildren } from 'react';
4
- export interface ColorPickerViewProps extends PropsWithChildren {
4
+ import { type HTMLArkProps } from '../factory';
5
+ export interface ColorPickerViewProps extends HTMLArkProps<'div'> {
5
6
  format: ColorFormat;
6
7
  }
7
- export declare const ColorPickerView: (props: ColorPickerViewProps) => JSX.Element | null;
8
+ export declare const ColorPickerView: ForwardRefExoticComponent<ColorPickerViewProps & RefAttributes<HTMLDivElement>>;
@@ -1,11 +1,25 @@
1
1
  'use client';
2
- import { jsx, Fragment } from 'react/jsx-runtime';
3
- import 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { colorPickerAnatomy } from '@ark-ui/anatomy';
4
+ import { forwardRef } from 'react';
5
+ import { ark } from '../factory.mjs';
4
6
  import { useColorPickerContext } from './color-picker-context.mjs';
5
7
 
6
- const ColorPickerView = (props) => {
8
+ const ColorPickerView = forwardRef((props, ref) => {
7
9
  const api = useColorPickerContext();
8
- return api.format === props.format ? /* @__PURE__ */ jsx(Fragment, { children: props.children }) : null;
9
- };
10
+ if (api.format !== props.format) {
11
+ return null;
12
+ }
13
+ return /* @__PURE__ */ jsx(
14
+ ark.div,
15
+ {
16
+ ref,
17
+ "data-format": props.format,
18
+ ...colorPickerAnatomy.build().view.attrs,
19
+ ...props
20
+ }
21
+ );
22
+ });
23
+ ColorPickerView.displayName = "ColorPickerView";
10
24
 
11
25
  export { ColorPickerView };
@@ -1,4 +1,3 @@
1
- import { JSX } from 'react/jsx-runtime';
2
1
  import { ForwardRefExoticComponent, RefAttributes } from 'react';
3
2
  /// <reference types="react" />
4
3
  import { type ColorPickerProps } from './color-picker';
@@ -44,7 +43,7 @@ declare const ColorPicker: ForwardRefExoticComponent<ColorPickerProps & RefAttri
44
43
  TransparencyGrid: ForwardRefExoticComponent<ColorPickerTransparencyGridProps & RefAttributes<HTMLDivElement>>;
45
44
  Trigger: ForwardRefExoticComponent<ColorPickerTriggerProps & RefAttributes<HTMLButtonElement>>;
46
45
  ValueText: ForwardRefExoticComponent<ColorPickerValueTextProps & RefAttributes<HTMLDivElement>>;
47
- View: (props: ColorPickerViewProps) => JSX.Element | null;
46
+ View: ForwardRefExoticComponent<ColorPickerViewProps & RefAttributes<HTMLDivElement>>;
48
47
  };
49
48
  export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, useColorPickerAreaContext, useColorPickerChannelSliderContext, useColorPickerContext, };
50
49
  export type { ColorPickerAreaBackgroundProps, ColorPickerAreaContext, ColorPickerAreaProps, ColorPickerAreaThumbProps, ColorPickerChannelInputProps, ColorPickerChannelSliderContext, ColorPickerChannelSliderProps, ColorPickerChannelSliderThumbProps, ColorPickerChannelSliderTrackProps, ColorPickerContentProps, ColorPickerContext, ColorPickerControlProps, ColorPickerEyeDropperTriggerProps, ColorPickerLabelProps, ColorPickerPositionerProps, ColorPickerProps, ColorPickerSwatchGroupProps, ColorPickerSwatchProps, ColorPickerSwatchTriggerProps, ColorPickerTransparencyGridProps, ColorPickerTriggerProps, ColorPickerValueTextProps, ColorPickerViewProps, };
@@ -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-beta.5",
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",
@@ -59,40 +59,39 @@
59
59
  "release-it": "release-it --config ../../../release-it.json"
60
60
  },
61
61
  "dependencies": {
62
- "@ark-ui/anatomy": "1.0.0-beta.1",
63
- "@zag-js/accordion": "0.28.0",
64
- "@zag-js/anatomy": "0.28.0",
65
- "@zag-js/avatar": "0.28.0",
66
- "@zag-js/carousel": "0.28.0",
67
- "@zag-js/checkbox": "0.28.0",
68
- "@zag-js/color-picker": "0.28.0",
69
- "@zag-js/color-utils": "0.28.0",
70
- "@zag-js/combobox": "0.28.0",
71
- "@zag-js/core": "0.28.0",
72
- "@zag-js/date-picker": "0.28.0",
73
- "@zag-js/date-utils": "0.28.0",
74
- "@zag-js/dialog": "0.28.0",
75
- "@zag-js/editable": "0.28.0",
76
- "@zag-js/hover-card": "0.28.0",
77
- "@zag-js/menu": "0.28.0",
78
- "@zag-js/number-input": "0.28.0",
79
- "@zag-js/pagination": "0.28.0",
80
- "@zag-js/pin-input": "0.28.0",
81
- "@zag-js/popover": "0.28.0",
82
- "@zag-js/presence": "0.28.0",
83
- "@zag-js/radio-group": "0.28.0",
84
- "@zag-js/rating-group": "0.28.0",
85
- "@zag-js/react": "0.28.0",
86
- "@zag-js/select": "0.28.0",
87
- "@zag-js/slider": "0.28.0",
88
- "@zag-js/splitter": "0.28.0",
89
- "@zag-js/switch": "0.28.0",
90
- "@zag-js/tabs": "0.28.0",
91
- "@zag-js/tags-input": "0.28.0",
92
- "@zag-js/toast": "0.28.0",
93
- "@zag-js/toggle-group": "0.28.0",
94
- "@zag-js/tooltip": "0.28.0",
95
- "@zag-js/types": "0.28.0"
62
+ "@ark-ui/anatomy": "1.0.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"
96
95
  },
97
96
  "devDependencies": {
98
97
  "@release-it/keep-a-changelog": "4.0.0",
@@ -0,0 +1,2 @@
1
+ import { type AnatomyPart } from '@ark-ui/anatomy';
2
+ export declare const parts: Record<'root' | 'label' | 'item' | 'itemText' | 'itemControl' | 'indicator', AnatomyPart>;