@ark-ui/react 1.0.0-beta.4 → 1.0.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.
- package/CHANGELOG.md +18 -0
- package/accordion/accordion-context.d.ts +2 -1
- package/accordion/accordion-item-content.cjs +14 -21
- package/accordion/accordion-item-content.d.ts +1 -3
- package/accordion/accordion-item-content.mjs +14 -21
- package/accordion/accordion-item-context.d.ts +2 -2
- package/accordion/accordion-item-trigger.cjs +11 -1
- package/accordion/accordion-item-trigger.mjs +11 -1
- package/accordion/accordion-item.cjs +7 -1
- package/accordion/accordion-item.d.ts +4 -5
- package/accordion/accordion-item.mjs +7 -1
- package/accordion/accordion.cjs +7 -3
- package/accordion/accordion.d.ts +2 -1
- package/accordion/accordion.mjs +7 -3
- package/carousel/carousel.d.ts +4 -5
- package/checkbox/checkbox.cjs +2 -2
- package/checkbox/checkbox.d.ts +4 -5
- package/checkbox/checkbox.mjs +2 -2
- package/color-picker/color-picker-content.cjs +8 -11
- package/color-picker/color-picker-content.d.ts +1 -3
- package/color-picker/color-picker-content.mjs +8 -11
- package/color-picker/color-picker-positioner.cjs +6 -0
- package/color-picker/color-picker-positioner.mjs +6 -0
- package/color-picker/color-picker-view.cjs +29 -0
- package/color-picker/color-picker-view.d.ts +8 -0
- package/color-picker/color-picker-view.mjs +25 -0
- package/color-picker/color-picker.cjs +31 -28
- package/color-picker/color-picker.d.ts +6 -5
- package/color-picker/color-picker.mjs +32 -29
- package/color-picker/index.cjs +3 -1
- package/color-picker/index.d.ts +3 -1
- package/color-picker/index.mjs +3 -1
- package/combobox/combobox-content.cjs +8 -11
- package/combobox/combobox-content.d.ts +1 -3
- package/combobox/combobox-content.mjs +8 -11
- package/combobox/combobox-item.d.ts +6 -4
- package/combobox/combobox-positioner.cjs +6 -0
- package/combobox/combobox-positioner.mjs +6 -0
- package/combobox/combobox.cjs +8 -2
- package/combobox/combobox.d.ts +4 -3
- package/combobox/combobox.mjs +8 -2
- package/date-picker/date-picker-content.cjs +8 -11
- package/date-picker/date-picker-content.d.ts +1 -3
- package/date-picker/date-picker-content.mjs +8 -11
- package/date-picker/date-picker-positioner.cjs +6 -0
- package/date-picker/date-picker-positioner.mjs +6 -0
- package/date-picker/date-picker-view.d.ts +3 -3
- package/date-picker/date-picker.cjs +10 -4
- package/date-picker/date-picker.d.ts +6 -5
- package/date-picker/date-picker.mjs +10 -4
- package/dialog/dialog-backdrop.cjs +8 -11
- package/dialog/dialog-backdrop.d.ts +1 -3
- package/dialog/dialog-backdrop.mjs +8 -11
- package/dialog/dialog-content.cjs +8 -11
- package/dialog/dialog-content.d.ts +1 -3
- package/dialog/dialog-content.mjs +8 -11
- package/dialog/dialog-positioner.cjs +6 -0
- package/dialog/dialog-positioner.mjs +6 -0
- package/dialog/dialog-trigger.cjs +10 -1
- package/dialog/dialog-trigger.mjs +10 -1
- package/dialog/dialog.cjs +8 -3
- package/dialog/dialog.d.ts +4 -6
- package/dialog/dialog.mjs +8 -3
- package/editable/editable.d.ts +4 -5
- package/environment/environment-context.d.ts +1 -1
- package/hover-card/hover-card-content.cjs +8 -11
- package/hover-card/hover-card-content.d.ts +1 -3
- package/hover-card/hover-card-content.mjs +8 -11
- package/hover-card/hover-card-positioner.cjs +6 -0
- package/hover-card/hover-card-positioner.mjs +6 -0
- package/hover-card/hover-card.cjs +8 -3
- package/hover-card/hover-card.d.ts +4 -6
- package/hover-card/hover-card.mjs +8 -3
- package/index.cjs +8 -0
- package/index.mjs +3 -0
- package/menu/menu-content.cjs +8 -11
- package/menu/menu-content.d.ts +1 -3
- package/menu/menu-content.mjs +8 -11
- package/menu/menu-option-item.d.ts +2 -2
- package/menu/menu.cjs +11 -12
- package/menu/menu.d.ts +4 -11
- package/menu/menu.mjs +12 -13
- package/package.json +49 -50
- package/pagination/pagination.d.ts +3 -3
- package/popover/popover-content.cjs +8 -11
- package/popover/popover-content.d.ts +1 -3
- package/popover/popover-content.mjs +8 -11
- package/popover/popover-positioner.cjs +6 -0
- package/popover/popover-positioner.mjs +6 -0
- package/popover/popover-trigger.cjs +10 -1
- package/popover/popover-trigger.mjs +10 -1
- package/popover/popover.cjs +8 -3
- package/popover/popover.d.ts +4 -6
- package/popover/popover.mjs +8 -3
- package/presence/index.cjs +8 -0
- package/presence/index.d.ts +8 -5
- package/presence/index.mjs +3 -0
- package/presence/presence-context.cjs +15 -0
- package/presence/presence-context.d.ts +6 -0
- package/presence/presence-context.mjs +10 -0
- package/presence/presence-props-context.cjs +17 -0
- package/presence/presence-props-context.d.ts +6 -0
- package/presence/presence-props-context.mjs +12 -0
- package/presence/presence.cjs +18 -19
- package/presence/presence.d.ts +6 -21
- package/presence/presence.mjs +19 -20
- package/presence/split-presence-props.d.ts +2 -2
- package/presence/use-presence.cjs +22 -4
- package/presence/use-presence.d.ts +21 -1
- package/presence/use-presence.mjs +20 -2
- package/radio-group/radio-group-item.d.ts +2 -3
- package/rating-group/rating-group-control.d.ts +5 -3
- package/rating-group/rating-group-item.d.ts +4 -5
- package/segment-group/segment-group-item.d.ts +2 -3
- package/segment-group/segment-group.anatomy.d.ts +2 -0
- package/select/select-content.cjs +8 -11
- package/select/select-content.d.ts +1 -3
- package/select/select-content.mjs +8 -11
- package/select/select-item.d.ts +2 -3
- package/select/select-positioner.cjs +6 -0
- package/select/select-positioner.mjs +6 -0
- package/select/select.cjs +8 -2
- package/select/select.d.ts +4 -3
- package/select/select.mjs +8 -2
- package/slider/slider-value-text.cjs +1 -3
- package/slider/slider-value-text.d.ts +3 -6
- package/slider/slider-value-text.mjs +1 -3
- package/slider/slider.d.ts +3 -3
- package/splitter/splitter.d.ts +3 -3
- package/switch/switch.d.ts +3 -3
- package/switch/switch.stories.d.ts +1 -0
- package/tabs/tab-content.cjs +13 -12
- package/tabs/tab-content.d.ts +2 -4
- package/tabs/tab-content.mjs +13 -12
- package/tabs/tabs.cjs +7 -3
- package/tabs/tabs.d.ts +2 -1
- package/tabs/tabs.mjs +7 -3
- package/tags-input/tags-input-item.d.ts +4 -5
- package/tags-input/tags-input.d.ts +3 -3
- package/toast/toast.stories.d.ts +3 -1
- package/tooltip/tooltip-content.cjs +8 -11
- package/tooltip/tooltip-content.d.ts +1 -3
- package/tooltip/tooltip-content.mjs +8 -11
- package/tooltip/tooltip-positioner.cjs +6 -0
- package/tooltip/tooltip-positioner.mjs +6 -0
- package/tooltip/tooltip.cjs +8 -3
- package/tooltip/tooltip.d.ts +4 -4
- package/tooltip/tooltip.mjs +8 -3
- package/types.d.ts +1 -3
- package/use-event.cjs +6 -2
- package/use-event.mjs +6 -2
- package/tabs/tab-presence.cjs +0 -17
- package/tabs/tab-presence.d.ts +0 -6
- package/tabs/tab-presence.mjs +0 -13
- package/use-latest-ref.cjs +0 -14
- package/use-latest-ref.d.ts +0 -3
- package/use-latest-ref.mjs +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,24 @@ description: All notable changes to this project will be documented in this file
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.0.0] - 2023-11-09
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
### Highlights
|
|
14
|
+
|
|
15
|
+
- 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.
|
|
16
|
+
- Breaking changes have been implemented in `Accordion`, `ColorPicker`, `DatePicker`, `Dialog`, `RadioGroup`, `SegmentGroup`, `TagsInput`, `Toast`, and `ToggleGroup` to achieve a consistent and more intuitive API.
|
|
17
|
+
- Resolved various bugs and addressed accessibility issues across all components.
|
|
18
|
+
|
|
19
|
+
### Stability and Support
|
|
20
|
+
|
|
21
|
+
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
|
+
|
|
23
|
+
## [1.0.0-beta.5] - 2023-11-09
|
|
24
|
+
|
|
25
|
+
- Integrate latest `@zag-js` packages
|
|
26
|
+
|
|
9
27
|
## [1.0.0-beta.4] - 2023-10-31
|
|
10
28
|
|
|
11
29
|
### Fixed
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Provider } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
|
+
import type { UsePresenceProps } from '../presence';
|
|
3
4
|
import { type UseAccordionReturn } from './use-accordion';
|
|
4
|
-
export interface AccordionContext extends UseAccordionReturn {
|
|
5
|
+
export interface AccordionContext extends UseAccordionReturn, UsePresenceProps {
|
|
5
6
|
}
|
|
6
7
|
export declare const AccordionProvider: Provider<AccordionContext>, useAccordionContext: () => AccordionContext;
|
|
@@ -7,34 +7,27 @@ 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
|
-
|
|
10
|
+
require('../presence/index.cjs');
|
|
11
11
|
const accordionContext = require('./accordion-context.cjs');
|
|
12
12
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
13
|
-
const
|
|
13
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
14
14
|
|
|
15
15
|
const AccordionItemContent = react.forwardRef(
|
|
16
|
-
|
|
17
|
-
const [presenceProps, localProps] = splitPresenceProps.splitPresenceProps(props);
|
|
18
|
-
const api = accordionContext.useAccordionContext();
|
|
19
|
-
const item = accordionItemContext.useAccordionItemContext();
|
|
20
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
-
index.Presence,
|
|
22
|
-
{
|
|
23
|
-
present: item.isOpen,
|
|
24
|
-
...presenceProps,
|
|
25
|
-
fallback: /* @__PURE__ */ jsxRuntime.jsx("div", { ...api.getItemContentProps(item) }),
|
|
26
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(AccordionInnerContent, { ref, ...localProps })
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
const AccordionInnerContent = react.forwardRef(
|
|
32
|
-
function AccordionInnerContent2(props, ref) {
|
|
16
|
+
(props, ref) => {
|
|
33
17
|
const api = accordionContext.useAccordionContext();
|
|
34
18
|
const accordionItem = accordionItemContext.useAccordionItemContext();
|
|
35
|
-
const
|
|
36
|
-
|
|
19
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
20
|
+
const mergedProps = react$1.mergeProps(
|
|
21
|
+
api.getItemContentProps(accordionItem),
|
|
22
|
+
presenceApi.getPresenceProps(ref),
|
|
23
|
+
props
|
|
24
|
+
);
|
|
25
|
+
if (presenceApi.isUnmounted) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps });
|
|
37
29
|
}
|
|
38
30
|
);
|
|
31
|
+
AccordionItemContent.displayName = "AccordionItemContent";
|
|
39
32
|
|
|
40
33
|
exports.AccordionItemContent = AccordionItemContent;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
|
-
|
|
5
|
-
import type { Assign } from '../types';
|
|
6
|
-
export interface AccordionItemContentProps extends Assign<HTMLArkProps<'div'>, Omit<PresenceProps, 'children' | 'fallback'>> {
|
|
4
|
+
export interface AccordionItemContentProps extends HTMLArkProps<'div'> {
|
|
7
5
|
}
|
|
8
6
|
export declare const AccordionItemContent: ForwardRefExoticComponent<AccordionItemContentProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -3,34 +3,27 @@ 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
|
|
6
|
+
import '../presence/index.mjs';
|
|
7
7
|
import { useAccordionContext } from './accordion-context.mjs';
|
|
8
8
|
import { useAccordionItemContext } from './accordion-item-context.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
10
10
|
|
|
11
11
|
const AccordionItemContent = forwardRef(
|
|
12
|
-
|
|
13
|
-
const [presenceProps, localProps] = splitPresenceProps(props);
|
|
14
|
-
const api = useAccordionContext();
|
|
15
|
-
const item = useAccordionItemContext();
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
Presence,
|
|
18
|
-
{
|
|
19
|
-
present: item.isOpen,
|
|
20
|
-
...presenceProps,
|
|
21
|
-
fallback: /* @__PURE__ */ jsx("div", { ...api.getItemContentProps(item) }),
|
|
22
|
-
children: /* @__PURE__ */ jsx(AccordionInnerContent, { ref, ...localProps })
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
const AccordionInnerContent = forwardRef(
|
|
28
|
-
function AccordionInnerContent2(props, ref) {
|
|
12
|
+
(props, ref) => {
|
|
29
13
|
const api = useAccordionContext();
|
|
30
14
|
const accordionItem = useAccordionItemContext();
|
|
31
|
-
const
|
|
32
|
-
|
|
15
|
+
const presenceApi = usePresenceContext();
|
|
16
|
+
const mergedProps = mergeProps(
|
|
17
|
+
api.getItemContentProps(accordionItem),
|
|
18
|
+
presenceApi.getPresenceProps(ref),
|
|
19
|
+
props
|
|
20
|
+
);
|
|
21
|
+
if (presenceApi.isUnmounted) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps });
|
|
33
25
|
}
|
|
34
26
|
);
|
|
27
|
+
AccordionItemContent.displayName = "AccordionItemContent";
|
|
35
28
|
|
|
36
29
|
export { AccordionItemContent };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Provider } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
|
-
import type { ItemProps
|
|
4
|
-
export interface AccordionItemContext extends ItemProps
|
|
3
|
+
import type { ItemProps } from '@zag-js/accordion';
|
|
4
|
+
export interface AccordionItemContext extends ItemProps {
|
|
5
5
|
}
|
|
6
6
|
export declare const AccordionItemProvider: Provider<AccordionItemContext>, useAccordionItemContext: () => AccordionItemContext;
|
|
@@ -7,14 +7,24 @@ 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 accordionContext = require('./accordion-context.cjs');
|
|
11
12
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
13
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
12
14
|
|
|
13
15
|
const AccordionItemTrigger = react.forwardRef(
|
|
14
16
|
(props, ref) => {
|
|
15
17
|
const api = accordionContext.useAccordionContext();
|
|
16
18
|
const accordionItem = accordionItemContext.useAccordionItemContext();
|
|
17
|
-
const
|
|
19
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
20
|
+
const triggerProps = api.getItemTriggerProps(accordionItem);
|
|
21
|
+
const mergedProps = react$1.mergeProps(
|
|
22
|
+
{
|
|
23
|
+
...triggerProps,
|
|
24
|
+
"aria-controls": presenceApi.isUnmounted ? void 0 : triggerProps["aria-controls"]
|
|
25
|
+
},
|
|
26
|
+
props
|
|
27
|
+
);
|
|
18
28
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
|
|
19
29
|
}
|
|
20
30
|
);
|
|
@@ -3,14 +3,24 @@ 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 { useAccordionContext } from './accordion-context.mjs';
|
|
7
8
|
import { useAccordionItemContext } from './accordion-item-context.mjs';
|
|
9
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
8
10
|
|
|
9
11
|
const AccordionItemTrigger = forwardRef(
|
|
10
12
|
(props, ref) => {
|
|
11
13
|
const api = useAccordionContext();
|
|
12
14
|
const accordionItem = useAccordionItemContext();
|
|
13
|
-
const
|
|
15
|
+
const presenceApi = usePresenceContext();
|
|
16
|
+
const triggerProps = api.getItemTriggerProps(accordionItem);
|
|
17
|
+
const mergedProps = mergeProps(
|
|
18
|
+
{
|
|
19
|
+
...triggerProps,
|
|
20
|
+
"aria-controls": presenceApi.isUnmounted ? void 0 : triggerProps["aria-controls"]
|
|
21
|
+
},
|
|
22
|
+
props
|
|
23
|
+
);
|
|
14
24
|
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
15
25
|
}
|
|
16
26
|
);
|
|
@@ -8,9 +8,13 @@ const react$1 = require('@zag-js/react');
|
|
|
8
8
|
const react = require('react');
|
|
9
9
|
const createSplitProps = require('../create-split-props.cjs');
|
|
10
10
|
const factory = require('../factory.cjs');
|
|
11
|
+
require('../presence/index.cjs');
|
|
11
12
|
const runIfFn = require('../run-if-fn.cjs');
|
|
12
13
|
const accordionContext = require('./accordion-context.cjs');
|
|
13
14
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
15
|
+
const presencePropsContext = require('../presence/presence-props-context.cjs');
|
|
16
|
+
const usePresence = require('../presence/use-presence.cjs');
|
|
17
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
14
18
|
|
|
15
19
|
const AccordionItem = react.forwardRef((props, ref) => {
|
|
16
20
|
const [itemProps, { children, ...localProps }] = createSplitProps.createSplitProps()(props, [
|
|
@@ -21,7 +25,9 @@ const AccordionItem = react.forwardRef((props, ref) => {
|
|
|
21
25
|
const itemState = api.getItemState(itemProps);
|
|
22
26
|
const mergedProps = react$1.mergeProps(api.getItemProps(itemProps), localProps);
|
|
23
27
|
const view = runIfFn.runIfFn(children, itemState);
|
|
24
|
-
|
|
28
|
+
const presenceProps = presencePropsContext.usePresencePropsContext();
|
|
29
|
+
const presenceApi = usePresence.usePresence({ ...presenceProps, present: itemState.isOpen });
|
|
30
|
+
return /* @__PURE__ */ jsxRuntime.jsx(accordionItemContext.AccordionItemProvider, { value: itemProps, children: /* @__PURE__ */ jsxRuntime.jsx(presenceContext.PresenceProvider, { value: presenceApi, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: view }) }) });
|
|
25
31
|
});
|
|
26
32
|
AccordionItem.displayName = "AccordionItem";
|
|
27
33
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
-
/// <reference types="react" />
|
|
3
1
|
import type { ItemProps, ItemState } from '@zag-js/accordion';
|
|
2
|
+
import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
|
|
4
3
|
import { type HTMLArkProps } from '../factory';
|
|
5
4
|
import type { Assign } from '../types';
|
|
6
|
-
export interface AccordionItemProps extends
|
|
7
|
-
children?:
|
|
8
|
-
}
|
|
5
|
+
export interface AccordionItemProps extends Assign<HTMLArkProps<'div'>, {
|
|
6
|
+
children?: ReactNode | ((state: ItemState) => ReactNode);
|
|
7
|
+
}>, ItemProps {
|
|
9
8
|
}
|
|
10
9
|
export declare const AccordionItem: ForwardRefExoticComponent<AccordionItemProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -4,9 +4,13 @@ import { mergeProps } from '@zag-js/react';
|
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { createSplitProps } from '../create-split-props.mjs';
|
|
6
6
|
import { ark } from '../factory.mjs';
|
|
7
|
+
import '../presence/index.mjs';
|
|
7
8
|
import { runIfFn } from '../run-if-fn.mjs';
|
|
8
9
|
import { useAccordionContext } from './accordion-context.mjs';
|
|
9
10
|
import { AccordionItemProvider } from './accordion-item-context.mjs';
|
|
11
|
+
import { usePresencePropsContext } from '../presence/presence-props-context.mjs';
|
|
12
|
+
import { usePresence } from '../presence/use-presence.mjs';
|
|
13
|
+
import { PresenceProvider } from '../presence/presence-context.mjs';
|
|
10
14
|
|
|
11
15
|
const AccordionItem = forwardRef((props, ref) => {
|
|
12
16
|
const [itemProps, { children, ...localProps }] = createSplitProps()(props, [
|
|
@@ -17,7 +21,9 @@ const AccordionItem = forwardRef((props, ref) => {
|
|
|
17
21
|
const itemState = api.getItemState(itemProps);
|
|
18
22
|
const mergedProps = mergeProps(api.getItemProps(itemProps), localProps);
|
|
19
23
|
const view = runIfFn(children, itemState);
|
|
20
|
-
|
|
24
|
+
const presenceProps = usePresencePropsContext();
|
|
25
|
+
const presenceApi = usePresence({ ...presenceProps, present: itemState.isOpen });
|
|
26
|
+
return /* @__PURE__ */ jsx(AccordionItemProvider, { value: itemProps, children: /* @__PURE__ */ jsx(PresenceProvider, { value: presenceApi, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: view }) }) });
|
|
21
27
|
});
|
|
22
28
|
AccordionItem.displayName = "AccordionItem";
|
|
23
29
|
|
package/accordion/accordion.cjs
CHANGED
|
@@ -8,11 +8,15 @@ const react$1 = require('@zag-js/react');
|
|
|
8
8
|
const react = require('react');
|
|
9
9
|
const createSplitProps = require('../create-split-props.cjs');
|
|
10
10
|
const factory = require('../factory.cjs');
|
|
11
|
+
require('../presence/index.cjs');
|
|
11
12
|
const accordionContext = require('./accordion-context.cjs');
|
|
12
13
|
const useAccordion = require('./use-accordion.cjs');
|
|
14
|
+
const splitPresenceProps = require('../presence/split-presence-props.cjs');
|
|
15
|
+
const presencePropsContext = require('../presence/presence-props-context.cjs');
|
|
13
16
|
|
|
14
17
|
const Accordion = react.forwardRef((props, ref) => {
|
|
15
|
-
const [
|
|
18
|
+
const [presenceProps, accordionProps] = splitPresenceProps.splitPresenceProps(props);
|
|
19
|
+
const [useAccordionProps, localProps] = createSplitProps.createSplitProps()(accordionProps, [
|
|
16
20
|
"collapsible",
|
|
17
21
|
"defaultValue",
|
|
18
22
|
"dir",
|
|
@@ -27,8 +31,8 @@ const Accordion = react.forwardRef((props, ref) => {
|
|
|
27
31
|
"value"
|
|
28
32
|
]);
|
|
29
33
|
const api = useAccordion.useAccordion(useAccordionProps);
|
|
30
|
-
const mergedProps = react$1.mergeProps(api.rootProps,
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsx(accordionContext.AccordionProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) });
|
|
34
|
+
const mergedProps = react$1.mergeProps(api.rootProps, localProps);
|
|
35
|
+
return /* @__PURE__ */ jsxRuntime.jsx(accordionContext.AccordionProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(presencePropsContext.PresencePropsProvider, { value: presenceProps, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) }) });
|
|
32
36
|
});
|
|
33
37
|
Accordion.displayName = "Accordion";
|
|
34
38
|
|
package/accordion/accordion.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
import { type UsePresenceProps } from '../presence';
|
|
4
5
|
import type { Assign } from '../types';
|
|
5
6
|
import { type UseAccordionProps } from './use-accordion';
|
|
6
|
-
export interface AccordionProps extends Assign<HTMLArkProps<'div'>, UseAccordionProps
|
|
7
|
+
export interface AccordionProps extends Assign<HTMLArkProps<'div'>, UseAccordionProps>, UsePresenceProps {
|
|
7
8
|
}
|
|
8
9
|
export declare const Accordion: ForwardRefExoticComponent<AccordionProps & RefAttributes<HTMLDivElement>>;
|
package/accordion/accordion.mjs
CHANGED
|
@@ -4,11 +4,15 @@ import { mergeProps } from '@zag-js/react';
|
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import { createSplitProps } from '../create-split-props.mjs';
|
|
6
6
|
import { ark } from '../factory.mjs';
|
|
7
|
+
import '../presence/index.mjs';
|
|
7
8
|
import { AccordionProvider } from './accordion-context.mjs';
|
|
8
9
|
import { useAccordion } from './use-accordion.mjs';
|
|
10
|
+
import { splitPresenceProps } from '../presence/split-presence-props.mjs';
|
|
11
|
+
import { PresencePropsProvider } from '../presence/presence-props-context.mjs';
|
|
9
12
|
|
|
10
13
|
const Accordion = forwardRef((props, ref) => {
|
|
11
|
-
const [
|
|
14
|
+
const [presenceProps, accordionProps] = splitPresenceProps(props);
|
|
15
|
+
const [useAccordionProps, localProps] = createSplitProps()(accordionProps, [
|
|
12
16
|
"collapsible",
|
|
13
17
|
"defaultValue",
|
|
14
18
|
"dir",
|
|
@@ -23,8 +27,8 @@ const Accordion = forwardRef((props, ref) => {
|
|
|
23
27
|
"value"
|
|
24
28
|
]);
|
|
25
29
|
const api = useAccordion(useAccordionProps);
|
|
26
|
-
const mergedProps = mergeProps(api.rootProps,
|
|
27
|
-
return /* @__PURE__ */ jsx(AccordionProvider, { value: api, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });
|
|
30
|
+
const mergedProps = mergeProps(api.rootProps, localProps);
|
|
31
|
+
return /* @__PURE__ */ jsx(AccordionProvider, { value: api, children: /* @__PURE__ */ jsx(PresencePropsProvider, { value: presenceProps, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
28
32
|
});
|
|
29
33
|
Accordion.displayName = "Accordion";
|
|
30
34
|
|
package/carousel/carousel.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { type HTMLArkProps } from '../factory';
|
|
3
3
|
import { type Assign } from '../types';
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}, UseCarouselProps> {
|
|
4
|
+
import { type UseCarouselProps, type UseCarouselReturn } from './use-carousel';
|
|
5
|
+
export interface CarouselProps extends Assign<Assign<HTMLArkProps<'div'>, {
|
|
6
|
+
children?: ReactNode | ((api: UseCarouselReturn) => ReactNode);
|
|
7
|
+
}>, UseCarouselProps> {
|
|
9
8
|
}
|
|
10
9
|
export declare const Carousel: ForwardRefExoticComponent<CarouselProps & RefAttributes<HTMLDivElement>>;
|
package/checkbox/checkbox.cjs
CHANGED
|
@@ -13,7 +13,7 @@ const checkboxContext = require('./checkbox-context.cjs');
|
|
|
13
13
|
const useCheckbox = require('./use-checkbox.cjs');
|
|
14
14
|
|
|
15
15
|
const Checkbox = react.forwardRef((props, ref) => {
|
|
16
|
-
const [useCheckboxProps, { children, ...
|
|
16
|
+
const [useCheckboxProps, { children, ...localProps }] = createSplitProps.createSplitProps()(
|
|
17
17
|
props,
|
|
18
18
|
[
|
|
19
19
|
"checked",
|
|
@@ -32,7 +32,7 @@ const Checkbox = react.forwardRef((props, ref) => {
|
|
|
32
32
|
]
|
|
33
33
|
);
|
|
34
34
|
const api = useCheckbox.useCheckbox(useCheckboxProps);
|
|
35
|
-
const mergedProps = react$1.mergeProps(api.rootProps,
|
|
35
|
+
const mergedProps = react$1.mergeProps(api.rootProps, localProps);
|
|
36
36
|
const view = runIfFn.runIfFn(children, api);
|
|
37
37
|
return /* @__PURE__ */ jsxRuntime.jsx(checkboxContext.CheckboxProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.label, { ...mergedProps, ref, children: view }) });
|
|
38
38
|
});
|
package/checkbox/checkbox.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { type HTMLArkProps } from '../factory';
|
|
3
3
|
import { type Assign } from '../types';
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}>> {
|
|
4
|
+
import { type UseCheckboxProps, type UseCheckboxReturn } from './use-checkbox';
|
|
5
|
+
export interface CheckboxProps extends Assign<Assign<HTMLArkProps<'label'>, {
|
|
6
|
+
children?: ReactNode | ((api: UseCheckboxReturn) => ReactNode);
|
|
7
|
+
}>, UseCheckboxProps> {
|
|
9
8
|
}
|
|
10
9
|
export declare const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLLabelElement>>;
|
package/checkbox/checkbox.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { CheckboxProvider } from './checkbox-context.mjs';
|
|
|
9
9
|
import { useCheckbox } from './use-checkbox.mjs';
|
|
10
10
|
|
|
11
11
|
const Checkbox = forwardRef((props, ref) => {
|
|
12
|
-
const [useCheckboxProps, { children, ...
|
|
12
|
+
const [useCheckboxProps, { children, ...localProps }] = createSplitProps()(
|
|
13
13
|
props,
|
|
14
14
|
[
|
|
15
15
|
"checked",
|
|
@@ -28,7 +28,7 @@ const Checkbox = forwardRef((props, ref) => {
|
|
|
28
28
|
]
|
|
29
29
|
);
|
|
30
30
|
const api = useCheckbox(useCheckboxProps);
|
|
31
|
-
const mergedProps = mergeProps(api.rootProps,
|
|
31
|
+
const mergedProps = mergeProps(api.rootProps, localProps);
|
|
32
32
|
const view = runIfFn(children, api);
|
|
33
33
|
return /* @__PURE__ */ jsx(CheckboxProvider, { value: api, children: /* @__PURE__ */ jsx(ark.label, { ...mergedProps, ref, children: view }) });
|
|
34
34
|
});
|
|
@@ -7,24 +7,21 @@ 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
|
-
|
|
10
|
+
require('../presence/index.cjs');
|
|
11
11
|
const colorPickerContext = require('./color-picker-context.cjs');
|
|
12
|
-
const
|
|
12
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
13
13
|
|
|
14
14
|
const ColorPickerContent = react.forwardRef(
|
|
15
15
|
(props, ref) => {
|
|
16
|
-
const [presenceProps, localProps] = splitPresenceProps.splitPresenceProps(props);
|
|
17
16
|
const api = colorPickerContext.useColorPickerContext();
|
|
18
|
-
|
|
17
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
18
|
+
const mergedProps = react$1.mergeProps(api.contentProps, presenceApi.getPresenceProps(ref), props);
|
|
19
|
+
if (presenceApi.isUnmounted) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps });
|
|
19
23
|
}
|
|
20
24
|
);
|
|
21
25
|
ColorPickerContent.displayName = "ColorPickerContent";
|
|
22
|
-
const ColorPickerInnerContent = react.forwardRef(
|
|
23
|
-
function ColorPickerInnerContent2(props, ref) {
|
|
24
|
-
const api = colorPickerContext.useColorPickerContext();
|
|
25
|
-
const mergedProps = react$1.mergeProps(api.contentProps, props);
|
|
26
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
26
|
|
|
30
27
|
exports.ColorPickerContent = ColorPickerContent;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
|
-
|
|
5
|
-
import type { Assign } from '../types';
|
|
6
|
-
export interface ColorPickerContentProps extends Assign<HTMLArkProps<'div'>, Omit<PresenceProps, 'children' | 'fallback'>> {
|
|
4
|
+
export interface ColorPickerContentProps extends HTMLArkProps<'div'> {
|
|
7
5
|
}
|
|
8
6
|
export declare const ColorPickerContent: ForwardRefExoticComponent<ColorPickerContentProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -3,24 +3,21 @@ 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
|
|
6
|
+
import '../presence/index.mjs';
|
|
7
7
|
import { useColorPickerContext } from './color-picker-context.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
9
9
|
|
|
10
10
|
const ColorPickerContent = forwardRef(
|
|
11
11
|
(props, ref) => {
|
|
12
|
-
const [presenceProps, localProps] = splitPresenceProps(props);
|
|
13
12
|
const api = useColorPickerContext();
|
|
14
|
-
|
|
13
|
+
const presenceApi = usePresenceContext();
|
|
14
|
+
const mergedProps = mergeProps(api.contentProps, presenceApi.getPresenceProps(ref), props);
|
|
15
|
+
if (presenceApi.isUnmounted) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps });
|
|
15
19
|
}
|
|
16
20
|
);
|
|
17
21
|
ColorPickerContent.displayName = "ColorPickerContent";
|
|
18
|
-
const ColorPickerInnerContent = forwardRef(
|
|
19
|
-
function ColorPickerInnerContent2(props, ref) {
|
|
20
|
-
const api = useColorPickerContext();
|
|
21
|
-
const mergedProps = mergeProps(api.contentProps, props);
|
|
22
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
22
|
|
|
26
23
|
export { ColorPickerContent };
|
|
@@ -7,12 +7,18 @@ 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 colorPickerContext = require('./color-picker-context.cjs');
|
|
12
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
11
13
|
|
|
12
14
|
const ColorPickerPositioner = react.forwardRef(
|
|
13
15
|
(props, ref) => {
|
|
14
16
|
const api = colorPickerContext.useColorPickerContext();
|
|
15
17
|
const mergedProps = react$1.mergeProps(api.positionerProps, props);
|
|
18
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
19
|
+
if (presenceApi.isUnmounted) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
16
22
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
17
23
|
}
|
|
18
24
|
);
|
|
@@ -3,12 +3,18 @@ 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 { useColorPickerContext } from './color-picker-context.mjs';
|
|
8
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
7
9
|
|
|
8
10
|
const ColorPickerPositioner = forwardRef(
|
|
9
11
|
(props, ref) => {
|
|
10
12
|
const api = useColorPickerContext();
|
|
11
13
|
const mergedProps = mergeProps(api.positionerProps, props);
|
|
14
|
+
const presenceApi = usePresenceContext();
|
|
15
|
+
if (presenceApi.isUnmounted) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
12
18
|
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
13
19
|
}
|
|
14
20
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const anatomy = require('@ark-ui/anatomy');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const colorPickerContext = require('./color-picker-context.cjs');
|
|
11
|
+
|
|
12
|
+
const ColorPickerView = react.forwardRef((props, ref) => {
|
|
13
|
+
const api = colorPickerContext.useColorPickerContext();
|
|
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";
|
|
28
|
+
|
|
29
|
+
exports.ColorPickerView = ColorPickerView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import type { ColorFormat } from '@zag-js/color-picker';
|
|
4
|
+
import { type HTMLArkProps } from '../factory';
|
|
5
|
+
export interface ColorPickerViewProps extends HTMLArkProps<'div'> {
|
|
6
|
+
format: ColorFormat;
|
|
7
|
+
}
|
|
8
|
+
export declare const ColorPickerView: ForwardRefExoticComponent<ColorPickerViewProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
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';
|
|
6
|
+
import { useColorPickerContext } from './color-picker-context.mjs';
|
|
7
|
+
|
|
8
|
+
const ColorPickerView = forwardRef((props, ref) => {
|
|
9
|
+
const api = useColorPickerContext();
|
|
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";
|
|
24
|
+
|
|
25
|
+
export { ColorPickerView };
|