@ark-ui/react 2.2.1 → 2.2.3
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,19 @@ description: All notable changes to this project will be documented in this file
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.2.3] - 2024-03-05
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Resolved an issue with using `Locale` in Next.js projects.
|
|
14
|
+
- Resolved an issue with `Toast` not updating its toasts and count properties when creating one or more toasts.
|
|
15
|
+
|
|
16
|
+
## [2.2.2] - 2024-02-27
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Resolved an issue that a disabled `Accordion.Item` could still be opened.̊
|
|
21
|
+
|
|
9
22
|
## [2.2.1] - 2024-02-27
|
|
10
23
|
|
|
11
24
|
### Changed
|
|
@@ -8,19 +8,16 @@ const accordion = require('@zag-js/accordion');
|
|
|
8
8
|
const react$1 = require('@zag-js/react');
|
|
9
9
|
const react = require('react');
|
|
10
10
|
const collapsibleRoot = require('../collapsible/collapsible-root.cjs');
|
|
11
|
-
const splitCollapsibleProps = require('../collapsible/split-collapsible-props.cjs');
|
|
12
11
|
const renderStrategy = require('../render-strategy.cjs');
|
|
13
12
|
const runIfFn = require('../run-if-fn.cjs');
|
|
14
13
|
const accordionContext = require('./accordion-context.cjs');
|
|
15
14
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
16
15
|
|
|
17
16
|
const AccordionItem = react.forwardRef((props, ref) => {
|
|
18
|
-
const [
|
|
19
|
-
const [itemProps, { children, ...localProps }] = accordion.splitItemProps(accordionItemProps);
|
|
17
|
+
const [itemProps, { children, ...localProps }] = accordion.splitItemProps(props);
|
|
20
18
|
const api = accordionContext.useAccordionContext();
|
|
21
19
|
const renderStrategyProps = renderStrategy.useRenderStrategyContext();
|
|
22
20
|
const mergedItemProps = react$1.mergeProps(api.getItemProps(itemProps), localProps);
|
|
23
|
-
const mergedCollapsibleProps = react$1.mergeProps(renderStrategyProps, collapsibleProps);
|
|
24
21
|
const itemState = api.getItemState(itemProps);
|
|
25
22
|
const view = runIfFn.runIfFn(children, itemState);
|
|
26
23
|
const itemContentProps = api.getItemContentProps(itemProps);
|
|
@@ -30,8 +27,8 @@ const AccordionItem = react.forwardRef((props, ref) => {
|
|
|
30
27
|
ref,
|
|
31
28
|
open: itemState.isOpen,
|
|
32
29
|
ids: { content: itemContentProps.id },
|
|
30
|
+
...renderStrategyProps,
|
|
33
31
|
...mergedItemProps,
|
|
34
|
-
...mergedCollapsibleProps,
|
|
35
32
|
children: view
|
|
36
33
|
}
|
|
37
34
|
) });
|
|
@@ -4,19 +4,16 @@ import { splitItemProps } from '@zag-js/accordion';
|
|
|
4
4
|
import { mergeProps } from '@zag-js/react';
|
|
5
5
|
import { forwardRef } from 'react';
|
|
6
6
|
import { CollapsibleRoot } from '../collapsible/collapsible-root.mjs';
|
|
7
|
-
import { splitCollapsibleProps } from '../collapsible/split-collapsible-props.mjs';
|
|
8
7
|
import { useRenderStrategyContext } from '../render-strategy.mjs';
|
|
9
8
|
import { runIfFn } from '../run-if-fn.mjs';
|
|
10
9
|
import { useAccordionContext } from './accordion-context.mjs';
|
|
11
10
|
import { AccordionItemProvider } from './accordion-item-context.mjs';
|
|
12
11
|
|
|
13
12
|
const AccordionItem = forwardRef((props, ref) => {
|
|
14
|
-
const [
|
|
15
|
-
const [itemProps, { children, ...localProps }] = splitItemProps(accordionItemProps);
|
|
13
|
+
const [itemProps, { children, ...localProps }] = splitItemProps(props);
|
|
16
14
|
const api = useAccordionContext();
|
|
17
15
|
const renderStrategyProps = useRenderStrategyContext();
|
|
18
16
|
const mergedItemProps = mergeProps(api.getItemProps(itemProps), localProps);
|
|
19
|
-
const mergedCollapsibleProps = mergeProps(renderStrategyProps, collapsibleProps);
|
|
20
17
|
const itemState = api.getItemState(itemProps);
|
|
21
18
|
const view = runIfFn(children, itemState);
|
|
22
19
|
const itemContentProps = api.getItemContentProps(itemProps);
|
|
@@ -26,8 +23,8 @@ const AccordionItem = forwardRef((props, ref) => {
|
|
|
26
23
|
ref,
|
|
27
24
|
open: itemState.isOpen,
|
|
28
25
|
ids: { content: itemContentProps.id },
|
|
26
|
+
...renderStrategyProps,
|
|
29
27
|
...mergedItemProps,
|
|
30
|
-
...mergedCollapsibleProps,
|
|
31
28
|
children: view
|
|
32
29
|
}
|
|
33
30
|
) });
|
package/locale/locale.cjs
CHANGED
package/locale/locale.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/react",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accordion",
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"@testing-library/react": "14.2.1",
|
|
118
118
|
"@testing-library/user-event": "14.5.2",
|
|
119
119
|
"@types/jsdom": "21.1.6",
|
|
120
|
-
"@types/react": "18.2.
|
|
120
|
+
"@types/react": "18.2.61",
|
|
121
121
|
"@types/react-dom": "18.2.19",
|
|
122
122
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
123
|
-
"@typescript-eslint/eslint-plugin": "7.0
|
|
124
|
-
"@typescript-eslint/parser": "7.0
|
|
123
|
+
"@typescript-eslint/eslint-plugin": "7.1.0",
|
|
124
|
+
"@typescript-eslint/parser": "7.1.0",
|
|
125
125
|
"@vitejs/plugin-react": "4.2.1",
|
|
126
126
|
"@vitest/coverage-v8": "1.3.1",
|
|
127
127
|
"eslint": "8.57.0",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"react": "18.2.0",
|
|
135
135
|
"react-dom": "18.2.0",
|
|
136
136
|
"react-frame-component": "5.2.6",
|
|
137
|
-
"react-hook-form": "7.
|
|
137
|
+
"react-hook-form": "7.51.0",
|
|
138
138
|
"release-it": "17.1.1",
|
|
139
139
|
"resize-observer-polyfill": "1.5.1",
|
|
140
140
|
"storybook": "7.6.17",
|
package/toast/create-toaster.cjs
CHANGED
|
@@ -34,6 +34,9 @@ const createToaster = (props) => {
|
|
|
34
34
|
const { placement, ...rest } = props;
|
|
35
35
|
const service = toast__namespace.group.machine({ id: "1", placement, ...rest }).start();
|
|
36
36
|
let api = toast__namespace.group.connect(service.getState(), service.send, react.normalizeProps);
|
|
37
|
+
const subscribe = (fn) => {
|
|
38
|
+
return service.subscribe((state) => fn(state.context.toasts));
|
|
39
|
+
};
|
|
37
40
|
const Toaster = react$1.forwardRef((props2, ref) => {
|
|
38
41
|
const getRootNode = environmentContext.useEnvironmentContext();
|
|
39
42
|
const [state, send] = react.useActor(service);
|
|
@@ -47,7 +50,7 @@ const createToaster = (props) => {
|
|
|
47
50
|
return /* @__PURE__ */ jsxRuntime.jsx(toastGroup.ToastGroup, { ...mergedProps, ref, children: toasts.map((toast2) => /* @__PURE__ */ jsxRuntime.jsx(ToastProviderFactory, { service: toast2 }, toast2.id)) });
|
|
48
51
|
});
|
|
49
52
|
Toaster.displayName = "ToastGroup";
|
|
50
|
-
return [Toaster, api];
|
|
53
|
+
return [Toaster, Object.assign(api, { subscribe })];
|
|
51
54
|
};
|
|
52
55
|
const ToastProviderFactory = (props) => {
|
|
53
56
|
const [state, send] = react.useActor(props.service);
|
package/toast/create-toaster.mjs
CHANGED
|
@@ -11,6 +11,9 @@ const createToaster = (props) => {
|
|
|
11
11
|
const { placement, ...rest } = props;
|
|
12
12
|
const service = toast.group.machine({ id: "1", placement, ...rest }).start();
|
|
13
13
|
let api = toast.group.connect(service.getState(), service.send, normalizeProps);
|
|
14
|
+
const subscribe = (fn) => {
|
|
15
|
+
return service.subscribe((state) => fn(state.context.toasts));
|
|
16
|
+
};
|
|
14
17
|
const Toaster = forwardRef((props2, ref) => {
|
|
15
18
|
const getRootNode = useEnvironmentContext();
|
|
16
19
|
const [state, send] = useActor(service);
|
|
@@ -24,7 +27,7 @@ const createToaster = (props) => {
|
|
|
24
27
|
return /* @__PURE__ */ jsx(ToastGroup, { ...mergedProps, ref, children: toasts.map((toast2) => /* @__PURE__ */ jsx(ToastProviderFactory, { service: toast2 }, toast2.id)) });
|
|
25
28
|
});
|
|
26
29
|
Toaster.displayName = "ToastGroup";
|
|
27
|
-
return [Toaster, api];
|
|
30
|
+
return [Toaster, Object.assign(api, { subscribe })];
|
|
28
31
|
};
|
|
29
32
|
const ToastProviderFactory = (props) => {
|
|
30
33
|
const [state, send] = useActor(props.service);
|