@ark-ui/react 2.1.1 → 2.2.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 +53 -0
- package/accordion/accordion-context.d.ts +1 -2
- package/accordion/accordion-item-content.cjs +4 -12
- package/accordion/accordion-item-content.mjs +4 -12
- package/accordion/accordion-item-trigger.cjs +3 -3
- package/accordion/accordion-item-trigger.mjs +3 -3
- package/accordion/accordion-item.cjs +21 -13
- package/accordion/accordion-item.d.ts +4 -3
- package/accordion/accordion-item.mjs +21 -13
- package/accordion/accordion-root.cjs +3 -4
- package/accordion/accordion-root.d.ts +2 -2
- package/accordion/accordion-root.mjs +3 -4
- package/clipboard/clipboard-indicator.cjs +1 -1
- package/clipboard/clipboard-indicator.mjs +1 -1
- package/collapsible/collapsible-content.cjs +24 -0
- package/collapsible/collapsible-content.d.ts +6 -0
- package/collapsible/collapsible-content.mjs +20 -0
- package/collapsible/collapsible-context.cjs +15 -0
- package/collapsible/collapsible-context.d.ts +6 -0
- package/collapsible/collapsible-context.mjs +10 -0
- package/collapsible/collapsible-root.cjs +22 -0
- package/collapsible/collapsible-root.d.ts +8 -0
- package/collapsible/collapsible-root.mjs +18 -0
- package/collapsible/collapsible-trigger.cjs +21 -0
- package/collapsible/collapsible-trigger.d.ts +6 -0
- package/collapsible/collapsible-trigger.mjs +17 -0
- package/collapsible/collapsible.cjs +13 -0
- package/collapsible/collapsible.d.ts +4 -0
- package/collapsible/collapsible.mjs +3 -0
- package/collapsible/index.cjs +17 -0
- package/collapsible/index.d.ts +8 -0
- package/collapsible/index.mjs +6 -0
- package/collapsible/split-collapsible-props.cjs +22 -0
- package/collapsible/split-collapsible-props.d.ts +2 -0
- package/collapsible/split-collapsible-props.mjs +18 -0
- package/collapsible/use-collapsible.cjs +55 -0
- package/collapsible/use-collapsible.d.ts +17 -0
- package/collapsible/use-collapsible.mjs +32 -0
- package/dialog/dialog-backdrop.cjs +3 -3
- package/dialog/dialog-backdrop.mjs +3 -3
- package/dialog/dialog-root.cjs +3 -2
- package/dialog/dialog-root.mjs +3 -2
- package/factory.cjs +16 -12
- package/factory.mjs +17 -13
- package/index.cjs +10 -3
- package/index.d.ts +1 -0
- package/index.mjs +6 -1
- package/menu/menu-item-group.d.ts +2 -2
- package/package.json +61 -54
- package/presence/index.cjs +0 -3
- package/presence/index.d.ts +2 -3
- package/presence/index.mjs +0 -1
- package/presence/split-presence-props.cjs +6 -8
- package/presence/split-presence-props.d.ts +1 -1
- package/presence/split-presence-props.mjs +6 -8
- package/presence/use-presence.d.ts +2 -11
- package/render-strategy.cjs +18 -0
- package/render-strategy.d.ts +16 -0
- package/render-strategy.mjs +12 -0
- package/splitter/splitter-root.cjs +0 -1
- package/splitter/splitter-root.mjs +0 -1
- package/splitter/use-splitter.cjs +1 -2
- package/splitter/use-splitter.mjs +1 -2
- package/tabs/tab-content.cjs +3 -3
- package/tabs/tab-content.mjs +3 -3
- package/tabs/tabs-root.cjs +3 -4
- package/tabs/tabs-root.d.ts +2 -2
- package/tabs/tabs-root.mjs +3 -4
- package/toast/create-toaster.d.ts +2 -1
- package/tree-view/tree-view-branch-indicator.cjs +1 -7
- package/tree-view/tree-view-branch-indicator.mjs +1 -7
- package/tree-view/tree-view-root.cjs +2 -1
- package/tree-view/tree-view-root.mjs +2 -1
- package/tree-view/use-tree-view.cjs +2 -2
- package/tree-view/use-tree-view.d.ts +6 -2
- package/tree-view/use-tree-view.mjs +2 -2
- package/presence/presence-props-context.cjs +0 -17
- package/presence/presence-props-context.d.ts +0 -6
- package/presence/presence-props-context.mjs +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,59 @@ description: All notable changes to this project will be documented in this file
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.2.1] - 2024-02-27
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Updated to latest `@ark-ui/anatomy` version.
|
|
14
|
+
|
|
15
|
+
## [2.2.0] - 2024-02-27
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Added `Collapsible` component.
|
|
20
|
+
- Added support for `defaultExpandedIds` in the `TreeView` component.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Enhanced the performance of the Ark `factory` by utilizing `memo` to avoid unnecessary re-renders.
|
|
25
|
+
- Integrated `Collapsible` into `Accordion`, allowing the `Accordion` component to utilize `Collapsible` for animating the opening and closing of content.d
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
@keyframes slideDown {
|
|
29
|
+
from {
|
|
30
|
+
height: 0;
|
|
31
|
+
}
|
|
32
|
+
to {
|
|
33
|
+
height: var(--height);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes slideUp {
|
|
38
|
+
from {
|
|
39
|
+
height: var(--height);
|
|
40
|
+
}
|
|
41
|
+
to {
|
|
42
|
+
height: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[data-scope='accordion'][data-part='item-content'][data-state='open'] {
|
|
47
|
+
animation: slideDown 250ms;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[data-scope='accordion'][data-part='item-content'][data-state='closed'] {
|
|
51
|
+
animation: slideUp 200ms;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Updated the return type of `createToaster` for comprehensive IntelliSense support when styling the `Toaster` component.
|
|
58
|
+
- Revised `TreeView` to utilize `defaultSelectedIds` instead of `defaultFocusedId`.
|
|
59
|
+
- Resolved an issue with using `factory` in Next.js projects.
|
|
60
|
+
- Fixed a bug where the disabled `Tooltip` would flash upon hovering and clicking the trigger.
|
|
61
|
+
|
|
9
62
|
## [2.1.1] - 2024-02-14
|
|
10
63
|
|
|
11
64
|
### Fixed
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Provider } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
|
-
import type { UsePresenceProps } from '../presence';
|
|
4
3
|
import { type UseAccordionReturn } from './use-accordion';
|
|
5
|
-
export interface AccordionContext extends UseAccordionReturn
|
|
4
|
+
export interface AccordionContext extends UseAccordionReturn {
|
|
6
5
|
}
|
|
7
6
|
export declare const AccordionProvider: Provider<AccordionContext>, useAccordionContext: () => AccordionContext;
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
const react$1 = require('@zag-js/react');
|
|
8
8
|
const react = require('react');
|
|
9
|
-
const
|
|
10
|
-
const presenceContext = require('../presence/presence-context.cjs');
|
|
9
|
+
const collapsibleContent = require('../collapsible/collapsible-content.cjs');
|
|
11
10
|
const accordionContext = require('./accordion-context.cjs');
|
|
12
11
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
13
12
|
|
|
@@ -15,16 +14,9 @@ const AccordionItemContent = react.forwardRef(
|
|
|
15
14
|
(props, ref) => {
|
|
16
15
|
const api = accordionContext.useAccordionContext();
|
|
17
16
|
const accordionItem = accordionItemContext.useAccordionItemContext();
|
|
18
|
-
const
|
|
19
|
-
const mergedProps = react$1.mergeProps(
|
|
20
|
-
|
|
21
|
-
presenceApi.getPresenceProps(ref),
|
|
22
|
-
props
|
|
23
|
-
);
|
|
24
|
-
if (presenceApi.isUnmounted) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps });
|
|
17
|
+
const { hidden: _, ...itemContentProps } = api.getItemContentProps(accordionItem);
|
|
18
|
+
const mergedProps = react$1.mergeProps(itemContentProps, props);
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(collapsibleContent.CollapsibleContent, { ref, ...mergedProps });
|
|
28
20
|
}
|
|
29
21
|
);
|
|
30
22
|
AccordionItemContent.displayName = "AccordionItemContent";
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { mergeProps } from '@zag-js/react';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
5
|
+
import { CollapsibleContent } from '../collapsible/collapsible-content.mjs';
|
|
7
6
|
import { useAccordionContext } from './accordion-context.mjs';
|
|
8
7
|
import { useAccordionItemContext } from './accordion-item-context.mjs';
|
|
9
8
|
|
|
@@ -11,16 +10,9 @@ const AccordionItemContent = forwardRef(
|
|
|
11
10
|
(props, ref) => {
|
|
12
11
|
const api = useAccordionContext();
|
|
13
12
|
const accordionItem = useAccordionItemContext();
|
|
14
|
-
const
|
|
15
|
-
const mergedProps = mergeProps(
|
|
16
|
-
|
|
17
|
-
presenceApi.getPresenceProps(ref),
|
|
18
|
-
props
|
|
19
|
-
);
|
|
20
|
-
if (presenceApi.isUnmounted) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps });
|
|
13
|
+
const { hidden: _, ...itemContentProps } = api.getItemContentProps(accordionItem);
|
|
14
|
+
const mergedProps = mergeProps(itemContentProps, props);
|
|
15
|
+
return /* @__PURE__ */ jsx(CollapsibleContent, { ref, ...mergedProps });
|
|
24
16
|
}
|
|
25
17
|
);
|
|
26
18
|
AccordionItemContent.displayName = "AccordionItemContent";
|
|
@@ -6,21 +6,21 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
const react$1 = require('@zag-js/react');
|
|
8
8
|
const react = require('react');
|
|
9
|
+
const collapsibleContext = require('../collapsible/collapsible-context.cjs');
|
|
9
10
|
const factory = require('../factory.cjs');
|
|
10
|
-
const presenceContext = require('../presence/presence-context.cjs');
|
|
11
11
|
const accordionContext = require('./accordion-context.cjs');
|
|
12
12
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
13
13
|
|
|
14
14
|
const AccordionItemTrigger = react.forwardRef(
|
|
15
15
|
(props, ref) => {
|
|
16
16
|
const api = accordionContext.useAccordionContext();
|
|
17
|
+
const collapsible = collapsibleContext.useCollapsibleContext();
|
|
17
18
|
const accordionItem = accordionItemContext.useAccordionItemContext();
|
|
18
|
-
const presenceApi = presenceContext.usePresenceContext();
|
|
19
19
|
const triggerProps = api.getItemTriggerProps(accordionItem);
|
|
20
20
|
const mergedProps = react$1.mergeProps(
|
|
21
21
|
{
|
|
22
22
|
...triggerProps,
|
|
23
|
-
"aria-controls":
|
|
23
|
+
"aria-controls": collapsible.isUnmounted ? void 0 : triggerProps["aria-controls"]
|
|
24
24
|
},
|
|
25
25
|
props
|
|
26
26
|
);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { mergeProps } from '@zag-js/react';
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
|
+
import { useCollapsibleContext } from '../collapsible/collapsible-context.mjs';
|
|
5
6
|
import { ark } from '../factory.mjs';
|
|
6
|
-
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
7
7
|
import { useAccordionContext } from './accordion-context.mjs';
|
|
8
8
|
import { useAccordionItemContext } from './accordion-item-context.mjs';
|
|
9
9
|
|
|
10
10
|
const AccordionItemTrigger = forwardRef(
|
|
11
11
|
(props, ref) => {
|
|
12
12
|
const api = useAccordionContext();
|
|
13
|
+
const collapsible = useCollapsibleContext();
|
|
13
14
|
const accordionItem = useAccordionItemContext();
|
|
14
|
-
const presenceApi = usePresenceContext();
|
|
15
15
|
const triggerProps = api.getItemTriggerProps(accordionItem);
|
|
16
16
|
const mergedProps = mergeProps(
|
|
17
17
|
{
|
|
18
18
|
...triggerProps,
|
|
19
|
-
"aria-controls":
|
|
19
|
+
"aria-controls": collapsible.isUnmounted ? void 0 : triggerProps["aria-controls"]
|
|
20
20
|
},
|
|
21
21
|
props
|
|
22
22
|
);
|
|
@@ -4,29 +4,37 @@
|
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
5
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
const accordion = require('@zag-js/accordion');
|
|
7
8
|
const react$1 = require('@zag-js/react');
|
|
8
9
|
const react = require('react');
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const presencePropsContext = require('../presence/presence-props-context.cjs');
|
|
13
|
-
const usePresence = require('../presence/use-presence.cjs');
|
|
10
|
+
const collapsibleRoot = require('../collapsible/collapsible-root.cjs');
|
|
11
|
+
const splitCollapsibleProps = require('../collapsible/split-collapsible-props.cjs');
|
|
12
|
+
const renderStrategy = require('../render-strategy.cjs');
|
|
14
13
|
const runIfFn = require('../run-if-fn.cjs');
|
|
15
14
|
const accordionContext = require('./accordion-context.cjs');
|
|
16
15
|
const accordionItemContext = require('./accordion-item-context.cjs');
|
|
17
16
|
|
|
18
17
|
const AccordionItem = react.forwardRef((props, ref) => {
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
"disabled"
|
|
22
|
-
]);
|
|
18
|
+
const [collapsibleProps, accordionItemProps] = splitCollapsibleProps.splitCollapsibleProps(props);
|
|
19
|
+
const [itemProps, { children, ...localProps }] = accordion.splitItemProps(accordionItemProps);
|
|
23
20
|
const api = accordionContext.useAccordionContext();
|
|
21
|
+
const renderStrategyProps = renderStrategy.useRenderStrategyContext();
|
|
22
|
+
const mergedItemProps = react$1.mergeProps(api.getItemProps(itemProps), localProps);
|
|
23
|
+
const mergedCollapsibleProps = react$1.mergeProps(renderStrategyProps, collapsibleProps);
|
|
24
24
|
const itemState = api.getItemState(itemProps);
|
|
25
|
-
const mergedProps = react$1.mergeProps(api.getItemProps(itemProps), localProps);
|
|
26
25
|
const view = runIfFn.runIfFn(children, itemState);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const itemContentProps = api.getItemContentProps(itemProps);
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(accordionItemContext.AccordionItemProvider, { value: itemProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
28
|
+
collapsibleRoot.CollapsibleRoot,
|
|
29
|
+
{
|
|
30
|
+
ref,
|
|
31
|
+
open: itemState.isOpen,
|
|
32
|
+
ids: { content: itemContentProps.id },
|
|
33
|
+
...mergedItemProps,
|
|
34
|
+
...mergedCollapsibleProps,
|
|
35
|
+
children: view
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
30
38
|
});
|
|
31
39
|
AccordionItem.displayName = "AccordionItem";
|
|
32
40
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ItemProps, type ItemState } from '@zag-js/accordion';
|
|
2
2
|
import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
|
|
3
|
+
import type { UseCollapsibleProps } from '../collapsible/use-collapsible';
|
|
3
4
|
import { type HTMLArkProps } from '../factory';
|
|
4
5
|
import type { Assign } from '../types';
|
|
5
|
-
export interface AccordionItemProps extends Assign<HTMLArkProps<'div'>, {
|
|
6
|
+
export interface AccordionItemProps extends Assign<Assign<HTMLArkProps<'div'>, {
|
|
6
7
|
children?: ReactNode | ((state: ItemState) => ReactNode);
|
|
7
|
-
}>, ItemProps {
|
|
8
|
+
}>, UseCollapsibleProps>, ItemProps {
|
|
8
9
|
}
|
|
9
10
|
export declare const AccordionItem: ForwardRefExoticComponent<AccordionItemProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { splitItemProps } from '@zag-js/accordion';
|
|
3
4
|
import { mergeProps } from '@zag-js/react';
|
|
4
5
|
import { forwardRef } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { usePresencePropsContext } from '../presence/presence-props-context.mjs';
|
|
9
|
-
import { usePresence } from '../presence/use-presence.mjs';
|
|
6
|
+
import { CollapsibleRoot } from '../collapsible/collapsible-root.mjs';
|
|
7
|
+
import { splitCollapsibleProps } from '../collapsible/split-collapsible-props.mjs';
|
|
8
|
+
import { useRenderStrategyContext } from '../render-strategy.mjs';
|
|
10
9
|
import { runIfFn } from '../run-if-fn.mjs';
|
|
11
10
|
import { useAccordionContext } from './accordion-context.mjs';
|
|
12
11
|
import { AccordionItemProvider } from './accordion-item-context.mjs';
|
|
13
12
|
|
|
14
13
|
const AccordionItem = forwardRef((props, ref) => {
|
|
15
|
-
const [
|
|
16
|
-
|
|
17
|
-
"disabled"
|
|
18
|
-
]);
|
|
14
|
+
const [collapsibleProps, accordionItemProps] = splitCollapsibleProps(props);
|
|
15
|
+
const [itemProps, { children, ...localProps }] = splitItemProps(accordionItemProps);
|
|
19
16
|
const api = useAccordionContext();
|
|
17
|
+
const renderStrategyProps = useRenderStrategyContext();
|
|
18
|
+
const mergedItemProps = mergeProps(api.getItemProps(itemProps), localProps);
|
|
19
|
+
const mergedCollapsibleProps = mergeProps(renderStrategyProps, collapsibleProps);
|
|
20
20
|
const itemState = api.getItemState(itemProps);
|
|
21
|
-
const mergedProps = mergeProps(api.getItemProps(itemProps), localProps);
|
|
22
21
|
const view = runIfFn(children, itemState);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const itemContentProps = api.getItemContentProps(itemProps);
|
|
23
|
+
return /* @__PURE__ */ jsx(AccordionItemProvider, { value: itemProps, children: /* @__PURE__ */ jsx(
|
|
24
|
+
CollapsibleRoot,
|
|
25
|
+
{
|
|
26
|
+
ref,
|
|
27
|
+
open: itemState.isOpen,
|
|
28
|
+
ids: { content: itemContentProps.id },
|
|
29
|
+
...mergedItemProps,
|
|
30
|
+
...mergedCollapsibleProps,
|
|
31
|
+
children: view
|
|
32
|
+
}
|
|
33
|
+
) });
|
|
26
34
|
});
|
|
27
35
|
AccordionItem.displayName = "AccordionItem";
|
|
28
36
|
|
|
@@ -8,13 +8,12 @@ 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
|
-
const
|
|
12
|
-
const splitPresenceProps = require('../presence/split-presence-props.cjs');
|
|
11
|
+
const renderStrategy = require('../render-strategy.cjs');
|
|
13
12
|
const accordionContext = require('./accordion-context.cjs');
|
|
14
13
|
const useAccordion = require('./use-accordion.cjs');
|
|
15
14
|
|
|
16
15
|
const AccordionRoot = react.forwardRef((props, ref) => {
|
|
17
|
-
const [
|
|
16
|
+
const [renderStrategyProps, accordionProps] = renderStrategy.splitRenderStrategyProps(props);
|
|
18
17
|
const [useAccordionProps, localProps] = createSplitProps.createSplitProps()(accordionProps, [
|
|
19
18
|
"collapsible",
|
|
20
19
|
"defaultValue",
|
|
@@ -31,7 +30,7 @@ const AccordionRoot = react.forwardRef((props, ref) => {
|
|
|
31
30
|
]);
|
|
32
31
|
const api = useAccordion.useAccordion(useAccordionProps);
|
|
33
32
|
const mergedProps = react$1.mergeProps(api.rootProps, localProps);
|
|
34
|
-
return /* @__PURE__ */ jsxRuntime.jsx(accordionContext.AccordionProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(accordionContext.AccordionProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(renderStrategy.RenderStrategyProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) }) });
|
|
35
34
|
});
|
|
36
35
|
AccordionRoot.displayName = "AccordionRoot";
|
|
37
36
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
|
-
import { type
|
|
4
|
+
import { type RenderStrategyProps } from '../render-strategy';
|
|
5
5
|
import type { Assign } from '../types';
|
|
6
6
|
import { type UseAccordionProps } from './use-accordion';
|
|
7
|
-
export interface AccordionRootProps extends Assign<HTMLArkProps<'div'>, UseAccordionProps>,
|
|
7
|
+
export interface AccordionRootProps extends Assign<HTMLArkProps<'div'>, UseAccordionProps>, RenderStrategyProps {
|
|
8
8
|
}
|
|
9
9
|
export declare const AccordionRoot: ForwardRefExoticComponent<AccordionRootProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -4,13 +4,12 @@ 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 {
|
|
8
|
-
import { splitPresenceProps } from '../presence/split-presence-props.mjs';
|
|
7
|
+
import { splitRenderStrategyProps, RenderStrategyProvider } from '../render-strategy.mjs';
|
|
9
8
|
import { AccordionProvider } from './accordion-context.mjs';
|
|
10
9
|
import { useAccordion } from './use-accordion.mjs';
|
|
11
10
|
|
|
12
11
|
const AccordionRoot = forwardRef((props, ref) => {
|
|
13
|
-
const [
|
|
12
|
+
const [renderStrategyProps, accordionProps] = splitRenderStrategyProps(props);
|
|
14
13
|
const [useAccordionProps, localProps] = createSplitProps()(accordionProps, [
|
|
15
14
|
"collapsible",
|
|
16
15
|
"defaultValue",
|
|
@@ -27,7 +26,7 @@ const AccordionRoot = forwardRef((props, ref) => {
|
|
|
27
26
|
]);
|
|
28
27
|
const api = useAccordion(useAccordionProps);
|
|
29
28
|
const mergedProps = mergeProps(api.rootProps, localProps);
|
|
30
|
-
return /* @__PURE__ */ jsx(AccordionProvider, { value: api, children: /* @__PURE__ */ jsx(
|
|
29
|
+
return /* @__PURE__ */ jsx(AccordionProvider, { value: api, children: /* @__PURE__ */ jsx(RenderStrategyProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
31
30
|
});
|
|
32
31
|
AccordionRoot.displayName = "AccordionRoot";
|
|
33
32
|
|
|
@@ -17,6 +17,6 @@ const ClipboardIndicator = react.forwardRef(
|
|
|
17
17
|
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref, children: api.isCopied ? copied : children });
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
|
-
ClipboardIndicator.displayName = "
|
|
20
|
+
ClipboardIndicator.displayName = "ClipboardIndicator";
|
|
21
21
|
|
|
22
22
|
exports.ClipboardIndicator = ClipboardIndicator;
|
|
@@ -13,6 +13,6 @@ const ClipboardIndicator = forwardRef(
|
|
|
13
13
|
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: api.isCopied ? copied : children });
|
|
14
14
|
}
|
|
15
15
|
);
|
|
16
|
-
ClipboardIndicator.displayName = "
|
|
16
|
+
ClipboardIndicator.displayName = "ClipboardIndicator";
|
|
17
17
|
|
|
18
18
|
export { ClipboardIndicator };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const collapsibleContext = require('./collapsible-context.cjs');
|
|
11
|
+
|
|
12
|
+
const CollapsibleContent = react.forwardRef(
|
|
13
|
+
(props, ref) => {
|
|
14
|
+
const api = collapsibleContext.useCollapsibleContext();
|
|
15
|
+
if (api.isUnmounted) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const mergedProps = react$1.mergeProps(api.contentProps, props);
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
CollapsibleContent.displayName = "CollapsibleContent";
|
|
23
|
+
|
|
24
|
+
exports.CollapsibleContent = CollapsibleContent;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface CollapsibleContentProps extends HTMLArkProps<'div'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const CollapsibleContent: ForwardRefExoticComponent<CollapsibleContentProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useCollapsibleContext } from './collapsible-context.mjs';
|
|
7
|
+
|
|
8
|
+
const CollapsibleContent = forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const api = useCollapsibleContext();
|
|
11
|
+
if (api.isUnmounted) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const mergedProps = mergeProps(api.contentProps, props);
|
|
15
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
CollapsibleContent.displayName = "CollapsibleContent";
|
|
19
|
+
|
|
20
|
+
export { CollapsibleContent };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
|
|
6
|
+
const createContext = require('../create-context.cjs');
|
|
7
|
+
|
|
8
|
+
const [CollapsibleProvider, useCollapsibleContext] = createContext.createContext({
|
|
9
|
+
name: "CollapsibleContext",
|
|
10
|
+
hookName: "useCollapsibleContext",
|
|
11
|
+
providerName: "<CollapsibleProvider />"
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
exports.CollapsibleProvider = CollapsibleProvider;
|
|
15
|
+
exports.useCollapsibleContext = useCollapsibleContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Provider } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type UseCollapsibleReturn } from './use-collapsible';
|
|
4
|
+
export interface CollapsibleContext extends UseCollapsibleReturn {
|
|
5
|
+
}
|
|
6
|
+
export declare const CollapsibleProvider: Provider<CollapsibleContext>, useCollapsibleContext: () => CollapsibleContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createContext } from '../create-context.mjs';
|
|
3
|
+
|
|
4
|
+
const [CollapsibleProvider, useCollapsibleContext] = createContext({
|
|
5
|
+
name: "CollapsibleContext",
|
|
6
|
+
hookName: "useCollapsibleContext",
|
|
7
|
+
providerName: "<CollapsibleProvider />"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export { CollapsibleProvider, useCollapsibleContext };
|
|
@@ -0,0 +1,22 @@
|
|
|
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 react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const collapsibleContext = require('./collapsible-context.cjs');
|
|
11
|
+
const splitCollapsibleProps = require('./split-collapsible-props.cjs');
|
|
12
|
+
const useCollapsible = require('./use-collapsible.cjs');
|
|
13
|
+
|
|
14
|
+
const CollapsibleRoot = react.forwardRef((props, ref) => {
|
|
15
|
+
const [useCollapsibleProps, localProps] = splitCollapsibleProps.splitCollapsibleProps(props);
|
|
16
|
+
const api = useCollapsible.useCollapsible(useCollapsibleProps);
|
|
17
|
+
const mergedProps = react$1.mergeProps(api.rootProps, localProps);
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(collapsibleContext.CollapsibleProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref }) });
|
|
19
|
+
});
|
|
20
|
+
CollapsibleRoot.displayName = "CollapsibleRoot";
|
|
21
|
+
|
|
22
|
+
exports.CollapsibleRoot = CollapsibleRoot;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
import { type Assign } from '../types';
|
|
5
|
+
import { type UseCollapsibleProps } from './use-collapsible';
|
|
6
|
+
export interface CollapsibleRootProps extends Assign<HTMLArkProps<'div'>, UseCollapsibleProps> {
|
|
7
|
+
}
|
|
8
|
+
export declare const CollapsibleRoot: ForwardRefExoticComponent<CollapsibleRootProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { CollapsibleProvider } from './collapsible-context.mjs';
|
|
7
|
+
import { splitCollapsibleProps } from './split-collapsible-props.mjs';
|
|
8
|
+
import { useCollapsible } from './use-collapsible.mjs';
|
|
9
|
+
|
|
10
|
+
const CollapsibleRoot = forwardRef((props, ref) => {
|
|
11
|
+
const [useCollapsibleProps, localProps] = splitCollapsibleProps(props);
|
|
12
|
+
const api = useCollapsible(useCollapsibleProps);
|
|
13
|
+
const mergedProps = mergeProps(api.rootProps, localProps);
|
|
14
|
+
return /* @__PURE__ */ jsx(CollapsibleProvider, { value: api, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) });
|
|
15
|
+
});
|
|
16
|
+
CollapsibleRoot.displayName = "CollapsibleRoot";
|
|
17
|
+
|
|
18
|
+
export { CollapsibleRoot };
|
|
@@ -0,0 +1,21 @@
|
|
|
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 react$1 = require('@zag-js/react');
|
|
8
|
+
const react = require('react');
|
|
9
|
+
const factory = require('../factory.cjs');
|
|
10
|
+
const collapsibleContext = require('./collapsible-context.cjs');
|
|
11
|
+
|
|
12
|
+
const CollapsibleTrigger = react.forwardRef(
|
|
13
|
+
(props, ref) => {
|
|
14
|
+
const api = collapsibleContext.useCollapsibleContext();
|
|
15
|
+
const mergedProps = react$1.mergeProps(api.triggerProps, props);
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.button, { ...mergedProps, ref });
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
CollapsibleTrigger.displayName = "CollapsibleTrigger";
|
|
20
|
+
|
|
21
|
+
exports.CollapsibleTrigger = CollapsibleTrigger;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { type HTMLArkProps } from '../factory';
|
|
4
|
+
export interface CollapsibleTriggerProps extends HTMLArkProps<'button'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const CollapsibleTrigger: ForwardRefExoticComponent<CollapsibleTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { mergeProps } from '@zag-js/react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { ark } from '../factory.mjs';
|
|
6
|
+
import { useCollapsibleContext } from './collapsible-context.mjs';
|
|
7
|
+
|
|
8
|
+
const CollapsibleTrigger = forwardRef(
|
|
9
|
+
(props, ref) => {
|
|
10
|
+
const api = useCollapsibleContext();
|
|
11
|
+
const mergedProps = mergeProps(api.triggerProps, props);
|
|
12
|
+
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
CollapsibleTrigger.displayName = "CollapsibleTrigger";
|
|
16
|
+
|
|
17
|
+
export { CollapsibleTrigger };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const collapsibleContent = require('./collapsible-content.cjs');
|
|
6
|
+
const collapsibleRoot = require('./collapsible-root.cjs');
|
|
7
|
+
const collapsibleTrigger = require('./collapsible-trigger.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.Content = collapsibleContent.CollapsibleContent;
|
|
12
|
+
exports.Root = collapsibleRoot.CollapsibleRoot;
|
|
13
|
+
exports.Trigger = collapsibleTrigger.CollapsibleTrigger;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const collapsibleContent = require('./collapsible-content.cjs');
|
|
6
|
+
const collapsibleContext = require('./collapsible-context.cjs');
|
|
7
|
+
const collapsibleRoot = require('./collapsible-root.cjs');
|
|
8
|
+
const collapsibleTrigger = require('./collapsible-trigger.cjs');
|
|
9
|
+
const collapsible = require('./collapsible.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.CollapsibleContent = collapsibleContent.CollapsibleContent;
|
|
14
|
+
exports.useCollapsibleContext = collapsibleContext.useCollapsibleContext;
|
|
15
|
+
exports.CollapsibleRoot = collapsibleRoot.CollapsibleRoot;
|
|
16
|
+
exports.CollapsibleTrigger = collapsibleTrigger.CollapsibleTrigger;
|
|
17
|
+
exports.Collapsible = collapsible;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OpenChangeDetails as CollapsibleOpenChangeDetails } from '@zag-js/collapsible';
|
|
2
|
+
import { CollapsibleContent, type CollapsibleContentProps } from './collapsible-content';
|
|
3
|
+
import { useCollapsibleContext, type CollapsibleContext } from './collapsible-context';
|
|
4
|
+
import { CollapsibleRoot, type CollapsibleRootProps } from './collapsible-root';
|
|
5
|
+
import { CollapsibleTrigger, type CollapsibleTriggerProps } from './collapsible-trigger';
|
|
6
|
+
export * as Collapsible from './collapsible';
|
|
7
|
+
export { CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, useCollapsibleContext };
|
|
8
|
+
export type { CollapsibleContentProps, CollapsibleContext, CollapsibleOpenChangeDetails, CollapsibleRootProps, CollapsibleTriggerProps, };
|