@lattice-ui/popover 0.1.1 → 0.3.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/LICENSE +7 -0
- package/out/index.d.ts +15 -6
- package/out/init.luau +23 -8
- package/package.json +10 -6
- package/src/Popover/PopoverAnchor.tsx +0 -33
- package/src/Popover/PopoverClose.tsx +0 -35
- package/src/Popover/PopoverContent.tsx +0 -145
- package/src/Popover/PopoverPortal.tsx +0 -28
- package/src/Popover/PopoverRoot.tsx +0 -37
- package/src/Popover/PopoverTrigger.tsx +0 -61
- package/src/Popover/context.ts +0 -6
- package/src/Popover/types.ts +0 -56
- package/src/index.ts +0 -14
- package/tsconfig.json +0 -16
- package/tsconfig.typecheck.json +0 -25
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 astra-void
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/out/index.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { PopoverAnchor } from "./Popover/PopoverAnchor";
|
|
2
|
+
import { PopoverClose } from "./Popover/PopoverClose";
|
|
3
|
+
import { PopoverContent } from "./Popover/PopoverContent";
|
|
4
|
+
import { PopoverPortal } from "./Popover/PopoverPortal";
|
|
5
|
+
import { Popover as PopoverRoot } from "./Popover/PopoverRoot";
|
|
6
|
+
import { PopoverTrigger } from "./Popover/PopoverTrigger";
|
|
7
|
+
export declare const Popover: {
|
|
8
|
+
readonly Root: typeof PopoverRoot;
|
|
9
|
+
readonly Trigger: typeof PopoverTrigger;
|
|
10
|
+
readonly Portal: typeof PopoverPortal;
|
|
11
|
+
readonly Content: typeof PopoverContent;
|
|
12
|
+
readonly Anchor: typeof PopoverAnchor;
|
|
13
|
+
readonly Close: typeof PopoverClose;
|
|
14
|
+
};
|
|
15
|
+
export { PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger };
|
|
7
16
|
export type { PopoverAnchorProps, PopoverCloseProps, PopoverContentProps, PopoverPortalProps, PopoverProps, PopoverTriggerProps, } from "./Popover/types";
|
package/out/init.luau
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
local PopoverAnchor = TS.import(script, script, "Popover", "PopoverAnchor").PopoverAnchor
|
|
4
|
+
local PopoverClose = TS.import(script, script, "Popover", "PopoverClose").PopoverClose
|
|
5
|
+
local PopoverContent = TS.import(script, script, "Popover", "PopoverContent").PopoverContent
|
|
6
|
+
local PopoverPortal = TS.import(script, script, "Popover", "PopoverPortal").PopoverPortal
|
|
7
|
+
local PopoverRoot = TS.import(script, script, "Popover", "PopoverRoot").Popover
|
|
8
|
+
local PopoverTrigger = TS.import(script, script, "Popover", "PopoverTrigger").PopoverTrigger
|
|
9
|
+
local Popover = {
|
|
10
|
+
Root = PopoverRoot,
|
|
11
|
+
Trigger = PopoverTrigger,
|
|
12
|
+
Portal = PopoverPortal,
|
|
13
|
+
Content = PopoverContent,
|
|
14
|
+
Anchor = PopoverAnchor,
|
|
15
|
+
Close = PopoverClose,
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
Popover = Popover,
|
|
19
|
+
PopoverAnchor = PopoverAnchor,
|
|
20
|
+
PopoverClose = PopoverClose,
|
|
21
|
+
PopoverContent = PopoverContent,
|
|
22
|
+
PopoverPortal = PopoverPortal,
|
|
23
|
+
PopoverRoot = PopoverRoot,
|
|
24
|
+
PopoverTrigger = PopoverTrigger,
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lattice-ui/popover",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "out/init.luau",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"out",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
7
11
|
"dependencies": {
|
|
8
|
-
"@lattice-ui/
|
|
9
|
-
"@lattice-ui/popper": "0.
|
|
10
|
-
"@lattice-ui/
|
|
12
|
+
"@lattice-ui/core": "0.3.1",
|
|
13
|
+
"@lattice-ui/popper": "0.3.1",
|
|
14
|
+
"@lattice-ui/layer": "0.3.1"
|
|
11
15
|
},
|
|
12
16
|
"devDependencies": {
|
|
13
17
|
"@rbxts/react": "17.3.7-ts.1",
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
},
|
|
20
24
|
"scripts": {
|
|
21
25
|
"build": "rbxtsc -p tsconfig.json",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
26
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
27
|
+
"watch": "rbxtsc -p tsconfig.json -w"
|
|
24
28
|
}
|
|
25
29
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { usePopoverContext } from "./context";
|
|
3
|
-
import type { PopoverAnchorProps } from "./types";
|
|
4
|
-
|
|
5
|
-
function toGuiObject(instance: Instance | undefined) {
|
|
6
|
-
if (!instance || !instance.IsA("GuiObject")) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return instance;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function PopoverAnchor(props: PopoverAnchorProps) {
|
|
14
|
-
const popoverContext = usePopoverContext();
|
|
15
|
-
|
|
16
|
-
const setAnchorRef = React.useCallback(
|
|
17
|
-
(instance: Instance | undefined) => {
|
|
18
|
-
popoverContext.anchorRef.current = toGuiObject(instance);
|
|
19
|
-
},
|
|
20
|
-
[popoverContext.anchorRef],
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
if (props.asChild) {
|
|
24
|
-
const child = props.children;
|
|
25
|
-
if (!child) {
|
|
26
|
-
error("[PopoverAnchor] `asChild` requires a child element.");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return <Slot ref={setAnchorRef}>{child}</Slot>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return <frame BackgroundTransparency={1} BorderSizePixel={0} Size={UDim2.fromOffset(0, 0)} ref={setAnchorRef} />;
|
|
33
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { usePopoverContext } from "./context";
|
|
3
|
-
import type { PopoverCloseProps } from "./types";
|
|
4
|
-
|
|
5
|
-
export function PopoverClose(props: PopoverCloseProps) {
|
|
6
|
-
const popoverContext = usePopoverContext();
|
|
7
|
-
|
|
8
|
-
const handleActivated = React.useCallback(() => {
|
|
9
|
-
popoverContext.setOpen(false);
|
|
10
|
-
}, [popoverContext.setOpen]);
|
|
11
|
-
|
|
12
|
-
if (props.asChild) {
|
|
13
|
-
const child = props.children;
|
|
14
|
-
if (!child) {
|
|
15
|
-
error("[PopoverClose] `asChild` requires a child element.");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return <Slot Event={{ Activated: handleActivated }}>{child}</Slot>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<textbutton
|
|
23
|
-
AutoButtonColor={false}
|
|
24
|
-
BackgroundTransparency={1}
|
|
25
|
-
BorderSizePixel={0}
|
|
26
|
-
Event={{ Activated: handleActivated }}
|
|
27
|
-
Size={UDim2.fromOffset(110, 34)}
|
|
28
|
-
Text="Close"
|
|
29
|
-
TextColor3={Color3.fromRGB(240, 244, 250)}
|
|
30
|
-
TextSize={16}
|
|
31
|
-
>
|
|
32
|
-
{props.children}
|
|
33
|
-
</textbutton>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { DismissableLayer, Presence } from "@lattice-ui/layer";
|
|
3
|
-
import { usePopper } from "@lattice-ui/popper";
|
|
4
|
-
import { usePopoverContext } from "./context";
|
|
5
|
-
import type { PopoverContentProps } from "./types";
|
|
6
|
-
|
|
7
|
-
type PopoverContentImplProps = {
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
visible: boolean;
|
|
10
|
-
onDismiss: () => void;
|
|
11
|
-
asChild?: boolean;
|
|
12
|
-
placement?: PopoverContentProps["placement"];
|
|
13
|
-
offset?: PopoverContentProps["offset"];
|
|
14
|
-
padding?: PopoverContentProps["padding"];
|
|
15
|
-
} & Pick<PopoverContentProps, "children" | "onEscapeKeyDown" | "onInteractOutside" | "onPointerDownOutside">;
|
|
16
|
-
|
|
17
|
-
function toGuiObject(instance: Instance | undefined) {
|
|
18
|
-
if (!instance || !instance.IsA("GuiObject")) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return instance;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function PopoverContentImpl(props: PopoverContentImplProps) {
|
|
26
|
-
const popoverContext = usePopoverContext();
|
|
27
|
-
const anchorRef = popoverContext.anchorRef.current ? popoverContext.anchorRef : popoverContext.triggerRef;
|
|
28
|
-
|
|
29
|
-
const popper = usePopper({
|
|
30
|
-
anchorRef,
|
|
31
|
-
contentRef: popoverContext.contentRef,
|
|
32
|
-
placement: props.placement,
|
|
33
|
-
offset: props.offset,
|
|
34
|
-
padding: props.padding,
|
|
35
|
-
enabled: props.enabled,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const setContentRef = React.useCallback(
|
|
39
|
-
(instance: Instance | undefined) => {
|
|
40
|
-
popoverContext.contentRef.current = toGuiObject(instance);
|
|
41
|
-
},
|
|
42
|
-
[popoverContext.contentRef],
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
if (props.asChild) {
|
|
46
|
-
const child = props.children;
|
|
47
|
-
if (!React.isValidElement(child)) {
|
|
48
|
-
error("[PopoverContent] `asChild` requires a child element.");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<DismissableLayer
|
|
53
|
-
enabled={props.enabled}
|
|
54
|
-
modal={popoverContext.modal}
|
|
55
|
-
onDismiss={props.onDismiss}
|
|
56
|
-
onEscapeKeyDown={props.onEscapeKeyDown}
|
|
57
|
-
onInteractOutside={props.onInteractOutside}
|
|
58
|
-
onPointerDownOutside={props.onPointerDownOutside}
|
|
59
|
-
>
|
|
60
|
-
<Slot AnchorPoint={popper.anchorPoint} Position={popper.position} Visible={props.visible} ref={setContentRef}>
|
|
61
|
-
{child}
|
|
62
|
-
</Slot>
|
|
63
|
-
</DismissableLayer>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<DismissableLayer
|
|
69
|
-
enabled={props.enabled}
|
|
70
|
-
modal={popoverContext.modal}
|
|
71
|
-
onDismiss={props.onDismiss}
|
|
72
|
-
onEscapeKeyDown={props.onEscapeKeyDown}
|
|
73
|
-
onInteractOutside={props.onInteractOutside}
|
|
74
|
-
onPointerDownOutside={props.onPointerDownOutside}
|
|
75
|
-
>
|
|
76
|
-
<frame
|
|
77
|
-
AnchorPoint={popper.anchorPoint}
|
|
78
|
-
BackgroundTransparency={1}
|
|
79
|
-
BorderSizePixel={0}
|
|
80
|
-
Position={popper.position}
|
|
81
|
-
Size={UDim2.fromOffset(0, 0)}
|
|
82
|
-
Visible={props.visible}
|
|
83
|
-
ref={setContentRef}
|
|
84
|
-
>
|
|
85
|
-
{props.children}
|
|
86
|
-
</frame>
|
|
87
|
-
</DismissableLayer>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function PopoverContent(props: PopoverContentProps) {
|
|
92
|
-
const popoverContext = usePopoverContext();
|
|
93
|
-
const open = popoverContext.open;
|
|
94
|
-
const forceMount = props.forceMount === true;
|
|
95
|
-
|
|
96
|
-
const handleDismiss = React.useCallback(() => {
|
|
97
|
-
popoverContext.setOpen(false);
|
|
98
|
-
}, [popoverContext.setOpen]);
|
|
99
|
-
|
|
100
|
-
if (!open && !forceMount) {
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (forceMount) {
|
|
105
|
-
return (
|
|
106
|
-
<PopoverContentImpl
|
|
107
|
-
asChild={props.asChild}
|
|
108
|
-
enabled={open}
|
|
109
|
-
offset={props.offset}
|
|
110
|
-
onDismiss={handleDismiss}
|
|
111
|
-
onEscapeKeyDown={props.onEscapeKeyDown}
|
|
112
|
-
onInteractOutside={props.onInteractOutside}
|
|
113
|
-
onPointerDownOutside={props.onPointerDownOutside}
|
|
114
|
-
padding={props.padding}
|
|
115
|
-
placement={props.placement}
|
|
116
|
-
visible={open}
|
|
117
|
-
>
|
|
118
|
-
{props.children}
|
|
119
|
-
</PopoverContentImpl>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<Presence
|
|
125
|
-
exitFallbackMs={0}
|
|
126
|
-
present={open}
|
|
127
|
-
render={(state) => (
|
|
128
|
-
<PopoverContentImpl
|
|
129
|
-
asChild={props.asChild}
|
|
130
|
-
enabled={state.isPresent}
|
|
131
|
-
offset={props.offset}
|
|
132
|
-
onDismiss={handleDismiss}
|
|
133
|
-
onEscapeKeyDown={props.onEscapeKeyDown}
|
|
134
|
-
onInteractOutside={props.onInteractOutside}
|
|
135
|
-
onPointerDownOutside={props.onPointerDownOutside}
|
|
136
|
-
padding={props.padding}
|
|
137
|
-
placement={props.placement}
|
|
138
|
-
visible={state.isPresent}
|
|
139
|
-
>
|
|
140
|
-
{props.children}
|
|
141
|
-
</PopoverContentImpl>
|
|
142
|
-
)}
|
|
143
|
-
/>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { React } from "@lattice-ui/core";
|
|
2
|
-
import { Portal, PortalProvider, usePortalContext } from "@lattice-ui/layer";
|
|
3
|
-
import type { PopoverPortalProps } from "./types";
|
|
4
|
-
|
|
5
|
-
function PopoverPortalWithOverrides(props: PopoverPortalProps) {
|
|
6
|
-
const portalContext = usePortalContext();
|
|
7
|
-
const container = props.container ?? portalContext.container;
|
|
8
|
-
const displayOrderBase = props.displayOrderBase ?? portalContext.displayOrderBase;
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<PortalProvider container={container} displayOrderBase={displayOrderBase}>
|
|
12
|
-
<Portal>{props.children}</Portal>
|
|
13
|
-
</PortalProvider>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function PopoverPortal(props: PopoverPortalProps) {
|
|
18
|
-
const hasOverrides = props.container !== undefined || props.displayOrderBase !== undefined;
|
|
19
|
-
if (hasOverrides) {
|
|
20
|
-
return (
|
|
21
|
-
<PopoverPortalWithOverrides container={props.container} displayOrderBase={props.displayOrderBase}>
|
|
22
|
-
{props.children}
|
|
23
|
-
</PopoverPortalWithOverrides>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return <Portal>{props.children}</Portal>;
|
|
28
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { React, useControllableState } from "@lattice-ui/core";
|
|
2
|
-
import { PopoverContextProvider } from "./context";
|
|
3
|
-
import type { PopoverProps } from "./types";
|
|
4
|
-
|
|
5
|
-
export function Popover(props: PopoverProps) {
|
|
6
|
-
const [open, setOpenState] = useControllableState<boolean>({
|
|
7
|
-
value: props.open,
|
|
8
|
-
defaultValue: props.defaultOpen ?? false,
|
|
9
|
-
onChange: props.onOpenChange,
|
|
10
|
-
});
|
|
11
|
-
const modal = props.modal ?? false;
|
|
12
|
-
|
|
13
|
-
const triggerRef = React.useRef<GuiObject>();
|
|
14
|
-
const anchorRef = React.useRef<GuiObject>();
|
|
15
|
-
const contentRef = React.useRef<GuiObject>();
|
|
16
|
-
|
|
17
|
-
const setOpen = React.useCallback(
|
|
18
|
-
(nextOpen: boolean) => {
|
|
19
|
-
setOpenState(nextOpen);
|
|
20
|
-
},
|
|
21
|
-
[setOpenState],
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const contextValue = React.useMemo(
|
|
25
|
-
() => ({
|
|
26
|
-
open,
|
|
27
|
-
setOpen,
|
|
28
|
-
modal,
|
|
29
|
-
triggerRef,
|
|
30
|
-
anchorRef,
|
|
31
|
-
contentRef,
|
|
32
|
-
}),
|
|
33
|
-
[modal, open, setOpen],
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
return <PopoverContextProvider value={contextValue}>{props.children}</PopoverContextProvider>;
|
|
37
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { React, Slot } from "@lattice-ui/core";
|
|
2
|
-
import { usePopoverContext } from "./context";
|
|
3
|
-
import type { PopoverTriggerProps } from "./types";
|
|
4
|
-
|
|
5
|
-
function toGuiObject(instance: Instance | undefined) {
|
|
6
|
-
if (!instance || !instance.IsA("GuiObject")) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return instance;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function PopoverTrigger(props: PopoverTriggerProps) {
|
|
14
|
-
const popoverContext = usePopoverContext();
|
|
15
|
-
|
|
16
|
-
const setTriggerRef = React.useCallback(
|
|
17
|
-
(instance: Instance | undefined) => {
|
|
18
|
-
popoverContext.triggerRef.current = toGuiObject(instance);
|
|
19
|
-
},
|
|
20
|
-
[popoverContext.triggerRef],
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const handleActivated = React.useCallback(() => {
|
|
24
|
-
if (props.disabled) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
popoverContext.setOpen(!popoverContext.open);
|
|
29
|
-
}, [popoverContext.open, popoverContext.setOpen, props.disabled]);
|
|
30
|
-
|
|
31
|
-
if (props.asChild) {
|
|
32
|
-
const child = props.children;
|
|
33
|
-
if (!child) {
|
|
34
|
-
error("[PopoverTrigger] `asChild` requires a child element.");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Slot Event={{ Activated: handleActivated }} ref={setTriggerRef}>
|
|
39
|
-
{child}
|
|
40
|
-
</Slot>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<textbutton
|
|
46
|
-
Active={props.disabled !== true}
|
|
47
|
-
AutoButtonColor={false}
|
|
48
|
-
BackgroundTransparency={1}
|
|
49
|
-
BorderSizePixel={0}
|
|
50
|
-
Event={{ Activated: handleActivated }}
|
|
51
|
-
Selectable={props.disabled !== true}
|
|
52
|
-
Size={UDim2.fromOffset(150, 38)}
|
|
53
|
-
Text="Toggle Popover"
|
|
54
|
-
TextColor3={Color3.fromRGB(240, 244, 250)}
|
|
55
|
-
TextSize={16}
|
|
56
|
-
ref={setTriggerRef}
|
|
57
|
-
>
|
|
58
|
-
{props.children}
|
|
59
|
-
</textbutton>
|
|
60
|
-
);
|
|
61
|
-
}
|
package/src/Popover/context.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createStrictContext } from "@lattice-ui/core";
|
|
2
|
-
import type { PopoverContextValue } from "./types";
|
|
3
|
-
|
|
4
|
-
const [PopoverContextProvider, usePopoverContext] = createStrictContext<PopoverContextValue>("Popover");
|
|
5
|
-
|
|
6
|
-
export { PopoverContextProvider, usePopoverContext };
|
package/src/Popover/types.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { LayerInteractEvent } from "@lattice-ui/layer";
|
|
2
|
-
import type { PopperPlacement } from "@lattice-ui/popper";
|
|
3
|
-
import type React from "@rbxts/react";
|
|
4
|
-
|
|
5
|
-
export type PopoverSetOpen = (open: boolean) => void;
|
|
6
|
-
|
|
7
|
-
export type PopoverContextValue = {
|
|
8
|
-
open: boolean;
|
|
9
|
-
setOpen: PopoverSetOpen;
|
|
10
|
-
modal: boolean;
|
|
11
|
-
triggerRef: React.MutableRefObject<GuiObject | undefined>;
|
|
12
|
-
anchorRef: React.MutableRefObject<GuiObject | undefined>;
|
|
13
|
-
contentRef: React.MutableRefObject<GuiObject | undefined>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type PopoverProps = {
|
|
17
|
-
open?: boolean;
|
|
18
|
-
defaultOpen?: boolean;
|
|
19
|
-
onOpenChange?: (open: boolean) => void;
|
|
20
|
-
modal?: boolean;
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type PopoverTriggerProps = {
|
|
25
|
-
asChild?: boolean;
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
children?: React.ReactElement;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type PopoverPortalProps = {
|
|
31
|
-
container?: BasePlayerGui;
|
|
32
|
-
displayOrderBase?: number;
|
|
33
|
-
children?: React.ReactNode;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type PopoverContentProps = {
|
|
37
|
-
asChild?: boolean;
|
|
38
|
-
forceMount?: boolean;
|
|
39
|
-
placement?: PopperPlacement;
|
|
40
|
-
offset?: Vector2;
|
|
41
|
-
padding?: number;
|
|
42
|
-
onEscapeKeyDown?: (event: LayerInteractEvent) => void;
|
|
43
|
-
onPointerDownOutside?: (event: LayerInteractEvent) => void;
|
|
44
|
-
onInteractOutside?: (event: LayerInteractEvent) => void;
|
|
45
|
-
children?: React.ReactNode;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type PopoverAnchorProps = {
|
|
49
|
-
asChild?: boolean;
|
|
50
|
-
children?: React.ReactElement;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export type PopoverCloseProps = {
|
|
54
|
-
asChild?: boolean;
|
|
55
|
-
children?: React.ReactElement;
|
|
56
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { PopoverAnchor } from "./Popover/PopoverAnchor";
|
|
2
|
-
export { PopoverClose } from "./Popover/PopoverClose";
|
|
3
|
-
export { PopoverContent } from "./Popover/PopoverContent";
|
|
4
|
-
export { PopoverPortal } from "./Popover/PopoverPortal";
|
|
5
|
-
export { Popover } from "./Popover/PopoverRoot";
|
|
6
|
-
export { PopoverTrigger } from "./Popover/PopoverTrigger";
|
|
7
|
-
export type {
|
|
8
|
-
PopoverAnchorProps,
|
|
9
|
-
PopoverCloseProps,
|
|
10
|
-
PopoverContentProps,
|
|
11
|
-
PopoverPortalProps,
|
|
12
|
-
PopoverProps,
|
|
13
|
-
PopoverTriggerProps,
|
|
14
|
-
} from "./Popover/types";
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "src",
|
|
5
|
-
"outDir": "out",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"typeRoots": [
|
|
8
|
-
"./node_modules/@rbxts",
|
|
9
|
-
"../../node_modules/@rbxts",
|
|
10
|
-
"./node_modules/@lattice-ui",
|
|
11
|
-
"../../node_modules/@lattice-ui"
|
|
12
|
-
],
|
|
13
|
-
"types": ["types", "compiler-types"]
|
|
14
|
-
},
|
|
15
|
-
"include": ["src"]
|
|
16
|
-
}
|
package/tsconfig.typecheck.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"noEmit": true,
|
|
5
|
-
"baseUrl": "..",
|
|
6
|
-
"rootDir": "..",
|
|
7
|
-
"paths": {
|
|
8
|
-
"@lattice-ui/checkbox": ["checkbox/src/index.ts"],
|
|
9
|
-
"@lattice-ui/core": ["core/src/index.ts"],
|
|
10
|
-
"@lattice-ui/dialog": ["dialog/src/index.ts"],
|
|
11
|
-
"@lattice-ui/focus": ["focus/src/index.ts"],
|
|
12
|
-
"@lattice-ui/layer": ["layer/src/index.ts"],
|
|
13
|
-
"@lattice-ui/menu": ["menu/src/index.ts"],
|
|
14
|
-
"@lattice-ui/popover": ["popover/src/index.ts"],
|
|
15
|
-
"@lattice-ui/popper": ["popper/src/index.ts"],
|
|
16
|
-
"@lattice-ui/radio-group": ["radio-group/src/index.ts"],
|
|
17
|
-
"@lattice-ui/style": ["style/src/index.ts"],
|
|
18
|
-
"@lattice-ui/switch": ["switch/src/index.ts"],
|
|
19
|
-
"@lattice-ui/system": ["system/src/index.ts"],
|
|
20
|
-
"@lattice-ui/tabs": ["tabs/src/index.ts"],
|
|
21
|
-
"@lattice-ui/toggle-group": ["toggle-group/src/index.ts"],
|
|
22
|
-
"@lattice-ui/tooltip": ["tooltip/src/index.ts"]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|