@ark-ui/react 1.0.0-beta.3 → 1.0.0-beta.5
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 +11 -1
- 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/carousel/carousel.stories.d.ts +2 -0
- 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 +15 -0
- package/color-picker/color-picker-view.d.ts +7 -0
- package/color-picker/color-picker-view.mjs +11 -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/color-picker.stories.d.ts +1 -0
- package/color-picker/index.cjs +3 -1
- package/color-picker/index.d.ts +4 -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 +11 -5
- package/date-picker/date-picker.d.ts +6 -5
- package/date-picker/date-picker.mjs +11 -5
- package/date-picker/date-picker.stories.d.ts +1 -0
- 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 +10 -2
- package/index.mjs +4 -1
- package/menu/index.d.ts +1 -1
- 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-item-group-label.cjs +1 -1
- package/menu/menu-item-group-label.d.ts +3 -3
- package/menu/menu-item-group-label.mjs +1 -1
- 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/menu/menu.stories.d.ts +4 -1
- package/number-input/number-input.stories.d.ts +6 -1
- package/package.json +50 -50
- package/pagination/pagination.d.ts +3 -3
- package/pin-input/pin-input.stories.d.ts +5 -0
- 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/popover/popover.stories.d.ts +4 -1
- 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/radio-group/radio-group.stories.d.ts +3 -0
- package/rating-group/rating-group-control.d.ts +5 -3
- package/rating-group/rating-group-item.d.ts +4 -5
- package/rating-group/rating-group.stories.d.ts +6 -0
- package/segment-group/segment-group-item.d.ts +2 -3
- package/segment-group/segment-group.stories.d.ts +3 -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-control.cjs +4 -1
- package/select/select-control.mjs +5 -2
- 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/select/select.stories.d.ts +1 -1
- package/slider/index.cjs +4 -4
- package/slider/index.d.ts +4 -4
- package/slider/index.mjs +4 -4
- package/slider/{slider-output.cjs → slider-value-text.cjs} +5 -7
- package/slider/slider-value-text.d.ts +6 -0
- package/slider/slider-value-text.mjs +16 -0
- package/slider/slider.d.ts +3 -3
- package/slider/slider.stories.d.ts +9 -2
- 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/tags-input/tags-input.stories.d.ts +6 -0
- package/toast/toast.stories.d.ts +5 -1
- package/toggle-group/toggle-group.stories.d.ts +1 -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/slider/slider-output.d.ts +0 -9
- package/slider/slider-output.mjs +0 -18
- 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/index.mjs
CHANGED
|
@@ -175,7 +175,10 @@ export { PopoverPositioner } from './popover/popover-positioner.mjs';
|
|
|
175
175
|
export { PopoverTitle } from './popover/popover-title.mjs';
|
|
176
176
|
export { PopoverTrigger } from './popover/popover-trigger.mjs';
|
|
177
177
|
export { usePopoverContext } from './popover/popover-context.mjs';
|
|
178
|
+
export { PresencePropsProvider, usePresencePropsContext } from './presence/presence-props-context.mjs';
|
|
179
|
+
export { PresenceProvider, usePresenceContext } from './presence/presence-context.mjs';
|
|
178
180
|
export { splitPresenceProps } from './presence/split-presence-props.mjs';
|
|
181
|
+
export { usePresence } from './presence/use-presence.mjs';
|
|
179
182
|
export { RadioGroupItem } from './radio-group/radio-group-item.mjs';
|
|
180
183
|
export { RadioGroupItemControl } from './radio-group/radio-group-item-control.mjs';
|
|
181
184
|
export { RadioGroupItemText } from './radio-group/radio-group-item-text.mjs';
|
|
@@ -213,10 +216,10 @@ export { SliderControl } from './slider/slider-control.mjs';
|
|
|
213
216
|
export { SliderLabel } from './slider/slider-label.mjs';
|
|
214
217
|
export { SliderMarker } from './slider/slider-marker.mjs';
|
|
215
218
|
export { SliderMarkerGroup } from './slider/slider-marker-group.mjs';
|
|
216
|
-
export { SliderOutput } from './slider/slider-output.mjs';
|
|
217
219
|
export { SliderRange } from './slider/slider-range.mjs';
|
|
218
220
|
export { SliderThumb } from './slider/slider-thumb.mjs';
|
|
219
221
|
export { SliderTrack } from './slider/slider-track.mjs';
|
|
222
|
+
export { SliderValueText } from './slider/slider-value-text.mjs';
|
|
220
223
|
export { useSliderContext } from './slider/slider-context.mjs';
|
|
221
224
|
export { SplitterPanel } from './splitter/splitter-panel.mjs';
|
|
222
225
|
export { SplitterResizeTrigger } from './splitter/splitter-resize-trigger.mjs';
|
package/menu/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const Menu: ((props: MenuProps) => JSX.Element) & {
|
|
|
23
23
|
ContextTrigger: ForwardRefExoticComponent<MenuContextTriggerProps & RefAttributes<HTMLButtonElement>>;
|
|
24
24
|
Item: ForwardRefExoticComponent<MenuItemProps & RefAttributes<HTMLDivElement>>;
|
|
25
25
|
ItemGroup: ForwardRefExoticComponent<MenuItemGroupProps & RefAttributes<HTMLDivElement>>;
|
|
26
|
-
ItemGroupLabel: ForwardRefExoticComponent<MenuItemGroupLabelProps & RefAttributes<
|
|
26
|
+
ItemGroupLabel: ForwardRefExoticComponent<MenuItemGroupLabelProps & RefAttributes<HTMLDivElement>>;
|
|
27
27
|
OptionItem: ForwardRefExoticComponent<MenuOptionItemProps & RefAttributes<HTMLDivElement>>;
|
|
28
28
|
Positioner: ForwardRefExoticComponent<MenuPositionerProps & RefAttributes<HTMLDivElement>>;
|
|
29
29
|
Separator: ForwardRefExoticComponent<MenuSeparatorProps & RefAttributes<HTMLHRElement>>;
|
package/menu/menu-content.cjs
CHANGED
|
@@ -7,22 +7,19 @@ 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 menuContext = require('./menu-context.cjs');
|
|
12
|
-
const
|
|
12
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
13
13
|
|
|
14
14
|
const MenuContent = react.forwardRef((props, ref) => {
|
|
15
|
-
const [presenceProps, localProps] = splitPresenceProps.splitPresenceProps(props);
|
|
16
15
|
const api = menuContext.useMenuContext();
|
|
17
|
-
|
|
16
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
17
|
+
const mergedProps = react$1.mergeProps(api?.contentProps ?? {}, presenceApi.getPresenceProps(ref), props);
|
|
18
|
+
if (presenceApi.isUnmounted) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps });
|
|
18
22
|
});
|
|
19
23
|
MenuContent.displayName = "MenuContent";
|
|
20
|
-
const MenuInnerContent = react.forwardRef(
|
|
21
|
-
function MenuInnerContent2(props, ref) {
|
|
22
|
-
const api = menuContext.useMenuContext();
|
|
23
|
-
const mergedProps = react$1.mergeProps(api?.contentProps ?? {}, props);
|
|
24
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
24
|
|
|
28
25
|
exports.MenuContent = MenuContent;
|
package/menu/menu-content.d.ts
CHANGED
|
@@ -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 MenuContentProps extends Assign<HTMLArkProps<'div'>, Omit<PresenceProps, 'children' | 'fallback'>> {
|
|
4
|
+
export interface MenuContentProps extends HTMLArkProps<'div'> {
|
|
7
5
|
}
|
|
8
6
|
export declare const MenuContent: ForwardRefExoticComponent<MenuContentProps & RefAttributes<HTMLDivElement>>;
|
package/menu/menu-content.mjs
CHANGED
|
@@ -3,22 +3,19 @@ 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 { useMenuContext } from './menu-context.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
9
9
|
|
|
10
10
|
const MenuContent = forwardRef((props, ref) => {
|
|
11
|
-
const [presenceProps, localProps] = splitPresenceProps(props);
|
|
12
11
|
const api = useMenuContext();
|
|
13
|
-
|
|
12
|
+
const presenceApi = usePresenceContext();
|
|
13
|
+
const mergedProps = mergeProps(api?.contentProps ?? {}, presenceApi.getPresenceProps(ref), props);
|
|
14
|
+
if (presenceApi.isUnmounted) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps });
|
|
14
18
|
});
|
|
15
19
|
MenuContent.displayName = "MenuContent";
|
|
16
|
-
const MenuInnerContent = forwardRef(
|
|
17
|
-
function MenuInnerContent2(props, ref) {
|
|
18
|
-
const api = useMenuContext();
|
|
19
|
-
const mergedProps = mergeProps(api?.contentProps ?? {}, props);
|
|
20
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
20
|
|
|
24
21
|
export { MenuContent };
|
|
@@ -15,7 +15,7 @@ const MenuItemGroupLabel = react.forwardRef(
|
|
|
15
15
|
const [labelProps, htmlProps] = createSplitProps.createSplitProps()(props, ["htmlFor"]);
|
|
16
16
|
const api = menuContext.useMenuContext();
|
|
17
17
|
const mergedProps = react$1.mergeProps(api?.getItemGroupLabelProps(labelProps) ?? {}, htmlProps);
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
21
|
MenuItemGroupLabel.displayName = "MenuItemGroupLabel";
|
|
@@ -2,10 +2,10 @@ import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
|
2
2
|
/// <reference types="react" />
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
4
|
import { type Assign } from '../types';
|
|
5
|
-
interface
|
|
5
|
+
interface ItemGroupLabelProps {
|
|
6
6
|
htmlFor: string;
|
|
7
7
|
}
|
|
8
|
-
export interface MenuItemGroupLabelProps extends Assign<HTMLArkProps<'
|
|
8
|
+
export interface MenuItemGroupLabelProps extends Assign<HTMLArkProps<'div'>, ItemGroupLabelProps> {
|
|
9
9
|
}
|
|
10
|
-
export declare const MenuItemGroupLabel: ForwardRefExoticComponent<MenuItemGroupLabelProps & RefAttributes<
|
|
10
|
+
export declare const MenuItemGroupLabel: ForwardRefExoticComponent<MenuItemGroupLabelProps & RefAttributes<HTMLDivElement>>;
|
|
11
11
|
export {};
|
|
@@ -11,7 +11,7 @@ const MenuItemGroupLabel = forwardRef(
|
|
|
11
11
|
const [labelProps, htmlProps] = createSplitProps()(props, ["htmlFor"]);
|
|
12
12
|
const api = useMenuContext();
|
|
13
13
|
const mergedProps = mergeProps(api?.getItemGroupLabelProps(labelProps) ?? {}, htmlProps);
|
|
14
|
-
return /* @__PURE__ */ jsx(ark.
|
|
14
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
15
15
|
}
|
|
16
16
|
);
|
|
17
17
|
MenuItemGroupLabel.displayName = "MenuItemGroupLabel";
|
|
@@ -2,8 +2,8 @@ import type { OptionItemProps, OptionItemState } from '@zag-js/menu';
|
|
|
2
2
|
import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react';
|
|
3
3
|
import { type HTMLArkProps } from '../factory';
|
|
4
4
|
import { type Assign } from '../types';
|
|
5
|
-
export interface MenuOptionItemProps extends Assign<HTMLArkProps<'div'>,
|
|
5
|
+
export interface MenuOptionItemProps extends Assign<HTMLArkProps<'div'>, {
|
|
6
6
|
children?: ReactNode | ((state: OptionItemState) => ReactNode);
|
|
7
|
-
}
|
|
7
|
+
}>, OptionItemProps {
|
|
8
8
|
}
|
|
9
9
|
export declare const MenuOptionItem: ForwardRefExoticComponent<MenuOptionItemProps & RefAttributes<HTMLDivElement>>;
|
package/menu/menu.cjs
CHANGED
|
@@ -6,13 +6,18 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
6
6
|
const jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
const react = require('react');
|
|
8
8
|
const createSplitProps = require('../create-split-props.cjs');
|
|
9
|
+
require('../presence/index.cjs');
|
|
9
10
|
const runIfFn = require('../run-if-fn.cjs');
|
|
10
11
|
const useEffectOnce = require('../use-effect-once.cjs');
|
|
11
12
|
const menuContext = require('./menu-context.cjs');
|
|
12
13
|
const useMenu = require('./use-menu.cjs');
|
|
14
|
+
const splitPresenceProps = require('../presence/split-presence-props.cjs');
|
|
15
|
+
const usePresence = require('../presence/use-presence.cjs');
|
|
16
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
13
17
|
|
|
14
18
|
const Menu = (props) => {
|
|
15
|
-
const [
|
|
19
|
+
const [presenceProps, menuProps] = splitPresenceProps.splitPresenceProps(props);
|
|
20
|
+
const [useMenuProps, localProps] = createSplitProps.createSplitProps()(menuProps, [
|
|
16
21
|
"anchorPoint",
|
|
17
22
|
"aria-label",
|
|
18
23
|
"closeOnSelect",
|
|
@@ -28,32 +33,26 @@ const Menu = (props) => {
|
|
|
28
33
|
"onPointerDownOutside",
|
|
29
34
|
"onSelect",
|
|
30
35
|
"onValueChange",
|
|
36
|
+
"open",
|
|
31
37
|
"positioning",
|
|
32
38
|
"value"
|
|
33
39
|
]);
|
|
34
40
|
const parentApi = menuContext.useMenuContext();
|
|
35
41
|
const parentMachine = menuContext.useMenuMachineContext();
|
|
36
|
-
const { api, machine } = useMenu.useMenu(
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
onClose: api.close
|
|
40
|
-
});
|
|
42
|
+
const { api, machine } = useMenu.useMenu(useMenuProps);
|
|
43
|
+
const presenceApi = usePresence.usePresence({ ...presenceProps, present: api.isOpen });
|
|
44
|
+
const view = runIfFn.runIfFn(localProps.children, api);
|
|
41
45
|
useEffectOnce.useEffectOnce(() => {
|
|
42
46
|
if (!parentMachine)
|
|
43
47
|
return;
|
|
44
48
|
parentApi.setChild(machine);
|
|
45
49
|
api.setParent(parentMachine);
|
|
46
50
|
});
|
|
47
|
-
react.useEffect(() => {
|
|
48
|
-
if (isOpen && !api.isOpen) {
|
|
49
|
-
api.open();
|
|
50
|
-
}
|
|
51
|
-
}, [isOpen, api]);
|
|
52
51
|
const getTriggerItemProps = react.useCallback(
|
|
53
52
|
() => parentApi.getTriggerItemProps(api),
|
|
54
53
|
[api, parentApi]
|
|
55
54
|
);
|
|
56
|
-
return /* @__PURE__ */ jsxRuntime.jsx(menuContext.MenuTriggerItemProvider, { value: getTriggerItemProps, children: /* @__PURE__ */ jsxRuntime.jsx(menuContext.MenuMachineProvider, { value: machine, children: /* @__PURE__ */ jsxRuntime.jsx(menuContext.MenuProvider, { value: api, children: view }) }) });
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsx(menuContext.MenuTriggerItemProvider, { value: getTriggerItemProps, children: /* @__PURE__ */ jsxRuntime.jsx(menuContext.MenuMachineProvider, { value: machine, children: /* @__PURE__ */ jsxRuntime.jsx(menuContext.MenuProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(presenceContext.PresenceProvider, { value: presenceApi, children: view }) }) }) });
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
exports.Menu = Menu;
|
package/menu/menu.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { JSX } from 'react/jsx-runtime';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
-
import { type
|
|
4
|
-
import { type UseMenuProps } from './use-menu';
|
|
5
|
-
interface
|
|
6
|
-
|
|
7
|
-
onClose: () => void;
|
|
8
|
-
}
|
|
9
|
-
export interface MenuProps extends Assign<UseMenuProps, {
|
|
10
|
-
children?: ReactNode | ((state: MenuState) => ReactNode);
|
|
11
|
-
isOpen?: boolean;
|
|
12
|
-
}> {
|
|
3
|
+
import { type UsePresenceProps } from '../presence';
|
|
4
|
+
import { type UseMenuProps, type UseMenuReturn } from './use-menu';
|
|
5
|
+
export interface MenuProps extends UseMenuProps, UsePresenceProps {
|
|
6
|
+
children?: ReactNode | ((api: UseMenuReturn['api']) => ReactNode);
|
|
13
7
|
}
|
|
14
8
|
export declare const Menu: (props: MenuProps) => JSX.Element;
|
|
15
|
-
export {};
|
package/menu/menu.mjs
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
4
|
import { createSplitProps } from '../create-split-props.mjs';
|
|
5
|
+
import '../presence/index.mjs';
|
|
5
6
|
import { runIfFn } from '../run-if-fn.mjs';
|
|
6
7
|
import { useEffectOnce } from '../use-effect-once.mjs';
|
|
7
8
|
import { useMenuContext, useMenuMachineContext, MenuTriggerItemProvider, MenuMachineProvider, MenuProvider } from './menu-context.mjs';
|
|
8
9
|
import { useMenu } from './use-menu.mjs';
|
|
10
|
+
import { splitPresenceProps } from '../presence/split-presence-props.mjs';
|
|
11
|
+
import { usePresence } from '../presence/use-presence.mjs';
|
|
12
|
+
import { PresenceProvider } from '../presence/presence-context.mjs';
|
|
9
13
|
|
|
10
14
|
const Menu = (props) => {
|
|
11
|
-
const [
|
|
15
|
+
const [presenceProps, menuProps] = splitPresenceProps(props);
|
|
16
|
+
const [useMenuProps, localProps] = createSplitProps()(menuProps, [
|
|
12
17
|
"anchorPoint",
|
|
13
18
|
"aria-label",
|
|
14
19
|
"closeOnSelect",
|
|
@@ -24,32 +29,26 @@ const Menu = (props) => {
|
|
|
24
29
|
"onPointerDownOutside",
|
|
25
30
|
"onSelect",
|
|
26
31
|
"onValueChange",
|
|
32
|
+
"open",
|
|
27
33
|
"positioning",
|
|
28
34
|
"value"
|
|
29
35
|
]);
|
|
30
36
|
const parentApi = useMenuContext();
|
|
31
37
|
const parentMachine = useMenuMachineContext();
|
|
32
|
-
const { api, machine } = useMenu(
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
onClose: api.close
|
|
36
|
-
});
|
|
38
|
+
const { api, machine } = useMenu(useMenuProps);
|
|
39
|
+
const presenceApi = usePresence({ ...presenceProps, present: api.isOpen });
|
|
40
|
+
const view = runIfFn(localProps.children, api);
|
|
37
41
|
useEffectOnce(() => {
|
|
38
42
|
if (!parentMachine)
|
|
39
43
|
return;
|
|
40
44
|
parentApi.setChild(machine);
|
|
41
45
|
api.setParent(parentMachine);
|
|
42
46
|
});
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (isOpen && !api.isOpen) {
|
|
45
|
-
api.open();
|
|
46
|
-
}
|
|
47
|
-
}, [isOpen, api]);
|
|
48
47
|
const getTriggerItemProps = useCallback(
|
|
49
48
|
() => parentApi.getTriggerItemProps(api),
|
|
50
49
|
[api, parentApi]
|
|
51
50
|
);
|
|
52
|
-
return /* @__PURE__ */ jsx(MenuTriggerItemProvider, { value: getTriggerItemProps, children: /* @__PURE__ */ jsx(MenuMachineProvider, { value: machine, children: /* @__PURE__ */ jsx(MenuProvider, { value: api, children: view }) }) });
|
|
51
|
+
return /* @__PURE__ */ jsx(MenuTriggerItemProvider, { value: getTriggerItemProps, children: /* @__PURE__ */ jsx(MenuMachineProvider, { value: machine, children: /* @__PURE__ */ jsx(MenuProvider, { value: api, children: /* @__PURE__ */ jsx(PresenceProvider, { value: presenceApi, children: view }) }) }) });
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
export { Menu };
|
package/menu/menu.stories.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ type MenuType = typeof Menu;
|
|
|
5
5
|
declare const meta: Meta<MenuType>;
|
|
6
6
|
export default meta;
|
|
7
7
|
export declare const Basic: () => JSX.Element;
|
|
8
|
+
export declare const Controlled: () => JSX.Element;
|
|
8
9
|
export declare const Group: () => JSX.Element;
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const Separator: () => JSX.Element;
|
|
11
|
+
export declare const ContextMenu: () => JSX.Element;
|
|
10
12
|
export declare const SubMenu: () => JSX.Element;
|
|
13
|
+
export declare const Options: () => JSX.Element;
|
|
11
14
|
export declare const ComplexSubMenu: () => JSX.Element;
|
|
@@ -5,5 +5,10 @@ type NumberInputType = typeof NumberInput.Root;
|
|
|
5
5
|
declare const meta: Meta<NumberInputType>;
|
|
6
6
|
export default meta;
|
|
7
7
|
export declare const Basic: () => JSX.Element;
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const MinMax: () => JSX.Element;
|
|
9
9
|
export declare const FractionDigits: () => JSX.Element;
|
|
10
|
+
export declare const Scrubber: () => JSX.Element;
|
|
11
|
+
export declare const MouseWheel: () => JSX.Element;
|
|
12
|
+
export declare const NoClamp: () => JSX.Element;
|
|
13
|
+
export declare const FormUsage: () => JSX.Element;
|
|
14
|
+
export declare const Formatted: () => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accordion",
|
|
@@ -60,74 +60,74 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@ark-ui/anatomy": "1.0.0-beta.1",
|
|
63
|
-
"@zag-js/accordion": "0.
|
|
64
|
-
"@zag-js/anatomy": "0.
|
|
65
|
-
"@zag-js/avatar": "0.
|
|
66
|
-
"@zag-js/carousel": "0.
|
|
67
|
-
"@zag-js/checkbox": "0.
|
|
68
|
-
"@zag-js/color-picker": "0.
|
|
69
|
-
"@zag-js/color-utils": "0.
|
|
70
|
-
"@zag-js/combobox": "0.
|
|
71
|
-
"@zag-js/core": "0.
|
|
72
|
-
"@zag-js/date-picker": "0.
|
|
73
|
-
"@zag-js/date-utils": "0.
|
|
74
|
-
"@zag-js/dialog": "0.
|
|
75
|
-
"@zag-js/editable": "0.
|
|
76
|
-
"@zag-js/hover-card": "0.
|
|
77
|
-
"@zag-js/menu": "0.
|
|
78
|
-
"@zag-js/number-input": "0.
|
|
79
|
-
"@zag-js/pagination": "0.
|
|
80
|
-
"@zag-js/pin-input": "0.
|
|
81
|
-
"@zag-js/popover": "0.
|
|
82
|
-
"@zag-js/presence": "0.
|
|
83
|
-
"@zag-js/radio-group": "0.
|
|
84
|
-
"@zag-js/rating-group": "0.
|
|
85
|
-
"@zag-js/react": "0.
|
|
86
|
-
"@zag-js/select": "0.
|
|
87
|
-
"@zag-js/slider": "0.
|
|
88
|
-
"@zag-js/splitter": "0.
|
|
89
|
-
"@zag-js/switch": "0.
|
|
90
|
-
"@zag-js/tabs": "0.
|
|
91
|
-
"@zag-js/tags-input": "0.
|
|
92
|
-
"@zag-js/toast": "0.
|
|
93
|
-
"@zag-js/toggle-group": "0.
|
|
94
|
-
"@zag-js/tooltip": "0.
|
|
95
|
-
"@zag-js/types": "0.
|
|
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"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@release-it/keep-a-changelog": "4.0.0",
|
|
99
|
-
"@storybook/addon-a11y": "7.5.
|
|
100
|
-
"@storybook/addon-essentials": "7.5.
|
|
101
|
-
"@storybook/addons": "7.5.
|
|
102
|
-
"@storybook/react": "7.5.
|
|
103
|
-
"@storybook/react-vite": "7.5.
|
|
99
|
+
"@storybook/addon-a11y": "7.5.3",
|
|
100
|
+
"@storybook/addon-essentials": "7.5.3",
|
|
101
|
+
"@storybook/addons": "7.5.3",
|
|
102
|
+
"@storybook/react": "7.5.3",
|
|
103
|
+
"@storybook/react-vite": "7.5.3",
|
|
104
104
|
"@testing-library/dom": "9.3.3",
|
|
105
105
|
"@testing-library/jest-dom": "6.1.4",
|
|
106
|
-
"@testing-library/react": "14.
|
|
106
|
+
"@testing-library/react": "14.1.0",
|
|
107
107
|
"@testing-library/user-event": "14.5.1",
|
|
108
|
-
"@types/jsdom": "21.1.
|
|
109
|
-
"@types/react": "18.2.
|
|
110
|
-
"@types/react-dom": "18.2.
|
|
108
|
+
"@types/jsdom": "21.1.5",
|
|
109
|
+
"@types/react": "18.2.37",
|
|
110
|
+
"@types/react-dom": "18.2.15",
|
|
111
111
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
113
|
-
"@typescript-eslint/parser": "6.
|
|
114
|
-
"@vitejs/plugin-react": "4.1.
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "6.10.0",
|
|
113
|
+
"@typescript-eslint/parser": "6.10.0",
|
|
114
|
+
"@vitejs/plugin-react": "4.1.1",
|
|
115
115
|
"@vitest/coverage-v8": "0.34.6",
|
|
116
|
-
"eslint": "8.
|
|
116
|
+
"eslint": "8.53.0",
|
|
117
117
|
"eslint-plugin-react": "7.33.2",
|
|
118
118
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
119
119
|
"globby": "13.2.2",
|
|
120
120
|
"jsdom": "22.1.0",
|
|
121
|
-
"lucide-react": "0.
|
|
121
|
+
"lucide-react": "0.292.0",
|
|
122
122
|
"react": "18.2.0",
|
|
123
123
|
"react-dom": "18.2.0",
|
|
124
124
|
"react-frame-component": "5.2.6",
|
|
125
125
|
"release-it": "16.2.1",
|
|
126
126
|
"resize-observer-polyfill": "1.5.1",
|
|
127
|
-
"storybook": "7.5.
|
|
127
|
+
"storybook": "7.5.3",
|
|
128
128
|
"typescript": "5.2.2",
|
|
129
129
|
"vite": "4.5.0",
|
|
130
|
-
"vite-plugin-dts": "3.6.
|
|
130
|
+
"vite-plugin-dts": "3.6.3",
|
|
131
131
|
"vitest": "0.34.6"
|
|
132
132
|
},
|
|
133
133
|
"peerDependencies": {
|
|
@@ -2,8 +2,8 @@ import { ForwardRefExoticComponent, RefAttributes, type ReactNode } from 'react'
|
|
|
2
2
|
import { type HTMLArkProps } from '../factory';
|
|
3
3
|
import { type Assign } from '../types';
|
|
4
4
|
import { type UsePaginationProps, type UsePaginationReturn } from './use-pagination';
|
|
5
|
-
export interface PaginationProps extends Assign<Assign<HTMLArkProps<'nav'>,
|
|
6
|
-
children?: ReactNode | ((
|
|
7
|
-
}> {
|
|
5
|
+
export interface PaginationProps extends Assign<Assign<HTMLArkProps<'nav'>, {
|
|
6
|
+
children?: ReactNode | ((api: UsePaginationReturn) => ReactNode);
|
|
7
|
+
}>, UsePaginationProps> {
|
|
8
8
|
}
|
|
9
9
|
export declare const Pagination: ForwardRefExoticComponent<PaginationProps & RefAttributes<HTMLElement>>;
|
|
@@ -5,3 +5,8 @@ type PinInputType = typeof PinInput;
|
|
|
5
5
|
declare const meta: Meta<PinInputType>;
|
|
6
6
|
export default meta;
|
|
7
7
|
export declare const Basic: () => JSX.Element;
|
|
8
|
+
export declare const InitialValue: () => JSX.Element;
|
|
9
|
+
export declare const Customized: () => JSX.Element;
|
|
10
|
+
export declare const Blurred: () => JSX.Element;
|
|
11
|
+
export declare const OTPMode: () => JSX.Element;
|
|
12
|
+
export declare const WithMask: () => JSX.Element;
|
|
@@ -7,22 +7,19 @@ 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 popoverContext = require('./popover-context.cjs');
|
|
12
|
-
const
|
|
12
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
13
13
|
|
|
14
14
|
const PopoverContent = react.forwardRef((props, ref) => {
|
|
15
|
-
const [presenceProps, localProps] = splitPresenceProps.splitPresenceProps(props);
|
|
16
15
|
const api = popoverContext.usePopoverContext();
|
|
17
|
-
|
|
16
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
17
|
+
const mergedProps = react$1.mergeProps(api.contentProps, presenceApi.getPresenceProps(ref), props);
|
|
18
|
+
if (presenceApi.isUnmounted) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps });
|
|
18
22
|
});
|
|
19
23
|
PopoverContent.displayName = "PopoverContent";
|
|
20
|
-
const PopoverInnerContent = react.forwardRef(
|
|
21
|
-
function PopoverInnerContent2(props, ref) {
|
|
22
|
-
const api = popoverContext.usePopoverContext();
|
|
23
|
-
const mergedProps = react$1.mergeProps(api.contentProps, props);
|
|
24
|
-
return /* @__PURE__ */ jsxRuntime.jsx(factory.ark.div, { ...mergedProps, ref });
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
24
|
|
|
28
25
|
exports.PopoverContent = PopoverContent;
|
|
@@ -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 PopoverContentProps extends Assign<HTMLArkProps<'div'>, Omit<PresenceProps, 'children' | 'fallback'>> {
|
|
4
|
+
export interface PopoverContentProps extends HTMLArkProps<'div'> {
|
|
7
5
|
}
|
|
8
6
|
export declare const PopoverContent: ForwardRefExoticComponent<PopoverContentProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -3,22 +3,19 @@ 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 { usePopoverContext } from './popover-context.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
9
9
|
|
|
10
10
|
const PopoverContent = forwardRef((props, ref) => {
|
|
11
|
-
const [presenceProps, localProps] = splitPresenceProps(props);
|
|
12
11
|
const api = usePopoverContext();
|
|
13
|
-
|
|
12
|
+
const presenceApi = usePresenceContext();
|
|
13
|
+
const mergedProps = mergeProps(api.contentProps, presenceApi.getPresenceProps(ref), props);
|
|
14
|
+
if (presenceApi.isUnmounted) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps });
|
|
14
18
|
});
|
|
15
19
|
PopoverContent.displayName = "PopoverContent";
|
|
16
|
-
const PopoverInnerContent = forwardRef(
|
|
17
|
-
function PopoverInnerContent2(props, ref) {
|
|
18
|
-
const api = usePopoverContext();
|
|
19
|
-
const mergedProps = mergeProps(api.contentProps, props);
|
|
20
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
20
|
|
|
24
21
|
export { PopoverContent };
|
|
@@ -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 popoverContext = require('./popover-context.cjs');
|
|
12
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
11
13
|
|
|
12
14
|
const PopoverPositioner = react.forwardRef(
|
|
13
15
|
(props, ref) => {
|
|
14
16
|
const api = popoverContext.usePopoverContext();
|
|
17
|
+
const presenceApi = presenceContext.usePresenceContext();
|
|
15
18
|
const mergedProps = react$1.mergeProps(api.positionerProps, props);
|
|
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 { usePopoverContext } from './popover-context.mjs';
|
|
8
|
+
import { usePresenceContext } from '../presence/presence-context.mjs';
|
|
7
9
|
|
|
8
10
|
const PopoverPositioner = forwardRef(
|
|
9
11
|
(props, ref) => {
|
|
10
12
|
const api = usePopoverContext();
|
|
13
|
+
const presenceApi = usePresenceContext();
|
|
11
14
|
const mergedProps = mergeProps(api.positionerProps, props);
|
|
15
|
+
if (presenceApi.isUnmounted) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
12
18
|
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
13
19
|
}
|
|
14
20
|
);
|
|
@@ -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 popoverContext = require('./popover-context.cjs');
|
|
12
|
+
const presenceContext = require('../presence/presence-context.cjs');
|
|
11
13
|
|
|
12
14
|
const PopoverTrigger = react.forwardRef((props, ref) => {
|
|
13
15
|
const api = popoverContext.usePopoverContext();
|
|
14
|
-
const
|
|
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
|
PopoverTrigger.displayName = "PopoverTrigger";
|