@yamada-ui/popover 0.1.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/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/chunk-DQEXAU5O.mjs +229 -0
- package/dist/chunk-O75PU3DP.mjs +216 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +458 -0
- package/dist/index.mjs +24 -0
- package/dist/popover-anchor.d.ts +5 -0
- package/dist/popover-anchor.js +51 -0
- package/dist/popover-anchor.mjs +7 -0
- package/dist/popover-body.d.ts +7 -0
- package/dist/popover-body.js +58 -0
- package/dist/popover-body.mjs +7 -0
- package/dist/popover-close-button.d.ts +7 -0
- package/dist/popover-close-button.js +72 -0
- package/dist/popover-close-button.mjs +7 -0
- package/dist/popover-content.d.ts +8 -0
- package/dist/popover-content.js +173 -0
- package/dist/popover-content.mjs +7 -0
- package/dist/popover-footer.d.ts +7 -0
- package/dist/popover-footer.js +60 -0
- package/dist/popover-footer.mjs +7 -0
- package/dist/popover-header.d.ts +7 -0
- package/dist/popover-header.js +60 -0
- package/dist/popover-header.mjs +7 -0
- package/dist/popover-trigger.d.ts +5 -0
- package/dist/popover-trigger.js +51 -0
- package/dist/popover-trigger.mjs +7 -0
- package/dist/popover.d.ts +45 -0
- package/dist/popover.js +247 -0
- package/dist/popover.mjs +8 -0
- package/package.json +82 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/popover-close-button.tsx
|
|
21
|
+
var popover_close_button_exports = {};
|
|
22
|
+
__export(popover_close_button_exports, {
|
|
23
|
+
PopoverCloseButton: () => PopoverCloseButton
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(popover_close_button_exports);
|
|
26
|
+
var import_close_button = require("@yamada-ui/close-button");
|
|
27
|
+
var import_core2 = require("@yamada-ui/core");
|
|
28
|
+
var import_utils2 = require("@yamada-ui/utils");
|
|
29
|
+
|
|
30
|
+
// src/popover.tsx
|
|
31
|
+
var import_core = require("@yamada-ui/core");
|
|
32
|
+
var import_use_animation = require("@yamada-ui/use-animation");
|
|
33
|
+
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
|
34
|
+
var import_use_focus = require("@yamada-ui/use-focus");
|
|
35
|
+
var import_use_popper = require("@yamada-ui/use-popper");
|
|
36
|
+
var import_utils = require("@yamada-ui/utils");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
var [PopoverProvider, usePopover] = (0, import_utils.createContext)({
|
|
40
|
+
strict: false,
|
|
41
|
+
name: "PopoverContext"
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// src/popover-close-button.tsx
|
|
45
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
46
|
+
var PopoverCloseButton = (0, import_core2.forwardRef)(
|
|
47
|
+
({ onClick, ...rest }, ref) => {
|
|
48
|
+
const { styles, onClose } = usePopover();
|
|
49
|
+
const css = {
|
|
50
|
+
position: "absolute",
|
|
51
|
+
...styles.closeButton
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
54
|
+
import_close_button.CloseButton,
|
|
55
|
+
{
|
|
56
|
+
ref,
|
|
57
|
+
className: (0, import_utils2.cx)("ui-popover-close-button"),
|
|
58
|
+
__css: css,
|
|
59
|
+
onClick: (0, import_utils2.handlerAll)(onClick, (event) => {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
onClose == null ? void 0 : onClose();
|
|
62
|
+
}),
|
|
63
|
+
size: "sm",
|
|
64
|
+
...rest
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
PopoverCloseButton
|
|
72
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
+
import { HTMLMotionProps } from '@yamada-ui/motion';
|
|
4
|
+
|
|
5
|
+
type PopoverContentProps = Omit<HTMLUIProps<'section'>, keyof Omit<HTMLMotionProps<'section'>, 'children'>> & Omit<HTMLMotionProps<'section'>, 'color' | 'style' | 'onDrag' | 'onDragEnd' | 'onDragStart' | 'onAnimationStart' | 'variants' | 'transition'>;
|
|
6
|
+
declare const PopoverContent: _yamada_ui_core.Component<"section", PopoverContentProps>;
|
|
7
|
+
|
|
8
|
+
export { PopoverContent, PopoverContentProps };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/popover-content.tsx
|
|
21
|
+
var popover_content_exports = {};
|
|
22
|
+
__export(popover_content_exports, {
|
|
23
|
+
PopoverContent: () => PopoverContent
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(popover_content_exports);
|
|
26
|
+
var import_core3 = require("@yamada-ui/core");
|
|
27
|
+
var import_motion = require("@yamada-ui/motion");
|
|
28
|
+
var import_transitions = require("@yamada-ui/transitions");
|
|
29
|
+
var import_utils3 = require("@yamada-ui/utils");
|
|
30
|
+
|
|
31
|
+
// src/popover.tsx
|
|
32
|
+
var import_core = require("@yamada-ui/core");
|
|
33
|
+
var import_use_animation = require("@yamada-ui/use-animation");
|
|
34
|
+
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
|
35
|
+
var import_use_focus = require("@yamada-ui/use-focus");
|
|
36
|
+
var import_use_popper = require("@yamada-ui/use-popper");
|
|
37
|
+
var import_utils = require("@yamada-ui/utils");
|
|
38
|
+
var import_react = require("react");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var [PopoverProvider, usePopover] = (0, import_utils.createContext)({
|
|
41
|
+
strict: false,
|
|
42
|
+
name: "PopoverContext"
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/popover-close-button.tsx
|
|
46
|
+
var import_close_button = require("@yamada-ui/close-button");
|
|
47
|
+
var import_core2 = require("@yamada-ui/core");
|
|
48
|
+
var import_utils2 = require("@yamada-ui/utils");
|
|
49
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
50
|
+
var PopoverCloseButton = (0, import_core2.forwardRef)(
|
|
51
|
+
({ onClick, ...rest }, ref) => {
|
|
52
|
+
const { styles, onClose } = usePopover();
|
|
53
|
+
const css = {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
...styles.closeButton
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
58
|
+
import_close_button.CloseButton,
|
|
59
|
+
{
|
|
60
|
+
ref,
|
|
61
|
+
className: (0, import_utils2.cx)("ui-popover-close-button"),
|
|
62
|
+
__css: css,
|
|
63
|
+
onClick: (0, import_utils2.handlerAll)(onClick, (event) => {
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
onClose == null ? void 0 : onClose();
|
|
66
|
+
}),
|
|
67
|
+
size: "sm",
|
|
68
|
+
...rest
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// src/popover-content.tsx
|
|
75
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
76
|
+
var getPopoverContentProps = (animation = "scale", duration) => {
|
|
77
|
+
const custom = {
|
|
78
|
+
reverse: true,
|
|
79
|
+
duration,
|
|
80
|
+
enter: { visibility: "visible" },
|
|
81
|
+
transitionEnd: { exit: { visibility: "hidden" } }
|
|
82
|
+
};
|
|
83
|
+
switch (animation) {
|
|
84
|
+
case "scale":
|
|
85
|
+
return {
|
|
86
|
+
...import_transitions.scaleFadeProps,
|
|
87
|
+
custom: { ...custom, scale: 0.95 }
|
|
88
|
+
};
|
|
89
|
+
case "top":
|
|
90
|
+
return {
|
|
91
|
+
...import_transitions.slideFadeProps,
|
|
92
|
+
custom: { ...custom, offsetX: 0, offsetY: -16 }
|
|
93
|
+
};
|
|
94
|
+
case "right":
|
|
95
|
+
return {
|
|
96
|
+
...import_transitions.slideFadeProps,
|
|
97
|
+
custom: { ...custom, offsetX: 16, offsetY: 0 }
|
|
98
|
+
};
|
|
99
|
+
case "left":
|
|
100
|
+
return {
|
|
101
|
+
...import_transitions.slideFadeProps,
|
|
102
|
+
custom: { ...custom, offsetX: -16, offsetY: 0 }
|
|
103
|
+
};
|
|
104
|
+
case "bottom":
|
|
105
|
+
return {
|
|
106
|
+
...import_transitions.slideFadeProps,
|
|
107
|
+
custom: { ...custom, offsetX: 0, offsetY: 16 }
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var PopoverContent = (0, import_core3.forwardRef)(
|
|
112
|
+
({ as = "section", className, children, w, width, minW, minWidth, zIndex, __css, ...rest }, ref) => {
|
|
113
|
+
var _a, _b, _c, _d;
|
|
114
|
+
const {
|
|
115
|
+
isOpen,
|
|
116
|
+
closeOnButton,
|
|
117
|
+
getPopperProps,
|
|
118
|
+
getPopoverProps,
|
|
119
|
+
onAnimationComplete,
|
|
120
|
+
animation,
|
|
121
|
+
duration,
|
|
122
|
+
styles
|
|
123
|
+
} = usePopover();
|
|
124
|
+
const validChildren = (0, import_utils3.getValidChildren)(children);
|
|
125
|
+
const [customPopoverCloseButton, ...cloneChildren] = (0, import_utils3.findChildren)(
|
|
126
|
+
validChildren,
|
|
127
|
+
PopoverCloseButton
|
|
128
|
+
);
|
|
129
|
+
const css = {
|
|
130
|
+
position: "relative",
|
|
131
|
+
w: "100%",
|
|
132
|
+
display: "flex",
|
|
133
|
+
flexDirection: "column",
|
|
134
|
+
outline: 0,
|
|
135
|
+
...(0, import_utils3.omitObject)(__css != null ? __css : styles.container, ["zIndex"])
|
|
136
|
+
};
|
|
137
|
+
w = (_b = w != null ? w : width) != null ? _b : (_a = styles.container.w) != null ? _a : styles.container.width;
|
|
138
|
+
minW = (_d = minW != null ? minW : minWidth) != null ? _d : (_c = styles.container.minW) != null ? _c : styles.container.minWidth;
|
|
139
|
+
zIndex = zIndex != null ? zIndex : styles.container.zIndex;
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
141
|
+
import_core3.ui.div,
|
|
142
|
+
{
|
|
143
|
+
...getPopperProps({ style: { visibility: isOpen ? "visible" : "hidden" } }),
|
|
144
|
+
className: "ui-popover",
|
|
145
|
+
w,
|
|
146
|
+
minW,
|
|
147
|
+
zIndex,
|
|
148
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
149
|
+
import_core3.ui.section,
|
|
150
|
+
{
|
|
151
|
+
as: import_motion.motion[as],
|
|
152
|
+
className: (0, import_utils3.cx)("ui-popover-content", className),
|
|
153
|
+
...animation !== "none" ? getPopoverContentProps(animation, duration) : {},
|
|
154
|
+
...getPopoverProps(rest, ref),
|
|
155
|
+
initial: "exit",
|
|
156
|
+
animate: isOpen ? "enter" : "exit",
|
|
157
|
+
exit: "exit",
|
|
158
|
+
onAnimationComplete: (0, import_utils3.funcAll)(onAnimationComplete, rest.onAnimationComplete),
|
|
159
|
+
__css: css,
|
|
160
|
+
children: [
|
|
161
|
+
customPopoverCloseButton != null ? customPopoverCloseButton : closeOnButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PopoverCloseButton, {}) : null,
|
|
162
|
+
cloneChildren
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
171
|
+
0 && (module.exports = {
|
|
172
|
+
PopoverContent
|
|
173
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
+
|
|
4
|
+
type PopoverFooterProps = HTMLUIProps<'footer'>;
|
|
5
|
+
declare const PopoverFooter: _yamada_ui_core.Component<"footer", PopoverFooterProps>;
|
|
6
|
+
|
|
7
|
+
export { PopoverFooter, PopoverFooterProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/popover-footer.tsx
|
|
21
|
+
var popover_footer_exports = {};
|
|
22
|
+
__export(popover_footer_exports, {
|
|
23
|
+
PopoverFooter: () => PopoverFooter
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(popover_footer_exports);
|
|
26
|
+
var import_core2 = require("@yamada-ui/core");
|
|
27
|
+
var import_utils2 = require("@yamada-ui/utils");
|
|
28
|
+
|
|
29
|
+
// src/popover.tsx
|
|
30
|
+
var import_core = require("@yamada-ui/core");
|
|
31
|
+
var import_use_animation = require("@yamada-ui/use-animation");
|
|
32
|
+
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
|
33
|
+
var import_use_focus = require("@yamada-ui/use-focus");
|
|
34
|
+
var import_use_popper = require("@yamada-ui/use-popper");
|
|
35
|
+
var import_utils = require("@yamada-ui/utils");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var [PopoverProvider, usePopover] = (0, import_utils.createContext)({
|
|
39
|
+
strict: false,
|
|
40
|
+
name: "PopoverContext"
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/popover-footer.tsx
|
|
44
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
45
|
+
var PopoverFooter = (0, import_core2.forwardRef)(
|
|
46
|
+
({ className, ...rest }, ref) => {
|
|
47
|
+
const { styles } = usePopover();
|
|
48
|
+
const css = {
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "flex-start",
|
|
52
|
+
...styles.footer
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.footer, { ref, className: (0, import_utils2.cx)("ui-popover-footer", className), __css: css, ...rest });
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
PopoverFooter
|
|
60
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
+
|
|
4
|
+
type PopoverHeaderProps = HTMLUIProps<'header'>;
|
|
5
|
+
declare const PopoverHeader: _yamada_ui_core.Component<"header", PopoverHeaderProps>;
|
|
6
|
+
|
|
7
|
+
export { PopoverHeader, PopoverHeaderProps };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/popover-header.tsx
|
|
21
|
+
var popover_header_exports = {};
|
|
22
|
+
__export(popover_header_exports, {
|
|
23
|
+
PopoverHeader: () => PopoverHeader
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(popover_header_exports);
|
|
26
|
+
var import_core2 = require("@yamada-ui/core");
|
|
27
|
+
var import_utils2 = require("@yamada-ui/utils");
|
|
28
|
+
|
|
29
|
+
// src/popover.tsx
|
|
30
|
+
var import_core = require("@yamada-ui/core");
|
|
31
|
+
var import_use_animation = require("@yamada-ui/use-animation");
|
|
32
|
+
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
|
33
|
+
var import_use_focus = require("@yamada-ui/use-focus");
|
|
34
|
+
var import_use_popper = require("@yamada-ui/use-popper");
|
|
35
|
+
var import_utils = require("@yamada-ui/utils");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var [PopoverProvider, usePopover] = (0, import_utils.createContext)({
|
|
39
|
+
strict: false,
|
|
40
|
+
name: "PopoverContext"
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/popover-header.tsx
|
|
44
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
45
|
+
var PopoverHeader = (0, import_core2.forwardRef)(
|
|
46
|
+
({ className, ...rest }, ref) => {
|
|
47
|
+
const { styles } = usePopover();
|
|
48
|
+
const css = {
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "flex-start",
|
|
52
|
+
...styles.header
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.header, { ref, className: (0, import_utils2.cx)("ui-popover-header", className), __css: css, ...rest });
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
PopoverHeader
|
|
60
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/popover-trigger.tsx
|
|
21
|
+
var popover_trigger_exports = {};
|
|
22
|
+
__export(popover_trigger_exports, {
|
|
23
|
+
PopoverTrigger: () => PopoverTrigger
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(popover_trigger_exports);
|
|
26
|
+
var import_react2 = require("react");
|
|
27
|
+
|
|
28
|
+
// src/popover.tsx
|
|
29
|
+
var import_core = require("@yamada-ui/core");
|
|
30
|
+
var import_use_animation = require("@yamada-ui/use-animation");
|
|
31
|
+
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
|
32
|
+
var import_use_focus = require("@yamada-ui/use-focus");
|
|
33
|
+
var import_use_popper = require("@yamada-ui/use-popper");
|
|
34
|
+
var import_utils = require("@yamada-ui/utils");
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var [PopoverProvider, usePopover] = (0, import_utils.createContext)({
|
|
38
|
+
strict: false,
|
|
39
|
+
name: "PopoverContext"
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/popover-trigger.tsx
|
|
43
|
+
var PopoverTrigger = ({ children }) => {
|
|
44
|
+
const child = import_react2.Children.only(children);
|
|
45
|
+
const { getTriggerProps } = usePopover();
|
|
46
|
+
return (0, import_react2.cloneElement)(child, getTriggerProps(child.props, child.ref));
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
PopoverTrigger
|
|
51
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ThemeProps, CSSUIObject } from '@yamada-ui/core';
|
|
2
|
+
import { MotionTransitionProperties } from '@yamada-ui/motion';
|
|
3
|
+
import { LazyMode } from '@yamada-ui/use-disclosure';
|
|
4
|
+
import { UsePopperProps } from '@yamada-ui/use-popper';
|
|
5
|
+
import { PropGetter } from '@yamada-ui/utils';
|
|
6
|
+
import { PropsWithChildren, FC } from 'react';
|
|
7
|
+
|
|
8
|
+
type Trigger = 'click' | 'hover' | 'never';
|
|
9
|
+
type Animation = 'scale' | 'top' | 'right' | 'left' | 'bottom' | 'none';
|
|
10
|
+
type PopoverOptions = {
|
|
11
|
+
isOpen?: boolean;
|
|
12
|
+
defaultIsOpen?: boolean;
|
|
13
|
+
onOpen?: () => void;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
initialFocusRef?: React.RefObject<{
|
|
16
|
+
focus(): void;
|
|
17
|
+
}>;
|
|
18
|
+
restoreFocus?: boolean;
|
|
19
|
+
autoFocus?: boolean;
|
|
20
|
+
closeOnBlur?: boolean;
|
|
21
|
+
closeOnEsc?: boolean;
|
|
22
|
+
closeOnButton?: boolean;
|
|
23
|
+
trigger?: Trigger;
|
|
24
|
+
openDelay?: number;
|
|
25
|
+
closeDelay?: number;
|
|
26
|
+
isLazy?: boolean;
|
|
27
|
+
lazyBehavior?: LazyMode;
|
|
28
|
+
animation?: Animation;
|
|
29
|
+
duration?: MotionTransitionProperties['duration'];
|
|
30
|
+
};
|
|
31
|
+
type PopoverProps = ThemeProps<'Popover'> & Omit<UsePopperProps, 'enabled'> & PropsWithChildren<PopoverOptions>;
|
|
32
|
+
type PopoverContext = Pick<PopoverOptions, 'isOpen' | 'onClose' | 'closeOnButton' | 'animation' | 'duration'> & {
|
|
33
|
+
onAnimationComplete: () => void;
|
|
34
|
+
forceUpdate: () => void | undefined;
|
|
35
|
+
getTriggerProps: PropGetter;
|
|
36
|
+
getAnchorProps: PropGetter;
|
|
37
|
+
getPopperProps: PropGetter;
|
|
38
|
+
getPopoverProps: PropGetter;
|
|
39
|
+
styles: Record<string, CSSUIObject>;
|
|
40
|
+
};
|
|
41
|
+
declare const usePopover: () => PopoverContext;
|
|
42
|
+
|
|
43
|
+
declare const Popover: FC<PopoverProps>;
|
|
44
|
+
|
|
45
|
+
export { Popover, PopoverProps, usePopover };
|