@zag-js/popover 0.1.8 → 0.1.11
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/LICENSE +21 -0
- package/dist/index.d.ts +103 -3
- package/dist/index.js +259 -346
- package/dist/index.mjs +255 -351
- package/package.json +19 -15
- package/dist/popover.connect.d.ts +0 -17
- package/dist/popover.dom.d.ts +0 -27
- package/dist/popover.machine.d.ts +0 -2
- package/dist/popover.types.d.ts +0 -100
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popover",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Core logic for the popover widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,22 +29,26 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/aria-hidden": "0.1.
|
|
33
|
-
"@zag-js/core": "0.1.
|
|
34
|
-
"@zag-js/
|
|
35
|
-
"@zag-js/popper": "0.1.
|
|
36
|
-
"@zag-js/remove-scroll": "0.1.
|
|
37
|
-
"@zag-js/types": "0.2.
|
|
38
|
-
"
|
|
39
|
-
|
|
32
|
+
"@zag-js/aria-hidden": "0.1.1",
|
|
33
|
+
"@zag-js/core": "0.1.9",
|
|
34
|
+
"@zag-js/dismissable": "0.1.3",
|
|
35
|
+
"@zag-js/popper": "0.1.9",
|
|
36
|
+
"@zag-js/remove-scroll": "0.1.3",
|
|
37
|
+
"@zag-js/types": "0.2.3",
|
|
38
|
+
"focus-trap": "6.9.4"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@zag-js/dom-utils": "0.1.8",
|
|
42
|
+
"@zag-js/utils": "0.1.3"
|
|
40
43
|
},
|
|
41
44
|
"scripts": {
|
|
42
|
-
"build
|
|
43
|
-
"start": "
|
|
44
|
-
"build": "
|
|
45
|
+
"build-fast": "tsup src/index.ts --format=esm,cjs",
|
|
46
|
+
"start": "pnpm build --watch",
|
|
47
|
+
"build": "tsup src/index.ts --format=esm,cjs --dts",
|
|
45
48
|
"test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
|
|
46
49
|
"lint": "eslint src --ext .ts,.tsx",
|
|
47
|
-
"test
|
|
48
|
-
"test
|
|
50
|
+
"test-ci": "pnpm test --ci --runInBand",
|
|
51
|
+
"test-watch": "pnpm test --watch -u",
|
|
52
|
+
"typecheck": "tsc --noEmit"
|
|
49
53
|
}
|
|
50
|
-
}
|
|
54
|
+
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PropTypes, ReactPropTypes } from "@zag-js/types";
|
|
2
|
-
import type { Send, State } from "./popover.types";
|
|
3
|
-
export declare function connect<T extends PropTypes = ReactPropTypes>(state: State, send: Send, normalize?: import("@zag-js/types").NormalizeProps): {
|
|
4
|
-
portalled: boolean;
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
open(): void;
|
|
7
|
-
close(): void;
|
|
8
|
-
arrowProps: T["element"];
|
|
9
|
-
innerArrowProps: T["element"];
|
|
10
|
-
anchorProps: T["element"];
|
|
11
|
-
triggerProps: T["button"];
|
|
12
|
-
positionerProps: T["element"];
|
|
13
|
-
contentProps: T["element"];
|
|
14
|
-
titleProps: T["element"];
|
|
15
|
-
descriptionProps: T["element"];
|
|
16
|
-
closeButtonProps: T["button"];
|
|
17
|
-
};
|
package/dist/popover.dom.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { MachineContext as Ctx } from "./popover.types";
|
|
2
|
-
export declare const dom: {
|
|
3
|
-
getDoc: (ctx: Ctx) => Document;
|
|
4
|
-
getActiveEl: (ctx: Ctx) => Element;
|
|
5
|
-
getRootNode: (ctx: Ctx) => Document | ShadowRoot;
|
|
6
|
-
getAnchorId: (ctx: Ctx) => string;
|
|
7
|
-
getTriggerId: (ctx: Ctx) => string;
|
|
8
|
-
getContentId: (ctx: Ctx) => string;
|
|
9
|
-
getPositionerId: (ctx: Ctx) => string;
|
|
10
|
-
getArrowId: (ctx: Ctx) => string;
|
|
11
|
-
getTitleId: (ctx: Ctx) => string;
|
|
12
|
-
getDescriptionId: (ctx: Ctx) => string;
|
|
13
|
-
getCloseButtonId: (ctx: Ctx) => string;
|
|
14
|
-
getAnchorEl: (ctx: Ctx) => HTMLElement;
|
|
15
|
-
getTriggerEl: (ctx: Ctx) => HTMLElement;
|
|
16
|
-
getContentEl: (ctx: Ctx) => HTMLElement;
|
|
17
|
-
getPositionerEl: (ctx: Ctx) => HTMLElement;
|
|
18
|
-
getTitleEl: (ctx: Ctx) => HTMLElement;
|
|
19
|
-
getDescriptionEl: (ctx: Ctx) => HTMLElement;
|
|
20
|
-
getFocusableEls: (ctx: Ctx) => HTMLElement[];
|
|
21
|
-
getFirstFocusableEl: (ctx: Ctx) => HTMLElement;
|
|
22
|
-
getDocTabbableEls: (ctx: Ctx) => HTMLElement[];
|
|
23
|
-
getTabbableEls: (ctx: Ctx) => HTMLElement[];
|
|
24
|
-
getFirstTabbableEl: (ctx: Ctx) => HTMLElement;
|
|
25
|
-
getLastTabbableEl: (ctx: Ctx) => HTMLElement;
|
|
26
|
-
getInitialFocusEl: (ctx: Ctx) => HTMLElement;
|
|
27
|
-
};
|
package/dist/popover.types.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type { StateMachine as S } from "@zag-js/core";
|
|
2
|
-
import type { PositioningOptions, Placement } from "@zag-js/popper";
|
|
3
|
-
import type { Context, MaybeElement } from "@zag-js/types";
|
|
4
|
-
declare type ElementIds = Partial<{
|
|
5
|
-
anchor: string;
|
|
6
|
-
trigger: string;
|
|
7
|
-
content: string;
|
|
8
|
-
title: string;
|
|
9
|
-
description: string;
|
|
10
|
-
closeBtn: string;
|
|
11
|
-
}>;
|
|
12
|
-
declare type PublicContext = {
|
|
13
|
-
/**
|
|
14
|
-
* The ids of the elements in the popover. Useful for composition.
|
|
15
|
-
*/
|
|
16
|
-
ids?: ElementIds;
|
|
17
|
-
/**
|
|
18
|
-
* Whether the popover should be modal. When set to `true`:
|
|
19
|
-
* - interaction with outside elements will be disabled
|
|
20
|
-
* - only popover content will be visible to screen readers
|
|
21
|
-
* - focus is trapped within the popover
|
|
22
|
-
* - scrolling is blocked
|
|
23
|
-
*
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
modal?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Whether the popover is rendered in a portal
|
|
29
|
-
*/
|
|
30
|
-
portalled?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to automatically set focus on the first focusable
|
|
33
|
-
* content within the popover when opened.
|
|
34
|
-
*/
|
|
35
|
-
autoFocus?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* The element to focus on when the popover is opened.
|
|
38
|
-
*/
|
|
39
|
-
initialFocusEl?: MaybeElement | (() => MaybeElement);
|
|
40
|
-
/**
|
|
41
|
-
* Whether to close the popover when the user clicks outside of the popover.
|
|
42
|
-
*/
|
|
43
|
-
closeOnBlur?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to close the popover when the escape key is pressed.
|
|
46
|
-
*/
|
|
47
|
-
closeOnEsc?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Function invoked when the popover is opened.
|
|
50
|
-
*/
|
|
51
|
-
onOpen?: () => void;
|
|
52
|
-
/**
|
|
53
|
-
* Function invoked when the popover is closed.
|
|
54
|
-
*/
|
|
55
|
-
onClose?: () => void;
|
|
56
|
-
/**
|
|
57
|
-
* The user provided options used to position the popover content
|
|
58
|
-
*/
|
|
59
|
-
positioning: PositioningOptions;
|
|
60
|
-
/**
|
|
61
|
-
* Whether to open the popover on page load
|
|
62
|
-
*/
|
|
63
|
-
open?: boolean;
|
|
64
|
-
};
|
|
65
|
-
export declare type UserDefinedContext = Partial<PublicContext>;
|
|
66
|
-
declare type ComputedContext = Readonly<{
|
|
67
|
-
/**
|
|
68
|
-
* @computed
|
|
69
|
-
* The computed value of `portalled`
|
|
70
|
-
*/
|
|
71
|
-
currentPortalled: boolean;
|
|
72
|
-
}>;
|
|
73
|
-
declare type PrivateContext = Context<{
|
|
74
|
-
/**
|
|
75
|
-
* @internal
|
|
76
|
-
* The elements that are rendered on mount
|
|
77
|
-
*/
|
|
78
|
-
renderedElements: {
|
|
79
|
-
title: boolean;
|
|
80
|
-
description: boolean;
|
|
81
|
-
anchor: boolean;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* @internal
|
|
85
|
-
* The computed placement (maybe different from initial placement)
|
|
86
|
-
*/
|
|
87
|
-
currentPlacement?: Placement;
|
|
88
|
-
/**
|
|
89
|
-
* @internal
|
|
90
|
-
* Whether the dynamic placement has been computed
|
|
91
|
-
*/
|
|
92
|
-
isPlacementComplete?: boolean;
|
|
93
|
-
}>;
|
|
94
|
-
export declare type MachineContext = PublicContext & ComputedContext & PrivateContext;
|
|
95
|
-
export declare type MachineState = {
|
|
96
|
-
value: "unknown" | "open" | "closed";
|
|
97
|
-
};
|
|
98
|
-
export declare type State = S.State<MachineContext, MachineState>;
|
|
99
|
-
export declare type Send = S.Send<S.AnyEventObject>;
|
|
100
|
-
export {};
|